diff --git a/.gitignore b/.gitignore index 196a12d..48169ac 100644 --- a/.gitignore +++ b/.gitignore @@ -80,7 +80,7 @@ typings/ # Nuxt.js build / generate output .nuxt -dist +# dist # Gatsby files .cache/ @@ -107,4 +107,7 @@ dist .idea # TypeScript build files -build/ \ No newline at end of file +build/ + + +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index 390329e..167e95b 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,7 @@ ## What is py-slang? -`py-slang` is a language frontend for the -[js-slang](https://github.com/source-academy/js-slang) repository. It parses -a restricted subset of Python (enough to complete SICP), and outputs an -`estree`-compatible AST. [The grammar](./src/Grammar.gram) is a reduced -version of [Python 3.7's](https://docs.python.org/3.7/reference/grammar.html). -This project does not aim to be a full Python to JS transpiler, but aims -to transpile just a small enough subset of Python. +`py-slang` is a Python implementation developed specifically for the Source Academy online learning environment. Unlike previous versions where Python was treated as a subset within [js-slang](https://github.com/source-academy/js-slang), py-slang now stands as an independent language implementation. It features its own parser, csemachine, and runtime, designed to process a tailored subset of Python for educational purposes. ## Usage For local testing: diff --git a/dist/ast-types.d.ts b/dist/ast-types.d.ts new file mode 100644 index 0000000..19fb13b --- /dev/null +++ b/dist/ast-types.d.ts @@ -0,0 +1,234 @@ +import { Token } from "./tokenizer"; +import { PyComplexNumber } from "./types"; +export declare namespace ExprNS { + interface Visitor { + visitBigIntLiteralExpr(expr: BigIntLiteral): T; + visitBinaryExpr(expr: Binary): T; + visitCompareExpr(expr: Compare): T; + visitBoolOpExpr(expr: BoolOp): T; + visitGroupingExpr(expr: Grouping): T; + visitLiteralExpr(expr: Literal): T; + visitUnaryExpr(expr: Unary): T; + visitTernaryExpr(expr: Ternary): T; + visitLambdaExpr(expr: Lambda): T; + visitMultiLambdaExpr(expr: MultiLambda): T; + visitVariableExpr(expr: Variable): T; + visitCallExpr(expr: Call): T; + visitComplexExpr(expr: Complex): T; + visitNoneExpr(expr: None): T; + } + abstract class Expr { + startToken: Token; + endToken: Token; + protected constructor(startToken: Token, endToken: Token); + abstract accept(visitor: Visitor): any; + } + class None extends Expr { + constructor(startToken: Token, endToken: Token, value?: string); + accept(visitor: Visitor): any; + } + class BigIntLiteral extends Expr { + value: string; + constructor(startToken: Token, endToken: Token, value: string); + accept(visitor: Visitor): any; + } + class Complex extends Expr { + value: PyComplexNumber; + constructor(startToken: Token, endToken: Token, value: string); + accept(visitor: Visitor): T; + } + class Binary extends Expr { + left: Expr; + operator: Token; + right: Expr; + constructor(startToken: Token, endToken: Token, left: Expr, operator: Token, right: Expr); + accept(visitor: Visitor): any; + } + class Compare extends Expr { + left: Expr; + operator: Token; + right: Expr; + constructor(startToken: Token, endToken: Token, left: Expr, operator: Token, right: Expr); + accept(visitor: Visitor): any; + } + class BoolOp extends Expr { + left: Expr; + operator: Token; + right: Expr; + constructor(startToken: Token, endToken: Token, left: Expr, operator: Token, right: Expr); + accept(visitor: Visitor): any; + } + class Grouping extends Expr { + expression: Expr; + constructor(startToken: Token, endToken: Token, expression: Expr); + accept(visitor: Visitor): any; + } + class Literal extends Expr { + value: true | false | number | string; + constructor(startToken: Token, endToken: Token, value: true | false | number | string); + accept(visitor: Visitor): any; + } + class Unary extends Expr { + operator: Token; + right: Expr; + constructor(startToken: Token, endToken: Token, operator: Token, right: Expr); + accept(visitor: Visitor): any; + } + class Ternary extends Expr { + predicate: Expr; + consequent: Expr; + alternative: Expr; + constructor(startToken: Token, endToken: Token, predicate: Expr, consequent: Expr, alternative: Expr); + accept(visitor: Visitor): any; + } + class Lambda extends Expr { + parameters: Token[]; + body: Expr; + constructor(startToken: Token, endToken: Token, parameters: Token[], body: Expr); + accept(visitor: Visitor): any; + } + class MultiLambda extends Expr { + parameters: Token[]; + body: StmtNS.Stmt[]; + varDecls: Token[]; + constructor(startToken: Token, endToken: Token, parameters: Token[], body: StmtNS.Stmt[], varDecls: Token[]); + accept(visitor: Visitor): any; + } + class Variable extends Expr { + name: Token; + constructor(startToken: Token, endToken: Token, name: Token); + accept(visitor: Visitor): any; + } + class Call extends Expr { + callee: Expr; + args: Expr[]; + constructor(startToken: Token, endToken: Token, callee: Expr, args: Expr[]); + accept(visitor: Visitor): any; + } +} +export declare namespace StmtNS { + interface Visitor { + visitIndentCreation(stmt: Indent): T; + visitDedentCreation(stmt: Dedent): T; + visitPassStmt(stmt: Pass): T; + visitAssignStmt(stmt: Assign): T; + visitAnnAssignStmt(stmt: AnnAssign): T; + visitBreakStmt(stmt: Break): T; + visitContinueStmt(stmt: Continue): T; + visitReturnStmt(stmt: Return): T; + visitFromImportStmt(stmt: FromImport): T; + visitGlobalStmt(stmt: Global): T; + visitNonLocalStmt(stmt: NonLocal): T; + visitAssertStmt(stmt: Assert): T; + visitIfStmt(stmt: If): T; + visitWhileStmt(stmt: While): T; + visitForStmt(stmt: For): T; + visitFunctionDefStmt(stmt: FunctionDef): T; + visitSimpleExprStmt(stmt: SimpleExpr): T; + visitFileInputStmt(stmt: FileInput): T; + } + abstract class Stmt { + startToken: Token; + endToken: Token; + protected constructor(startToken: Token, endToken: Token); + abstract accept(visitor: Visitor): any; + } + class Indent extends Stmt { + constructor(startToken: Token, endToken: Token); + accept(visitor: Visitor): any; + } + class Dedent extends Stmt { + constructor(startToken: Token, endToken: Token); + accept(visitor: Visitor): any; + } + class Pass extends Stmt { + constructor(startToken: Token, endToken: Token); + accept(visitor: Visitor): any; + } + class Assign extends Stmt { + name: Token; + value: ExprNS.Expr; + constructor(startToken: Token, endToken: Token, name: Token, value: ExprNS.Expr); + accept(visitor: Visitor): any; + } + class AnnAssign extends Stmt { + name: Token; + value: ExprNS.Expr; + ann: ExprNS.Expr; + constructor(startToken: Token, endToken: Token, name: Token, value: ExprNS.Expr, ann: ExprNS.Expr); + accept(visitor: Visitor): any; + } + class Break extends Stmt { + constructor(startToken: Token, endToken: Token); + accept(visitor: Visitor): any; + } + class Continue extends Stmt { + constructor(startToken: Token, endToken: Token); + accept(visitor: Visitor): any; + } + class Return extends Stmt { + value: ExprNS.Expr | null; + constructor(startToken: Token, endToken: Token, value: ExprNS.Expr | null); + accept(visitor: Visitor): any; + } + class FromImport extends Stmt { + module: Token; + names: Token[]; + constructor(startToken: Token, endToken: Token, module: Token, names: Token[]); + accept(visitor: Visitor): any; + } + class Global extends Stmt { + name: Token; + constructor(startToken: Token, endToken: Token, name: Token); + accept(visitor: Visitor): any; + } + class NonLocal extends Stmt { + name: Token; + constructor(startToken: Token, endToken: Token, name: Token); + accept(visitor: Visitor): any; + } + class Assert extends Stmt { + value: ExprNS.Expr; + constructor(startToken: Token, endToken: Token, value: ExprNS.Expr); + accept(visitor: Visitor): any; + } + class If extends Stmt { + condition: ExprNS.Expr; + body: Stmt[]; + elseBlock: Stmt[] | null; + constructor(startToken: Token, endToken: Token, condition: ExprNS.Expr, body: Stmt[], elseBlock: Stmt[] | null); + accept(visitor: Visitor): any; + } + class While extends Stmt { + condition: ExprNS.Expr; + body: Stmt[]; + constructor(startToken: Token, endToken: Token, condition: ExprNS.Expr, body: Stmt[]); + accept(visitor: Visitor): any; + } + class For extends Stmt { + target: Token; + iter: ExprNS.Expr; + body: Stmt[]; + constructor(startToken: Token, endToken: Token, target: Token, iter: ExprNS.Expr, body: Stmt[]); + accept(visitor: Visitor): any; + } + class FunctionDef extends Stmt { + name: Token; + parameters: Token[]; + body: Stmt[]; + varDecls: Token[]; + constructor(startToken: Token, endToken: Token, name: Token, parameters: Token[], body: Stmt[], varDecls: Token[]); + accept(visitor: Visitor): any; + } + class SimpleExpr extends Stmt { + expression: ExprNS.Expr; + constructor(startToken: Token, endToken: Token, expression: ExprNS.Expr); + accept(visitor: Visitor): any; + } + class FileInput extends Stmt { + statements: Stmt[]; + varDecls: Token[]; + constructor(startToken: Token, endToken: Token, statements: Stmt[], varDecls: Token[]); + accept(visitor: Visitor): any; + } +} diff --git a/dist/common/Constant.d.ts b/dist/common/Constant.d.ts new file mode 100644 index 0000000..7f1742c --- /dev/null +++ b/dist/common/Constant.d.ts @@ -0,0 +1,4 @@ +export declare const enum Constant { + PROTOCOL_VERSION = 0, + PROTOCOL_MIN_VERSION = 0 +} diff --git a/dist/common/ds/MessageQueue.d.ts b/dist/common/ds/MessageQueue.d.ts new file mode 100644 index 0000000..ba315fc --- /dev/null +++ b/dist/common/ds/MessageQueue.d.ts @@ -0,0 +1,8 @@ +export declare class MessageQueue { + private readonly __inputQueue; + private readonly __promiseQueue; + push(item: T): void; + pop(): Promise; + tryPop(): T | undefined; + constructor(); +} diff --git a/dist/common/ds/Queue.d.ts b/dist/common/ds/Queue.d.ts new file mode 100644 index 0000000..8a1b707 --- /dev/null +++ b/dist/common/ds/Queue.d.ts @@ -0,0 +1,30 @@ +/** + * A stack-based queue implementation. + * `push` and `pop` run in amortized constant time. + */ +export declare class Queue { + /** The output stack. */ + private __s1; + /** The input stack. */ + private __s2; + /** + * Adds an item to the queue. + * @param item The item to be added to the queue. + */ + push(item: T): void; + /** + * Removes an item from the queue. + * @returns The item removed from the queue. + * @throws If the queue is empty. + */ + pop(): T; + /** + * The length of the queue. + */ + get length(): number; + /** + * Makes a copy of the queue. + * @returns A copy of the queue. + */ + clone(): Queue; +} diff --git a/dist/common/ds/index.d.ts b/dist/common/ds/index.d.ts new file mode 100644 index 0000000..4f75299 --- /dev/null +++ b/dist/common/ds/index.d.ts @@ -0,0 +1,2 @@ +export { MessageQueue } from "./MessageQueue"; +export { Queue } from "./Queue"; diff --git a/dist/common/errors/ConductorError.d.ts b/dist/common/errors/ConductorError.d.ts new file mode 100644 index 0000000..b3fe326 --- /dev/null +++ b/dist/common/errors/ConductorError.d.ts @@ -0,0 +1,9 @@ +import { ErrorType } from "./ErrorType"; +/** + * Generic Conductor Error. + */ +export declare class ConductorError extends Error { + name: string; + readonly errorType: ErrorType | string; + constructor(message: string); +} diff --git a/dist/common/errors/ConductorInternalError.d.ts b/dist/common/errors/ConductorInternalError.d.ts new file mode 100644 index 0000000..a32da96 --- /dev/null +++ b/dist/common/errors/ConductorInternalError.d.ts @@ -0,0 +1,10 @@ +import { ConductorError } from "./ConductorError"; +import { ErrorType } from "./ErrorType"; +/** + * Conductor internal error, probably caused by developer oversight. + */ +export declare class ConductorInternalError extends ConductorError { + name: string; + readonly errorType: ErrorType | string; + constructor(message: string); +} diff --git a/dist/common/errors/ErrorType.d.ts b/dist/common/errors/ErrorType.d.ts new file mode 100644 index 0000000..2242017 --- /dev/null +++ b/dist/common/errors/ErrorType.d.ts @@ -0,0 +1,8 @@ +export declare const enum ErrorType { + UNKNOWN = "__unknown", + INTERNAL = "__internal", + EVALUATOR = "__evaluator", + EVALUATOR_SYNTAX = "__evaluator_syntax", + EVALUATOR_TYPE = "__evaluator_type", + EVALUATOR_RUNTIME = "__evaluator_runtime" +} diff --git a/dist/common/errors/EvaluatorError.d.ts b/dist/common/errors/EvaluatorError.d.ts new file mode 100644 index 0000000..efa2e19 --- /dev/null +++ b/dist/common/errors/EvaluatorError.d.ts @@ -0,0 +1,14 @@ +import { ConductorError } from "./ConductorError"; +import { ErrorType } from "./ErrorType"; +/** + * Generic evaluation error, caused by a problem in user code. + */ +export declare class EvaluatorError extends ConductorError { + name: string; + readonly errorType: ErrorType | string; + readonly rawMessage: string; + readonly line?: number; + readonly column?: number; + readonly fileName?: string; + constructor(message: string, line?: number, column?: number, fileName?: string); +} diff --git a/dist/common/errors/EvaluatorRuntimeError.d.ts b/dist/common/errors/EvaluatorRuntimeError.d.ts new file mode 100644 index 0000000..bb56d09 --- /dev/null +++ b/dist/common/errors/EvaluatorRuntimeError.d.ts @@ -0,0 +1,9 @@ +import { ErrorType } from "./ErrorType"; +import { EvaluatorError } from "./EvaluatorError"; +/** + * Evaluator runtime error - some problem occurred while running the user code. + */ +export declare class EvaluatorRuntimeError extends EvaluatorError { + name: string; + readonly errorType: ErrorType | string; +} diff --git a/dist/common/errors/EvaluatorSyntaxError.d.ts b/dist/common/errors/EvaluatorSyntaxError.d.ts new file mode 100644 index 0000000..1182bc4 --- /dev/null +++ b/dist/common/errors/EvaluatorSyntaxError.d.ts @@ -0,0 +1,9 @@ +import { ErrorType } from "./ErrorType"; +import { EvaluatorError } from "./EvaluatorError"; +/** + * Evaluator syntax error - the user code does not follow the evaluator's prescribed syntax. + */ +export declare class EvaluatorSyntaxError extends EvaluatorError { + name: string; + readonly errorType: ErrorType | string; +} diff --git a/dist/common/errors/EvaluatorTypeError.d.ts b/dist/common/errors/EvaluatorTypeError.d.ts new file mode 100644 index 0000000..f2958c9 --- /dev/null +++ b/dist/common/errors/EvaluatorTypeError.d.ts @@ -0,0 +1,13 @@ +import { ErrorType } from "./ErrorType"; +import { EvaluatorError } from "./EvaluatorError"; +/** + * Evaluator type error - the user code is not well typed or provides values of incorrect type to external functions. + */ +export declare class EvaluatorTypeError extends EvaluatorError { + name: string; + readonly errorType: ErrorType | string; + readonly rawMessage: string; + readonly expected: string; + readonly actual: string; + constructor(message: string, expected: string, actual: string, line?: number, column?: number, fileName?: string); +} diff --git a/dist/common/errors/index.d.ts b/dist/common/errors/index.d.ts new file mode 100644 index 0000000..e060bb0 --- /dev/null +++ b/dist/common/errors/index.d.ts @@ -0,0 +1,4 @@ +export { ConductorError } from "./ConductorError"; +export { ConductorInternalError } from "./ConductorInternalError"; +export { ErrorType } from "./ErrorType"; +export { EvaluatorTypeError } from "./EvaluatorTypeError"; diff --git a/dist/common/util/InvalidModuleError.d.ts b/dist/common/util/InvalidModuleError.d.ts new file mode 100644 index 0000000..a8ed319 --- /dev/null +++ b/dist/common/util/InvalidModuleError.d.ts @@ -0,0 +1,6 @@ +import { ConductorError } from "../errors"; +export declare class InvalidModuleError extends ConductorError { + name: string; + readonly errorType = "__invalidmodule"; + constructor(); +} diff --git a/dist/common/util/importExternalModule.d.ts b/dist/common/util/importExternalModule.d.ts new file mode 100644 index 0000000..55b5a1b --- /dev/null +++ b/dist/common/util/importExternalModule.d.ts @@ -0,0 +1,8 @@ +import type { IModulePlugin } from "../../conductor/module"; +import { PluginClass } from "../../conduit/types"; +/** + * Imports an external module from a given location. + * @param location Where to find the external module. + * @returns A promise resolving to the imported module. + */ +export declare function importExternalModule(location: string): Promise>; diff --git a/dist/common/util/importExternalPlugin.d.ts b/dist/common/util/importExternalPlugin.d.ts new file mode 100644 index 0000000..87b16d7 --- /dev/null +++ b/dist/common/util/importExternalPlugin.d.ts @@ -0,0 +1,7 @@ +import { PluginClass } from "../../conduit/types"; +/** + * Imports an external plugin from a given location. + * @param location Where to find the external plugin. + * @returns A promise resolving to the imported plugin. + */ +export declare function importExternalPlugin(location: string): Promise; diff --git a/dist/common/util/index.d.ts b/dist/common/util/index.d.ts new file mode 100644 index 0000000..d25108c --- /dev/null +++ b/dist/common/util/index.d.ts @@ -0,0 +1,3 @@ +export { importExternalModule } from "./importExternalModule"; +export { importExternalPlugin } from "./importExternalPlugin"; +export { InvalidModuleError } from "./InvalidModuleError"; diff --git a/dist/conductor/host/BasicHostPlugin.d.ts b/dist/conductor/host/BasicHostPlugin.d.ts new file mode 100644 index 0000000..b9defb8 --- /dev/null +++ b/dist/conductor/host/BasicHostPlugin.d.ts @@ -0,0 +1,30 @@ +import type { ConductorError } from "../../common/errors"; +import { IChannel, IConduit, IPlugin } from "../../conduit"; +import { PluginClass } from "../../conduit/types"; +import { InternalChannelName, InternalPluginName } from "../strings"; +import { Chunk, RunnerStatus } from "../types"; +import { IHostPlugin } from "./types"; +export declare abstract class BasicHostPlugin implements IHostPlugin { + name: InternalPluginName; + private readonly __conduit; + private readonly __chunkChannel; + private readonly __serviceChannel; + private readonly __ioChannel; + private readonly __status; + private __chunkCount; + private readonly __serviceHandlers; + abstract requestFile(fileName: string): Promise; + abstract requestLoadPlugin(pluginName: string): void; + startEvaluator(entryPoint: string): void; + sendChunk(chunk: Chunk): void; + sendInput(message: string): void; + receiveOutput?(message: string): void; + receiveError?(message: ConductorError): void; + isStatusActive(status: RunnerStatus): boolean; + receiveStatusUpdate?(status: RunnerStatus, isActive: boolean): void; + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer; + unregisterPlugin(plugin: IPlugin): void; + importAndRegisterExternalPlugin(location: string, ...arg: any[]): Promise; + static readonly channelAttach: InternalChannelName[]; + constructor(conduit: IConduit, [fileChannel, chunkChannel, serviceChannel, ioChannel, errorChannel, statusChannel]: IChannel[]); +} diff --git a/dist/conductor/host/index.d.ts b/dist/conductor/host/index.d.ts new file mode 100644 index 0000000..7da4918 --- /dev/null +++ b/dist/conductor/host/index.d.ts @@ -0,0 +1,2 @@ +export type { IHostPlugin } from "./types"; +export { BasicHostPlugin } from "./BasicHostPlugin"; diff --git a/dist/conductor/host/types/IHostFileRpc.d.ts b/dist/conductor/host/types/IHostFileRpc.d.ts new file mode 100644 index 0000000..3423934 --- /dev/null +++ b/dist/conductor/host/types/IHostFileRpc.d.ts @@ -0,0 +1,3 @@ +export interface IHostFileRpc { + requestFile(fileName: string): Promise; +} diff --git a/dist/conductor/host/types/IHostPlugin.d.ts b/dist/conductor/host/types/IHostPlugin.d.ts new file mode 100644 index 0000000..de29040 --- /dev/null +++ b/dist/conductor/host/types/IHostPlugin.d.ts @@ -0,0 +1,73 @@ +import type { ConductorError } from "../../../common/errors"; +import type { IPlugin } from "../../../conduit"; +import { PluginClass } from "../../../conduit/types"; +import type { Chunk, RunnerStatus } from "../../types"; +export interface IHostPlugin extends IPlugin { + /** + * Request a file's contents. + * @param fileName The name of the file to request. + * @returns A promise resolving to the content of the requested file. + */ + requestFile(fileName: string): Promise; + /** + * Request to load a plugin. + * @param pluginName The name of the plugin to request loading. + */ + requestLoadPlugin(pluginName: string): void; + /** + * Starts the evaluator. + * @param entryPoint The entry point file to start running from. + */ + startEvaluator(entryPoint: string): void; + /** + * Send the next chunk to be run. + * @param chunk The next chunk to be run. + */ + sendChunk(chunk: Chunk): void; + /** + * Send an input on standard-input. + * @param input The input to be sent on standard-input. + */ + sendInput(input: string): void; + /** + * An event handler called when an output is received. + * @param message The output received. + */ + receiveOutput?(message: string): void; + /** + * An event handler called when an error is received. + * @param message The error received. + */ + receiveError?(message: ConductorError): void; + /** + * Checks if a runner status is active. + * @param status The runner status to check. + * @returns true if the given status is active. + */ + isStatusActive(status: RunnerStatus): boolean; + /** + * An event handler called when a status update is received. + * @param message The status update received. + * @param isActive Is the specified status currently active? + */ + receiveStatusUpdate?(status: RunnerStatus, isActive: boolean): void; + /** + * Registers a plugin with the conduit. + * @param pluginClass The plugin class to be registered. + * @param arg Arguments to be passed to pluginClass' constructor. + * @returns The registered plugin. + */ + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer; + /** + * Unregister a plugin from the conduit. + * @param plugin The plugin to be unregistered. + */ + unregisterPlugin(plugin: IPlugin): void; + /** + * Imports an external plugin and registers it with the conduit. + * @param location The location of the external plugin. + * @param arg Arguments to be passed to the external plugin's constructor. + * @returns The imported plugin. + */ + importAndRegisterExternalPlugin(location: string, ...arg: any[]): Promise; +} diff --git a/dist/conductor/host/types/index.d.ts b/dist/conductor/host/types/index.d.ts new file mode 100644 index 0000000..a6c4b35 --- /dev/null +++ b/dist/conductor/host/types/index.d.ts @@ -0,0 +1,2 @@ +export type { IHostFileRpc } from "./IHostFileRpc"; +export type { IHostPlugin } from "./IHostPlugin"; diff --git a/dist/conductor/module/BaseModulePlugin.d.ts b/dist/conductor/module/BaseModulePlugin.d.ts new file mode 100644 index 0000000..85ab421 --- /dev/null +++ b/dist/conductor/module/BaseModulePlugin.d.ts @@ -0,0 +1,11 @@ +import { IChannel, IConduit } from "../../conduit"; +import { IInterfacableEvaluator } from "../runner/types"; +import { IDataHandler } from "../types"; +import { IModulePlugin, IModuleExport } from "./types"; +export declare abstract class BaseModulePlugin implements IModulePlugin { + readonly exports: IModuleExport[]; + readonly exportedNames: readonly (keyof this)[]; + readonly evaluator: IDataHandler; + static readonly channelAttach: string[]; + constructor(_conduit: IConduit, _channels: IChannel[], evaluator: IInterfacableEvaluator); +} diff --git a/dist/conductor/module/index.d.ts b/dist/conductor/module/index.d.ts new file mode 100644 index 0000000..c124d4d --- /dev/null +++ b/dist/conductor/module/index.d.ts @@ -0,0 +1,2 @@ +export type { IModuleExport, IModulePlugin } from "./types"; +export { BaseModulePlugin } from "./BaseModulePlugin"; diff --git a/dist/conductor/module/types/IModuleExport.d.ts b/dist/conductor/module/types/IModuleExport.d.ts new file mode 100644 index 0000000..28caf3c --- /dev/null +++ b/dist/conductor/module/types/IModuleExport.d.ts @@ -0,0 +1,9 @@ +import type { ExternCallable, IFunctionSignature, NativeValue } from "../../types"; +export interface IModuleExport { + /** The symbol referencing the export. */ + symbol: string; + /** The exported value. Can be JS-native values or a function. */ + value: NativeValue | ExternCallable; + /** If value is a function, provides its function signature. */ + signature?: IFunctionSignature; +} diff --git a/dist/conductor/module/types/IModulePlugin.d.ts b/dist/conductor/module/types/IModulePlugin.d.ts new file mode 100644 index 0000000..c1924bf --- /dev/null +++ b/dist/conductor/module/types/IModulePlugin.d.ts @@ -0,0 +1,7 @@ +import type { IPlugin } from "../../../conduit"; +import type { IDataHandler } from "../../types"; +import type { IModuleExport } from "./IModuleExport"; +export interface IModulePlugin extends IPlugin { + readonly exports: IModuleExport[]; + readonly evaluator: IDataHandler; +} diff --git a/dist/conductor/module/types/ModuleClass.d.ts b/dist/conductor/module/types/ModuleClass.d.ts new file mode 100644 index 0000000..72869d6 --- /dev/null +++ b/dist/conductor/module/types/ModuleClass.d.ts @@ -0,0 +1,4 @@ +import { PluginClass } from "../../../conduit/types"; +import { IEvaluator } from "../../runner/types"; +import { IModulePlugin } from "./IModulePlugin"; +export type ModuleClass = PluginClass<[IEvaluator], T>; diff --git a/dist/conductor/module/types/index.d.ts b/dist/conductor/module/types/index.d.ts new file mode 100644 index 0000000..ae1b807 --- /dev/null +++ b/dist/conductor/module/types/index.d.ts @@ -0,0 +1,2 @@ +export type { IModuleExport } from "./IModuleExport"; +export type { IModulePlugin } from "./IModulePlugin"; diff --git a/dist/conductor/module/util/index.d.ts b/dist/conductor/module/util/index.d.ts new file mode 100644 index 0000000..6e09964 --- /dev/null +++ b/dist/conductor/module/util/index.d.ts @@ -0,0 +1 @@ +export { moduleMethod } from "./moduleMethod"; diff --git a/dist/conductor/module/util/moduleMethod.d.ts b/dist/conductor/module/util/moduleMethod.d.ts new file mode 100644 index 0000000..07e3f60 --- /dev/null +++ b/dist/conductor/module/util/moduleMethod.d.ts @@ -0,0 +1,7 @@ +import { DataType, ExternCallable, IFunctionSignature } from "../../types"; +export declare function moduleMethod(args: Args, returnType: Ret): (method: ExternCallable<{ + readonly args: Args; + readonly returnType: DataType; +}> & { + signature?: IFunctionSignature; +}, _context: ClassMemberDecoratorContext) => void; diff --git a/dist/conductor/runner/BasicEvaluator.d.ts b/dist/conductor/runner/BasicEvaluator.d.ts new file mode 100644 index 0000000..ca72948 --- /dev/null +++ b/dist/conductor/runner/BasicEvaluator.d.ts @@ -0,0 +1,19 @@ +import { IEvaluator, IRunnerPlugin } from "./types"; +export declare abstract class BasicEvaluator implements IEvaluator { + readonly conductor: IRunnerPlugin; + startEvaluator(entryPoint: string): Promise; + /** + * Evaluates a file. + * @param fileName The name of the file to be evaluated. + * @param fileContent The content of the file to be evaluated. + * @returns A promise that resolves when the evaluation is complete. + */ + evaluateFile(fileName: string, fileContent: string): Promise; + /** + * Evaluates a chunk. + * @param chunk The chunk to be evaluated. + * @returns A promise that resolves when the evaluation is complete. + */ + abstract evaluateChunk(chunk: string): Promise; + constructor(conductor: IRunnerPlugin); +} diff --git a/dist/conductor/runner/RunnerPlugin.d.ts b/dist/conductor/runner/RunnerPlugin.d.ts new file mode 100644 index 0000000..b9e7367 --- /dev/null +++ b/dist/conductor/runner/RunnerPlugin.d.ts @@ -0,0 +1,37 @@ +import type { ConductorError } from "../../common/errors"; +import { IConduit, IChannel, IPlugin } from "../../conduit"; +import { PluginClass } from "../../conduit/types"; +import { IModulePlugin } from "../module"; +import { ModuleClass } from "../module/types/ModuleClass"; +import { InternalChannelName, InternalPluginName } from "../strings"; +import { Chunk, RunnerStatus } from "../types"; +import { IRunnerPlugin, EvaluatorClass } from "./types"; +export declare class RunnerPlugin implements IRunnerPlugin { + name: InternalPluginName; + private readonly __evaluator; + private readonly __isCompatibleWithModules; + private readonly __conduit; + private readonly __fileRpc; + private readonly __chunkQueue; + private readonly __serviceChannel; + private readonly __ioQueue; + private readonly __errorChannel; + private readonly __statusChannel; + private readonly __serviceHandlers; + requestFile(fileName: string): Promise; + requestChunk(): Promise; + requestInput(): Promise; + tryRequestInput(): string | undefined; + sendOutput(message: string): void; + sendError(error: ConductorError): void; + updateStatus(status: RunnerStatus, isActive: boolean): void; + hostLoadPlugin(pluginName: string): void; + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer; + unregisterPlugin(plugin: IPlugin): void; + registerModule(moduleClass: ModuleClass): NoInfer; + unregisterModule(module: IModulePlugin): void; + importAndRegisterExternalPlugin(location: string, ...arg: any[]): Promise; + importAndRegisterExternalModule(location: string): Promise; + static readonly channelAttach: InternalChannelName[]; + constructor(conduit: IConduit, [fileChannel, chunkChannel, serviceChannel, ioChannel, errorChannel, statusChannel]: IChannel[], evaluatorClass: EvaluatorClass); +} diff --git a/dist/conductor/runner/index.d.ts b/dist/conductor/runner/index.d.ts new file mode 100644 index 0000000..1b96004 --- /dev/null +++ b/dist/conductor/runner/index.d.ts @@ -0,0 +1,2 @@ +export { BasicEvaluator } from "./BasicEvaluator"; +export { RunnerPlugin } from "./RunnerPlugin"; diff --git a/dist/conductor/runner/types/EvaluatorClass.d.ts b/dist/conductor/runner/types/EvaluatorClass.d.ts new file mode 100644 index 0000000..deb11fb --- /dev/null +++ b/dist/conductor/runner/types/EvaluatorClass.d.ts @@ -0,0 +1,4 @@ +import { IEvaluator } from "./IEvaluator"; +import { IInterfacableEvaluator } from "./IInterfacableEvaluator"; +import { IRunnerPlugin } from "./IRunnerPlugin"; +export type EvaluatorClass = new (conductor: IRunnerPlugin, ...arg: Arg) => IEvaluator | IInterfacableEvaluator; diff --git a/dist/conductor/runner/types/IEvaluator.d.ts b/dist/conductor/runner/types/IEvaluator.d.ts new file mode 100644 index 0000000..2bbb27e --- /dev/null +++ b/dist/conductor/runner/types/IEvaluator.d.ts @@ -0,0 +1,11 @@ +/** + * The IEvaluator interface exposes methods used by Conductor to interact with evaluators. + */ +export interface IEvaluator { + /** + * Starts this evaluator. + * @param entryPoint The entry point file to start running from. + * @returns A promise that resolves when the evaluator has terminated. + */ + startEvaluator(entryPoint: string): Promise; +} diff --git a/dist/conductor/runner/types/IInterfacableEvaluator.d.ts b/dist/conductor/runner/types/IInterfacableEvaluator.d.ts new file mode 100644 index 0000000..3165b27 --- /dev/null +++ b/dist/conductor/runner/types/IInterfacableEvaluator.d.ts @@ -0,0 +1,3 @@ +import type { IDataHandler } from "../../types"; +import type { IEvaluator } from "./IEvaluator"; +export type IInterfacableEvaluator = IEvaluator & IDataHandler; diff --git a/dist/conductor/runner/types/IRunnerPlugin.d.ts b/dist/conductor/runner/types/IRunnerPlugin.d.ts new file mode 100644 index 0000000..0858df3 --- /dev/null +++ b/dist/conductor/runner/types/IRunnerPlugin.d.ts @@ -0,0 +1,86 @@ +import type { ConductorError } from "../../../common/errors"; +import type { IPlugin } from "../../../conduit"; +import { PluginClass } from "../../../conduit/types"; +import type { IModulePlugin } from "../../module"; +import { ModuleClass } from "../../module/types/ModuleClass"; +import type { Chunk, RunnerStatus } from "../../types"; +export interface IRunnerPlugin extends IPlugin { + /** + * Request a file's contents. + * @param fileName The name of the file to request. + * @returns A promise resolving to the content of the requested file. + */ + requestFile(fileName: string): Promise; + /** + * Request the next chunk to run. + * @returns A promise resolving to the next chunk. + */ + requestChunk(): Promise; + /** + * Request for some input on standard-input. + * @returns A promise resolving to the input received. + */ + requestInput(): Promise; + /** + * Try to request for some input on standard-input. + * @returns The input received, or undefined if there is currently no input. + */ + tryRequestInput(): string | undefined; + /** + * Sends a message on standard-output. + * @param message The output message to send. + */ + sendOutput(message: string): void; + /** + * Sends an error. + * @param error The error to send. + */ + sendError(error: ConductorError): void; + /** + * Provide a status update of the runner. + * @param status The status to update. + * @param isActive Is the specified status currently active? + */ + updateStatus(status: RunnerStatus, isActive: boolean): void; + /** + * Informs the host to load a plugin. + * @param pluginName The name of the plugin to load. + */ + hostLoadPlugin(pluginName: string): void; + /** + * Registers a plugin with the conduit. + * @param pluginClass The plugin class to be registered. + * @param arg Arguments to be passed to pluginClass' constructor. + * @returns The registered plugin. + */ + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer; + /** + * Unregister a plugin from the conduit. + * @param plugin The plugin to be unregistered. + */ + unregisterPlugin(plugin: IPlugin): void; + /** + * Registers an external module with the conduit, and links it with the evaluator. + * @param moduleClass The module class to be registered. + * @returns The registered module. + */ + registerModule(moduleClass: ModuleClass): T; + /** + * Unregisters an external module from the conduit, and unlinks it from the evaluator. + * @param module The module to be unregistered. + */ + unregisterModule(module: IModulePlugin): void; + /** + * Imports an external plugin and registers it with the conduit. + * @param location The location of the external plugin. + * @param arg Arguments to be passed to the external plugin's constructor. + * @returns The imported plugin. + */ + importAndRegisterExternalPlugin(location: string, ...arg: any[]): Promise; + /** + * Imports an external module and registers it with the conduit. + * @param location The location of the external module. + * @returns The imported module. + */ + importAndRegisterExternalModule(location: string): Promise; +} diff --git a/dist/conductor/runner/types/PyEvaluator.d.ts b/dist/conductor/runner/types/PyEvaluator.d.ts new file mode 100644 index 0000000..5322102 --- /dev/null +++ b/dist/conductor/runner/types/PyEvaluator.d.ts @@ -0,0 +1,8 @@ +import { BasicEvaluator } from "../BasicEvaluator"; +import { IRunnerPlugin } from "./IRunnerPlugin"; +export declare class PyEvaluator extends BasicEvaluator { + private context; + private options; + constructor(conductor: IRunnerPlugin); + evaluateChunk(chunk: string): Promise; +} diff --git a/dist/conductor/runner/types/index.d.ts b/dist/conductor/runner/types/index.d.ts new file mode 100644 index 0000000..9b8ef04 --- /dev/null +++ b/dist/conductor/runner/types/index.d.ts @@ -0,0 +1,4 @@ +export type { EvaluatorClass } from "./EvaluatorClass"; +export type { IEvaluator } from "./IEvaluator"; +export type { IInterfacableEvaluator } from "./IInterfacableEvaluator"; +export type { IRunnerPlugin } from "./IRunnerPlugin"; diff --git a/dist/conductor/runner/util/index.d.ts b/dist/conductor/runner/util/index.d.ts new file mode 100644 index 0000000..a7e1ca2 --- /dev/null +++ b/dist/conductor/runner/util/index.d.ts @@ -0,0 +1 @@ +export { initialise } from "./initialise"; diff --git a/dist/conductor/runner/util/initialise.d.ts b/dist/conductor/runner/util/initialise.d.ts new file mode 100644 index 0000000..db65e61 --- /dev/null +++ b/dist/conductor/runner/util/initialise.d.ts @@ -0,0 +1,12 @@ +import { IConduit, ILink } from "../../../conduit"; +import { EvaluatorClass, IRunnerPlugin } from "../types"; +/** + * Initialise this runner with the evaluator to be used. + * @param evaluatorClass The Evaluator to be used on this runner. + * @param link The underlying communication link. + * @returns The initialised `runnerPlugin` and `conduit`. + */ +export declare function initialise(evaluatorClass: EvaluatorClass, link?: ILink): { + runnerPlugin: IRunnerPlugin; + conduit: IConduit; +}; diff --git a/dist/conductor/stdlib/index.d.ts b/dist/conductor/stdlib/index.d.ts new file mode 100644 index 0000000..634b761 --- /dev/null +++ b/dist/conductor/stdlib/index.d.ts @@ -0,0 +1,7 @@ +import { accumulate, is_list, length } from "./list"; +export declare const stdlib: { + is_list: typeof is_list; + accumulate: typeof accumulate; + length: typeof length; +}; +export { accumulate }; diff --git a/dist/conductor/stdlib/list/accumulate.d.ts b/dist/conductor/stdlib/list/accumulate.d.ts new file mode 100644 index 0000000..5676ece --- /dev/null +++ b/dist/conductor/stdlib/list/accumulate.d.ts @@ -0,0 +1,13 @@ +import { ClosureIdentifier, DataType, IDataHandler, TypedValue, List } from "../../types"; +/** + * Accumulates a Closure over a List. + * + * The Closure is applied in a right-to-left order - the first application + * will be on the last element of the list and the given initial value. + * @param op The Closure to use as an accumulator over the List. + * @param initial The initial typed value (that is, the result of accumulating an empty List). + * @param sequence The List to be accumulated over. + * @param resultType The (expected) type of the result. + * @returns A Promise resolving to the result of accumulating the Closure over the List. + */ +export declare function accumulate>(this: IDataHandler, op: ClosureIdentifier, initial: TypedValue, sequence: List, resultType: T): Promise>; diff --git a/dist/conductor/stdlib/list/index.d.ts b/dist/conductor/stdlib/list/index.d.ts new file mode 100644 index 0000000..5630e52 --- /dev/null +++ b/dist/conductor/stdlib/list/index.d.ts @@ -0,0 +1,5 @@ +export { accumulate } from "./accumulate"; +export { is_list } from "./is_list"; +export { length } from "./length"; +export { list_to_vec } from "./list_to_vec"; +export { list } from "./list"; diff --git a/dist/conductor/stdlib/list/is_list.d.ts b/dist/conductor/stdlib/list/is_list.d.ts new file mode 100644 index 0000000..2247258 --- /dev/null +++ b/dist/conductor/stdlib/list/is_list.d.ts @@ -0,0 +1,7 @@ +import { IDataHandler, List } from "../../types"; +/** + * Checks if a List is a true list (`tail(tail...(xs))` is empty-list). + * @param xs The List to check. + * @returns true if the provided List is a true list. + */ +export declare function is_list(this: IDataHandler, xs: List): boolean; diff --git a/dist/conductor/stdlib/list/length.d.ts b/dist/conductor/stdlib/list/length.d.ts new file mode 100644 index 0000000..963b5b0 --- /dev/null +++ b/dist/conductor/stdlib/list/length.d.ts @@ -0,0 +1,7 @@ +import { IDataHandler, List } from "../../types"; +/** + * Gets the length of a List. + * @param xs The List to get the length of. + * @returns The length of the List. + */ +export declare function length(this: IDataHandler, xs: List): number; diff --git a/dist/conductor/stdlib/list/list.d.ts b/dist/conductor/stdlib/list/list.d.ts new file mode 100644 index 0000000..d2ca834 --- /dev/null +++ b/dist/conductor/stdlib/list/list.d.ts @@ -0,0 +1,7 @@ +import { DataType, IDataHandler, TypedValue } from "../../types"; +/** + * Creates a new List from given elements. + * @param elements The elements of the List, given as typed values. + * @returns The newly created List. + */ +export declare function list(this: IDataHandler, ...elements: TypedValue[]): TypedValue; diff --git a/dist/conductor/stdlib/list/list_to_vec.d.ts b/dist/conductor/stdlib/list/list_to_vec.d.ts new file mode 100644 index 0000000..4fe121e --- /dev/null +++ b/dist/conductor/stdlib/list/list_to_vec.d.ts @@ -0,0 +1,2 @@ +import { DataType, IDataHandler, List, TypedValue } from "../../types"; +export declare function list_to_vec(this: IDataHandler, xs: List): TypedValue[]; diff --git a/dist/conductor/stdlib/util/array_assert.d.ts b/dist/conductor/stdlib/util/array_assert.d.ts new file mode 100644 index 0000000..7b43f2a --- /dev/null +++ b/dist/conductor/stdlib/util/array_assert.d.ts @@ -0,0 +1,2 @@ +import { ArrayIdentifier, DataType, IDataHandler } from "../../types"; +export declare function array_assert(this: IDataHandler, a: ArrayIdentifier, type?: T, length?: number): asserts a is ArrayIdentifier; diff --git a/dist/conductor/stdlib/util/closure_arity_assert.d.ts b/dist/conductor/stdlib/util/closure_arity_assert.d.ts new file mode 100644 index 0000000..406d369 --- /dev/null +++ b/dist/conductor/stdlib/util/closure_arity_assert.d.ts @@ -0,0 +1,2 @@ +import { IDataHandler, ClosureIdentifier, DataType } from "../../types"; +export declare function closure_arity_assert(this: IDataHandler, c: ClosureIdentifier, arity: number): void; diff --git a/dist/conductor/stdlib/util/index.d.ts b/dist/conductor/stdlib/util/index.d.ts new file mode 100644 index 0000000..42e285e --- /dev/null +++ b/dist/conductor/stdlib/util/index.d.ts @@ -0,0 +1,3 @@ +export { array_assert } from "./array_assert"; +export { closure_arity_assert } from "./closure_arity_assert"; +export { pair_assert } from "./pair_assert"; diff --git a/dist/conductor/stdlib/util/pair_assert.d.ts b/dist/conductor/stdlib/util/pair_assert.d.ts new file mode 100644 index 0000000..d2ac75a --- /dev/null +++ b/dist/conductor/stdlib/util/pair_assert.d.ts @@ -0,0 +1,2 @@ +import { DataType, IDataHandler, PairIdentifier } from "../../types"; +export declare function pair_assert(this: IDataHandler, p: PairIdentifier, headType?: DataType, tailType?: DataType): void; diff --git a/dist/conductor/strings/InternalChannelName.d.ts b/dist/conductor/strings/InternalChannelName.d.ts new file mode 100644 index 0000000..594a614 --- /dev/null +++ b/dist/conductor/strings/InternalChannelName.d.ts @@ -0,0 +1,8 @@ +export declare const enum InternalChannelName { + CHUNK = "__chunk", + FILE = "__file_rpc", + SERVICE = "__service", + STANDARD_IO = "__stdio", + ERROR = "__error", + STATUS = "__status" +} diff --git a/dist/conductor/strings/InternalPluginName.d.ts b/dist/conductor/strings/InternalPluginName.d.ts new file mode 100644 index 0000000..4d12846 --- /dev/null +++ b/dist/conductor/strings/InternalPluginName.d.ts @@ -0,0 +1,4 @@ +export declare const enum InternalPluginName { + HOST_MAIN = "__host_main", + RUNNER_MAIN = "__runner_main" +} diff --git a/dist/conductor/strings/index.d.ts b/dist/conductor/strings/index.d.ts new file mode 100644 index 0000000..eb875a6 --- /dev/null +++ b/dist/conductor/strings/index.d.ts @@ -0,0 +1,2 @@ +export { InternalChannelName } from "./InternalChannelName"; +export { InternalPluginName } from "./InternalPluginName"; diff --git a/dist/conductor/types/Chunk.d.ts b/dist/conductor/types/Chunk.d.ts new file mode 100644 index 0000000..29cdaf4 --- /dev/null +++ b/dist/conductor/types/Chunk.d.ts @@ -0,0 +1,2 @@ +/** A chunk of code. */ +export type Chunk = string; diff --git a/dist/conductor/types/IChunkMessage.d.ts b/dist/conductor/types/IChunkMessage.d.ts new file mode 100644 index 0000000..93651ff --- /dev/null +++ b/dist/conductor/types/IChunkMessage.d.ts @@ -0,0 +1,5 @@ +import type { Chunk } from "./Chunk"; +export interface IChunkMessage { + id: number; + chunk: Chunk; +} diff --git a/dist/conductor/types/IErrorMessage.d.ts b/dist/conductor/types/IErrorMessage.d.ts new file mode 100644 index 0000000..af70793 --- /dev/null +++ b/dist/conductor/types/IErrorMessage.d.ts @@ -0,0 +1,4 @@ +import type { ConductorError } from "../../common/errors"; +export interface IErrorMessage { + error: ConductorError; +} diff --git a/dist/conductor/types/IIOMessage.d.ts b/dist/conductor/types/IIOMessage.d.ts new file mode 100644 index 0000000..507fda0 --- /dev/null +++ b/dist/conductor/types/IIOMessage.d.ts @@ -0,0 +1,3 @@ +export interface IIOMessage { + message: string; +} diff --git a/dist/conductor/types/IServiceMessage.d.ts b/dist/conductor/types/IServiceMessage.d.ts new file mode 100644 index 0000000..6774ee4 --- /dev/null +++ b/dist/conductor/types/IServiceMessage.d.ts @@ -0,0 +1,5 @@ +import type { ServiceMessageType } from "./ServiceMessageType"; +export interface IServiceMessage { + readonly type: ServiceMessageType; + readonly data?: any; +} diff --git a/dist/conductor/types/IStatusMessage.d.ts b/dist/conductor/types/IStatusMessage.d.ts new file mode 100644 index 0000000..1996ce6 --- /dev/null +++ b/dist/conductor/types/IStatusMessage.d.ts @@ -0,0 +1,5 @@ +import type { RunnerStatus } from "./RunnerStatus"; +export interface IStatusMessage { + status: RunnerStatus; + isActive: boolean; +} diff --git a/dist/conductor/types/RunnerStatus.d.ts b/dist/conductor/types/RunnerStatus.d.ts new file mode 100644 index 0000000..3241ebd --- /dev/null +++ b/dist/conductor/types/RunnerStatus.d.ts @@ -0,0 +1,9 @@ +export declare const enum RunnerStatus { + ONLINE = 0,// Runner is online + EVAL_READY = 1,// Evaluator is ready + RUNNING = 2,// I am running some code + WAITING = 3,// I am waiting for inputs + BREAKPOINT = 4,// I have reached a debug breakpoint + STOPPED = 5,// I have exited, crashed, etc.; the environment is no longer valid + ERROR = 6 +} diff --git a/dist/conductor/types/ServiceMessageType.d.ts b/dist/conductor/types/ServiceMessageType.d.ts new file mode 100644 index 0000000..7a40e4a --- /dev/null +++ b/dist/conductor/types/ServiceMessageType.d.ts @@ -0,0 +1,10 @@ +export declare const enum ServiceMessageType { + /** A handshake message. See `HelloServiceMessage`. */ + HELLO = 0, + /** Abort the connection, due to incompatible protocol versions. See `AbortServiceMessage`. */ + ABORT = 1, + /** The evaluation entry point, sent from the host. See `EntryServiceMessage`. */ + ENTRY = 2, + /** Plugin advisory sent from the runner so the host may load a corresponding plugin. See `PluginServiceMessage`. */ + PLUGIN = 3 +} diff --git a/dist/conductor/types/index.d.ts b/dist/conductor/types/index.d.ts new file mode 100644 index 0000000..509a497 --- /dev/null +++ b/dist/conductor/types/index.d.ts @@ -0,0 +1,10 @@ +export type { Chunk } from "./Chunk"; +export type { IChunkMessage } from "./IChunkMessage"; +export type { IErrorMessage } from "./IErrorMessage"; +export type { IIOMessage } from "./IIOMessage"; +export type { IServiceMessage } from "./IServiceMessage"; +export type { IStatusMessage } from "./IStatusMessage"; +export { RunnerStatus } from "./RunnerStatus"; +export { ServiceMessageType } from "./ServiceMessageType"; +export * from "./moduleInterface"; +export * from "./serviceMessages"; diff --git a/dist/conductor/types/moduleInterface/ArrayIdentifier.d.ts b/dist/conductor/types/moduleInterface/ArrayIdentifier.d.ts new file mode 100644 index 0000000..b5c16fd --- /dev/null +++ b/dist/conductor/types/moduleInterface/ArrayIdentifier.d.ts @@ -0,0 +1,7 @@ +import type { DataType } from "./DataType"; +import type { Identifier } from "./Identifier"; +/** An identifier for an extern array. */ +export type ArrayIdentifier = Identifier & { + __brand: "array"; + __type: T; +}; diff --git a/dist/conductor/types/moduleInterface/ClosureIdentifier.d.ts b/dist/conductor/types/moduleInterface/ClosureIdentifier.d.ts new file mode 100644 index 0000000..6ff821f --- /dev/null +++ b/dist/conductor/types/moduleInterface/ClosureIdentifier.d.ts @@ -0,0 +1,7 @@ +import type { DataType } from "./DataType"; +import type { Identifier } from "./Identifier"; +/** An identifier for an extern closure. */ +export type ClosureIdentifier = Identifier & { + __brand: "closure"; + __ret: T; +}; diff --git a/dist/conductor/types/moduleInterface/DataType.d.ts b/dist/conductor/types/moduleInterface/DataType.d.ts new file mode 100644 index 0000000..18e9e19 --- /dev/null +++ b/dist/conductor/types/moduleInterface/DataType.d.ts @@ -0,0 +1,22 @@ +export declare enum DataType { + /** The return type of functions with no returned value. As a convention, the associated JS value is undefined. */ + VOID = 0, + /** A Boolean value. */ + BOOLEAN = 1, + /** A numerical value. */ + NUMBER = 2, + /** An immutable string of characters. */ + CONST_STRING = 3, + /** The empty list. As a convention, the associated JS value is null. */ + EMPTY_LIST = 4, + /** A pair of values. Reference type. */ + PAIR = 5, + /** An array of values of a single type. Reference type. */ + ARRAY = 6, + /** A value that can be called with fixed arity. Reference type. */ + CLOSURE = 7, + /** An opaque value that cannot be manipulated from user code. */ + OPAQUE = 8, + /** A list (either a pair or the empty list). */ + LIST = 9 +} diff --git a/dist/conductor/types/moduleInterface/ExternCallable.d.ts b/dist/conductor/types/moduleInterface/ExternCallable.d.ts new file mode 100644 index 0000000..861d105 --- /dev/null +++ b/dist/conductor/types/moduleInterface/ExternCallable.d.ts @@ -0,0 +1,9 @@ +import type { DataType } from "./DataType"; +import type { ExternTypeOf } from "./ExternTypeOf"; +import type { IFunctionSignature } from "./IFunctionSignature"; +type DataTypeMap = { + [Idx in keyof T]: ExternTypeOf; +}; +/** The expected function type based on an IFunctionSignature. */ +export type ExternCallable = (...args: DataTypeMap) => ExternTypeOf | Promise>; +export {}; diff --git a/dist/conductor/types/moduleInterface/ExternTypeOf.d.ts b/dist/conductor/types/moduleInterface/ExternTypeOf.d.ts new file mode 100644 index 0000000..bb15020 --- /dev/null +++ b/dist/conductor/types/moduleInterface/ExternTypeOf.d.ts @@ -0,0 +1,21 @@ +import type { ArrayIdentifier } from "./ArrayIdentifier"; +import type { ClosureIdentifier } from "./ClosureIdentifier"; +import { DataType } from "./DataType"; +import { List } from "./List"; +import type { OpaqueIdentifier } from "./OpaqueIdentifier"; +import type { PairIdentifier } from "./PairIdentifier"; +type typeMap = { + [DataType.VOID]: void; + [DataType.BOOLEAN]: boolean; + [DataType.NUMBER]: number; + [DataType.CONST_STRING]: string; + [DataType.EMPTY_LIST]: null; + [DataType.PAIR]: PairIdentifier; + [DataType.ARRAY]: ArrayIdentifier; + [DataType.CLOSURE]: ClosureIdentifier; + [DataType.OPAQUE]: OpaqueIdentifier; + [DataType.LIST]: List; +}; +/** Maps the Conductor DataTypes to their corresponding native types. */ +export type ExternTypeOf = T extends DataType ? typeMap[T] : never; +export {}; diff --git a/dist/conductor/types/moduleInterface/ExternValue.d.ts b/dist/conductor/types/moduleInterface/ExternValue.d.ts new file mode 100644 index 0000000..9399a85 --- /dev/null +++ b/dist/conductor/types/moduleInterface/ExternValue.d.ts @@ -0,0 +1,3 @@ +import type { ArrayIdentifier, ClosureIdentifier, DataType, Identifier, NativeValue, OpaqueIdentifier, PairIdentifier } from "."; +/** A valid extern value. */ +export type ExternValue = NativeValue | Identifier | PairIdentifier | ArrayIdentifier | ClosureIdentifier | OpaqueIdentifier; diff --git a/dist/conductor/types/moduleInterface/IDataHandler.d.ts b/dist/conductor/types/moduleInterface/IDataHandler.d.ts new file mode 100644 index 0000000..eac7430 --- /dev/null +++ b/dist/conductor/types/moduleInterface/IDataHandler.d.ts @@ -0,0 +1,174 @@ +import type { ArrayIdentifier, ClosureIdentifier, DataType, ExternCallable, Identifier, IFunctionSignature, List, OpaqueIdentifier, PairIdentifier, TypedValue } from "."; +export interface IDataHandler { + readonly hasDataInterface: true; + /** + * Makes a new Pair. + * @param head The typed value to be the head of the new Pair. + * @param tail The typed value to be the tail of the new Pair. + * @returns An identifier to the new Pair. + */ + pair_make(head: TypedValue, tail: TypedValue): PairIdentifier; + /** + * Gets the typed value in the head of a Pair. + * @param p The Pair to retrieve the head of. + * @returns The typed value in the head of the Pair. + */ + pair_head(p: PairIdentifier): TypedValue; + /** + * Sets the head of a Pair. + * @param p The Pair to set the head of. + * @param tv The typed value to set the head of the Pair to. + */ + pair_sethead(p: PairIdentifier, tv: TypedValue): void; + /** + * Gets the typed value in the tail of a Pair. + * @param p The Pair to retrieve the tail of. + * @returns The typed value in the tail of the Pair. + */ + pair_tail(p: PairIdentifier): TypedValue; + /** + * Sets the tail of a Pair. + * @param p The Pair to set the tail of. + * @param tv The typed value to set the tail of the Pair to. + */ + pair_settail(p: PairIdentifier, tv: TypedValue): void; + /** + * Asserts the type of a Pair. + * @param p The Pair to assert the type of. + * @param headType The expected type of the head of the Pair. + * @param tailType The expected type of the tail of the Pair. + * @throws If the Pair's type is not as expected. + */ + pair_assert(p: PairIdentifier, headType?: DataType, tailType?: DataType): void; + /** + * Makes a new Array. + * + * Creation of untyped arrays (with type `VOID`) should be avoided. + * @param t The type of the elements of the Array + * @param len The length of the Array + * @param init An optional initial typed value for the elements of the Array + * @returns An identifier to the new Array. + */ + array_make(t: T, len: number, init?: TypedValue>): ArrayIdentifier>; + /** + * Gets the length of an Array. + * @param a The Array to retrieve the length of. + * @returns The length of the given Array. + */ + array_length(a: ArrayIdentifier): number; + /** + * Gets the typed value at a specific index of an Array. + * Arrays are 0-indexed. + * @param a The Array to retrieve the value from. + * @param idx The index of the value wanted. + * @returns The typed value at the given index of the given Array. + */ + array_get(a: ArrayIdentifier, idx: number): TypedValue; + array_get(a: ArrayIdentifier, idx: number): TypedValue>; + /** + * Gets the type of the elements of an Array. + * + * If the Array is untyped, `VOID` is returned. + * @param a The Array to retrieve the element type of. + * @returns The type of the elements of the Array. + */ + array_type(a: ArrayIdentifier): NoInfer; + /** + * Sets a value at a specific index of an Array. + * Arrays are 0-indexed. + * @param a The Array to be modified. + * @param idx The index to be modified. + * @param tv The new typed value at the given index of the given Array. + * @throws If the array is typed and v's type does not match the Array's type. + */ + array_set(a: ArrayIdentifier, idx: number, tv: TypedValue): void; + array_set(a: ArrayIdentifier, idx: number, tv: TypedValue>): void; + /** + * Asserts the type and/or length of an Array. + * @param a The Array to assert. + * @param type The expected type of the elements of the Array. + * @param length The expected length of the Array. + * @throws If the Array's type is not as expected. + */ + array_assert(a: ArrayIdentifier, type?: T, length?: number): asserts a is ArrayIdentifier>; + /** + * Makes a new Closure. + * @param sig The signature of the new Closure. + * @param func A callback to be called when the Closure is called. + * @param dependsOn An optional array of Identifiers the Closure will depend on. + * @returns An identifier to the new Closure. + */ + closure_make(sig: T, func: ExternCallable, dependsOn?: (Identifier | null)[]): ClosureIdentifier; + /** + * Checks if a Closure accepts variable number of arguments. + * @param c The Closure to check. + * @returns `true` if the Closure accepts variable number of arguments. + */ + closure_is_vararg(c: ClosureIdentifier): boolean; + /** + * Gets the arity (number of parameters) of a Closure. + * For vararg Closures, the arity is the minimum number of parameters required. + * @param c The Closure to get the arity of. + * @returns The arity of the Closure. + */ + closure_arity(c: ClosureIdentifier): number; + /** + * Calls a Closure and checks the type of the returned value. + * @param c The Closure to be called. + * @param args An array of typed arguments to be passed to the Closure. + * @param returnType The expected type of the returned value. + * @returns The returned typed value. + */ + closure_call(c: ClosureIdentifier, args: TypedValue[], returnType: T): Promise>>; + /** + * Calls a Closure of known return type. + * @param c The Closure to be called. + * @param args An array of typed arguments to be passed to the Closure. + * @returns The returned typed value. + */ + closure_call_unchecked(c: ClosureIdentifier, args: TypedValue[]): Promise>>; + /** + * Asserts the arity of a Closure. + * @param c The Closure to assert the arity of. + * @param arity The expected arity of the Closure. + * @throws If the Closure's arity is not as expected. + */ + closure_arity_assert(c: ClosureIdentifier, arity: number): void; + /** + * Makes a new Opaque object. + * @param v The value to be stored under this Opaque object. + * @param immutable Mark this Opaque object as immutable. Mutable Opaque objects are not rollback-friendly, + * and evaluators should disable any rollback functionality upon receiving such an object. + * @returns An identifier to the new Opaque object. + */ + opaque_make(v: any, immutable?: boolean): OpaqueIdentifier; + /** + * Gets the value stored under an Opaque object. + * @param o The identifier to the Opaque object. + * @returns The value stored under this new Opaque object. + */ + opaque_get(o: OpaqueIdentifier): any; + /** + * Update the value stored under an Opaque object. + * @param o The identifier to the Opaque object. + * @param v The new value to store under this Opaque object. + */ + opaque_update(o: OpaqueIdentifier, v: any): void; + /** + * Ties the lifetime of the dependee to the dependent. + * @param dependent The object that requires the existence of the dependee. + * @param dependee The object whose existence is required by the dependent. + */ + tie(dependent: Identifier, dependee: Identifier | null): void; + /** + * Unties the lifetime of the dependee from the dependent. + * @param dependent The tied dependent object. + * @param dependee The tied dependee object. + */ + untie(dependent: Identifier, dependee: Identifier | null): void; + list(...elements: TypedValue[]): TypedValue; + is_list(xs: List): boolean; + list_to_vec(xs: List): TypedValue[]; + accumulate>(op: ClosureIdentifier, initial: TypedValue, sequence: List, resultType: T): Promise>; + length(xs: List): number; +} diff --git a/dist/conductor/types/moduleInterface/IFunctionSignature.d.ts b/dist/conductor/types/moduleInterface/IFunctionSignature.d.ts new file mode 100644 index 0000000..f5a9291 --- /dev/null +++ b/dist/conductor/types/moduleInterface/IFunctionSignature.d.ts @@ -0,0 +1,9 @@ +import type { DataType } from "./DataType"; +export interface IFunctionSignature { + /** The name of this function or closure. */ + name?: string; + /** The parameter types of this function or closure. */ + args: readonly DataType[]; + /** The type of the return value from this function or closure. */ + returnType: DataType; +} diff --git a/dist/conductor/types/moduleInterface/Identifier.d.ts b/dist/conductor/types/moduleInterface/Identifier.d.ts new file mode 100644 index 0000000..deef17c --- /dev/null +++ b/dist/conductor/types/moduleInterface/Identifier.d.ts @@ -0,0 +1,2 @@ +/** An identifier to an extern value. */ +export type Identifier = number; diff --git a/dist/conductor/types/moduleInterface/List.d.ts b/dist/conductor/types/moduleInterface/List.d.ts new file mode 100644 index 0000000..9c0718b --- /dev/null +++ b/dist/conductor/types/moduleInterface/List.d.ts @@ -0,0 +1,3 @@ +import type { PairIdentifier } from "./PairIdentifier"; +/** Either an identifier for a extern pair, or a null (empty-list) value. */ +export type List = PairIdentifier | null; diff --git a/dist/conductor/types/moduleInterface/NativeValue.d.ts b/dist/conductor/types/moduleInterface/NativeValue.d.ts new file mode 100644 index 0000000..3036018 --- /dev/null +++ b/dist/conductor/types/moduleInterface/NativeValue.d.ts @@ -0,0 +1,2 @@ +/** A value that can be expressed with JS primitives. */ +export type NativeValue = undefined | boolean | number | string | null; diff --git a/dist/conductor/types/moduleInterface/OpaqueIdentifier.d.ts b/dist/conductor/types/moduleInterface/OpaqueIdentifier.d.ts new file mode 100644 index 0000000..cd05980 --- /dev/null +++ b/dist/conductor/types/moduleInterface/OpaqueIdentifier.d.ts @@ -0,0 +1,5 @@ +import type { Identifier } from "./Identifier"; +/** An identifier for an extern opaque value. */ +export type OpaqueIdentifier = Identifier & { + __brand: "opaque"; +}; diff --git a/dist/conductor/types/moduleInterface/PairIdentifier.d.ts b/dist/conductor/types/moduleInterface/PairIdentifier.d.ts new file mode 100644 index 0000000..0ab72d5 --- /dev/null +++ b/dist/conductor/types/moduleInterface/PairIdentifier.d.ts @@ -0,0 +1,5 @@ +import type { Identifier } from "./Identifier"; +/** An identifier for an extern pair. */ +export type PairIdentifier = Identifier & { + __brand: "pair"; +}; diff --git a/dist/conductor/types/moduleInterface/StdlibFunction.d.ts b/dist/conductor/types/moduleInterface/StdlibFunction.d.ts new file mode 100644 index 0000000..d5113e7 --- /dev/null +++ b/dist/conductor/types/moduleInterface/StdlibFunction.d.ts @@ -0,0 +1,2 @@ +import type { IDataHandler } from "./IDataHandler"; +export type StdlibFunction = (this: IDataHandler, ...args: Arg) => Ret; diff --git a/dist/conductor/types/moduleInterface/TypedValue.d.ts b/dist/conductor/types/moduleInterface/TypedValue.d.ts new file mode 100644 index 0000000..829cb8a --- /dev/null +++ b/dist/conductor/types/moduleInterface/TypedValue.d.ts @@ -0,0 +1,8 @@ +import type { DataType } from "./DataType"; +import type { ExternTypeOf } from "./ExternTypeOf"; +interface ITypedValue { + type: T; + value: ExternTypeOf; +} +export type TypedValue = T extends DataType ? ITypedValue : never; +export {}; diff --git a/dist/conductor/types/moduleInterface/index.d.ts b/dist/conductor/types/moduleInterface/index.d.ts new file mode 100644 index 0000000..723939d --- /dev/null +++ b/dist/conductor/types/moduleInterface/index.d.ts @@ -0,0 +1,15 @@ +export type { ArrayIdentifier } from "./ArrayIdentifier"; +export type { ClosureIdentifier } from "./ClosureIdentifier"; +export { DataType } from "./DataType"; +export type { ExternCallable } from "./ExternCallable"; +export type { ExternTypeOf } from "./ExternTypeOf"; +export type { ExternValue } from "./ExternValue"; +export type { IDataHandler } from "./IDataHandler"; +export type { Identifier } from "./Identifier"; +export type { IFunctionSignature } from "./IFunctionSignature"; +export type { List } from "./List"; +export type { NativeValue } from "./NativeValue"; +export type { OpaqueIdentifier } from "./OpaqueIdentifier"; +export type { PairIdentifier } from "./PairIdentifier"; +export type { StdlibFunction } from "./StdlibFunction"; +export type { TypedValue } from "./TypedValue"; diff --git a/dist/conductor/types/serviceMessages/AbortServiceMessage.d.ts b/dist/conductor/types/serviceMessages/AbortServiceMessage.d.ts new file mode 100644 index 0000000..0dd615a --- /dev/null +++ b/dist/conductor/types/serviceMessages/AbortServiceMessage.d.ts @@ -0,0 +1,9 @@ +import type { IServiceMessage } from "../IServiceMessage"; +import { ServiceMessageType } from "../ServiceMessageType"; +export declare class AbortServiceMessage implements IServiceMessage { + readonly type = ServiceMessageType.ABORT; + readonly data: { + minVersion: number; + }; + constructor(minVersion: number); +} diff --git a/dist/conductor/types/serviceMessages/EntryServiceMessage.d.ts b/dist/conductor/types/serviceMessages/EntryServiceMessage.d.ts new file mode 100644 index 0000000..c0cf46c --- /dev/null +++ b/dist/conductor/types/serviceMessages/EntryServiceMessage.d.ts @@ -0,0 +1,7 @@ +import type { IServiceMessage } from "../IServiceMessage"; +import { ServiceMessageType } from "../ServiceMessageType"; +export declare class EntryServiceMessage implements IServiceMessage { + readonly type = ServiceMessageType.ENTRY; + readonly data: string; + constructor(entryPoint: string); +} diff --git a/dist/conductor/types/serviceMessages/HelloServiceMessage.d.ts b/dist/conductor/types/serviceMessages/HelloServiceMessage.d.ts new file mode 100644 index 0000000..469a36e --- /dev/null +++ b/dist/conductor/types/serviceMessages/HelloServiceMessage.d.ts @@ -0,0 +1,9 @@ +import { Constant } from "../../../common/Constant"; +import type { IServiceMessage } from "../IServiceMessage"; +import { ServiceMessageType } from "../ServiceMessageType"; +export declare class HelloServiceMessage implements IServiceMessage { + readonly type = ServiceMessageType.HELLO; + readonly data: { + version: Constant; + }; +} diff --git a/dist/conductor/types/serviceMessages/PluginServiceMessage.d.ts b/dist/conductor/types/serviceMessages/PluginServiceMessage.d.ts new file mode 100644 index 0000000..03e4723 --- /dev/null +++ b/dist/conductor/types/serviceMessages/PluginServiceMessage.d.ts @@ -0,0 +1,7 @@ +import type { IServiceMessage } from "../IServiceMessage"; +import { ServiceMessageType } from "../ServiceMessageType"; +export declare class PluginServiceMessage implements IServiceMessage { + readonly type = ServiceMessageType.PLUGIN; + readonly data: string; + constructor(pluginName: string); +} diff --git a/dist/conductor/types/serviceMessages/index.d.ts b/dist/conductor/types/serviceMessages/index.d.ts new file mode 100644 index 0000000..b4e865f --- /dev/null +++ b/dist/conductor/types/serviceMessages/index.d.ts @@ -0,0 +1,4 @@ +export { AbortServiceMessage } from "./AbortServiceMessage"; +export { EntryServiceMessage } from "./EntryServiceMessage"; +export { HelloServiceMessage } from "./HelloServiceMessage"; +export { PluginServiceMessage } from "./PluginServiceMessage"; diff --git a/dist/conductor/util/index.d.ts b/dist/conductor/util/index.d.ts new file mode 100644 index 0000000..4bd2cbf --- /dev/null +++ b/dist/conductor/util/index.d.ts @@ -0,0 +1,12 @@ +export { isReferenceType } from "./isReferenceType"; +export { isSameType } from "./isSameType"; +export { mArray } from "./mArray"; +export { mBoolean } from "./mBoolean"; +export { mClosure } from "./mClosure"; +export { mEmptyList } from "./mEmptyList"; +export { mList } from "./mList"; +export { mNumber } from "./mNumber"; +export { mOpaque } from "./mOpaque"; +export { mPair } from "./mPair"; +export { mString } from "./mString"; +export { mVoid } from "./mVoid"; diff --git a/dist/conductor/util/isReferenceType.d.ts b/dist/conductor/util/isReferenceType.d.ts new file mode 100644 index 0000000..9b9e317 --- /dev/null +++ b/dist/conductor/util/isReferenceType.d.ts @@ -0,0 +1,2 @@ +import { DataType } from "../types"; +export declare function isReferenceType(type: DataType): boolean; diff --git a/dist/conductor/util/isSameType.d.ts b/dist/conductor/util/isSameType.d.ts new file mode 100644 index 0000000..204029a --- /dev/null +++ b/dist/conductor/util/isSameType.d.ts @@ -0,0 +1,2 @@ +import { DataType } from "../types"; +export declare function isSameType(t1: DataType, t2: DataType): boolean; diff --git a/dist/conductor/util/mArray.d.ts b/dist/conductor/util/mArray.d.ts new file mode 100644 index 0000000..b527d3d --- /dev/null +++ b/dist/conductor/util/mArray.d.ts @@ -0,0 +1,2 @@ +import { ArrayIdentifier, DataType, TypedValue } from "../types"; +export declare function mArray(value: ArrayIdentifier): TypedValue; diff --git a/dist/conductor/util/mBoolean.d.ts b/dist/conductor/util/mBoolean.d.ts new file mode 100644 index 0000000..daf8c7e --- /dev/null +++ b/dist/conductor/util/mBoolean.d.ts @@ -0,0 +1,2 @@ +import { DataType, TypedValue } from "../types"; +export declare function mBoolean(value: boolean): TypedValue; diff --git a/dist/conductor/util/mClosure.d.ts b/dist/conductor/util/mClosure.d.ts new file mode 100644 index 0000000..ecc5ac0 --- /dev/null +++ b/dist/conductor/util/mClosure.d.ts @@ -0,0 +1,2 @@ +import { ClosureIdentifier, DataType, TypedValue } from "../types"; +export declare function mClosure(value: ClosureIdentifier): TypedValue; diff --git a/dist/conductor/util/mEmptyList.d.ts b/dist/conductor/util/mEmptyList.d.ts new file mode 100644 index 0000000..ca9b758 --- /dev/null +++ b/dist/conductor/util/mEmptyList.d.ts @@ -0,0 +1,2 @@ +import { DataType, TypedValue } from "../types"; +export declare function mEmptyList(value?: null): TypedValue; diff --git a/dist/conductor/util/mList.d.ts b/dist/conductor/util/mList.d.ts new file mode 100644 index 0000000..0607548 --- /dev/null +++ b/dist/conductor/util/mList.d.ts @@ -0,0 +1,2 @@ +import { DataType, TypedValue, PairIdentifier } from "../types"; +export declare function mList(value: PairIdentifier | null): TypedValue; diff --git a/dist/conductor/util/mNumber.d.ts b/dist/conductor/util/mNumber.d.ts new file mode 100644 index 0000000..967b9dc --- /dev/null +++ b/dist/conductor/util/mNumber.d.ts @@ -0,0 +1,2 @@ +import { DataType, TypedValue } from "../types"; +export declare function mNumber(value: number): TypedValue; diff --git a/dist/conductor/util/mOpaque.d.ts b/dist/conductor/util/mOpaque.d.ts new file mode 100644 index 0000000..4825f73 --- /dev/null +++ b/dist/conductor/util/mOpaque.d.ts @@ -0,0 +1,2 @@ +import { DataType, TypedValue, OpaqueIdentifier } from "../types"; +export declare function mOpaque(value: OpaqueIdentifier): TypedValue; diff --git a/dist/conductor/util/mPair.d.ts b/dist/conductor/util/mPair.d.ts new file mode 100644 index 0000000..05a1c84 --- /dev/null +++ b/dist/conductor/util/mPair.d.ts @@ -0,0 +1,2 @@ +import { DataType, TypedValue, PairIdentifier } from "../types"; +export declare function mPair(value: PairIdentifier): TypedValue; diff --git a/dist/conductor/util/mString.d.ts b/dist/conductor/util/mString.d.ts new file mode 100644 index 0000000..ac5d00d --- /dev/null +++ b/dist/conductor/util/mString.d.ts @@ -0,0 +1,2 @@ +import { DataType, TypedValue } from "../types"; +export declare function mString(value: string): TypedValue; diff --git a/dist/conductor/util/mVoid.d.ts b/dist/conductor/util/mVoid.d.ts new file mode 100644 index 0000000..6688cf8 --- /dev/null +++ b/dist/conductor/util/mVoid.d.ts @@ -0,0 +1,2 @@ +import { DataType, TypedValue } from "../types"; +export declare function mVoid(value?: void): TypedValue; diff --git a/dist/conduit/Channel.d.ts b/dist/conduit/Channel.d.ts new file mode 100644 index 0000000..f14cbc0 --- /dev/null +++ b/dist/conduit/Channel.d.ts @@ -0,0 +1,37 @@ +import { IChannel, Subscriber } from "./types"; +export declare class Channel implements IChannel { + readonly name: string; + /** The underlying MessagePort of this Channel. */ + private __port; + /** The callbacks subscribed to this Channel. */ + private readonly __subscribers; + /** Is the Channel allowed to be used? */ + private __isAlive; + private __waitingMessages?; + send(message: T, transfer?: Transferable[]): void; + subscribe(subscriber: Subscriber): void; + unsubscribe(subscriber: Subscriber): void; + close(): void; + /** + * Check if this Channel is allowed to be used. + * @throws Throws an error if the Channel has been closed. + */ + private __verifyAlive; + /** + * Dispatch some data to subscribers. + * @param data The data to be dispatched to subscribers. + */ + private __dispatch; + /** + * Listens to the port's message event, and starts the port. + * Messages will be buffered until the first subscriber listens to the Channel. + * @param port The MessagePort to listen to. + */ + listenToPort(port: MessagePort): void; + /** + * Replaces the underlying MessagePort of this Channel and closes it, and starts the new port. + * @param port The new port to use. + */ + replacePort(port: MessagePort): void; + constructor(name: string, port: MessagePort); +} diff --git a/dist/conduit/ChannelQueue.d.ts b/dist/conduit/ChannelQueue.d.ts new file mode 100644 index 0000000..79d2ac2 --- /dev/null +++ b/dist/conduit/ChannelQueue.d.ts @@ -0,0 +1,11 @@ +import { IChannelQueue, IChannel } from "./types"; +export declare class ChannelQueue implements IChannelQueue { + readonly name: string; + private __channel; + private __messageQueue; + receive(): Promise; + tryReceive(): T | undefined; + send(message: T, transfer?: Transferable[]): void; + close(): void; + constructor(channel: IChannel); +} diff --git a/dist/conduit/Conduit.d.ts b/dist/conduit/Conduit.d.ts new file mode 100644 index 0000000..739a481 --- /dev/null +++ b/dist/conduit/Conduit.d.ts @@ -0,0 +1,17 @@ +import { IConduit, ILink, IPlugin, PluginClass } from "./types"; +export declare class Conduit implements IConduit { + private __alive; + private readonly __link; + private readonly __parent; + private readonly __channels; + private readonly __pluginMap; + private readonly __plugins; + private __negotiateChannel; + private __verifyAlive; + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer; + unregisterPlugin(plugin: IPlugin): void; + lookupPlugin(pluginName: string): IPlugin; + terminate(): void; + private __handlePort; + constructor(link: ILink, parent?: boolean); +} diff --git a/dist/conduit/index.d.ts b/dist/conduit/index.d.ts new file mode 100644 index 0000000..e045ea5 --- /dev/null +++ b/dist/conduit/index.d.ts @@ -0,0 +1,4 @@ +export type { IChannel, IConduit, ILink, IChannelQueue, IPlugin, Subscriber } from "./types"; +export { Channel } from "./Channel"; +export { ChannelQueue } from "./ChannelQueue"; +export { Conduit } from "./Conduit"; diff --git a/dist/conduit/rpc/index.d.ts b/dist/conduit/rpc/index.d.ts new file mode 100644 index 0000000..02375ad --- /dev/null +++ b/dist/conduit/rpc/index.d.ts @@ -0,0 +1,2 @@ +export { Remote } from "./types"; +export { makeRpc } from "./makeRpc"; diff --git a/dist/conduit/rpc/makeRpc.d.ts b/dist/conduit/rpc/makeRpc.d.ts new file mode 100644 index 0000000..a241b66 --- /dev/null +++ b/dist/conduit/rpc/makeRpc.d.ts @@ -0,0 +1,3 @@ +import { IChannel } from "../types"; +import { IRpcMessage, Remote } from "./types"; +export declare function makeRpc(channel: IChannel, self: ISelf): Remote; diff --git a/dist/conduit/rpc/types/IRpcMessage.d.ts b/dist/conduit/rpc/types/IRpcMessage.d.ts new file mode 100644 index 0000000..e81ff8f --- /dev/null +++ b/dist/conduit/rpc/types/IRpcMessage.d.ts @@ -0,0 +1,5 @@ +import { RpcMessageType } from "./RpcMessageType"; +export interface IRpcMessage { + type: RpcMessageType; + data?: any; +} diff --git a/dist/conduit/rpc/types/Remote.d.ts b/dist/conduit/rpc/types/Remote.d.ts new file mode 100644 index 0000000..8773dea --- /dev/null +++ b/dist/conduit/rpc/types/Remote.d.ts @@ -0,0 +1,3 @@ +export type Remote = { + [K in keyof IOther]: IOther[K] extends (...args: infer Args) => infer Ret ? K extends `$${infer _N}` ? Ret extends void ? IOther[K] : (...args: Args) => void : Ret extends Promise ? IOther[K] : (...args: Args) => Promise : never; +}; diff --git a/dist/conduit/rpc/types/RpcCallMessage.d.ts b/dist/conduit/rpc/types/RpcCallMessage.d.ts new file mode 100644 index 0000000..db7070d --- /dev/null +++ b/dist/conduit/rpc/types/RpcCallMessage.d.ts @@ -0,0 +1,11 @@ +import type { IRpcMessage } from "./IRpcMessage"; +import { RpcMessageType } from "./RpcMessageType"; +export declare class RpcCallMessage implements IRpcMessage { + type: RpcMessageType; + readonly data: { + fn: string | symbol; + args: any[]; + invokeId: number; + }; + constructor(fn: string | symbol, args: any[], invokeId: number); +} diff --git a/dist/conduit/rpc/types/RpcErrorMessage.d.ts b/dist/conduit/rpc/types/RpcErrorMessage.d.ts new file mode 100644 index 0000000..719aa53 --- /dev/null +++ b/dist/conduit/rpc/types/RpcErrorMessage.d.ts @@ -0,0 +1,10 @@ +import type { IRpcMessage } from "./IRpcMessage"; +import { RpcMessageType } from "./RpcMessageType"; +export declare class RpcErrorMessage implements IRpcMessage { + type: RpcMessageType; + readonly data: { + invokeId: number; + err: any; + }; + constructor(invokeId: number, err: any); +} diff --git a/dist/conduit/rpc/types/RpcMessageType.d.ts b/dist/conduit/rpc/types/RpcMessageType.d.ts new file mode 100644 index 0000000..0e827e0 --- /dev/null +++ b/dist/conduit/rpc/types/RpcMessageType.d.ts @@ -0,0 +1,6 @@ +declare const enum RpcMessageType { + CALL = 0, + RETURN = 1, + RETURN_ERR = 2 +} +export { RpcMessageType }; diff --git a/dist/conduit/rpc/types/RpcReturnMessage.d.ts b/dist/conduit/rpc/types/RpcReturnMessage.d.ts new file mode 100644 index 0000000..839af10 --- /dev/null +++ b/dist/conduit/rpc/types/RpcReturnMessage.d.ts @@ -0,0 +1,10 @@ +import type { IRpcMessage } from "./IRpcMessage"; +import { RpcMessageType } from "./RpcMessageType"; +export declare class RpcReturnMessage implements IRpcMessage { + type: RpcMessageType; + readonly data: { + invokeId: number; + res: any; + }; + constructor(invokeId: number, res: any); +} diff --git a/dist/conduit/rpc/types/index.d.ts b/dist/conduit/rpc/types/index.d.ts new file mode 100644 index 0000000..d7c959b --- /dev/null +++ b/dist/conduit/rpc/types/index.d.ts @@ -0,0 +1,6 @@ +export type { IRpcMessage } from "./IRpcMessage"; +export type { Remote } from "./Remote"; +export { RpcCallMessage } from "./RpcCallMessage"; +export { RpcErrorMessage } from "./RpcErrorMessage"; +export { RpcMessageType } from "./RpcMessageType"; +export { RpcReturnMessage } from "./RpcReturnMessage"; diff --git a/dist/conduit/types/AbstractPluginClass.d.ts b/dist/conduit/types/AbstractPluginClass.d.ts new file mode 100644 index 0000000..8b45c9c --- /dev/null +++ b/dist/conduit/types/AbstractPluginClass.d.ts @@ -0,0 +1,6 @@ +import { IChannel } from "./IChannel"; +import { IConduit } from "./IConduit"; +import { IPlugin } from "./IPlugin"; +export type AbstractPluginClass = { + readonly channelAttach: string[]; +} & (abstract new (conduit: IConduit, channels: IChannel[], ...arg: Arg) => T); diff --git a/dist/conduit/types/IChannel.d.ts b/dist/conduit/types/IChannel.d.ts new file mode 100644 index 0000000..5da70c0 --- /dev/null +++ b/dist/conduit/types/IChannel.d.ts @@ -0,0 +1,25 @@ +import type { Subscriber } from "./Subscriber"; +export interface IChannel { + /** The name of the channel. */ + readonly name: string; + /** + * Send a message through this channel. + * @param message The message to be sent. + * @param transfer An array of transferable objects to be sent with the message. + */ + send(message: T, transfer?: Transferable[]): void; + /** + * Subscribe to messages on this channel. + * @param subscriber The function to be called when a message is received. + */ + subscribe(subscriber: Subscriber): void; + /** + * Unsubscribe from messages on this channel. + * @param subscriber The function that was called when a message is received. + */ + unsubscribe(subscriber: Subscriber): void; + /** + * Closes the channel, and frees any held resources. + */ + close(): void; +} diff --git a/dist/conduit/types/IChannelQueue.d.ts b/dist/conduit/types/IChannelQueue.d.ts new file mode 100644 index 0000000..be37973 --- /dev/null +++ b/dist/conduit/types/IChannelQueue.d.ts @@ -0,0 +1,25 @@ +export interface IChannelQueue { + /** The name of the message queue. */ + readonly name: string; + /** + * Send a message through the underlying channel. + * @param message The message to be sent. + * @param transfer An array of transferable objects to be sent with the message. + */ + send(message: T, transfer?: Transferable[]): void; + /** + * Receives a queued message, or waits until one arrives. + * @returns A promise resolving to the received message. + */ + receive(): Promise; + /** + * Tries to receive a queued message. + * Does not wait for a message if the queue is empty. + * @returns The received message, or undefined if the queue is empty. + */ + tryReceive(): T | undefined; + /** + * Closes the message queue. + */ + close(): void; +} diff --git a/dist/conduit/types/IConduit.d.ts b/dist/conduit/types/IConduit.d.ts new file mode 100644 index 0000000..643feae --- /dev/null +++ b/dist/conduit/types/IConduit.d.ts @@ -0,0 +1,23 @@ +import type { IPlugin } from "./IPlugin"; +import type { PluginClass } from "./PluginClass"; +export interface IConduit { + /** + * Register a plugin with the conduit. + * @param pluginClass The plugin to be registered. + */ + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer; + /** + * Unregister a plugin from the conduit. + * @param plugin The plugin to be unregistered. + */ + unregisterPlugin(plugin: IPlugin): void; + /** + * Look for a plugin with the given name. + * @param pluginName The name of the plugin to be searched for. + */ + lookupPlugin(pluginName: string): IPlugin; + /** + * Shuts down the conduit. + */ + terminate(): void; +} diff --git a/dist/conduit/types/ILink.d.ts b/dist/conduit/types/ILink.d.ts new file mode 100644 index 0000000..d10cfd6 --- /dev/null +++ b/dist/conduit/types/ILink.d.ts @@ -0,0 +1,5 @@ +export interface ILink { + postMessage: typeof Worker.prototype.postMessage; + addEventListener: typeof Worker.prototype.addEventListener; + terminate?: typeof Worker.prototype.terminate; +} diff --git a/dist/conduit/types/IPlugin.d.ts b/dist/conduit/types/IPlugin.d.ts new file mode 100644 index 0000000..84617d5 --- /dev/null +++ b/dist/conduit/types/IPlugin.d.ts @@ -0,0 +1,8 @@ +export interface IPlugin { + /** The name of the plugin. Can be undefined for an unnamed plugin. */ + readonly name?: string; + /** + * Perform any cleanup of the plugin (e.g. closing message queues). + */ + destroy?(): void; +} diff --git a/dist/conduit/types/PluginClass.d.ts b/dist/conduit/types/PluginClass.d.ts new file mode 100644 index 0000000..200db5e --- /dev/null +++ b/dist/conduit/types/PluginClass.d.ts @@ -0,0 +1,6 @@ +import { IChannel } from "./IChannel"; +import { IConduit } from "./IConduit"; +import type { IPlugin } from "./IPlugin"; +export type PluginClass = { + readonly channelAttach: string[]; +} & (new (conduit: IConduit, channels: IChannel[], ...arg: Arg) => T); diff --git a/dist/conduit/types/Subscriber.d.ts b/dist/conduit/types/Subscriber.d.ts new file mode 100644 index 0000000..50cd74c --- /dev/null +++ b/dist/conduit/types/Subscriber.d.ts @@ -0,0 +1,2 @@ +/** A subscriber of a channel. */ +export type Subscriber = (data: T) => void; diff --git a/dist/conduit/types/index.d.ts b/dist/conduit/types/index.d.ts new file mode 100644 index 0000000..3722252 --- /dev/null +++ b/dist/conduit/types/index.d.ts @@ -0,0 +1,8 @@ +export type { AbstractPluginClass } from "./AbstractPluginClass"; +export type { IChannel } from "./IChannel"; +export type { IChannelQueue } from "./IChannelQueue"; +export type { IConduit } from "./IConduit"; +export type { ILink } from "./ILink"; +export type { IPlugin } from "./IPlugin"; +export type { PluginClass } from "./PluginClass"; +export type { Subscriber } from "./Subscriber"; diff --git a/dist/conduit/util/checkIsPluginClass.d.ts b/dist/conduit/util/checkIsPluginClass.d.ts new file mode 100644 index 0000000..0cb8e81 --- /dev/null +++ b/dist/conduit/util/checkIsPluginClass.d.ts @@ -0,0 +1,10 @@ +import { IPlugin } from ".."; +import { AbstractPluginClass, PluginClass } from "../types"; +/** + * Typechecking utility decorator. + * It is recommended that usage of this decorator is removed + * before or during the build process, as some tools + * (e.g. terser) do not have good support for class decorators. + * @param _pluginClass The Class to be typechecked. + */ +export declare function checkIsPluginClass(_pluginClass: PluginClass | AbstractPluginClass): void; diff --git a/dist/conduit/util/index.d.ts b/dist/conduit/util/index.d.ts new file mode 100644 index 0000000..0c82e60 --- /dev/null +++ b/dist/conduit/util/index.d.ts @@ -0,0 +1 @@ +export { checkIsPluginClass } from "./checkIsPluginClass"; diff --git a/dist/cse-machine/ast-helper.d.ts b/dist/cse-machine/ast-helper.d.ts new file mode 100644 index 0000000..eedcb2c --- /dev/null +++ b/dist/cse-machine/ast-helper.d.ts @@ -0,0 +1,37 @@ +import type * as es from 'estree'; +import { StatementSequence } from './types'; +import { ControlItem } from './control'; +/** + * Create a StatementSequence node. + */ +export declare const statementSequence: (body: es.Statement[], loc?: es.SourceLocation | null) => StatementSequence; +export declare const isNode: (item: any) => item is es.Node; +export declare const isBlockStatement: (node: es.Node | StatementSequence) => node is es.BlockStatement; +export declare const hasDeclarations: (node: es.BlockStatement) => boolean; +export declare const blockArrowFunction: (params: es.Identifier[], body: es.Statement[] | es.BlockStatement | es.Expression, loc?: es.SourceLocation | null) => es.ArrowFunctionExpression; +export declare const blockStatement: (body: es.Statement[], loc?: es.SourceLocation | null) => es.BlockStatement; +export declare const constantDeclaration: (name: string, init: es.Expression, loc?: es.SourceLocation | null) => pyVariableDeclaration; +export declare const declaration: (name: string, kind: AllowedDeclarations, init: es.Expression, loc?: es.SourceLocation | null) => pyVariableDeclaration; +type AllowedDeclarations = 'declaration' | 'const'; +export interface pyVariableDeclaration { + type: "VariableDeclaration"; + declarations: pyVariableDeclarator[]; + kind: "declaration" | "const"; + loc?: es.SourceLocation | null | undefined; + range?: [number, number] | undefined; +} +export interface pyVariableDeclarator { + type: "VariableDeclarator"; + id: Pattern; + init?: es.Expression | null | undefined; +} +export type Pattern = es.Identifier | es.ObjectPattern | es.ArrayPattern | es.RestElement | es.AssignmentPattern | es.MemberExpression; +export declare const identifier: (name: string, loc?: es.SourceLocation | null) => es.Identifier; +export declare const returnStatement: (argument: es.Expression, loc?: es.SourceLocation | null) => es.ReturnStatement; +export declare const hasReturnStatement: (block: es.BlockStatement | StatementSequence) => boolean; +export declare const isReturnStatement: (node: es.Node) => node is es.ReturnStatement; +export declare const isIfStatement: (node: es.Node) => node is es.IfStatement; +export declare const hasReturnStatementIf: (statement: es.IfStatement) => boolean; +export declare const isStatementSequence: (node: ControlItem) => node is StatementSequence; +export declare const literal: (value: string | number | boolean | null, loc?: es.SourceLocation | null) => es.Literal; +export {}; diff --git a/dist/cse-machine/closure.d.ts b/dist/cse-machine/closure.d.ts new file mode 100644 index 0000000..7cbfcc1 --- /dev/null +++ b/dist/cse-machine/closure.d.ts @@ -0,0 +1,18 @@ +import * as es from 'estree'; +import { Environment } from './environment'; +import { Context } from './context'; +import { StatementSequence } from './types'; +import { ControlItem } from './control'; +export declare class Closure { + node: es.ArrowFunctionExpression; + environment: Environment; + context: Context; + predefined: boolean; + originalNode?: es.ArrowFunctionExpression; + /** Unique ID defined for closure */ + /** Name of the constant declaration that the closure is assigned to */ + declaredName?: string; + constructor(node: es.ArrowFunctionExpression, environment: Environment, context: Context, predefined?: boolean); + static makeFromArrowFunction(node: es.ArrowFunctionExpression, environment: Environment, context: Context, dummyReturn?: boolean, predefined?: boolean): Closure; +} +export declare const isStatementSequence: (node: ControlItem) => node is StatementSequence; diff --git a/dist/cse-machine/context.d.ts b/dist/cse-machine/context.d.ts new file mode 100644 index 0000000..c75481f --- /dev/null +++ b/dist/cse-machine/context.d.ts @@ -0,0 +1,69 @@ +import * as es from 'estree'; +import { Stash } from './stash'; +import { Control } from './control'; +import { Environment } from './environment'; +import { CseError } from './error'; +import { Node, StatementSequence } from './types'; +import { NativeStorage } from '../types'; +export declare class Context { + control: Control; + stash: Stash; + errors: CseError[]; + runtime: { + break: boolean; + debuggerOn: boolean; + isRunning: boolean; + environmentTree: EnvTree; + environments: Environment[]; + nodes: Node[]; + control: Control | null; + stash: Stash | null; + objectCount: number; + envStepsTotal: number; + breakpointSteps: number[]; + changepointSteps: number[]; + }; + /** + * Used for storing the native context and other values + */ + nativeStorage: NativeStorage; + constructor(program?: es.Program | StatementSequence, context?: Context); + createGlobalEnvironment: () => Environment; + createEmptyRuntime: () => { + break: boolean; + debuggerOn: boolean; + isRunning: boolean; + environmentTree: EnvTree; + environments: never[]; + value: undefined; + nodes: never[]; + control: null; + stash: null; + objectCount: number; + envSteps: number; + envStepsTotal: number; + breakpointSteps: never[]; + changepointSteps: never[]; + }; + reset(program?: es.Program | StatementSequence): void; + copy(): Context; + private copyEnvironment; +} +export declare class EnvTree { + private _root; + private map; + get root(): EnvTreeNode | null; + insert(environment: Environment): void; + getTreeNode(environment: Environment): EnvTreeNode | undefined; +} +export declare class EnvTreeNode { + readonly environment: Environment; + parent: EnvTreeNode | null; + private _children; + constructor(environment: Environment, parent: EnvTreeNode | null); + get children(): EnvTreeNode[]; + resetChildren(newChildren: EnvTreeNode[]): void; + private clearChildren; + private addChildren; + addChild(newChild: EnvTreeNode): EnvTreeNode; +} diff --git a/dist/cse-machine/control.d.ts b/dist/cse-machine/control.d.ts new file mode 100644 index 0000000..fbf07f4 --- /dev/null +++ b/dist/cse-machine/control.d.ts @@ -0,0 +1,24 @@ +import type * as es from 'estree'; +import { Stack } from './stack'; +import { Node, StatementSequence, Instr } from './types'; +export type ControlItem = (Node | Instr) & { + isEnvDependent?: boolean; + skipEnv?: boolean; +}; +export declare class Control extends Stack { + private numEnvDependentItems; + constructor(program?: es.Program | StatementSequence); + canAvoidEnvInstr(): boolean; + getNumEnvDependentItems(): number; + pop(): ControlItem | undefined; + push(...items: ControlItem[]): void; + /** + * Before pushing block statements on the control stack, we check if the block statement has any declarations. + * If not, the block is converted to a StatementSequence. + * @param items The items being pushed on the control. + * @returns The same set of control items, but with block statements without declarations converted to StatementSequences. + * NOTE: this function handles any case where StatementSequence has to be converted back into BlockStatement due to type issues + */ + private static simplifyBlocksWithoutDeclarations; + copy(): Control; +} diff --git a/dist/cse-machine/dict.d.ts b/dist/cse-machine/dict.d.ts new file mode 100644 index 0000000..10e831e --- /dev/null +++ b/dist/cse-machine/dict.d.ts @@ -0,0 +1,45 @@ +import * as es from 'estree'; +/** + * Python style dictionary + */ +export default class Dict { + private readonly internalMap; + constructor(internalMap?: Map); + get size(): number; + [Symbol.iterator](): MapIterator<[K, V]>; + get(key: K): V | undefined; + set(key: K, value: V): Map; + has(key: K): boolean; + /** + * Similar to how the python dictionary's setdefault function works: + * If the key is not present, it is set to the given value, then that value is returned + * Otherwise, `setdefault` returns the value stored in the dictionary without + * modifying it + */ + setdefault(key: K, value: V): NonNullable; + update(key: K, defaultVal: V, updater: (oldV: V) => V): V; + entries(): [K, V][]; + forEach(func: (key: K, value: V) => void): void; + /** + * Similar to `mapAsync`, but for an async mapping function that does not return any value + */ + forEachAsync(func: (k: K, v: V, index: number) => Promise): Promise; + map(func: (key: K, value: V, index: number) => T): T[]; + /** + * Using a mapping function that returns a promise, transform a map + * to another map with different keys and values. All calls to the mapping function + * execute asynchronously + */ + mapAsync(func: (key: K, value: V, index: number) => Promise): Promise[]>; + flatMap(func: (key: K, value: V, index: number) => U[]): U[]; +} +/** + * Convenience class for maps that store an array of values + */ +export declare class ArrayMap extends Dict { + add(key: K, item: V): void; +} +export declare function filterImportDeclarations({ body }: es.Program): [ + ArrayMap, + Exclude[] +]; diff --git a/dist/cse-machine/environment.d.ts b/dist/cse-machine/environment.d.ts new file mode 100644 index 0000000..4740c13 --- /dev/null +++ b/dist/cse-machine/environment.d.ts @@ -0,0 +1,28 @@ +import { Value } from './stash'; +import * as es from 'estree'; +import { Heap } from './heap'; +import { Context } from './context'; +import { Closure } from './closure'; +import { Node } from './types'; +export interface Frame { + [name: string]: any; +} +export interface Environment { + readonly id: string; + name: string; + tail: Environment | null; + callExpression?: es.CallExpression; + head: Frame; + heap: Heap; + thisContext?: Value; +} +export declare const uniqueId: (context: Context) => string; +export declare const createEnvironment: (context: Context, closure: Closure, args: Value[], callExpression: es.CallExpression) => Environment; +export declare const createSimpleEnvironment: (context: Context, name: string, tail?: Environment | null) => Environment; +export declare const createProgramEnvironment: (context: Context, isPrelude: boolean) => Environment; +export declare const createBlockEnvironment: (context: Context, name?: string) => Environment; +export declare const isRestElement: (node: Node) => node is es.RestElement; +export declare const handleArrayCreation: (context: Context, array: any[], envOverride?: Environment) => void; +export declare const currentEnvironment: (context: Context) => Environment; +export declare const popEnvironment: (context: Context) => Environment | undefined; +export declare const pushEnvironment: (context: Context, environment: Environment) => void; diff --git a/dist/cse-machine/error.d.ts b/dist/cse-machine/error.d.ts new file mode 100644 index 0000000..29ff7f3 --- /dev/null +++ b/dist/cse-machine/error.d.ts @@ -0,0 +1,4 @@ +export declare class CseError { + message: string; + constructor(message: string); +} diff --git a/dist/cse-machine/heap.d.ts b/dist/cse-machine/heap.d.ts new file mode 100644 index 0000000..441147c --- /dev/null +++ b/dist/cse-machine/heap.d.ts @@ -0,0 +1,27 @@ +import { Environment } from './environment'; +import { Closure } from './closure'; +export type EnvArray = any[] & { + readonly id: string; + environment: Environment; +}; +export type HeapObject = EnvArray | Closure; +/** + * The heap stores all objects in each environment. + */ +export declare class Heap { + private storage; + constructor(); + add(...items: HeapObject[]): void; + /** Checks the existence of `item` in the heap. */ + contains(item: any): boolean; + /** Gets the number of items in the heap. */ + size(): number; + /** + * Removes `item` from current heap and adds it to `otherHeap`. + * If the current heap does not contain `item`, nothing happens. + * @returns whether the item transfer is successful + */ + move(item: HeapObject, otherHeap: Heap): boolean; + /** Returns a copy of the heap's contents. */ + getHeap(): Set; +} diff --git a/dist/cse-machine/instrCreator.d.ts b/dist/cse-machine/instrCreator.d.ts new file mode 100644 index 0000000..7c6ff2b --- /dev/null +++ b/dist/cse-machine/instrCreator.d.ts @@ -0,0 +1,13 @@ +import { Environment } from "./environment"; +import { AppInstr, AssmtInstr, BinOpInstr, BranchInstr, EnvInstr, Instr, Node, UnOpInstr } from "./types"; +import type * as es from 'estree'; +export declare const popInstr: (srcNode: Node) => Instr; +export declare const assmtInstr: (symbol: string, constant: boolean, declaration: boolean, srcNode: Node) => AssmtInstr; +export declare const appInstr: (numOfArgs: number, srcNode: es.CallExpression) => AppInstr; +export declare const envInstr: (env: Environment, srcNode: Node) => EnvInstr; +export declare const markerInstr: (srcNode: Node) => Instr; +export declare const binOpInstr: (symbol: any, srcNode: Node) => BinOpInstr; +export declare const resetInstr: (srcNode: Node) => Instr; +export declare const branchInstr: (consequent: es.Expression | es.Statement, alternate: es.Expression | es.Statement | null | undefined, srcNode: Node) => BranchInstr; +export declare const conditionalExpression: (test: es.Expression, consequent: es.Expression, alternate: es.Expression, loc?: es.SourceLocation | null) => es.ConditionalExpression; +export declare const unOpInstr: (symbol: es.UnaryOperator, srcNode: Node) => UnOpInstr; diff --git a/dist/cse-machine/interpreter.d.ts b/dist/cse-machine/interpreter.d.ts new file mode 100644 index 0000000..a91c76a --- /dev/null +++ b/dist/cse-machine/interpreter.d.ts @@ -0,0 +1,46 @@ +/** + * This interpreter implements an explicit-control evaluator. + * + * Heavily adapted from https://github.com/source-academy/JSpike/ + */ +import * as es from 'estree'; +import { Control } from './control'; +import { Stash, Value } from './stash'; +import { Context } from './context'; +import { RecursivePartial, Result } from '../types'; +import { IOptions } from '..'; +export declare function addPrint(str: string): void; +/** + * Function that returns the appropriate Promise given the output of CSE machine evaluating, depending + * on whether the program is finished evaluating, ran into a breakpoint or ran into an error. + * @param context The context of the program. + * @param value The value of CSE machine evaluating the program. + * @returns The corresponding promise. + */ +export declare function CSEResultPromise(context: Context, value: Value): Promise; +/** + * Function to be called when a program is to be interpreted using + * the explicit control evaluator. + * + * @param program The program to evaluate. + * @param context The context to evaluate the program in. + * @param options Evaluation options. + * @returns The result of running the CSE machine. + */ +export declare function evaluate(program: es.Program, context: Context, options?: RecursivePartial): Value; +/** + * Generator function that yields the state of the CSE Machine at each step. + * + * @param context The context of the program. + * @param control The control stack. + * @param stash The stash storage. + * @param envSteps Number of environment steps to run. + * @param stepLimit Maximum number of steps to execute. + * @param isPrelude Whether the program is the prelude. + * @yields The current state of the stash, control stack, and step count. + */ +export declare function generateCSEMachineStateStream(context: Context, control: Control, stash: Stash, envSteps: number, stepLimit: number, isPrelude?: boolean): Generator<{ + stash: Stash; + control: Control; + steps: number; +}, void, unknown>; diff --git a/dist/cse-machine/operators.d.ts b/dist/cse-machine/operators.d.ts new file mode 100644 index 0000000..31bf1bd --- /dev/null +++ b/dist/cse-machine/operators.d.ts @@ -0,0 +1,8 @@ +import * as es from "estree"; +import { Context } from "./context"; +export type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof"; +export declare function evaluateUnaryExpression(operator: es.UnaryOperator, value: any): any; +export declare function evaluateBinaryExpression(context: Context, identifier: any, left: any, right: any): { + type: any; + value: any; +}; diff --git a/dist/cse-machine/stack.d.ts b/dist/cse-machine/stack.d.ts new file mode 100644 index 0000000..d6c1bcd --- /dev/null +++ b/dist/cse-machine/stack.d.ts @@ -0,0 +1,24 @@ +/** + * Stack is implemented for control and stash registers. + */ +interface IStack { + push(...items: T[]): void; + pop(): T | undefined; + peek(): T | undefined; + size(): number; + isEmpty(): boolean; + getStack(): T[]; +} +export declare class Stack implements IStack { + storage: T[]; + constructor(); + push(...items: T[]): void; + pop(): T | undefined; + peek(): T | undefined; + size(): number; + isEmpty(): boolean; + getStack(): T[]; + some(predicate: (value: T) => boolean): boolean; + setTo(otherStack: Stack): void; +} +export {}; diff --git a/dist/cse-machine/stash.d.ts b/dist/cse-machine/stash.d.ts new file mode 100644 index 0000000..95741dc --- /dev/null +++ b/dist/cse-machine/stash.d.ts @@ -0,0 +1,59 @@ +import { ExprNS, StmtNS } from '../ast-types'; +import { Closure } from './closure'; +import { Environment } from './environment'; +import { Stack } from './stack'; +/** + * Value represents various runtime values in Python. + */ +export type Value = any; +export interface pyClosureValue { + type: "closure"; + closure: Closure; +} +export interface BigIntValue { + type: 'bigint'; + value: bigint; +} +export interface NumberValue { + type: 'number'; + value: number; +} +export interface BoolValue { + type: 'bool'; + value: boolean; +} +export interface StringValue { + type: 'string'; + value: string; +} +export interface FunctionValue { + type: 'function'; + name: string; + params: string[]; + body: StmtNS.Stmt[]; + env: Environment; +} +export interface LambdaValue { + type: 'lambda'; + parameters: string[]; + body: ExprNS.Expr; + env: Environment; +} +export interface MultiLambdaValue { + type: 'multi_lambda'; + parameters: string[]; + body: StmtNS.Stmt[]; + varDecls: string[]; + env: Environment; +} +export interface ErrorValue { + type: 'error'; + message: string; +} +export interface UndefinedValue { + type: 'undefined'; +} +export declare class Stash extends Stack { + constructor(); + copy(): Stash; +} diff --git a/dist/cse-machine/types.d.ts b/dist/cse-machine/types.d.ts new file mode 100644 index 0000000..0cb4fd3 --- /dev/null +++ b/dist/cse-machine/types.d.ts @@ -0,0 +1,91 @@ +import type * as es from 'estree'; +import { Environment } from './environment'; +export type Node = { + isEnvDependent?: boolean; +} & (es.Node | StatementSequence); +export interface StatementSequence extends es.BaseStatement { + type: 'StatementSequence'; + body: es.Statement[]; + innerComments?: es.Comment[] | undefined; +} +export declare enum InstrType { + RESET = "Reset", + WHILE = "While", + FOR = "For", + ASSIGNMENT = "Assignment", + ANN_ASSIGNMENT = "AnnAssignment", + APPLICATION = "Application", + UNARY_OP = "UnaryOperation", + BINARY_OP = "BinaryOperation", + BOOL_OP = "BoolOperation", + COMPARE = "Compare", + CALL = "Call", + RETURN = "Return", + BREAK = "Break", + CONTINUE = "Continue", + IF = "If", + FUNCTION_DEF = "FunctionDef", + LAMBDA = "Lambda", + MULTI_LAMBDA = "MultiLambda", + GROUPING = "Grouping", + LITERAL = "Literal", + VARIABLE = "Variable", + TERNARY = "Ternary", + PASS = "Pass", + ASSERT = "Assert", + IMPORT = "Import", + GLOBAL = "Global", + NONLOCAL = "NonLocal", + Program = "Program", + BRANCH = "Branch", + POP = "Pop", + ENVIRONMENT = "environment", + MARKER = "marker" +} +interface BaseInstr { + instrType: InstrType; + srcNode: Node; + isEnvDependent?: boolean; +} +export interface WhileInstr extends BaseInstr { + test: es.Expression; + body: es.Statement; +} +export interface ForInstr extends BaseInstr { + init: es.VariableDeclaration | es.Expression; + test: es.Expression; + update: es.Expression; + body: es.Statement; +} +export interface AssmtInstr extends BaseInstr { + symbol: string; + constant: boolean; + declaration: boolean; +} +export interface UnOpInstr extends BaseInstr { + symbol: es.UnaryOperator; +} +export interface BinOpInstr extends BaseInstr { + symbol: es.Identifier; +} +export interface AppInstr extends BaseInstr { + numOfArgs: number; + srcNode: es.CallExpression; +} +export interface BranchInstr extends BaseInstr { + consequent: es.Expression | es.Statement; + alternate: es.Expression | es.Statement | null | undefined; +} +export interface EnvInstr extends BaseInstr { + env: Environment; +} +export interface ArrLitInstr extends BaseInstr { + arity: number; +} +export interface AssmtInstr extends BaseInstr { + symbol: string; + constant: boolean; + declaration: boolean; +} +export type Instr = BaseInstr | WhileInstr | AssmtInstr | AppInstr | BranchInstr | EnvInstr | ArrLitInstr; +export {}; diff --git a/dist/cse-machine/utils.d.ts b/dist/cse-machine/utils.d.ts new file mode 100644 index 0000000..4e54faa --- /dev/null +++ b/dist/cse-machine/utils.d.ts @@ -0,0 +1,45 @@ +import type * as es from 'estree'; +import { Environment } from './environment'; +import { Control, ControlItem } from './control'; +import { Instr, Node } from './types'; +import { Context } from './context'; +import { Value } from './stash'; +import { Closure } from './closure'; +import { RuntimeSourceError } from '../errors/runtimeSourceError'; +export declare const isIdentifier: (node: Node) => node is es.Identifier; +type PropertySetter = Map; +type Transformer = (item: ControlItem) => ControlItem; +declare const propertySetter: PropertySetter; +export { propertySetter }; +/** + * Checks whether the evaluation of the given control item depends on the current environment. + * The item is also considered environment dependent if its evaluation introduces + * environment dependent items + * @param item The control item to be checked + * @return `true` if the item is environment depedent, else `false`. + */ +export declare function isEnvDependent(item: ControlItem | null | undefined): boolean; +export declare const envChanging: (command: ControlItem) => boolean; +export declare function declareFunctionsAndVariables(context: Context, node: es.BlockStatement, environment: Environment): void; +export declare function declareIdentifier(context: Context, name: string, node: Node, environment: Environment, constant?: boolean): Environment; +export declare const handleSequence: (seq: es.Statement[]) => ControlItem[]; +export declare const valueProducing: (command: Node) => boolean; +export declare function defineVariable(context: Context, name: string, value: Value, constant: boolean | undefined, node: es.VariableDeclaration | es.ImportDeclaration): Environment; +export declare const getVariable: (context: Context, name: string, node: es.Identifier) => any; +export declare const checkStackOverFlow: (context: Context, control: Control) => void; +export declare const checkNumberOfArguments: (command: ControlItem, context: Context, callee: Closure | Value, args: Value[], exp: es.CallExpression) => undefined; +export declare const isInstr: (command: ControlItem) => command is Instr; +export declare const isSimpleFunction: (node: any) => boolean; +export declare const reduceConditional: (node: es.IfStatement | es.ConditionalExpression) => ControlItem[]; +export declare const handleRuntimeError: (context: Context, error: RuntimeSourceError) => never; +export declare function pythonMod(a: any, b: any): any; +export declare function hasImportDeclarations(node: es.BlockStatement): boolean; +export declare const isImportDeclaration: (node: es.Program["body"][number]) => node is es.ImportDeclaration; +export declare function getModuleDeclarationSource(node: Exclude): string; +export declare class AssertionError extends RuntimeSourceError { + readonly message: string; + constructor(message: string); + explain(): string; + elaborate(): string; +} +export default function assert(condition: boolean, message: string): asserts condition; diff --git a/dist/errors.d.ts b/dist/errors.d.ts new file mode 100644 index 0000000..68f5f23 --- /dev/null +++ b/dist/errors.d.ts @@ -0,0 +1,76 @@ +import { Token } from "./tokenizer"; +import { Position } from "estree"; +export declare namespace TokenizerErrors { + class BaseTokenizerError extends SyntaxError { + line: number; + col: number; + loc: Position; + constructor(message: string, line: number, col: number); + } + class UnknownTokenError extends BaseTokenizerError { + constructor(token: string, line: number, col: number, source: string, current: number); + } + class UnterminatedStringError extends BaseTokenizerError { + constructor(line: number, col: number, source: string, start: number, current: number); + } + class NonFourIndentError extends BaseTokenizerError { + constructor(line: number, col: number, source: string, start: number); + } + class InvalidNumberError extends BaseTokenizerError { + constructor(line: number, col: number, source: string, start: number, current: number); + } + class InconsistentIndentError extends BaseTokenizerError { + constructor(line: number, col: number, source: string, start: number); + } + class ForbiddenIdentifierError extends BaseTokenizerError { + constructor(line: number, col: number, source: string, start: number); + } + class ForbiddenOperatorError extends BaseTokenizerError { + constructor(line: number, col: number, source: string, start: number, current: number); + } + class NonMatchingParenthesesError extends BaseTokenizerError { + constructor(line: number, col: number, source: string, current: number); + } +} +export declare namespace ParserErrors { + class BaseParserError extends SyntaxError { + line: number; + col: number; + loc: Position; + constructor(message: string, line: number, col: number); + } + class ExpectedTokenError extends BaseParserError { + constructor(source: string, current: Token, expected: string); + } + class NoElseBlockError extends BaseParserError { + constructor(source: string, current: Token); + } + class GenericUnexpectedSyntaxError extends BaseParserError { + constructor(line: number, col: number, source: string, start: number, current: number); + } +} +export declare namespace ResolverErrors { + class BaseResolverError extends SyntaxError { + line: number; + col: number; + loc: Position; + constructor(message: string, line: number, col: number); + } + class NameNotFoundError extends BaseResolverError { + constructor(line: number, col: number, source: string, start: number, current: number, suggestion: string | null); + } + class NameReassignmentError extends BaseResolverError { + constructor(line: number, col: number, source: string, start: number, current: number, oldName: Token); + } +} +export declare namespace TranslatorErrors { + class BaseTranslatorError extends SyntaxError { + line: number; + col: number; + loc: Position; + constructor(message: string, line: number, col: number); + } + class UnsupportedOperator extends BaseTranslatorError { + constructor(line: number, col: number, source: string, start: number); + } +} diff --git a/dist/errors/errors.d.ts b/dist/errors/errors.d.ts new file mode 100644 index 0000000..2ede71c --- /dev/null +++ b/dist/errors/errors.d.ts @@ -0,0 +1,24 @@ +import * as es from 'estree'; +import { RuntimeSourceError } from './runtimeSourceError'; +export declare class TypeConcatenateError extends RuntimeSourceError { + constructor(node: es.Node); + explain(): string; + elaborate(): string; +} +export declare class MissingRequiredPositionalError extends RuntimeSourceError { + private functionName; + private missingParamCnt; + private missingParamName; + constructor(node: es.Node, functionName: string, params: es.Pattern[], args: any); + explain(): string; + elaborate(): string; + private joinWithCommasAndAnd; +} +export declare class TooManyPositionalArgumentsError extends RuntimeSourceError { + private functionName; + private expectedCount; + private givenCount; + constructor(node: es.Node, functionName: string, params: es.Pattern[], args: any); + explain(): string; + elaborate(): string; +} diff --git a/dist/errors/runtimeSourceError.d.ts b/dist/errors/runtimeSourceError.d.ts new file mode 100644 index 0000000..216c78c --- /dev/null +++ b/dist/errors/runtimeSourceError.d.ts @@ -0,0 +1,12 @@ +import { ErrorSeverity, ErrorType, SourceError } from '../types'; +import * as es from 'estree'; +export declare const UNKNOWN_LOCATION: es.SourceLocation; +export declare class RuntimeSourceError implements SourceError { + type: ErrorType; + severity: ErrorSeverity; + location: es.SourceLocation; + message: string; + constructor(node?: es.Node); + explain(): string; + elaborate(): string; +} diff --git a/dist/generate-ast.d.ts b/dist/generate-ast.d.ts new file mode 100644 index 0000000..fe76f7b --- /dev/null +++ b/dist/generate-ast.d.ts @@ -0,0 +1,17 @@ +import fs from "fs"; +export declare class AstWriter { + indentationLevel: number; + fp?: fs.WriteStream; + constructor(); + main(): void; + private setup; + private tearDown; + private convertToReadableForm; + private defineAst; + private classDef; + private defineVisitorInterface; + private indent; + private dedent; + private writeSingleLine; + writeRaw(chunk: string): void; +} diff --git a/dist/generate.d.ts b/dist/generate.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/dist/generate.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..8a15ccb --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,11 @@ +import { Program } from "estree"; +import { Context } from './cse-machine/context'; +export * from './errors'; +import { RecursivePartial, Result } from "./types"; +export declare function parsePythonToEstreeAst(code: string, variant?: number, doValidate?: boolean): Program; +export interface IOptions { + isPrelude: boolean; + envSteps: number; + stepLimit: number; +} +export declare function runInContext(code: string, context: Context, options?: RecursivePartial): Promise; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..1db0b96 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,26905 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PySlangRunner = {})); +})(this, (function (exports) { 'use strict'; + + /****************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ + + + function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + } + function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + } + function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + } + function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + } + + typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; + + // Token names mostly identical to CPython https://github.com/python/cpython/blob/main/Lib/token.py. + // Main difference is that keywords are also a token type while in CPython they are generic name. + // We could also resolve special names at AST parse time. + // Also renamed some token names to make more sense. + var TokenType; + (function (TokenType) { + //// Source S1 + TokenType[TokenType["ENDMARKER"] = 0] = "ENDMARKER"; + TokenType[TokenType["NAME"] = 1] = "NAME"; + TokenType[TokenType["NUMBER"] = 2] = "NUMBER"; + TokenType[TokenType["BIGINT"] = 3] = "BIGINT"; + TokenType[TokenType["STRING"] = 4] = "STRING"; + TokenType[TokenType["NEWLINE"] = 5] = "NEWLINE"; + TokenType[TokenType["INDENT"] = 6] = "INDENT"; + TokenType[TokenType["DEDENT"] = 7] = "DEDENT"; + TokenType[TokenType["LPAR"] = 8] = "LPAR"; + TokenType[TokenType["RPAR"] = 9] = "RPAR"; + TokenType[TokenType["COLON"] = 10] = "COLON"; + TokenType[TokenType["DOUBLECOLON"] = 11] = "DOUBLECOLON"; + TokenType[TokenType["COMMA"] = 12] = "COMMA"; + TokenType[TokenType["PLUS"] = 13] = "PLUS"; + TokenType[TokenType["MINUS"] = 14] = "MINUS"; + TokenType[TokenType["BANG"] = 15] = "BANG"; + TokenType[TokenType["STAR"] = 16] = "STAR"; + TokenType[TokenType["SLASH"] = 17] = "SLASH"; + TokenType[TokenType["VBAR"] = 18] = "VBAR"; + TokenType[TokenType["AMPER"] = 19] = "AMPER"; + TokenType[TokenType["LESS"] = 20] = "LESS"; + TokenType[TokenType["GREATER"] = 21] = "GREATER"; + TokenType[TokenType["EQUAL"] = 22] = "EQUAL"; + TokenType[TokenType["PERCENT"] = 23] = "PERCENT"; + TokenType[TokenType["DOUBLEEQUAL"] = 24] = "DOUBLEEQUAL"; + TokenType[TokenType["NOTEQUAL"] = 25] = "NOTEQUAL"; + TokenType[TokenType["LESSEQUAL"] = 26] = "LESSEQUAL"; + TokenType[TokenType["GREATEREQUAL"] = 27] = "GREATEREQUAL"; + TokenType[TokenType["DOUBLESTAR"] = 28] = "DOUBLESTAR"; + TokenType[TokenType["COMPLEX"] = 29] = "COMPLEX"; + // Special identifiers + TokenType[TokenType["AND"] = 30] = "AND"; + TokenType[TokenType["OR"] = 31] = "OR"; + TokenType[TokenType["FOR"] = 32] = "FOR"; + TokenType[TokenType["WHILE"] = 33] = "WHILE"; + TokenType[TokenType["NONE"] = 34] = "NONE"; + TokenType[TokenType["TRUE"] = 35] = "TRUE"; + TokenType[TokenType["FALSE"] = 36] = "FALSE"; + TokenType[TokenType["IS"] = 37] = "IS"; + TokenType[TokenType["NOT"] = 38] = "NOT"; + TokenType[TokenType["ISNOT"] = 39] = "ISNOT"; + TokenType[TokenType["PASS"] = 40] = "PASS"; + TokenType[TokenType["DEF"] = 41] = "DEF"; + TokenType[TokenType["LAMBDA"] = 42] = "LAMBDA"; + TokenType[TokenType["FROM"] = 43] = "FROM"; + TokenType[TokenType["DOUBLESLASH"] = 44] = "DOUBLESLASH"; + TokenType[TokenType["BREAK"] = 45] = "BREAK"; + TokenType[TokenType["CONTINUE"] = 46] = "CONTINUE"; + TokenType[TokenType["RETURN"] = 47] = "RETURN"; + TokenType[TokenType["ASSERT"] = 48] = "ASSERT"; + TokenType[TokenType["IMPORT"] = 49] = "IMPORT"; + TokenType[TokenType["GLOBAL"] = 50] = "GLOBAL"; + TokenType[TokenType["NONLOCAL"] = 51] = "NONLOCAL"; + TokenType[TokenType["IF"] = 52] = "IF"; + TokenType[TokenType["ELSE"] = 53] = "ELSE"; + TokenType[TokenType["ELIF"] = 54] = "ELIF"; + TokenType[TokenType["IN"] = 55] = "IN"; + TokenType[TokenType["NOTIN"] = 56] = "NOTIN"; + //// Source s3 + TokenType[TokenType["RSQB"] = 57] = "RSQB"; + TokenType[TokenType["LSQB"] = 58] = "LSQB"; + TokenType[TokenType["ELLIPSIS"] = 59] = "ELLIPSIS"; + //// Unusued - Found in normal Python + TokenType[TokenType["SEMI"] = 60] = "SEMI"; + TokenType[TokenType["DOT"] = 61] = "DOT"; + TokenType[TokenType["LBRACE"] = 62] = "LBRACE"; + TokenType[TokenType["RBRACE"] = 63] = "RBRACE"; + TokenType[TokenType["TILDE"] = 64] = "TILDE"; + TokenType[TokenType["CIRCUMFLEX"] = 65] = "CIRCUMFLEX"; + TokenType[TokenType["LEFTSHIFT"] = 66] = "LEFTSHIFT"; + TokenType[TokenType["RIGHTSHIFT"] = 67] = "RIGHTSHIFT"; + TokenType[TokenType["PLUSEQUAL"] = 68] = "PLUSEQUAL"; + TokenType[TokenType["MINEQUAL"] = 69] = "MINEQUAL"; + TokenType[TokenType["STAREQUAL"] = 70] = "STAREQUAL"; + TokenType[TokenType["SLASHEQUAL"] = 71] = "SLASHEQUAL"; + TokenType[TokenType["PERCENTEQUAL"] = 72] = "PERCENTEQUAL"; + TokenType[TokenType["AMPEREQUAL"] = 73] = "AMPEREQUAL"; + TokenType[TokenType["VBAREQUAL"] = 74] = "VBAREQUAL"; + TokenType[TokenType["CIRCUMFLEXEQUAL"] = 75] = "CIRCUMFLEXEQUAL"; + TokenType[TokenType["LEFTSHIFTEQUAL"] = 76] = "LEFTSHIFTEQUAL"; + TokenType[TokenType["RIGHTSHIFTEQUAL"] = 77] = "RIGHTSHIFTEQUAL"; + TokenType[TokenType["DOUBLESTAREQUAL"] = 78] = "DOUBLESTAREQUAL"; + TokenType[TokenType["DOUBLESLASHEQUAL"] = 79] = "DOUBLESLASHEQUAL"; + TokenType[TokenType["AT"] = 80] = "AT"; + TokenType[TokenType["ATEQUAL"] = 81] = "ATEQUAL"; + TokenType[TokenType["RARROW"] = 82] = "RARROW"; + TokenType[TokenType["COLONEQUAL"] = 83] = "COLONEQUAL"; + TokenType[TokenType["OP"] = 84] = "OP"; + TokenType[TokenType["AWAIT"] = 85] = "AWAIT"; + TokenType[TokenType["ASYNC"] = 86] = "ASYNC"; + TokenType[TokenType["TYPE_IGNORE"] = 87] = "TYPE_IGNORE"; + TokenType[TokenType["TYPE_COMMENT"] = 88] = "TYPE_COMMENT"; + TokenType[TokenType["YIELD"] = 89] = "YIELD"; + TokenType[TokenType["WITH"] = 90] = "WITH"; + TokenType[TokenType["DEL"] = 91] = "DEL"; + TokenType[TokenType["TRY"] = 92] = "TRY"; + TokenType[TokenType["EXCEPT"] = 93] = "EXCEPT"; + TokenType[TokenType["FINALLY"] = 94] = "FINALLY"; + TokenType[TokenType["RAISE"] = 95] = "RAISE"; + })(TokenType || (TokenType = {})); + + /* + The offset is calculated as follows: + Current position is one after real position of end of token: 1 + */ + const MAGIC_OFFSET = 1; + const SPECIAL_CHARS = new RegExp("[\\\\$'\"]", "g"); + function escape(unsafe) { + // @TODO escape newlines + return unsafe.replace(SPECIAL_CHARS, "\\$&"); + } + /* Searches backwards and forwards till it hits a newline */ + function getFullLine(source, current) { + let back = current; + let forward = current; + while (back > 0 && source[back] != '\n') { + back--; + } + if (source[back] === '\n') { + back++; + } + while (forward < source.length && source[forward] != '\n') { + forward++; + } + return '\n' + source.slice(back, forward); + } + function toEstreeLocation(line, column, offset) { + return { line, column, offset }; + } + exports.TokenizerErrors = void 0; + (function (TokenizerErrors) { + class BaseTokenizerError extends SyntaxError { + constructor(message, line, col) { + super(`SyntaxError at line ${line} column ${col - 1} + ${message}`); + this.line = line; + this.col = col; + this.name = "BaseTokenizerError"; + this.loc = toEstreeLocation(line, col, 0); + } + } + TokenizerErrors.BaseTokenizerError = BaseTokenizerError; + class UnknownTokenError extends BaseTokenizerError { + constructor(token, line, col, source, current) { + let msg = getFullLine(source, current - 1) + "\n"; + let hint = `${col > 1 ? '~' : ''}^~ Unknown token '${escape(token)}'`; + // The extra `~` character takes up some space. + hint = hint.padStart(hint.length + col - MAGIC_OFFSET - (col > 1 ? 1 : 0), " "); + super(msg + hint, line, col); + this.name = "UnknownTokenError"; + } + } + TokenizerErrors.UnknownTokenError = UnknownTokenError; + class UnterminatedStringError extends BaseTokenizerError { + constructor(line, col, source, start, current) { + let msg = getFullLine(source, start) + "\n"; + let hint = `^ Unterminated string`; + const diff = (current - start); + // +1 because we want the arrow to point after the string (where we expect the closing ") + hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, "~"); + hint = hint.padStart(hint.length + col - diff, " "); + super(msg + hint, line, col); + this.name = "UnterminatedStringError"; + } + } + TokenizerErrors.UnterminatedStringError = UnterminatedStringError; + class NonFourIndentError extends BaseTokenizerError { + constructor(line, col, source, start) { + let msg = getFullLine(source, start) + "\n"; + let hint = `^ This indent should be a multiple of 4 spaces. It's currently ${col} spaces.`; + hint = hint.padStart(hint.length + col - MAGIC_OFFSET, "-"); + super(msg + hint, line, col); + this.name = "NonFourIndentError"; + } + } + TokenizerErrors.NonFourIndentError = NonFourIndentError; + class InvalidNumberError extends BaseTokenizerError { + constructor(line, col, source, start, current) { + let msg = getFullLine(source, start) + "\n"; + let hint = `^ Invalid Number input.`; + const diff = (current - start); + // +1 because we want the arrow to point after the string (where we expect the closing ") + hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, "~"); + hint = hint.padStart(hint.length + col - diff, " "); + super(msg + hint, line, col); + this.name = "InvalidNumberError"; + } + } + TokenizerErrors.InvalidNumberError = InvalidNumberError; + class InconsistentIndentError extends BaseTokenizerError { + constructor(line, col, source, start) { + let msg = getFullLine(source, start) + "\n"; + let hint = `^ This indent/dedent is inconsistent with other indents/dedents. It's currently ${col} spaces.`; + hint = hint.padStart(hint.length + col - MAGIC_OFFSET, "-"); + super(msg + hint, line, col); + this.name = "InconsistentIndentError"; + } + } + TokenizerErrors.InconsistentIndentError = InconsistentIndentError; + class ForbiddenIdentifierError extends BaseTokenizerError { + constructor(line, col, source, start) { + let msg = getFullLine(source, start) + "\n"; + let hint = `^ This identifier is reserved for use in Python. Consider using another identifier.`; + hint = hint.padStart(hint.length + col - MAGIC_OFFSET, "^"); + super(msg + hint, line, col); + this.name = "ForbiddenIdentifierError"; + } + } + TokenizerErrors.ForbiddenIdentifierError = ForbiddenIdentifierError; + class ForbiddenOperatorError extends BaseTokenizerError { + constructor(line, col, source, start, current) { + let msg = getFullLine(source, start) + "\n"; + let hint = ` This operator is reserved for use in Python. It's not allowed to be used.`; + const diff = (current - start); + hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, "^"); + hint = hint.padStart(hint.length + col - diff, " "); + super(msg + hint, line, col); + this.name = "ForbiddenOperatorError"; + } + } + TokenizerErrors.ForbiddenOperatorError = ForbiddenOperatorError; + class NonMatchingParenthesesError extends BaseTokenizerError { + constructor(line, col, source, current) { + let msg = getFullLine(source, current - 1) + "\n"; + let hint = `${col > 1 ? '~' : ''}^~ Non-matching closing parentheses.`; + // The extra `~` character takes up some space. + hint = hint.padStart(hint.length + col - MAGIC_OFFSET - (col > 1 ? 1 : 0), " "); + super(msg + hint, line, col); + this.name = "NonMatchingParenthesesError"; + } + } + TokenizerErrors.NonMatchingParenthesesError = NonMatchingParenthesesError; + })(exports.TokenizerErrors || (exports.TokenizerErrors = {})); + exports.ParserErrors = void 0; + (function (ParserErrors) { + class BaseParserError extends SyntaxError { + constructor(message, line, col) { + super(`SyntaxError at line ${line} column ${col - 1} + ${message}`); + this.line = line; + this.col = col; + this.name = "BaseParserError"; + this.loc = toEstreeLocation(line, col, 0); + } + } + ParserErrors.BaseParserError = BaseParserError; + class ExpectedTokenError extends BaseParserError { + constructor(source, current, expected) { + let msg = getFullLine(source, current.indexInSource - current.lexeme.length) + "\n"; + let hint = `^ ${expected}. Found '${escape(current.lexeme)}'.`; + hint = hint.padStart(hint.length + current.col - MAGIC_OFFSET, " "); + super(msg + hint, current.line, current.col); + this.name = "ExpectedTokenError"; + } + } + ParserErrors.ExpectedTokenError = ExpectedTokenError; + class NoElseBlockError extends BaseParserError { + constructor(source, current) { + let msg = getFullLine(source, current.indexInSource) + "\n"; + let hint = `^ Expected else block after this if block.`; + hint = hint.padStart(hint.length + current.col - MAGIC_OFFSET, " "); + super(msg + hint, current.line, current.col); + this.name = "ExpectedTokenError"; + } + } + ParserErrors.NoElseBlockError = NoElseBlockError; + class GenericUnexpectedSyntaxError extends BaseParserError { + constructor(line, col, source, start, current) { + let msg = getFullLine(source, start) + "\n"; + let hint = ` Detected invalid syntax.`; + const diff = (current - start); + hint = hint.padStart(hint.length + diff - MAGIC_OFFSET, "^"); + hint = hint.padStart(hint.length + col - diff, " "); + super(msg + hint, line, col); + this.name = "GenericUnexpectedSyntaxError"; + } + } + ParserErrors.GenericUnexpectedSyntaxError = GenericUnexpectedSyntaxError; + })(exports.ParserErrors || (exports.ParserErrors = {})); + exports.ResolverErrors = void 0; + (function (ResolverErrors) { + class BaseResolverError extends SyntaxError { + constructor(message, line, col) { + super(`ResolverError at line ${line} column ${col - 1} + ${message}`); + this.line = line; + this.col = col; + this.name = "BaseResolverError"; + this.loc = toEstreeLocation(line, col, 0); + } + } + ResolverErrors.BaseResolverError = BaseResolverError; + class NameNotFoundError extends BaseResolverError { + constructor(line, col, source, start, current, suggestion) { + let msg = getFullLine(source, start) + "\n"; + let hint = ` This name is not found in the current or enclosing environment(s).`; + const diff = (current - start); + hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, "^"); + hint = hint.padStart(hint.length + col - diff, " "); + if (suggestion !== null) { + let sugg = ` Perhaps you meant to type '${suggestion}'?`; + sugg = sugg.padStart(sugg.length + col - MAGIC_OFFSET + 1, " "); + sugg = '\n' + sugg; + hint += sugg; + } + super(msg + hint, line, col); + this.name = "NameNotFoundError"; + } + } + ResolverErrors.NameNotFoundError = NameNotFoundError; + class NameReassignmentError extends BaseResolverError { + constructor(line, col, source, start, current, oldName) { + let msg = getFullLine(source, start) + "\n"; + let hint = ` A name has been declared here.`; + const diff = (current - start); + hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, "^"); + hint = hint.padStart(hint.length + col - diff, " "); + let sugg = ` However, it has already been declared in the same environment at line ${oldName.line}, here:`; + sugg = sugg.padStart(sugg.length + col - MAGIC_OFFSET + 1, " "); + sugg = '\n' + sugg; + hint += sugg; + let oldNameLine = getFullLine(source, oldName.indexInSource); + oldNameLine.padStart(oldNameLine.length + col - MAGIC_OFFSET + 1, " "); + hint += oldNameLine; + super(msg + hint, line, col); + this.name = "NameReassignmentError"; + } + } + ResolverErrors.NameReassignmentError = NameReassignmentError; + })(exports.ResolverErrors || (exports.ResolverErrors = {})); + exports.TranslatorErrors = void 0; + (function (TranslatorErrors) { + class BaseTranslatorError extends SyntaxError { + constructor(message, line, col) { + super(`BaseTranslatorError at line ${line} column ${col - 1} + ${message}`); + this.line = line; + this.col = col; + this.name = "BaseTranslatorError"; + this.loc = toEstreeLocation(line, col, 0); + } + } + TranslatorErrors.BaseTranslatorError = BaseTranslatorError; + class UnsupportedOperator extends BaseTranslatorError { + constructor(line, col, source, start) { + let msg = getFullLine(source, start) + "\n"; + let hint = `^ This operator is not yet supported by us.`; + hint = hint.padStart(hint.length + col - MAGIC_OFFSET, " "); + super(msg + hint, line, col); + this.name = "UnsupportedOperator"; + } + } + TranslatorErrors.UnsupportedOperator = UnsupportedOperator; + })(exports.TranslatorErrors || (exports.TranslatorErrors = {})); + + /* + * Full disclosure: The general structure of this file is adapted from my own + * Rust implementation of a scanner + * https://github.com/Fidget-Spinner/crafting_interpreters/blob/main/rust/src/scanner.rs. + * That is in turn is adapted from the Java code written by the excellent book, + * "Crafting Interpreters" https://craftinginterpreters.com/scanning.html. + * Said book's copyright is under Robert Nystrom. + * I've included the MIT license that code snippets from + * the book is licensed under down below. See + * https://github.com/munificent/craftinginterpreters/blob/master/LICENSE + * + * The changes I've made: I have rewritten basically everything from scratch. + * Only the method names and overall method APIs + * are the same. Their internal behaviors are quite different as the scanner + * in the book parses a JS-like language, not Python. + * + * - The book was written in Java. I have written this in TypeScript. + * - The scanner supports a whitespace significant language now. + * - Also added support for column numbers for better error messages in the future. + * - Also added better errors. + * - Also added forbidden identifiers. + * + * + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + * */ + class Token { + constructor(type, lexeme, line, col, indexInSource) { + this.type = type; + this.lexeme = lexeme; + this.line = line; + this.col = col; + this.indexInSource = indexInSource; + } + } + const specialIdentifiers = new Map([ + ["and", TokenType.AND], + ["or", TokenType.OR], + ["while", TokenType.WHILE], + ["for", TokenType.FOR], + ["None", TokenType.NONE], + ["is", TokenType.IS], + ["not", TokenType.NOT], + ["pass", TokenType.PASS], + ["def", TokenType.DEF], + ["lambda", TokenType.LAMBDA], + ["from", TokenType.FROM], + ["True", TokenType.TRUE], + ["False", TokenType.FALSE], + ["break", TokenType.BREAK], + ["continue", TokenType.CONTINUE], + ["return", TokenType.RETURN], + ["assert", TokenType.ASSERT], + ["import", TokenType.IMPORT], + ["global", TokenType.GLOBAL], + ["nonlocal", TokenType.NONLOCAL], + ["if", TokenType.IF], + ["elif", TokenType.ELIF], + ["else", TokenType.ELSE], + ["in", TokenType.IN], + ]); + const SPECIAL_IDENTIFIER_TOKENS = Array.from(specialIdentifiers.values()); + class Tokenizer { + // forbiddenOperators: Set; + constructor(source) { + this.lexemeBuffer = ""; + this.source = source; + this.tokens = []; + this.start = 0; + this.current = 0; + this.line = 0; + this.col = 0; + this.indentStack = [0]; + this.specialIdentifiers = specialIdentifiers; + // Not used by us, but should be kept reserved as per Python spec + this.forbiddenIdentifiers = new Map([ + ["async", TokenType.ASYNC], + ["await", TokenType.AWAIT], + ["yield", TokenType.YIELD], + ["with", TokenType.WITH], + ["del", TokenType.DEL], + ["try", TokenType.TRY], + ["except", TokenType.EXCEPT], + ["finally", TokenType.FINALLY], + ["raise", TokenType.RAISE], + ]); + // Operators that are valid in Python, but invalid for our use case. + // this.forbiddenOperators = new Set([ + // TokenType.AT, + // // Augmented assign e.g. *= + // TokenType.ATEQUAL, + // TokenType.PLUSEQUAL, + // TokenType.MINEQUAL, + // TokenType.STAREQUAL, + // TokenType.SLASHEQUAL, + // TokenType.PERCENTEQUAL, + // TokenType.AMPEREQUAL, + // TokenType.VBAREQUAL, + // TokenType.CIRCUMFLEXEQUAL, + // TokenType.LEFTSHIFTEQUAL, + // TokenType.RIGHTSHIFTEQUAL, + // TokenType.DOUBLESTAREQUAL, + // TokenType.DOUBLESLASHEQUAL, + // ]) + this.parenthesesLevel = 0; + } + isAtEnd() { + return this.current >= this.source.length; + } + advance() { + const res = this.source[this.current]; + if (this.peek() == '\n') { + this.line += 1; + } + this.current += 1; + this.col += 1; + return res; + } + advanceString(record) { + const res = this.source[this.current]; + if (this.peek() == '\n') { + this.line += 1; + } + this.current += 1; + this.col += 1; + if (record) { + this.lexemeBuffer += res; + } + return res; + } + getBuffer() { + console.info(this.lexemeBuffer); + } + addBuffer(c) { + this.lexemeBuffer += c; + } + subtractBufferForThreeQuoteString() { + if (this.lexemeBuffer.length >= 3) { + this.lexemeBuffer = this.lexemeBuffer.slice(0, -3); + return true; + } + else { + return false; + } + } + /* Single character lookahead. */ + peek() { + return this.isAtEnd() ? '\0' : this.source[this.current]; + } + /* Double character lookahead. */ + overwriteToken(type) { + const previousToken = this.tokens[this.tokens.length - 1]; + const lexeme = this.source.slice(previousToken.indexInSource, this.current); + this.tokens[this.tokens.length - 1] = new Token(type, lexeme, previousToken.line, previousToken.col, previousToken.indexInSource); + } + addToken(type) { + const line = this.line; + const col = this.col; + const lexeme = this.source.slice(this.start, this.current); + this.tokens.push(new Token(type, lexeme, line, col, this.current - lexeme.length)); + } + addStringToken(type) { + const line = this.line; + const col = this.col; + // Remove starting and ending quotes when slicing + // Ensures that string is parsed properly + const lexeme = this.source.slice(this.start + 1, this.current - 1); + this.tokens.push(new Token(type, this.lexemeBuffer, line, col, this.current - lexeme.length)); + this.lexemeBuffer = ""; + } + addMultiLineStringToken(type) { + const line = this.line; + const col = this.col; + // Remove three starting and ending quotes when slicing + const lexeme = this.source.slice(this.start + 3, this.current - 3); + this.tokens.push(new Token(type, this.lexemeBuffer, line, col, this.current - lexeme.length)); + this.lexemeBuffer = ""; + } + // Checks that the current character matches a pattern. If so the character is consumed, else nothing is consumed. + matches(pattern) { + if (this.isAtEnd()) { + return false; + } + else { + if (this.source[this.current] === pattern) { + this.col += 1; + this.current += 1; + return true; + } + return false; + } + } + isLegalUnicode(c) { + if (this.isDelimiter(c)) { + return false; + } + return c.length === 1 && !/^\p{Nd}$/u.test(c); + } + isAlpha(c) { + return /^[A-Za-z]$/i.test(c); + } + isDigit(c) { + return /^[0-9]/.test(c); + } + isHexa(c) { + return /^[0-9A-F]$/i.test(c); + } + isOcta(c) { + return /^[0-7]/.test(c); + } + isBinary(c) { + return /^[0-1]/.test(c); + } + // TODO: unicode + isIdentifier(c) { + if (/\s/.test(c)) { + return false; + } + return c === '_' || this.isAlpha(c) || this.isDigit(c) || this.isLegalUnicode(c); + } + isDelimiter(c) { + return /[\p{P}\p{S}]/u.test(c); + } + baseNumber() { + switch (this.peek()) { + case 'x': + this.advance(); + if (!this.isHexa(this.peek())) { + throw new exports.TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current); + } + while (this.isHexa(this.peek())) { + this.advance(); + } + this.addToken(TokenType.BIGINT); + break; + case 'o': + this.advance(); + if (!this.isOcta(this.peek())) { + throw new exports.TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current); + } + while (this.isOcta(this.peek())) { + this.advance(); + } + this.addToken(TokenType.BIGINT); + break; + case 'b': + this.advance(); + if (!this.isBinary(this.peek())) { + throw new exports.TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current); + } + while (this.isBinary(this.peek())) { + this.advance(); + } + this.addToken(TokenType.BIGINT); + break; + default: + while (this.isDigit(this.peek())) { + this.advance(); + } + if (this.peek() !== '.' && this.peek() !== 'e') { + // if ends with j and J then complex number + if (this.peek() === 'j' || this.peek() === 'J') { + this.advance(); + this.addToken(TokenType.COMPLEX); + return; + } + this.addToken(TokenType.BIGINT); + return; + } + if (this.peek() === '.') { + this.advance(); + if (this.peek() === '_') { + // TODO: + // throw new error + throw new Error('_ after .'); + } + while (this.isDigit(this.peek())) { + this.advance(); + } + } + if (this.peek() === '_') { + this.advance(); + } + if (this.peek() === 'e') { + this.advance(); + if (this.peek() === '-') { + this.advance(); + } + if (this.peek() === '+') { + this.advance(); + } + if (!this.isDigit(this.peek())) { + throw new exports.TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current); + } + while (this.isDigit(this.peek())) { + this.advance(); + } + } + // if ends with j and J then complex number + if (this.peek() === 'j' || this.peek() === 'J') { + this.advance(); + this.addToken(TokenType.COMPLEX); + } + else { + this.addToken(TokenType.NUMBER); + } + } + } + number(c) { + while ((this.isDigit(this.peek()) || this.peek() === '_') && c !== '.') { + if (this.peek() === '_') { + this.advance(); + if (!this.isDigit(this.peek())) { + throw new Error("Invalid use of underscore in number"); + } + } + else { + this.advance(); + } + } + if (this.peek() !== '.' && this.peek() !== 'e' && c !== '.') { + // if ends with j and J then complex number + if (this.peek() === 'j' || this.peek() === 'J') { + this.advance(); + this.addToken(TokenType.COMPLEX); + return; + } + this.addToken(TokenType.BIGINT); + return; + } + // Fractional part + if ((this.peek() === '.' && c !== '.') || (this.peek() !== '.' && c === '.')) { + this.advance(); + if (this.peek() === '_') { + // TODO: + // throw new error + throw new Error('_ after .'); + } + while (this.isDigit(this.peek()) || this.peek() === '_') { + if (this.peek() === '_') { + this.advance(); + if (!this.isDigit(this.peek())) { + throw new Error("Invalid use of underscore in number"); + } + } + else { + this.advance(); + } + } + } + // Exponent part + if (this.peek() === 'e') { + this.advance(); + if (this.peek() === '-') { + this.advance(); + } + if (this.peek() === '+') { + this.advance(); + } + if (!this.isDigit(this.peek())) { + throw new exports.TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current); + } + while (this.isDigit(this.peek()) || this.peek() === '_') { + if (this.peek() === '_') { + this.advance(); + if (!this.isDigit(this.peek())) { + throw new Error("Invalid use of underscore in number"); + } + } + else { + this.advance(); + } + } + } + // if ends with j and J then complex number + if (this.peek() === 'j' || this.peek() === 'J') { + this.advance(); + this.addToken(TokenType.COMPLEX); + } + else { + this.addToken(TokenType.NUMBER); + } + //this.addToken(TokenType.NUMBER); + } + name() { + while (this.isIdentifier(this.peek())) { + this.advance(); + } + const identifier = this.source.slice(this.start, this.current); + if (!!this.forbiddenIdentifiers.get(identifier)) { + throw new exports.TokenizerErrors.ForbiddenIdentifierError(this.line, this.col, this.source, this.start); + } + const specialIdent = this.specialIdentifiers.get(identifier); + if (specialIdent !== undefined) { + /* Merge multi-token operators, like 'is not', 'not in' */ + const previousToken = this.tokens[this.tokens.length - 1]; + switch (specialIdent) { + case TokenType.NOT: + if (previousToken.type === TokenType.IS) { + this.overwriteToken(TokenType.ISNOT); + } + else { + this.addToken(specialIdent); + } + return; + case TokenType.IN: + if (previousToken.type === TokenType.NOT) { + this.overwriteToken(TokenType.NOTIN); + } + else { + this.addToken(specialIdent); + } + return; + default: + this.addToken(specialIdent); + } + } + else { + this.addToken(TokenType.NAME); + } + } + scanToken() { + const c = this.advance(); + // KJ: I really hope the JS runtime optimizes this to a jump table... + switch (c) { + //// SPECIAL MARKERS + // Comment -- advance to end of line. + case '#': + while ((this.peek() !== '\n' && this.peek() !== '\r') && !this.isAtEnd()) { + this.advance(); + } + break; + case ':': + this.addToken(this.matches(':') ? TokenType.DOUBLECOLON : TokenType.COLON); + break; + // All non-significant whitespace + case ' ': + break; + // CR LF on Windows + case '\r': + if (this.matches('\n')) ; + else { + break; + } + case '\n': + if (this.parenthesesLevel > 0) { + this.line += 1; + this.col = 0; + break; + } + this.addToken(TokenType.NEWLINE); + this.line += 1; + this.col = 0; + let accLeadingWhiteSpace = 0; + // Detect significant whitespace + while (this.peek() === " " && !this.isAtEnd()) { + accLeadingWhiteSpace += 1; + // Consume the rest of the line's leading whitespace. + this.advance(); + } + // Handles comments + if (this.peek() === "#") { + while ((this.peek() !== '\n' && this.peek() !== '\r') && !this.isAtEnd()) { + this.advance(); + } + } + // The following block handles things like + /* + def foo(): + pass + <---- this newline should be zapped + pass <---- this should be part of the block + */ + while ((this.peek() === "\n" || this.peek() === "\r") && !this.isAtEnd()) { + // Handle \r\n on Windows + if (this.peek() === "\r") { + this.advance(); + if (this.peek() === "\n") { + this.advance(); + } + } + else { + this.advance(); + } + this.line += 1; + this.col = 0; + accLeadingWhiteSpace = 0; + // Detect significant whitespace + while (this.peek() === " " && !this.isAtEnd()) { + accLeadingWhiteSpace += 1; + // Consume the rest of the line's leading whitespace. + this.advance(); + } + } + if (accLeadingWhiteSpace % 4 !== 0) { + throw new exports.TokenizerErrors.NonFourIndentError(this.line, this.col, this.source, this.current); + } + const tos = this.indentStack[this.indentStack.length - 1]; + if (accLeadingWhiteSpace > tos) { + this.indentStack.push(accLeadingWhiteSpace); + const indents = Math.floor((accLeadingWhiteSpace - tos) / 4); + for (let i = 0; i < indents; ++i) { + this.addToken(TokenType.INDENT); + } + } + else if (accLeadingWhiteSpace < tos) { + if (this.indentStack.length == 0) { + throw new exports.TokenizerErrors.InconsistentIndentError(this.line, this.col, this.source, this.current); + } + const prev = this.indentStack[this.indentStack.length - 1]; + if (prev === undefined || prev === null) { + throw new exports.TokenizerErrors.InconsistentIndentError(this.line, this.col, this.source, this.current); + } + const indents = Math.floor((prev - accLeadingWhiteSpace) / 4); + for (let i = 0; i < indents; ++i) { + this.indentStack.pop(); + this.addToken(TokenType.DEDENT); + } + } + break; + // String + case '"': + case "'": + let quote = c; + if (this.peek() == quote) { // handle multi-line string + this.advance(); // second quote found and consumed + if (this.peek() != quote) { // empty string "" + this.addStringToken(TokenType.STRING); + break; + } + this.advance(); // third quote consumed + let quote_sum = 0; + while (true) { + while (this.peek() != quote && !this.isAtEnd()) { + quote_sum = 0; + if (this.peek() === '\\') { + this.advanceString(false); + switch (this.peek()) { + case '\n': + break; + case '\\': + this.addBuffer('\\'); + break; + case '\'': + this.addBuffer('\''); + break; + case '\"': + this.addBuffer('\"'); + break; + case 'a': + this.addBuffer('\a'); + break; + case 'b': + this.addBuffer('\b'); + break; + case 'f': + this.addBuffer('\f'); + break; + case 'n': + this.addBuffer('\n'); + break; + case 'r': + this.addBuffer('\r'); + break; + case 't': + this.addBuffer('\t'); + break; + case 'v': + this.addBuffer('\v'); + break; + default: + throw new Error("SyntaxWarning: invalid escape sequence"); + } + this.advanceString(false); + } + else { + this.advanceString(true); + } + //this.advance(); // advance until ending quote found + } + if (this.isAtEnd()) { + throw new exports.TokenizerErrors.UnterminatedStringError(this.line, this.col, this.source, this.start, this.current); + } + if (this.peek() == quote) { + this.advanceString(true); + quote_sum++; + } + //this.advance(); // consume first ending quote + // if (this.peek() != quote) { + // throw new TokenizerErrors.UnterminatedStringError(this.line, + // this.col, this.source, this.start, this.current); + // } + // this.advance(); + if (quote_sum === 3) { + this.subtractBufferForThreeQuoteString(); + // console.info('endof3quote'); + // this.getBuffer(); + break; + } + } + // // consume second ending quote + // if (this.peek() != quote) { + // throw new TokenizerErrors.UnterminatedStringError(this.line, + // this.col, this.source, this.start, this.current); + // } + // this.advance(); // consume third ending quote + this.addMultiLineStringToken(TokenType.STRING); + } + else { // other case, single-line string + while (this.peek() !== quote && this.peek() !== '\n' && !this.isAtEnd()) { + if (this.peek() === '\\') { + this.advanceString(false); + switch (this.peek()) { + case '\n': + break; + case '\\': + this.addBuffer('\\'); + break; + case '\'': + this.addBuffer('\''); + break; + case '\"': + this.addBuffer('\"'); + break; + case 'a': + this.addBuffer('\a'); + break; + case 'b': + this.addBuffer('\b'); + break; + case 'f': + this.addBuffer('\f'); + break; + case 'n': + this.addBuffer('\n'); + break; + case 'r': + this.addBuffer('\r'); + break; + case 't': + this.addBuffer('\t'); + break; + case 'v': + this.addBuffer('\v'); + break; + default: + throw new Error("SyntaxWarning: invalid escape sequence"); + } + this.advanceString(false); + } + else { + this.advanceString(true); + } + } + // should look for \\ + if (this.peek() === '\n' || this.isAtEnd()) { + throw new exports.TokenizerErrors.UnterminatedStringError(this.line, this.col, this.source, this.start, this.current); + } + // Consume Closing " + this.advance(); + this.addStringToken(TokenType.STRING); + } + break; + // Number... I wish JS had match statements :( + case '0': + this.baseNumber(); + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '.': + this.number(c); + break; + //// Everything else + case '(': + this.addToken(TokenType.LPAR); + this.parenthesesLevel++; + break; + case ')': + this.addToken(TokenType.RPAR); + if (this.parenthesesLevel === 0) { + throw new exports.TokenizerErrors.NonMatchingParenthesesError(this.line, this.col, this.source, this.current); + } + this.parenthesesLevel--; + break; + case ',': + this.addToken(TokenType.COMMA); + break; + //// OPERATORS + case '-': + if (this.matches('=')) { + this.raiseForbiddenOperator(); + } + this.addToken(TokenType.MINUS); + break; + case '+': + if (this.matches('=')) { + this.raiseForbiddenOperator(); + } + this.addToken(TokenType.PLUS); + break; + case '*': + if (this.matches('=')) { + this.raiseForbiddenOperator(); + } + this.addToken(this.matches('*') ? TokenType.DOUBLESTAR : TokenType.STAR); + break; + case '/': + if (this.matches('=')) { + this.raiseForbiddenOperator(); + } + this.addToken(this.matches('/') ? TokenType.DOUBLESLASH : TokenType.SLASH); + break; + case '%': + if (this.matches('=')) { + this.raiseForbiddenOperator(); + } + this.addToken(TokenType.PERCENT); + break; + case '!': + this.addToken(this.matches('=') ? TokenType.NOTEQUAL : TokenType.BANG); + break; + case '=': + this.addToken(this.matches('=') ? TokenType.DOUBLEEQUAL : TokenType.EQUAL); + break; + case '<': + this.addToken(this.matches('=') ? TokenType.LESSEQUAL : TokenType.LESS); + break; + case '>': + this.addToken(this.matches('=') ? TokenType.GREATEREQUAL : TokenType.GREATER); + break; + default: + // Identifier start + // TODO: unicode + if (c === '_' || this.isAlpha(c) || this.isLegalUnicode(c)) { + this.name(); + break; + } + this.matchForbiddenOperator(c); + throw new exports.TokenizerErrors.UnknownTokenError(c, this.line, this.col, this.source, this.current); + } + } + matchForbiddenOperator(ch) { + switch (ch) { + case '@': + case '|': + case '&': + case '~': + case '^': + this.matches('='); + this.raiseForbiddenOperator(); + break; + } + } + scanEverything() { + while (!this.isAtEnd()) { + this.start = this.current; + this.scanToken(); + } + // Unravel the indent stack + while (this.indentStack[this.indentStack.length - 1] !== 0) { + this.indentStack.pop(); + this.addToken(TokenType.DEDENT); + } + this.tokens.push(new Token(TokenType.ENDMARKER, "", this.line, this.col, this.current)); + return this.tokens; + } + printTokens() { + for (const token of this.tokens) { + console.log(`${token.indexInSource}:${token.line}-${token.line},${token.indexInSource + token.lexeme.length}\t\t\t\ + ${TokenType[token.type]}\t\t\t'${token.lexeme}'`); + } + } + raiseForbiddenOperator() { + throw new exports.TokenizerErrors.ForbiddenOperatorError(this.line, this.col, this.source, this.start, this.current); + } + } + + function _extends() { + return _extends = Object.assign ? Object.assign.bind() : function (n) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); + } + return n; + }, _extends.apply(null, arguments); + } + + var DEFAULT_CONFIG = { + // minimum relative difference between two compared values, + // used by all comparison functions + relTol: 1e-12, + // minimum absolute difference between two compared values, + // used by all comparison functions + absTol: 1e-15, + // type of default matrix output. Choose 'matrix' (default) or 'array' + matrix: 'Matrix', + // type of default number output. Choose 'number' (default) 'BigNumber', 'bigint', or 'Fraction' + number: 'number', + // type of fallback used for config { number: 'bigint' } when a value cannot be represented + // in the configured numeric type. Choose 'number' (default) or 'BigNumber'. + numberFallback: 'number', + // number of significant digits in BigNumbers + precision: 64, + // predictable output type of functions. When true, output type depends only + // on the input types. When false (default), output type can vary depending + // on input values. For example `math.sqrt(-4)` returns `complex('2i')` when + // predictable is false, and returns `NaN` when true. + predictable: false, + // random seed for seeded pseudo random number generation + // null = randomly seed + randomSeed: null + }; + + /** + * Get a property of a plain object + * Throws an error in case the object is not a plain object or the + * property is not defined on the object itself + * @param {Object} object + * @param {string} prop + * @return {*} Returns the property value when safe + */ + function getSafeProperty(object, prop) { + // only allow getting safe properties of a plain object + if (isSafeProperty(object, prop)) { + return object[prop]; + } + if (typeof object[prop] === 'function' && isSafeMethod(object, prop)) { + throw new Error('Cannot access method "' + prop + '" as a property'); + } + throw new Error('No access to property "' + prop + '"'); + } + + /** + * Set a property on a plain object. + * Throws an error in case the object is not a plain object or the + * property would override an inherited property like .constructor or .toString + * @param {Object} object + * @param {string} prop + * @param {*} value + * @return {*} Returns the value + */ + // TODO: merge this function into access.js? + function setSafeProperty(object, prop, value) { + // only allow setting safe properties of a plain object + if (isSafeProperty(object, prop)) { + object[prop] = value; + return value; + } + throw new Error('No access to property "' + prop + '"'); + } + + /** + * Test whether a property is safe to use on an object or Array. + * For example .toString and .constructor are not safe + * @param {Object | Array} object + * @param {string} prop + * @return {boolean} Returns true when safe + */ + function isSafeProperty(object, prop) { + if (!isPlainObject(object) && !Array.isArray(object)) { + return false; + } + // SAFE: whitelisted + // e.g length + if (hasOwnProperty(safeNativeProperties, prop)) { + return true; + } + // UNSAFE: inherited from Object prototype + // e.g constructor + if (prop in Object.prototype) { + // 'in' is used instead of hasOwnProperty for nodejs v0.10 + // which is inconsistent on root prototypes. It is safe + // here because Object.prototype is a root object + return false; + } + // UNSAFE: inherited from Function prototype + // e.g call, apply + if (prop in Function.prototype) { + // 'in' is used instead of hasOwnProperty for nodejs v0.10 + // which is inconsistent on root prototypes. It is safe + // here because Function.prototype is a root object + return false; + } + return true; + } + + /** + * Check whether a method is safe. + * Throws an error when that's not the case (for example for `constructor`). + * @param {Object} object + * @param {string} method + * @return {boolean} Returns true when safe, false otherwise + */ + function isSafeMethod(object, method) { + if (object === null || object === undefined || typeof object[method] !== 'function') { + return false; + } + // UNSAFE: ghosted + // e.g overridden toString + // Note that IE10 doesn't support __proto__ and we can't do this check there. + if (hasOwnProperty(object, method) && Object.getPrototypeOf && method in Object.getPrototypeOf(object)) { + return false; + } + // SAFE: whitelisted + // e.g toString + if (hasOwnProperty(safeNativeMethods, method)) { + return true; + } + // UNSAFE: inherited from Object prototype + // e.g constructor + if (method in Object.prototype) { + // 'in' is used instead of hasOwnProperty for nodejs v0.10 + // which is inconsistent on root prototypes. It is safe + // here because Object.prototype is a root object + return false; + } + // UNSAFE: inherited from Function prototype + // e.g call, apply + if (method in Function.prototype) { + // 'in' is used instead of hasOwnProperty for nodejs v0.10 + // which is inconsistent on root prototypes. It is safe + // here because Function.prototype is a root object + return false; + } + return true; + } + function isPlainObject(object) { + return typeof object === 'object' && object && object.constructor === Object; + } + var safeNativeProperties = { + length: true, + name: true + }; + var safeNativeMethods = { + toString: true, + valueOf: true, + toLocaleString: true + }; + + /** + * A map facade on a bare object. + * + * The small number of methods needed to implement a scope, + * forwarding on to the SafeProperty functions. Over time, the codebase + * will stop using this method, as all objects will be Maps, rather than + * more security prone objects. + */ + class ObjectWrappingMap { + constructor(object) { + this.wrappedObject = object; + this[Symbol.iterator] = this.entries; + } + keys() { + return Object.keys(this.wrappedObject).filter(key => this.has(key)).values(); + } + get(key) { + return getSafeProperty(this.wrappedObject, key); + } + set(key, value) { + setSafeProperty(this.wrappedObject, key, value); + return this; + } + has(key) { + return isSafeProperty(this.wrappedObject, key) && key in this.wrappedObject; + } + entries() { + return mapIterator(this.keys(), key => [key, this.get(key)]); + } + forEach(callback) { + for (var key of this.keys()) { + callback(this.get(key), key, this); + } + } + delete(key) { + if (isSafeProperty(this.wrappedObject, key)) { + delete this.wrappedObject[key]; + } + } + clear() { + for (var key of this.keys()) { + this.delete(key); + } + } + get size() { + return Object.keys(this.wrappedObject).length; + } + } + + /** + * Create a new iterator that maps over the provided iterator, applying a mapping function to each item + */ + function mapIterator(it, callback) { + return { + next: () => { + var n = it.next(); + return n.done ? n : { + value: callback(n.value), + done: false + }; + } + }; + } + + // type checks for all known types + // + // note that: + // + // - check by duck-typing on a property like `isUnit`, instead of checking instanceof. + // instanceof cannot be used because that would not allow to pass data from + // one instance of math.js to another since each has it's own instance of Unit. + // - check the `isUnit` property via the constructor, so there will be no + // matches for "fake" instances like plain objects with a property `isUnit`. + // That is important for security reasons. + // - It must not be possible to override the type checks used internally, + // for security reasons, so these functions are not exposed in the expression + // parser. + + function isNumber(x) { + return typeof x === 'number'; + } + function isBigNumber(x) { + if (!x || typeof x !== 'object' || typeof x.constructor !== 'function') { + return false; + } + if (x.isBigNumber === true && typeof x.constructor.prototype === 'object' && x.constructor.prototype.isBigNumber === true) { + return true; + } + if (typeof x.constructor.isDecimal === 'function' && x.constructor.isDecimal(x) === true) { + return true; + } + return false; + } + function isBigInt(x) { + return typeof x === 'bigint'; + } + function isComplex(x) { + return x && typeof x === 'object' && Object.getPrototypeOf(x).isComplex === true || false; + } + function isFraction(x) { + return x && typeof x === 'object' && Object.getPrototypeOf(x).isFraction === true || false; + } + function isUnit(x) { + return x && x.constructor.prototype.isUnit === true || false; + } + function isString(x) { + return typeof x === 'string'; + } + var isArray = Array.isArray; + function isMatrix(x) { + return x && x.constructor.prototype.isMatrix === true || false; + } + + /** + * Test whether a value is a collection: an Array or Matrix + * @param {*} x + * @returns {boolean} isCollection + */ + function isCollection(x) { + return Array.isArray(x) || isMatrix(x); + } + function isDenseMatrix(x) { + return x && x.isDenseMatrix && x.constructor.prototype.isMatrix === true || false; + } + function isSparseMatrix(x) { + return x && x.isSparseMatrix && x.constructor.prototype.isMatrix === true || false; + } + function isRange(x) { + return x && x.constructor.prototype.isRange === true || false; + } + function isIndex(x) { + return x && x.constructor.prototype.isIndex === true || false; + } + function isBoolean(x) { + return typeof x === 'boolean'; + } + function isResultSet(x) { + return x && x.constructor.prototype.isResultSet === true || false; + } + function isHelp(x) { + return x && x.constructor.prototype.isHelp === true || false; + } + function isFunction(x) { + return typeof x === 'function'; + } + function isDate(x) { + return x instanceof Date; + } + function isRegExp(x) { + return x instanceof RegExp; + } + function isObject(x) { + return !!(x && typeof x === 'object' && x.constructor === Object && !isComplex(x) && !isFraction(x)); + } + + /** + * Returns `true` if the passed object appears to be a Map (i.e. duck typing). + * + * Methods looked for are `get`, `set`, `keys` and `has`. + * + * @param {Map | object} object + * @returns + */ + function isMap(object) { + // We can use the fast instanceof, or a slower duck typing check. + // The duck typing method needs to cover enough methods to not be confused with DenseMatrix. + if (!object) { + return false; + } + return object instanceof Map || object instanceof ObjectWrappingMap || typeof object.set === 'function' && typeof object.get === 'function' && typeof object.keys === 'function' && typeof object.has === 'function'; + } + function isNull(x) { + return x === null; + } + function isUndefined(x) { + return x === undefined; + } + function isAccessorNode(x) { + return x && x.isAccessorNode === true && x.constructor.prototype.isNode === true || false; + } + function isArrayNode(x) { + return x && x.isArrayNode === true && x.constructor.prototype.isNode === true || false; + } + function isAssignmentNode(x) { + return x && x.isAssignmentNode === true && x.constructor.prototype.isNode === true || false; + } + function isBlockNode(x) { + return x && x.isBlockNode === true && x.constructor.prototype.isNode === true || false; + } + function isConditionalNode(x) { + return x && x.isConditionalNode === true && x.constructor.prototype.isNode === true || false; + } + function isConstantNode(x) { + return x && x.isConstantNode === true && x.constructor.prototype.isNode === true || false; + } + function isFunctionAssignmentNode(x) { + return x && x.isFunctionAssignmentNode === true && x.constructor.prototype.isNode === true || false; + } + function isFunctionNode(x) { + return x && x.isFunctionNode === true && x.constructor.prototype.isNode === true || false; + } + function isIndexNode(x) { + return x && x.isIndexNode === true && x.constructor.prototype.isNode === true || false; + } + function isNode$1(x) { + return x && x.isNode === true && x.constructor.prototype.isNode === true || false; + } + function isObjectNode(x) { + return x && x.isObjectNode === true && x.constructor.prototype.isNode === true || false; + } + function isOperatorNode(x) { + return x && x.isOperatorNode === true && x.constructor.prototype.isNode === true || false; + } + function isParenthesisNode(x) { + return x && x.isParenthesisNode === true && x.constructor.prototype.isNode === true || false; + } + function isRangeNode(x) { + return x && x.isRangeNode === true && x.constructor.prototype.isNode === true || false; + } + function isRelationalNode(x) { + return x && x.isRelationalNode === true && x.constructor.prototype.isNode === true || false; + } + function isSymbolNode(x) { + return x && x.isSymbolNode === true && x.constructor.prototype.isNode === true || false; + } + function isChain(x) { + return x && x.constructor.prototype.isChain === true || false; + } + function typeOf(x) { + var t = typeof x; + if (t === 'object') { + if (x === null) return 'null'; + if (isBigNumber(x)) return 'BigNumber'; // Special: weird mashup with Decimal + if (x.constructor && x.constructor.name) return x.constructor.name; + return 'Object'; // just in case + } + return t; // can be 'string', 'number', 'boolean', 'function', 'bigint', ... + } + + /** + * Clone an object + * + * clone(x) + * + * Can clone any primitive type, array, and object. + * If x has a function clone, this function will be invoked to clone the object. + * + * @param {*} x + * @return {*} clone + */ + function clone$2(x) { + var type = typeof x; + + // immutable primitive types + if (type === 'number' || type === 'bigint' || type === 'string' || type === 'boolean' || x === null || x === undefined) { + return x; + } + + // use clone function of the object when available + if (typeof x.clone === 'function') { + return x.clone(); + } + + // array + if (Array.isArray(x)) { + return x.map(function (value) { + return clone$2(value); + }); + } + if (x instanceof Date) return new Date(x.valueOf()); + if (isBigNumber(x)) return x; // bignumbers are immutable + + // object + if (isObject(x)) { + return mapObject(x, clone$2); + } + if (type === 'function') { + // we assume that the function is immutable + return x; + } + throw new TypeError("Cannot clone: unknown type of value (value: ".concat(x, ")")); + } + + /** + * Apply map to all properties of an object + * @param {Object} object + * @param {function} callback + * @return {Object} Returns a copy of the object with mapped properties + */ + function mapObject(object, callback) { + var clone = {}; + for (var key in object) { + if (hasOwnProperty(object, key)) { + clone[key] = callback(object[key]); + } + } + return clone; + } + + /** + * Deep test equality of all fields in two pairs of arrays or objects. + * Compares values and functions strictly (ie. 2 is not the same as '2'). + * @param {Array | Object} a + * @param {Array | Object} b + * @returns {boolean} + */ + function deepStrictEqual(a, b) { + var prop, i, len; + if (Array.isArray(a)) { + if (!Array.isArray(b)) { + return false; + } + if (a.length !== b.length) { + return false; + } + for (i = 0, len = a.length; i < len; i++) { + if (!deepStrictEqual(a[i], b[i])) { + return false; + } + } + return true; + } else if (typeof a === 'function') { + return a === b; + } else if (a instanceof Object) { + if (Array.isArray(b) || !(b instanceof Object)) { + return false; + } + for (prop in a) { + // noinspection JSUnfilteredForInLoop + if (!(prop in b) || !deepStrictEqual(a[prop], b[prop])) { + return false; + } + } + for (prop in b) { + // noinspection JSUnfilteredForInLoop + if (!(prop in a)) { + return false; + } + } + return true; + } else { + return a === b; + } + } + + /** + * A safe hasOwnProperty + * @param {Object} object + * @param {string} property + */ + function hasOwnProperty(object, property) { + return object && Object.hasOwnProperty.call(object, property); + } + + /** + * Shallow version of pick, creating an object composed of the picked object properties + * but not for nested properties + * @param {Object} object + * @param {string[]} properties + * @return {Object} + */ + function pickShallow(object, properties) { + var copy = {}; + for (var i = 0; i < properties.length; i++) { + var key = properties[i]; + var value = object[key]; + if (value !== undefined) { + copy[key] = value; + } + } + return copy; + } + + var MATRIX_OPTIONS = ['Matrix', 'Array']; // valid values for option matrix + var NUMBER_OPTIONS = ['number', 'BigNumber', 'Fraction']; // valid values for option number + + // create a read-only version of config + var config$1 = function config(options) { + if (options) { + throw new Error('The global config is readonly. \n' + 'Please create a mathjs instance if you want to change the default configuration. \n' + 'Example:\n' + '\n' + ' import { create, all } from \'mathjs\';\n' + ' const mathjs = create(all);\n' + ' mathjs.config({ number: \'BigNumber\' });\n'); + } + return Object.freeze(DEFAULT_CONFIG); + }; + _extends(config$1, DEFAULT_CONFIG, { + MATRIX_OPTIONS, + NUMBER_OPTIONS + }); + + function ok() { + return true; + } + function notOk() { + return false; + } + function undef() { + return undefined; + } + const NOT_TYPED_FUNCTION = 'Argument is not a typed-function.'; + + /** + * @typedef {{ + * params: Param[], + * fn: function, + * test: function, + * implementation: function + * }} Signature + * + * @typedef {{ + * types: Type[], + * hasAny: boolean, + * hasConversion: boolean, + * restParam: boolean + * }} Param + * + * @typedef {{ + * name: string, + * typeIndex: number, + * test: function, + * isAny: boolean, + * conversion?: ConversionDef, + * conversionIndex: number, + * }} Type + * + * @typedef {{ + * from: string, + * to: string, + * convert: function (*) : * + * }} ConversionDef + * + * @typedef {{ + * name: string, + * test: function(*) : boolean, + * isAny?: boolean + * }} TypeDef + */ + + /** + * @returns {() => function} + */ + function create() { + // data type tests + + /** + * Returns true if the argument is a non-null "plain" object + */ + function isPlainObject(x) { + return typeof x === 'object' && x !== null && x.constructor === Object; + } + const _types = [{ + name: 'number', + test: function (x) { + return typeof x === 'number'; + } + }, { + name: 'string', + test: function (x) { + return typeof x === 'string'; + } + }, { + name: 'boolean', + test: function (x) { + return typeof x === 'boolean'; + } + }, { + name: 'Function', + test: function (x) { + return typeof x === 'function'; + } + }, { + name: 'Array', + test: Array.isArray + }, { + name: 'Date', + test: function (x) { + return x instanceof Date; + } + }, { + name: 'RegExp', + test: function (x) { + return x instanceof RegExp; + } + }, { + name: 'Object', + test: isPlainObject + }, { + name: 'null', + test: function (x) { + return x === null; + } + }, { + name: 'undefined', + test: function (x) { + return x === undefined; + } + }]; + const anyType = { + name: 'any', + test: ok, + isAny: true + }; + + // Data structures to track the types. As these are local variables in + // create(), each typed universe will get its own copy, but the variables + // will only be accessible through the (closures of the) functions supplied + // as properties of the typed object, not directly. + // These will be initialized in clear() below + let typeMap; // primary store of all types + let typeList; // Array of just type names, for the sake of ordering + + // And similar data structures for the type conversions: + let nConversions = 0; + // the actual conversions are stored on a property of the destination types + + // This is a temporary object, will be replaced with a function at the end + let typed = { + createCount: 0 + }; + + /** + * Takes a type name and returns the corresponding official type object + * for that type. + * + * @param {string} typeName + * @returns {TypeDef} type + */ + function findType(typeName) { + const type = typeMap.get(typeName); + if (type) { + return type; + } + // Remainder is error handling + let message = 'Unknown type "' + typeName + '"'; + const name = typeName.toLowerCase(); + let otherName; + for (otherName of typeList) { + if (otherName.toLowerCase() === name) { + message += '. Did you mean "' + otherName + '" ?'; + break; + } + } + throw new TypeError(message); + } + + /** + * Adds an array `types` of type definitions to this typed instance. + * Each type definition should be an object with properties: + * 'name' - a string giving the name of the type; 'test' - function + * returning a boolean that tests membership in the type; and optionally + * 'isAny' - true only for the 'any' type. + * + * The second optional argument, `before`, gives the name of a type that + * these types should be added before. The new types are added in the + * order specified. + * @param {TypeDef[]} types + * @param {string | boolean} [beforeSpec='any'] before + */ + function addTypes(types) { + let beforeSpec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'any'; + const beforeIndex = beforeSpec ? findType(beforeSpec).index : typeList.length; + const newTypes = []; + for (let i = 0; i < types.length; ++i) { + if (!types[i] || typeof types[i].name !== 'string' || typeof types[i].test !== 'function') { + throw new TypeError('Object with properties {name: string, test: function} expected'); + } + const typeName = types[i].name; + if (typeMap.has(typeName)) { + throw new TypeError('Duplicate type name "' + typeName + '"'); + } + newTypes.push(typeName); + typeMap.set(typeName, { + name: typeName, + test: types[i].test, + isAny: types[i].isAny, + index: beforeIndex + i, + conversionsTo: [] // Newly added type can't have any conversions to it + }); + } + // update the typeList + const affectedTypes = typeList.slice(beforeIndex); + typeList = typeList.slice(0, beforeIndex).concat(newTypes).concat(affectedTypes); + // Fix the indices + for (let i = beforeIndex + newTypes.length; i < typeList.length; ++i) { + typeMap.get(typeList[i]).index = i; + } + } + + /** + * Removes all types and conversions from this typed instance. + * May cause previously constructed typed-functions to throw + * strange errors when they are called with types that do not + * match any of their signatures. + */ + function clear() { + typeMap = new Map(); + typeList = []; + nConversions = 0; + addTypes([anyType], false); + } + + // initialize the types to the default list + clear(); + addTypes(_types); + + /** + * Removes all conversions, leaving the types alone. + */ + function clearConversions() { + let typeName; + for (typeName of typeList) { + typeMap.get(typeName).conversionsTo = []; + } + nConversions = 0; + } + + /** + * Find the type names that match a value. + * @param {*} value + * @return {string[]} Array of names of types for which + * the type test matches the value. + */ + function findTypeNames(value) { + const matches = typeList.filter(name => { + const type = typeMap.get(name); + return !type.isAny && type.test(value); + }); + if (matches.length) { + return matches; + } + return ['any']; + } + + /** + * Check if an entity is a typed function created by any instance + * @param {any} entity + * @returns {boolean} + */ + function isTypedFunction(entity) { + return entity && typeof entity === 'function' && '_typedFunctionData' in entity; + } + + /** + * Find a specific signature from a (composed) typed function, for example: + * + * typed.findSignature(fn, ['number', 'string']) + * typed.findSignature(fn, 'number, string') + * typed.findSignature(fn, 'number,string', {exact: true}) + * + * This function findSignature will by default return the best match to + * the given signature, possibly employing type conversions. + * + * The (optional) third argument is a plain object giving options + * controlling the signature search. Currently the only implemented + * option is `exact`: if specified as true (default is false), only + * exact matches will be returned (i.e. signatures for which `fn` was + * directly defined). Note that a (possibly different) type matching + * `any`, or one or more instances of TYPE matching `...TYPE` are + * considered exact matches in this regard, as no conversions are used. + * + * This function returns a "signature" object, as does `typed.resolve()`, + * which is a plain object with four keys: `params` (the array of parameters + * for this signature), `fn` (the originally supplied function for this + * signature), `test` (a generated function that determines if an argument + * list matches this signature, and `implementation` (the function to call + * on a matching argument list, that performs conversions if necessary and + * then calls the originally supplied function). + * + * @param {Function} fn A typed-function + * @param {string | string[]} signature + * Signature to be found, can be an array or a comma separated string. + * @param {object} options Controls the signature search as documented + * @return {{ params: Param[], fn: function, test: function, implementation: function }} + * Returns the matching signature, or throws an error when no signature + * is found. + */ + function findSignature(fn, signature, options) { + if (!isTypedFunction(fn)) { + throw new TypeError(NOT_TYPED_FUNCTION); + } + + // Canonicalize input + const exact = options && options.exact; + const stringSignature = Array.isArray(signature) ? signature.join(',') : signature; + const params = parseSignature(stringSignature); + const canonicalSignature = stringifyParams(params); + + // First hope we get lucky and exactly match a signature + if (!exact || canonicalSignature in fn.signatures) { + // OK, we can check the internal signatures + const match = fn._typedFunctionData.signatureMap.get(canonicalSignature); + if (match) { + return match; + } + } + + // Oh well, we did not; so we have to go back and check the parameters + // one by one, in order to catch things like `any` and rest params. + // Note here we can assume there is at least one parameter, because + // the empty signature would have matched successfully above. + const nParams = params.length; + let remainingSignatures; + if (exact) { + remainingSignatures = []; + let name; + for (name in fn.signatures) { + remainingSignatures.push(fn._typedFunctionData.signatureMap.get(name)); + } + } else { + remainingSignatures = fn._typedFunctionData.signatures; + } + for (let i = 0; i < nParams; ++i) { + const want = params[i]; + const filteredSignatures = []; + let possibility; + for (possibility of remainingSignatures) { + const have = getParamAtIndex(possibility.params, i); + if (!have || want.restParam && !have.restParam) { + continue; + } + if (!have.hasAny) { + // have to check all of the wanted types are available + const haveTypes = paramTypeSet(have); + if (want.types.some(wtype => !haveTypes.has(wtype.name))) { + continue; + } + } + // OK, this looks good + filteredSignatures.push(possibility); + } + remainingSignatures = filteredSignatures; + if (remainingSignatures.length === 0) break; + } + // Return the first remaining signature that was totally matched: + let candidate; + for (candidate of remainingSignatures) { + if (candidate.params.length <= nParams) { + return candidate; + } + } + throw new TypeError('Signature not found (signature: ' + (fn.name || 'unnamed') + '(' + stringifyParams(params, ', ') + '))'); + } + + /** + * Find the proper function to call for a specific signature from + * a (composed) typed function, for example: + * + * typed.find(fn, ['number', 'string']) + * typed.find(fn, 'number, string') + * typed.find(fn, 'number,string', {exact: true}) + * + * This function find will by default return the best match to + * the given signature, possibly employing type conversions (and returning + * a function that will perform those conversions as needed). The + * (optional) third argument is a plain object giving options contolling + * the signature search. Currently only the option `exact` is implemented, + * which defaults to "false". If `exact` is specified as true, then only + * exact matches will be returned (i.e. signatures for which `fn` was + * directly defined). Uses of `any` and `...TYPE` are considered exact if + * no conversions are necessary to apply the corresponding function. + * + * @param {Function} fn A typed-function + * @param {string | string[]} signature + * Signature to be found, can be an array or a comma separated string. + * @param {object} options Controls the signature match as documented + * @return {function} + * Returns the function to call for the given signature, or throws an + * error if no match is found. + */ + function find(fn, signature, options) { + return findSignature(fn, signature, options).implementation; + } + + /** + * Convert a given value to another data type, specified by type name. + * + * @param {*} value + * @param {string} typeName + */ + function convert(value, typeName) { + // check conversion is needed + const type = findType(typeName); + if (type.test(value)) { + return value; + } + const conversions = type.conversionsTo; + if (conversions.length === 0) { + throw new Error('There are no conversions to ' + typeName + ' defined.'); + } + for (let i = 0; i < conversions.length; i++) { + const fromType = findType(conversions[i].from); + if (fromType.test(value)) { + return conversions[i].convert(value); + } + } + throw new Error('Cannot convert ' + value + ' to ' + typeName); + } + + /** + * Stringify parameters in a normalized way + * @param {Param[]} params + * @param {string} [','] separator + * @return {string} + */ + function stringifyParams(params) { + let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ','; + return params.map(p => p.name).join(separator); + } + + /** + * Parse a parameter, like "...number | boolean" + * @param {string} param + * @return {Param} param + */ + function parseParam(param) { + const restParam = param.indexOf('...') === 0; + const types = !restParam ? param : param.length > 3 ? param.slice(3) : 'any'; + const typeDefs = types.split('|').map(s => findType(s.trim())); + let hasAny = false; + let paramName = restParam ? '...' : ''; + const exactTypes = typeDefs.map(function (type) { + hasAny = type.isAny || hasAny; + paramName += type.name + '|'; + return { + name: type.name, + typeIndex: type.index, + test: type.test, + isAny: type.isAny, + conversion: null, + conversionIndex: -1 + }; + }); + return { + types: exactTypes, + name: paramName.slice(0, -1), + // remove trailing '|' from above + hasAny, + hasConversion: false, + restParam + }; + } + + /** + * Expands a parsed parameter with the types available from currently + * defined conversions. + * @param {Param} param + * @return {Param} param + */ + function expandParam(param) { + const typeNames = param.types.map(t => t.name); + const matchingConversions = availableConversions(typeNames); + let hasAny = param.hasAny; + let newName = param.name; + const convertibleTypes = matchingConversions.map(function (conversion) { + const type = findType(conversion.from); + hasAny = type.isAny || hasAny; + newName += '|' + conversion.from; + return { + name: conversion.from, + typeIndex: type.index, + test: type.test, + isAny: type.isAny, + conversion, + conversionIndex: conversion.index + }; + }); + return { + types: param.types.concat(convertibleTypes), + name: newName, + hasAny, + hasConversion: convertibleTypes.length > 0, + restParam: param.restParam + }; + } + + /** + * Return the set of type names in a parameter. + * Caches the result for efficiency + * + * @param {Param} param + * @return {Set} typenames + */ + function paramTypeSet(param) { + if (!param.typeSet) { + param.typeSet = new Set(); + param.types.forEach(type => param.typeSet.add(type.name)); + } + return param.typeSet; + } + + /** + * Parse a signature with comma separated parameters, + * like "number | boolean, ...string" + * + * @param {string} signature + * @return {Param[]} params + */ + function parseSignature(rawSignature) { + const params = []; + if (typeof rawSignature !== 'string') { + throw new TypeError('Signatures must be strings'); + } + const signature = rawSignature.trim(); + if (signature === '') { + return params; + } + const rawParams = signature.split(','); + for (let i = 0; i < rawParams.length; ++i) { + const parsedParam = parseParam(rawParams[i].trim()); + if (parsedParam.restParam && i !== rawParams.length - 1) { + throw new SyntaxError('Unexpected rest parameter "' + rawParams[i] + '": ' + 'only allowed for the last parameter'); + } + // if invalid, short-circuit (all the types may have been filtered) + if (parsedParam.types.length === 0) { + return null; + } + params.push(parsedParam); + } + return params; + } + + /** + * Test whether a set of params contains a restParam + * @param {Param[]} params + * @return {boolean} Returns true when the last parameter is a restParam + */ + function hasRestParam(params) { + const param = last(params); + return param ? param.restParam : false; + } + + /** + * Create a type test for a single parameter, which can have one or multiple + * types. + * @param {Param} param + * @return {function(x: *) : boolean} Returns a test function + */ + function compileTest(param) { + if (!param || param.types.length === 0) { + // nothing to do + return ok; + } else if (param.types.length === 1) { + return findType(param.types[0].name).test; + } else if (param.types.length === 2) { + const test0 = findType(param.types[0].name).test; + const test1 = findType(param.types[1].name).test; + return function or(x) { + return test0(x) || test1(x); + }; + } else { + // param.types.length > 2 + const tests = param.types.map(function (type) { + return findType(type.name).test; + }); + return function or(x) { + for (let i = 0; i < tests.length; i++) { + if (tests[i](x)) { + return true; + } + } + return false; + }; + } + } + + /** + * Create a test for all parameters of a signature + * @param {Param[]} params + * @return {function(args: Array<*>) : boolean} + */ + function compileTests(params) { + let tests, test0, test1; + if (hasRestParam(params)) { + // variable arguments like '...number' + tests = initial(params).map(compileTest); + const varIndex = tests.length; + const lastTest = compileTest(last(params)); + const testRestParam = function (args) { + for (let i = varIndex; i < args.length; i++) { + if (!lastTest(args[i])) { + return false; + } + } + return true; + }; + return function testArgs(args) { + for (let i = 0; i < tests.length; i++) { + if (!tests[i](args[i])) { + return false; + } + } + return testRestParam(args) && args.length >= varIndex + 1; + }; + } else { + // no variable arguments + if (params.length === 0) { + return function testArgs(args) { + return args.length === 0; + }; + } else if (params.length === 1) { + test0 = compileTest(params[0]); + return function testArgs(args) { + return test0(args[0]) && args.length === 1; + }; + } else if (params.length === 2) { + test0 = compileTest(params[0]); + test1 = compileTest(params[1]); + return function testArgs(args) { + return test0(args[0]) && test1(args[1]) && args.length === 2; + }; + } else { + // arguments.length > 2 + tests = params.map(compileTest); + return function testArgs(args) { + for (let i = 0; i < tests.length; i++) { + if (!tests[i](args[i])) { + return false; + } + } + return args.length === tests.length; + }; + } + } + } + + /** + * Find the parameter at a specific index of a Params list. + * Handles rest parameters. + * @param {Param[]} params + * @param {number} index + * @return {Param | null} Returns the matching parameter when found, + * null otherwise. + */ + function getParamAtIndex(params, index) { + return index < params.length ? params[index] : hasRestParam(params) ? last(params) : null; + } + + /** + * Get all type names of a parameter + * @param {Params[]} params + * @param {number} index + * @return {string[]} Returns an array with type names + */ + function getTypeSetAtIndex(params, index) { + const param = getParamAtIndex(params, index); + if (!param) { + return new Set(); + } + return paramTypeSet(param); + } + + /** + * Test whether a type is an exact type or conversion + * @param {Type} type + * @return {boolean} Returns true when + */ + function isExactType(type) { + return type.conversion === null || type.conversion === undefined; + } + + /** + * Helper function for creating error messages: create an array with + * all available types on a specific argument index. + * @param {Signature[]} signatures + * @param {number} index + * @return {string[]} Returns an array with available types + */ + function mergeExpectedParams(signatures, index) { + const typeSet = new Set(); + signatures.forEach(signature => { + const paramSet = getTypeSetAtIndex(signature.params, index); + let name; + for (name of paramSet) { + typeSet.add(name); + } + }); + return typeSet.has('any') ? ['any'] : Array.from(typeSet); + } + + /** + * Create + * @param {string} name The name of the function + * @param {array.<*>} args The actual arguments passed to the function + * @param {Signature[]} signatures A list with available signatures + * @return {TypeError} Returns a type error with additional data + * attached to it in the property `data` + */ + function createError(name, args, signatures) { + let err, expected; + const _name = name || 'unnamed'; + + // test for wrong type at some index + let matchingSignatures = signatures; + let index; + for (index = 0; index < args.length; index++) { + const nextMatchingDefs = []; + matchingSignatures.forEach(signature => { + const param = getParamAtIndex(signature.params, index); + const test = compileTest(param); + if ((index < signature.params.length || hasRestParam(signature.params)) && test(args[index])) { + nextMatchingDefs.push(signature); + } + }); + if (nextMatchingDefs.length === 0) { + // no matching signatures anymore, throw error "wrong type" + expected = mergeExpectedParams(matchingSignatures, index); + if (expected.length > 0) { + const actualTypes = findTypeNames(args[index]); + err = new TypeError('Unexpected type of argument in function ' + _name + ' (expected: ' + expected.join(' or ') + ', actual: ' + actualTypes.join(' | ') + ', index: ' + index + ')'); + err.data = { + category: 'wrongType', + fn: _name, + index, + actual: actualTypes, + expected + }; + return err; + } + } else { + matchingSignatures = nextMatchingDefs; + } + } + + // test for too few arguments + const lengths = matchingSignatures.map(function (signature) { + return hasRestParam(signature.params) ? Infinity : signature.params.length; + }); + if (args.length < Math.min.apply(null, lengths)) { + expected = mergeExpectedParams(matchingSignatures, index); + err = new TypeError('Too few arguments in function ' + _name + ' (expected: ' + expected.join(' or ') + ', index: ' + args.length + ')'); + err.data = { + category: 'tooFewArgs', + fn: _name, + index: args.length, + expected + }; + return err; + } + + // test for too many arguments + const maxLength = Math.max.apply(null, lengths); + if (args.length > maxLength) { + err = new TypeError('Too many arguments in function ' + _name + ' (expected: ' + maxLength + ', actual: ' + args.length + ')'); + err.data = { + category: 'tooManyArgs', + fn: _name, + index: args.length, + expectedLength: maxLength + }; + return err; + } + + // Generic error + const argTypes = []; + for (let i = 0; i < args.length; ++i) { + argTypes.push(findTypeNames(args[i]).join('|')); + } + err = new TypeError('Arguments of type "' + argTypes.join(', ') + '" do not match any of the defined signatures of function ' + _name + '.'); + err.data = { + category: 'mismatch', + actual: argTypes + }; + return err; + } + + /** + * Find the lowest index of all exact types of a parameter (no conversions) + * @param {Param} param + * @return {number} Returns the index of the lowest type in typed.types + */ + function getLowestTypeIndex(param) { + let min = typeList.length + 1; + for (let i = 0; i < param.types.length; i++) { + if (isExactType(param.types[i])) { + min = Math.min(min, param.types[i].typeIndex); + } + } + return min; + } + + /** + * Find the lowest index of the conversion of all types of the parameter + * having a conversion + * @param {Param} param + * @return {number} Returns the lowest index of the conversions of this type + */ + function getLowestConversionIndex(param) { + let min = nConversions + 1; + for (let i = 0; i < param.types.length; i++) { + if (!isExactType(param.types[i])) { + min = Math.min(min, param.types[i].conversionIndex); + } + } + return min; + } + + /** + * Compare two params + * @param {Param} param1 + * @param {Param} param2 + * @return {number} returns -1 when param1 must get a lower + * index than param2, 1 when the opposite, + * or zero when both are equal + */ + function compareParams(param1, param2) { + // We compare a number of metrics on a param in turn: + // 1) 'any' parameters are the least preferred + if (param1.hasAny) { + if (!param2.hasAny) { + return 1; + } + } else if (param2.hasAny) { + return -1; + } + + // 2) Prefer non-rest to rest parameters + if (param1.restParam) { + if (!param2.restParam) { + return 1; + } + } else if (param2.restParam) { + return -1; + } + + // 3) Prefer exact type match to conversions + if (param1.hasConversion) { + if (!param2.hasConversion) { + return 1; + } + } else if (param2.hasConversion) { + return -1; + } + + // 4) Prefer lower type index: + const typeDiff = getLowestTypeIndex(param1) - getLowestTypeIndex(param2); + if (typeDiff < 0) { + return -1; + } + if (typeDiff > 0) { + return 1; + } + + // 5) Prefer lower conversion index + const convDiff = getLowestConversionIndex(param1) - getLowestConversionIndex(param2); + if (convDiff < 0) { + return -1; + } + if (convDiff > 0) { + return 1; + } + + // Don't have a basis for preference + return 0; + } + + /** + * Compare two signatures + * @param {Signature} signature1 + * @param {Signature} signature2 + * @return {number} returns a negative number when param1 must get a lower + * index than param2, a positive number when the opposite, + * or zero when both are equal + */ + function compareSignatures(signature1, signature2) { + const pars1 = signature1.params; + const pars2 = signature2.params; + const last1 = last(pars1); + const last2 = last(pars2); + const hasRest1 = hasRestParam(pars1); + const hasRest2 = hasRestParam(pars2); + // We compare a number of metrics on signatures in turn: + // 1) An "any rest param" is least preferred + if (hasRest1 && last1.hasAny) { + if (!hasRest2 || !last2.hasAny) { + return 1; + } + } else if (hasRest2 && last2.hasAny) { + return -1; + } + + // 2) Minimize the number of 'any' parameters + let any1 = 0; + let conv1 = 0; + let par; + for (par of pars1) { + if (par.hasAny) ++any1; + if (par.hasConversion) ++conv1; + } + let any2 = 0; + let conv2 = 0; + for (par of pars2) { + if (par.hasAny) ++any2; + if (par.hasConversion) ++conv2; + } + if (any1 !== any2) { + return any1 - any2; + } + + // 3) A conversion rest param is less preferred + if (hasRest1 && last1.hasConversion) { + if (!hasRest2 || !last2.hasConversion) { + return 1; + } + } else if (hasRest2 && last2.hasConversion) { + return -1; + } + + // 4) Minimize the number of conversions + if (conv1 !== conv2) { + return conv1 - conv2; + } + + // 5) Prefer no rest param + if (hasRest1) { + if (!hasRest2) { + return 1; + } + } else if (hasRest2) { + return -1; + } + + // 6) Prefer shorter with rest param, longer without + const lengthCriterion = (pars1.length - pars2.length) * (hasRest1 ? -1 : 1); + if (lengthCriterion !== 0) { + return lengthCriterion; + } + + // Signatures are identical in each of the above metrics. + // In particular, they are the same length. + // We can therefore compare the parameters one by one. + // First we count which signature has more preferred parameters. + const comparisons = []; + let tc = 0; + for (let i = 0; i < pars1.length; ++i) { + const thisComparison = compareParams(pars1[i], pars2[i]); + comparisons.push(thisComparison); + tc += thisComparison; + } + if (tc !== 0) { + return tc; + } + + // They have the same number of preferred parameters, so go by the + // earliest parameter in which we have a preference. + // In other words, dispatch is driven somewhat more by earlier + // parameters than later ones. + let c; + for (c of comparisons) { + if (c !== 0) { + return c; + } + } + + // It's a tossup: + return 0; + } + + /** + * Produce a list of all conversions from distinct types to one of + * the given types. + * + * @param {string[]} typeNames + * @return {ConversionDef[]} Returns the conversions that are available + * resulting in any given type (if any) + */ + function availableConversions(typeNames) { + if (typeNames.length === 0) { + return []; + } + const types = typeNames.map(findType); + if (typeNames.length > 1) { + types.sort((t1, t2) => t1.index - t2.index); + } + let matches = types[0].conversionsTo; + if (typeNames.length === 1) { + return matches; + } + matches = matches.concat([]); // shallow copy the matches + // Since the types are now in index order, we just want the first + // occurrence of any from type: + const knownTypes = new Set(typeNames); + for (let i = 1; i < types.length; ++i) { + let newMatch; + for (newMatch of types[i].conversionsTo) { + if (!knownTypes.has(newMatch.from)) { + matches.push(newMatch); + knownTypes.add(newMatch.from); + } + } + } + return matches; + } + + /** + * Preprocess arguments before calling the original function: + * - if needed convert the parameters + * - in case of rest parameters, move the rest parameters into an Array + * @param {Param[]} params + * @param {function} fn + * @return {function} Returns a wrapped function + */ + function compileArgsPreprocessing(params, fn) { + let fnConvert = fn; + + // TODO: can we make this wrapper function smarter/simpler? + + if (params.some(p => p.hasConversion)) { + const restParam = hasRestParam(params); + const compiledConversions = params.map(compileArgConversion); + fnConvert = function convertArgs() { + const args = []; + const last = restParam ? arguments.length - 1 : arguments.length; + for (let i = 0; i < last; i++) { + args[i] = compiledConversions[i](arguments[i]); + } + if (restParam) { + args[last] = arguments[last].map(compiledConversions[last]); + } + return fn.apply(this, args); + }; + } + let fnPreprocess = fnConvert; + if (hasRestParam(params)) { + const offset = params.length - 1; + fnPreprocess = function preprocessRestParams() { + return fnConvert.apply(this, slice(arguments, 0, offset).concat([slice(arguments, offset)])); + }; + } + return fnPreprocess; + } + + /** + * Compile conversion for a parameter to the right type + * @param {Param} param + * @return {function} Returns the wrapped function that will convert arguments + * + */ + function compileArgConversion(param) { + let test0, test1, conversion0, conversion1; + const tests = []; + const conversions = []; + param.types.forEach(function (type) { + if (type.conversion) { + tests.push(findType(type.conversion.from).test); + conversions.push(type.conversion.convert); + } + }); + + // create optimized conversion functions depending on the number of conversions + switch (conversions.length) { + case 0: + return function convertArg(arg) { + return arg; + }; + case 1: + test0 = tests[0]; + conversion0 = conversions[0]; + return function convertArg(arg) { + if (test0(arg)) { + return conversion0(arg); + } + return arg; + }; + case 2: + test0 = tests[0]; + test1 = tests[1]; + conversion0 = conversions[0]; + conversion1 = conversions[1]; + return function convertArg(arg) { + if (test0(arg)) { + return conversion0(arg); + } + if (test1(arg)) { + return conversion1(arg); + } + return arg; + }; + default: + return function convertArg(arg) { + for (let i = 0; i < conversions.length; i++) { + if (tests[i](arg)) { + return conversions[i](arg); + } + } + return arg; + }; + } + } + + /** + * Split params with union types in to separate params. + * + * For example: + * + * splitParams([['Array', 'Object'], ['string', 'RegExp']) + * // returns: + * // [ + * // ['Array', 'string'], + * // ['Array', 'RegExp'], + * // ['Object', 'string'], + * // ['Object', 'RegExp'] + * // ] + * + * @param {Param[]} params + * @return {Param[]} + */ + function splitParams(params) { + function _splitParams(params, index, paramsSoFar) { + if (index < params.length) { + const param = params[index]; + let resultingParams = []; + if (param.restParam) { + // split the types of a rest parameter in two: + // one with only exact types, and one with exact types and conversions + const exactTypes = param.types.filter(isExactType); + if (exactTypes.length < param.types.length) { + resultingParams.push({ + types: exactTypes, + name: '...' + exactTypes.map(t => t.name).join('|'), + hasAny: exactTypes.some(t => t.isAny), + hasConversion: false, + restParam: true + }); + } + resultingParams.push(param); + } else { + // split all the types of a regular parameter into one type per param + resultingParams = param.types.map(function (type) { + return { + types: [type], + name: type.name, + hasAny: type.isAny, + hasConversion: type.conversion, + restParam: false + }; + }); + } + + // recurse over the groups with types + return flatMap(resultingParams, function (nextParam) { + return _splitParams(params, index + 1, paramsSoFar.concat([nextParam])); + }); + } else { + // we've reached the end of the parameters. + return [paramsSoFar]; + } + } + return _splitParams(params, 0, []); + } + + /** + * Test whether two param lists represent conflicting signatures + * @param {Param[]} params1 + * @param {Param[]} params2 + * @return {boolean} Returns true when the signatures conflict, false otherwise. + */ + function conflicting(params1, params2) { + const ii = Math.max(params1.length, params2.length); + for (let i = 0; i < ii; i++) { + const typeSet1 = getTypeSetAtIndex(params1, i); + const typeSet2 = getTypeSetAtIndex(params2, i); + let overlap = false; + let name; + for (name of typeSet2) { + if (typeSet1.has(name)) { + overlap = true; + break; + } + } + if (!overlap) { + return false; + } + } + const len1 = params1.length; + const len2 = params2.length; + const restParam1 = hasRestParam(params1); + const restParam2 = hasRestParam(params2); + return restParam1 ? restParam2 ? len1 === len2 : len2 >= len1 : restParam2 ? len1 >= len2 : len1 === len2; + } + + /** + * Helper function for `resolveReferences` that returns a copy of + * functionList wihe any prior resolutions cleared out, in case we are + * recycling signatures from a prior typed function construction. + * + * @param {Array.} functionList + * @return {Array.} + */ + function clearResolutions(functionList) { + return functionList.map(fn => { + if (isReferToSelf(fn)) { + return referToSelf(fn.referToSelf.callback); + } + if (isReferTo(fn)) { + return makeReferTo(fn.referTo.references, fn.referTo.callback); + } + return fn; + }); + } + + /** + * Take a list of references, a list of functions functionList, and a + * signatureMap indexing signatures into functionList, and return + * the list of resolutions, or a false-y value if they don't all + * resolve in a valid way (yet). + * + * @param {string[]} references + * @param {Array} signatureMap + * @return {function[] | false} resolutions + */ + function collectResolutions(references, functionList, signatureMap) { + const resolvedReferences = []; + let reference; + for (reference of references) { + let resolution = signatureMap[reference]; + if (typeof resolution !== 'number') { + throw new TypeError('No definition for referenced signature "' + reference + '"'); + } + resolution = functionList[resolution]; + if (typeof resolution !== 'function') { + return false; + } + resolvedReferences.push(resolution); + } + return resolvedReferences; + } + + /** + * Resolve any references in the functionList for the typed function + * itself. The signatureMap tells which index in the functionList a + * given signature should be mapped to (for use in resolving typed.referTo) + * and self provides the destions of a typed.referToSelf. + * + * @param {Array} functionList + * @param {Object.} signatureMap + * @param {function} self The typed-function itself + * @return {Array} The list of resolved functions + */ + function resolveReferences(functionList, signatureMap, self) { + const resolvedFunctions = clearResolutions(functionList); + const isResolved = new Array(resolvedFunctions.length).fill(false); + let leftUnresolved = true; + while (leftUnresolved) { + leftUnresolved = false; + let nothingResolved = true; + for (let i = 0; i < resolvedFunctions.length; ++i) { + if (isResolved[i]) continue; + const fn = resolvedFunctions[i]; + if (isReferToSelf(fn)) { + resolvedFunctions[i] = fn.referToSelf.callback(self); + // Preserve reference in case signature is reused someday: + resolvedFunctions[i].referToSelf = fn.referToSelf; + isResolved[i] = true; + nothingResolved = false; + } else if (isReferTo(fn)) { + const resolvedReferences = collectResolutions(fn.referTo.references, resolvedFunctions, signatureMap); + if (resolvedReferences) { + resolvedFunctions[i] = fn.referTo.callback.apply(this, resolvedReferences); + // Preserve reference in case signature is reused someday: + resolvedFunctions[i].referTo = fn.referTo; + isResolved[i] = true; + nothingResolved = false; + } else { + leftUnresolved = true; + } + } + } + if (nothingResolved && leftUnresolved) { + throw new SyntaxError('Circular reference detected in resolving typed.referTo'); + } + } + return resolvedFunctions; + } + + /** + * Validate whether any of the function bodies contains a self-reference + * usage like `this(...)` or `this.signatures`. This self-referencing is + * deprecated since typed-function v3. It has been replaced with + * the functions typed.referTo and typed.referToSelf. + * @param {Object.} signaturesMap + */ + function validateDeprecatedThis(signaturesMap) { + // TODO: remove this deprecation warning logic some day (it's introduced in v3) + + // match occurrences like 'this(' and 'this.signatures' + const deprecatedThisRegex = /\bthis(\(|\.signatures\b)/; + Object.keys(signaturesMap).forEach(signature => { + const fn = signaturesMap[signature]; + if (deprecatedThisRegex.test(fn.toString())) { + throw new SyntaxError('Using `this` to self-reference a function ' + 'is deprecated since typed-function@3. ' + 'Use typed.referTo and typed.referToSelf instead.'); + } + }); + } + + /** + * Create a typed function + * @param {String} name The name for the typed function + * @param {Object.} rawSignaturesMap + * An object with one or + * multiple signatures as key, and the + * function corresponding to the + * signature as value. + * @return {function} Returns the created typed function. + */ + function createTypedFunction(name, rawSignaturesMap) { + typed.createCount++; + if (Object.keys(rawSignaturesMap).length === 0) { + throw new SyntaxError('No signatures provided'); + } + if (typed.warnAgainstDeprecatedThis) { + validateDeprecatedThis(rawSignaturesMap); + } + + // Main processing loop for signatures + const parsedParams = []; + const originalFunctions = []; + const signaturesMap = {}; + const preliminarySignatures = []; // may have duplicates from conversions + let signature; + for (signature in rawSignaturesMap) { + // A) Protect against polluted Object prototype: + if (!Object.prototype.hasOwnProperty.call(rawSignaturesMap, signature)) { + continue; + } + // B) Parse the signature + const params = parseSignature(signature); + if (!params) continue; + // C) Check for conflicts + parsedParams.forEach(function (pp) { + if (conflicting(pp, params)) { + throw new TypeError('Conflicting signatures "' + stringifyParams(pp) + '" and "' + stringifyParams(params) + '".'); + } + }); + parsedParams.push(params); + // D) Store the provided function and add conversions + const functionIndex = originalFunctions.length; + originalFunctions.push(rawSignaturesMap[signature]); + const conversionParams = params.map(expandParam); + // E) Split the signatures and collect them up + let sp; + for (sp of splitParams(conversionParams)) { + const spName = stringifyParams(sp); + preliminarySignatures.push({ + params: sp, + name: spName, + fn: functionIndex + }); + if (sp.every(p => !p.hasConversion)) { + signaturesMap[spName] = functionIndex; + } + } + } + preliminarySignatures.sort(compareSignatures); + + // Note the forward reference to theTypedFn + const resolvedFunctions = resolveReferences(originalFunctions, signaturesMap, theTypedFn); + + // Fill in the proper function for each signature + let s; + for (s in signaturesMap) { + if (Object.prototype.hasOwnProperty.call(signaturesMap, s)) { + signaturesMap[s] = resolvedFunctions[signaturesMap[s]]; + } + } + const signatures = []; + const internalSignatureMap = new Map(); // benchmarks faster than object + for (s of preliminarySignatures) { + // Note it's only safe to eliminate duplicates like this + // _after_ the signature sorting step above; otherwise we might + // remove the wrong one. + if (!internalSignatureMap.has(s.name)) { + s.fn = resolvedFunctions[s.fn]; + signatures.push(s); + internalSignatureMap.set(s.name, s); + } + } + + // we create a highly optimized checks for the first couple of signatures with max 2 arguments + const ok0 = signatures[0] && signatures[0].params.length <= 2 && !hasRestParam(signatures[0].params); + const ok1 = signatures[1] && signatures[1].params.length <= 2 && !hasRestParam(signatures[1].params); + const ok2 = signatures[2] && signatures[2].params.length <= 2 && !hasRestParam(signatures[2].params); + const ok3 = signatures[3] && signatures[3].params.length <= 2 && !hasRestParam(signatures[3].params); + const ok4 = signatures[4] && signatures[4].params.length <= 2 && !hasRestParam(signatures[4].params); + const ok5 = signatures[5] && signatures[5].params.length <= 2 && !hasRestParam(signatures[5].params); + const allOk = ok0 && ok1 && ok2 && ok3 && ok4 && ok5; + + // compile the tests + for (let i = 0; i < signatures.length; ++i) { + signatures[i].test = compileTests(signatures[i].params); + } + const test00 = ok0 ? compileTest(signatures[0].params[0]) : notOk; + const test10 = ok1 ? compileTest(signatures[1].params[0]) : notOk; + const test20 = ok2 ? compileTest(signatures[2].params[0]) : notOk; + const test30 = ok3 ? compileTest(signatures[3].params[0]) : notOk; + const test40 = ok4 ? compileTest(signatures[4].params[0]) : notOk; + const test50 = ok5 ? compileTest(signatures[5].params[0]) : notOk; + const test01 = ok0 ? compileTest(signatures[0].params[1]) : notOk; + const test11 = ok1 ? compileTest(signatures[1].params[1]) : notOk; + const test21 = ok2 ? compileTest(signatures[2].params[1]) : notOk; + const test31 = ok3 ? compileTest(signatures[3].params[1]) : notOk; + const test41 = ok4 ? compileTest(signatures[4].params[1]) : notOk; + const test51 = ok5 ? compileTest(signatures[5].params[1]) : notOk; + + // compile the functions + for (let i = 0; i < signatures.length; ++i) { + signatures[i].implementation = compileArgsPreprocessing(signatures[i].params, signatures[i].fn); + } + const fn0 = ok0 ? signatures[0].implementation : undef; + const fn1 = ok1 ? signatures[1].implementation : undef; + const fn2 = ok2 ? signatures[2].implementation : undef; + const fn3 = ok3 ? signatures[3].implementation : undef; + const fn4 = ok4 ? signatures[4].implementation : undef; + const fn5 = ok5 ? signatures[5].implementation : undef; + const len0 = ok0 ? signatures[0].params.length : -1; + const len1 = ok1 ? signatures[1].params.length : -1; + const len2 = ok2 ? signatures[2].params.length : -1; + const len3 = ok3 ? signatures[3].params.length : -1; + const len4 = ok4 ? signatures[4].params.length : -1; + const len5 = ok5 ? signatures[5].params.length : -1; + + // simple and generic, but also slow + const iStart = allOk ? 6 : 0; + const iEnd = signatures.length; + // de-reference ahead for execution speed: + const tests = signatures.map(s => s.test); + const fns = signatures.map(s => s.implementation); + const generic = function generic() { + + for (let i = iStart; i < iEnd; i++) { + if (tests[i](arguments)) { + return fns[i].apply(this, arguments); + } + } + return typed.onMismatch(name, arguments, signatures); + }; + + // create the typed function + // fast, specialized version. Falls back to the slower, generic one if needed + function theTypedFn(arg0, arg1) { + + if (arguments.length === len0 && test00(arg0) && test01(arg1)) { + return fn0.apply(this, arguments); + } + if (arguments.length === len1 && test10(arg0) && test11(arg1)) { + return fn1.apply(this, arguments); + } + if (arguments.length === len2 && test20(arg0) && test21(arg1)) { + return fn2.apply(this, arguments); + } + if (arguments.length === len3 && test30(arg0) && test31(arg1)) { + return fn3.apply(this, arguments); + } + if (arguments.length === len4 && test40(arg0) && test41(arg1)) { + return fn4.apply(this, arguments); + } + if (arguments.length === len5 && test50(arg0) && test51(arg1)) { + return fn5.apply(this, arguments); + } + return generic.apply(this, arguments); + } + + // attach name the typed function + try { + Object.defineProperty(theTypedFn, 'name', { + value: name + }); + } catch (err) { + // old browsers do not support Object.defineProperty and some don't support setting the name property + // the function name is not essential for the functioning, it's mostly useful for debugging, + // so it's fine to have unnamed functions. + } + + // attach signatures to the function. + // This property is close to the original collection of signatures + // used to create the typed-function, just with unions split: + theTypedFn.signatures = signaturesMap; + + // Store internal data for functions like resolve, find, etc. + // Also serves as the flag that this is a typed-function + theTypedFn._typedFunctionData = { + signatures, + signatureMap: internalSignatureMap + }; + return theTypedFn; + } + + /** + * Action to take on mismatch + * @param {string} name Name of function that was attempted to be called + * @param {Array} args Actual arguments to the call + * @param {Array} signatures Known signatures of the named typed-function + */ + function _onMismatch(name, args, signatures) { + throw createError(name, args, signatures); + } + + /** + * Return all but the last items of an array or function Arguments + * @param {Array | Arguments} arr + * @return {Array} + */ + function initial(arr) { + return slice(arr, 0, arr.length - 1); + } + + /** + * return the last item of an array or function Arguments + * @param {Array | Arguments} arr + * @return {*} + */ + function last(arr) { + return arr[arr.length - 1]; + } + + /** + * Slice an array or function Arguments + * @param {Array | Arguments | IArguments} arr + * @param {number} start + * @param {number} [end] + * @return {Array} + */ + function slice(arr, start, end) { + return Array.prototype.slice.call(arr, start, end); + } + + /** + * Return the first item from an array for which test(arr[i]) returns true + * @param {Array} arr + * @param {function} test + * @return {* | undefined} Returns the first matching item + * or undefined when there is no match + */ + function findInArray(arr, test) { + for (let i = 0; i < arr.length; i++) { + if (test(arr[i])) { + return arr[i]; + } + } + return undefined; + } + + /** + * Flat map the result invoking a callback for every item in an array. + * https://gist.github.com/samgiles/762ee337dff48623e729 + * @param {Array} arr + * @param {function} callback + * @return {Array} + */ + function flatMap(arr, callback) { + return Array.prototype.concat.apply([], arr.map(callback)); + } + + /** + * Create a reference callback to one or multiple signatures + * + * Syntax: + * + * typed.referTo(signature1, signature2, ..., function callback(fn1, fn2, ...) { + * // ... + * }) + * + * @returns {{referTo: {references: string[], callback}}} + */ + function referTo() { + const references = initial(arguments).map(s => stringifyParams(parseSignature(s))); + const callback = last(arguments); + if (typeof callback !== 'function') { + throw new TypeError('Callback function expected as last argument'); + } + return makeReferTo(references, callback); + } + function makeReferTo(references, callback) { + return { + referTo: { + references, + callback + } + }; + } + + /** + * Create a reference callback to the typed-function itself + * + * @param {(self: function) => function} callback + * @returns {{referToSelf: { callback: function }}} + */ + function referToSelf(callback) { + if (typeof callback !== 'function') { + throw new TypeError('Callback function expected as first argument'); + } + return { + referToSelf: { + callback + } + }; + } + + /** + * Test whether something is a referTo object, holding a list with reference + * signatures and a callback. + * + * @param {Object | function} objectOrFn + * @returns {boolean} + */ + function isReferTo(objectOrFn) { + return objectOrFn && typeof objectOrFn.referTo === 'object' && Array.isArray(objectOrFn.referTo.references) && typeof objectOrFn.referTo.callback === 'function'; + } + + /** + * Test whether something is a referToSelf object, holding a callback where + * to pass `self`. + * + * @param {Object | function} objectOrFn + * @returns {boolean} + */ + function isReferToSelf(objectOrFn) { + return objectOrFn && typeof objectOrFn.referToSelf === 'object' && typeof objectOrFn.referToSelf.callback === 'function'; + } + + /** + * Check if name is (A) new, (B) a match, or (C) a mismatch; and throw + * an error in case (C). + * + * @param { string | undefined } nameSoFar + * @param { string | undefined } newName + * @returns { string } updated name + */ + function checkName(nameSoFar, newName) { + if (!nameSoFar) { + return newName; + } + if (newName && newName !== nameSoFar) { + const err = new Error('Function names do not match (expected: ' + nameSoFar + ', actual: ' + newName + ')'); + err.data = { + actual: newName, + expected: nameSoFar + }; + throw err; + } + return nameSoFar; + } + + /** + * Retrieve the implied name from an object with signature keys + * and function values, checking whether all value names match + * + * @param { {string: function} } obj + */ + function getObjectName(obj) { + let name; + for (const key in obj) { + // Only pay attention to own properties, and only if their values + // are typed functions or functions with a signature property + if (Object.prototype.hasOwnProperty.call(obj, key) && (isTypedFunction(obj[key]) || typeof obj[key].signature === 'string')) { + name = checkName(name, obj[key].name); + } + } + return name; + } + + /** + * Copy all of the signatures from the second argument into the first, + * which is modified by side effect, checking for conflicts + * + * @param {Object.} dest + * @param {Object.} source + */ + function mergeSignatures(dest, source) { + let key; + for (key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + if (key in dest) { + if (source[key] !== dest[key]) { + const err = new Error('Signature "' + key + '" is defined twice'); + err.data = { + signature: key, + sourceFunction: source[key], + destFunction: dest[key] + }; + throw err; + } + // else: both signatures point to the same function, that's fine + } + dest[key] = source[key]; + } + } + } + const saveTyped = typed; + + /** + * Originally the main function was a typed function itself, but then + * it might not be able to generate error messages if the client + * replaced the type system with different names. + * + * Main entry: typed([name], functions/objects with signatures...) + * + * Assembles and returns a new typed-function from the given items + * that provide signatures and implementations, each of which may be + * * a plain object mapping (string) signatures to implementing functions, + * * a previously constructed typed function, or + * * any other single function with a string-valued property `signature`. + * The name of the resulting typed-function will be given by the + * string-valued name argument if present, or if not, by the name + * of any of the arguments that have one, as long as any that do are + * consistent with each other. If no name is specified, the name will be + * an empty string. + * + * @param {string} maybeName [optional] + * @param {(function|object)[]} signature providers + * @returns {typed-function} + */ + typed = function (maybeName) { + const named = typeof maybeName === 'string'; + const start = named ? 1 : 0; + let name = named ? maybeName : ''; + const allSignatures = {}; + for (let i = start; i < arguments.length; ++i) { + const item = arguments[i]; + let theseSignatures = {}; + let thisName; + if (typeof item === 'function') { + thisName = item.name; + if (typeof item.signature === 'string') { + // Case 1: Ordinary function with a string 'signature' property + theseSignatures[item.signature] = item; + } else if (isTypedFunction(item)) { + // Case 2: Existing typed function + theseSignatures = item.signatures; + } + } else if (isPlainObject(item)) { + // Case 3: Plain object, assume keys = signatures, values = functions + theseSignatures = item; + if (!named) { + thisName = getObjectName(item); + } + } + if (Object.keys(theseSignatures).length === 0) { + const err = new TypeError('Argument to \'typed\' at index ' + i + ' is not a (typed) function, ' + 'nor an object with signatures as keys and functions as values.'); + err.data = { + index: i, + argument: item + }; + throw err; + } + if (!named) { + name = checkName(name, thisName); + } + mergeSignatures(allSignatures, theseSignatures); + } + return createTypedFunction(name || '', allSignatures); + }; + typed.create = create; + typed.createCount = saveTyped.createCount; + typed.onMismatch = _onMismatch; + typed.throwMismatchError = _onMismatch; + typed.createError = createError; + typed.clear = clear; + typed.clearConversions = clearConversions; + typed.addTypes = addTypes; + typed._findType = findType; // For unit testing only + typed.referTo = referTo; + typed.referToSelf = referToSelf; + typed.convert = convert; + typed.findSignature = findSignature; + typed.find = find; + typed.isTypedFunction = isTypedFunction; + typed.warnAgainstDeprecatedThis = true; + + /** + * add a type (convenience wrapper for typed.addTypes) + * @param {{name: string, test: function}} type + * @param {boolean} [beforeObjectTest=true] + * If true, the new test will be inserted before + * the test with name 'Object' (if any), since + * tests for Object match Array and classes too. + */ + typed.addType = function (type, beforeObjectTest) { + let before = 'any'; + if (beforeObjectTest !== false && typeMap.has('Object')) { + before = 'Object'; + } + typed.addTypes([type], before); + }; + + /** + * Verify that the ConversionDef conversion has a valid format. + * + * @param {conversionDef} conversion + * @return {void} + * @throws {TypeError|SyntaxError} + */ + function _validateConversion(conversion) { + if (!conversion || typeof conversion.from !== 'string' || typeof conversion.to !== 'string' || typeof conversion.convert !== 'function') { + throw new TypeError('Object with properties {from: string, to: string, convert: function} expected'); + } + if (conversion.to === conversion.from) { + throw new SyntaxError('Illegal to define conversion from "' + conversion.from + '" to itself.'); + } + } + + /** + * Add a conversion + * + * @param {ConversionDef} conversion + * @param {{override: boolean}} [options] + * @returns {void} + * @throws {TypeError} + */ + typed.addConversion = function (conversion) { + let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + override: false + }; + _validateConversion(conversion); + const to = findType(conversion.to); + const existing = to.conversionsTo.find(other => other.from === conversion.from); + if (existing) { + if (options && options.override) { + typed.removeConversion({ + from: existing.from, + to: conversion.to, + convert: existing.convert + }); + } else { + throw new Error('There is already a conversion from "' + conversion.from + '" to "' + to.name + '"'); + } + } + to.conversionsTo.push({ + from: conversion.from, + convert: conversion.convert, + index: nConversions++ + }); + }; + + /** + * Convenience wrapper to call addConversion on each conversion in a list. + * + * @param {ConversionDef[]} conversions + * @param {{override: boolean}} [options] + * @returns {void} + * @throws {TypeError} + */ + typed.addConversions = function (conversions, options) { + conversions.forEach(conversion => typed.addConversion(conversion, options)); + }; + + /** + * Remove the specified conversion. The format is the same as for + * addConversion, and the convert function must match or an error + * is thrown. + * + * @param {{from: string, to: string, convert: function}} conversion + * @returns {void} + * @throws {TypeError|SyntaxError|Error} + */ + typed.removeConversion = function (conversion) { + _validateConversion(conversion); + const to = findType(conversion.to); + const existingConversion = findInArray(to.conversionsTo, c => c.from === conversion.from); + if (!existingConversion) { + throw new Error('Attempt to remove nonexistent conversion from ' + conversion.from + ' to ' + conversion.to); + } + if (existingConversion.convert !== conversion.convert) { + throw new Error('Conversion to remove does not match existing conversion'); + } + const index = to.conversionsTo.indexOf(existingConversion); + to.conversionsTo.splice(index, 1); + }; + + /** + * Produce the specific signature that a typed function + * will execute on the given arguments. Here, a "signature" is an + * object with properties 'params', 'test', 'fn', and 'implementation'. + * This last property is a function that converts params as necessary + * and then calls 'fn'. Returns null if there is no matching signature. + * @param {typed-function} tf + * @param {any[]} argList + * @returns {{params: string, test: function, fn: function, implementation: function}} + */ + typed.resolve = function (tf, argList) { + if (!isTypedFunction(tf)) { + throw new TypeError(NOT_TYPED_FUNCTION); + } + const sigs = tf._typedFunctionData.signatures; + for (let i = 0; i < sigs.length; ++i) { + if (sigs[i].test(argList)) { + return sigs[i]; + } + } + return null; + }; + return typed; + } + var typedFunction = create(); + + /** + * Create a factory function, which can be used to inject dependencies. + * + * The created functions are memoized, a consecutive call of the factory + * with the exact same inputs will return the same function instance. + * The memoized cache is exposed on `factory.cache` and can be cleared + * if needed. + * + * Example: + * + * const name = 'log' + * const dependencies = ['config', 'typed', 'divideScalar', 'Complex'] + * + * export const createLog = factory(name, dependencies, ({ typed, config, divideScalar, Complex }) => { + * // ... create the function log here and return it + * } + * + * @param {string} name Name of the function to be created + * @param {string[]} dependencies The names of all required dependencies + * @param {function} create Callback function called with an object with all dependencies + * @param {Object} [meta] + * Optional object with meta information that will be attached + * to the created factory function as property `meta`. For explanation + * of what meta properties can be specified and what they mean, see + * docs/core/extension.md. + * @returns {function} + */ + function factory(name, dependencies, create, meta) { + function assertAndCreate(scope) { + // we only pass the requested dependencies to the factory function + // to prevent functions to rely on dependencies that are not explicitly + // requested. + var deps = pickShallow(scope, dependencies.map(stripOptionalNotation)); + assertDependencies(name, dependencies, scope); + return create(deps); + } + assertAndCreate.isFactory = true; + assertAndCreate.fn = name; + assertAndCreate.dependencies = dependencies.slice().sort(); + if (meta) { + assertAndCreate.meta = meta; + } + return assertAndCreate; + } + + /** + * Assert that all dependencies of a list with dependencies are available in the provided scope. + * + * Will throw an exception when there are dependencies missing. + * + * @param {string} name Name for the function to be created. Used to generate a useful error message + * @param {string[]} dependencies + * @param {Object} scope + */ + function assertDependencies(name, dependencies, scope) { + var allDefined = dependencies.filter(dependency => !isOptionalDependency(dependency)) // filter optionals + .every(dependency => scope[dependency] !== undefined); + if (!allDefined) { + var missingDependencies = dependencies.filter(dependency => scope[dependency] === undefined); + + // TODO: create a custom error class for this, a MathjsError or something like that + throw new Error("Cannot create function \"".concat(name, "\", ") + "some dependencies are missing: ".concat(missingDependencies.map(d => "\"".concat(d, "\"")).join(', '), ".")); + } + } + function isOptionalDependency(dependency) { + return dependency && dependency[0] === '?'; + } + function stripOptionalNotation(dependency) { + return dependency && dependency[0] === '?' ? dependency.slice(1) : dependency; + } + + /** + * @typedef {{sign: '+' | '-' | '', coefficients: number[], exponent: number}} SplitValue + */ + + /** + * Check if a number is integer + * @param {number | boolean} value + * @return {boolean} isInteger + */ + function isInteger(value) { + if (typeof value === 'boolean') { + return true; + } + return isFinite(value) ? value === Math.round(value) : false; + } + + /** + * Calculate the sign of a number + * @param {number} x + * @returns {number} + */ + var sign$1 = Math.sign || function (x) { + if (x > 0) { + return 1; + } else if (x < 0) { + return -1; + } else { + return 0; + } + }; + + /** + * Formats a number in a given base + * @param {number} n + * @param {number} base + * @param {number} size + * @returns {string} + */ + function formatNumberToBase(n, base, size) { + var prefixes = { + 2: '0b', + 8: '0o', + 16: '0x' + }; + var prefix = prefixes[base]; + var suffix = ''; + if (size) { + if (size < 1) { + throw new Error('size must be in greater than 0'); + } + if (!isInteger(size)) { + throw new Error('size must be an integer'); + } + if (n > 2 ** (size - 1) - 1 || n < -(2 ** (size - 1))) { + throw new Error("Value must be in range [-2^".concat(size - 1, ", 2^").concat(size - 1, "-1]")); + } + if (!isInteger(n)) { + throw new Error('Value must be an integer'); + } + if (n < 0) { + n = n + 2 ** size; + } + suffix = "i".concat(size); + } + var sign = ''; + if (n < 0) { + n = -n; + sign = '-'; + } + return "".concat(sign).concat(prefix).concat(n.toString(base)).concat(suffix); + } + + /** + * Convert a number to a formatted string representation. + * + * Syntax: + * + * format(value) + * format(value, options) + * format(value, precision) + * format(value, fn) + * + * Where: + * + * {number} value The value to be formatted + * {Object} options An object with formatting options. Available options: + * {string} notation + * Number notation. Choose from: + * 'fixed' Always use regular number notation. + * For example '123.40' and '14000000' + * 'exponential' Always use exponential notation. + * For example '1.234e+2' and '1.4e+7' + * 'engineering' Always use engineering notation. + * For example '123.4e+0' and '14.0e+6' + * 'auto' (default) Regular number notation for numbers + * having an absolute value between + * `lowerExp` and `upperExp` bounds, and + * uses exponential notation elsewhere. + * Lower bound is included, upper bound + * is excluded. + * For example '123.4' and '1.4e7'. + * 'bin', 'oct, or + * 'hex' Format the number using binary, octal, + * or hexadecimal notation. + * For example '0b1101' and '0x10fe'. + * {number} wordSize The word size in bits to use for formatting + * in binary, octal, or hexadecimal notation. + * To be used only with 'bin', 'oct', or 'hex' + * values for 'notation' option. When this option + * is defined the value is formatted as a signed + * twos complement integer of the given word size + * and the size suffix is appended to the output. + * For example + * format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'. + * Default value is undefined. + * {number} precision A number between 0 and 16 to round + * the digits of the number. + * In case of notations 'exponential', + * 'engineering', and 'auto', + * `precision` defines the total + * number of significant digits returned. + * In case of notation 'fixed', + * `precision` defines the number of + * significant digits after the decimal + * point. + * `precision` is undefined by default, + * not rounding any digits. + * {number} lowerExp Exponent determining the lower boundary + * for formatting a value with an exponent + * when `notation='auto`. + * Default value is `-3`. + * {number} upperExp Exponent determining the upper boundary + * for formatting a value with an exponent + * when `notation='auto`. + * Default value is `5`. + * {Function} fn A custom formatting function. Can be used to override the + * built-in notations. Function `fn` is called with `value` as + * parameter and must return a string. Is useful for example to + * format all values inside a matrix in a particular way. + * + * Examples: + * + * format(6.4) // '6.4' + * format(1240000) // '1.24e6' + * format(1/3) // '0.3333333333333333' + * format(1/3, 3) // '0.333' + * format(21385, 2) // '21000' + * format(12.071, {notation: 'fixed'}) // '12' + * format(2.3, {notation: 'fixed', precision: 2}) // '2.30' + * format(52.8, {notation: 'exponential'}) // '5.28e+1' + * format(12345678, {notation: 'engineering'}) // '12.345678e+6' + * + * @param {number} value + * @param {Object | Function | number} [options] + * @return {string} str The formatted value + */ + function format$2(value, options) { + if (typeof options === 'function') { + // handle format(value, fn) + return options(value); + } + + // handle special cases + if (value === Infinity) { + return 'Infinity'; + } else if (value === -Infinity) { + return '-Infinity'; + } else if (isNaN(value)) { + return 'NaN'; + } + var { + notation, + precision, + wordSize + } = normalizeFormatOptions(options); + + // handle the various notations + switch (notation) { + case 'fixed': + return toFixed$1(value, precision); + case 'exponential': + return toExponential$1(value, precision); + case 'engineering': + return toEngineering$1(value, precision); + case 'bin': + return formatNumberToBase(value, 2, wordSize); + case 'oct': + return formatNumberToBase(value, 8, wordSize); + case 'hex': + return formatNumberToBase(value, 16, wordSize); + case 'auto': + // remove trailing zeros after the decimal point + return toPrecision(value, precision, options).replace(/((\.\d*?)(0+))($|e)/, function () { + var digits = arguments[2]; + var e = arguments[4]; + return digits !== '.' ? digits + e : e; + }); + default: + throw new Error('Unknown notation "' + notation + '". ' + 'Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.'); + } + } + + /** + * Normalize format options into an object: + * { + * notation: string, + * precision: number | undefined, + * wordSize: number | undefined + * } + */ + function normalizeFormatOptions(options) { + // default values for options + var notation = 'auto'; + var precision; + var wordSize; + if (options !== undefined) { + if (isNumber(options)) { + precision = options; + } else if (isBigNumber(options)) { + precision = options.toNumber(); + } else if (isObject(options)) { + if (options.precision !== undefined) { + precision = _toNumberOrThrow(options.precision, () => { + throw new Error('Option "precision" must be a number or BigNumber'); + }); + } + if (options.wordSize !== undefined) { + wordSize = _toNumberOrThrow(options.wordSize, () => { + throw new Error('Option "wordSize" must be a number or BigNumber'); + }); + } + if (options.notation) { + notation = options.notation; + } + } else { + throw new Error('Unsupported type of options, number, BigNumber, or object expected'); + } + } + return { + notation, + precision, + wordSize + }; + } + + /** + * Split a number into sign, coefficients, and exponent + * @param {number | string} value + * @return {SplitValue} + * Returns an object containing sign, coefficients, and exponent + */ + function splitNumber(value) { + // parse the input value + var match = String(value).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/); + if (!match) { + throw new SyntaxError('Invalid number ' + value); + } + var sign = match[1]; + var digits = match[2]; + var exponent = parseFloat(match[4] || '0'); + var dot = digits.indexOf('.'); + exponent += dot !== -1 ? dot - 1 : digits.length - 1; + var coefficients = digits.replace('.', '') // remove the dot (must be removed before removing leading zeros) + .replace(/^0*/, function (zeros) { + // remove leading zeros, add their count to the exponent + exponent -= zeros.length; + return ''; + }).replace(/0*$/, '') // remove trailing zeros + .split('').map(function (d) { + return parseInt(d); + }); + if (coefficients.length === 0) { + coefficients.push(0); + exponent++; + } + return { + sign, + coefficients, + exponent + }; + } + + /** + * Format a number in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3' + * @param {number | string} value + * @param {number} [precision] Optional number of significant figures to return. + */ + function toEngineering$1(value, precision) { + if (isNaN(value) || !isFinite(value)) { + return String(value); + } + var split = splitNumber(value); + var rounded = roundDigits(split, precision); + var e = rounded.exponent; + var c = rounded.coefficients; + + // find nearest lower multiple of 3 for exponent + var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3; + if (isNumber(precision)) { + // add zeroes to give correct sig figs + while (precision > c.length || e - newExp + 1 > c.length) { + c.push(0); + } + } else { + // concatenate coefficients with necessary zeros + // add zeros if necessary (for example: 1e+8 -> 100e+6) + var missingZeros = Math.abs(e - newExp) - (c.length - 1); + for (var i = 0; i < missingZeros; i++) { + c.push(0); + } + } + + // find difference in exponents + var expDiff = Math.abs(e - newExp); + var decimalIdx = 1; + + // push decimal index over by expDiff times + while (expDiff > 0) { + decimalIdx++; + expDiff--; + } + + // if all coefficient values are zero after the decimal point and precision is unset, don't add a decimal value. + // otherwise concat with the rest of the coefficients + var decimals = c.slice(decimalIdx).join(''); + var decimalVal = isNumber(precision) && decimals.length || decimals.match(/[1-9]/) ? '.' + decimals : ''; + var str = c.slice(0, decimalIdx).join('') + decimalVal + 'e' + (e >= 0 ? '+' : '') + newExp.toString(); + return rounded.sign + str; + } + + /** + * Format a number with fixed notation. + * @param {number | string} value + * @param {number} [precision=undefined] Optional number of decimals after the + * decimal point. null by default. + */ + function toFixed$1(value, precision) { + if (isNaN(value) || !isFinite(value)) { + return String(value); + } + var splitValue = splitNumber(value); + var rounded = typeof precision === 'number' ? roundDigits(splitValue, splitValue.exponent + 1 + precision) : splitValue; + var c = rounded.coefficients; + var p = rounded.exponent + 1; // exponent may have changed + + // append zeros if needed + var pp = p + (precision || 0); + if (c.length < pp) { + c = c.concat(zeros(pp - c.length)); + } + + // prepend zeros if needed + if (p < 0) { + c = zeros(-p + 1).concat(c); + p = 1; + } + + // insert a dot if needed + if (p < c.length) { + c.splice(p, 0, p === 0 ? '0.' : '.'); + } + return rounded.sign + c.join(''); + } + + /** + * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3' + * @param {number | string} value + * @param {number} [precision] Number of digits in formatted output. + * If not provided, the maximum available digits + * is used. + */ + function toExponential$1(value, precision) { + if (isNaN(value) || !isFinite(value)) { + return String(value); + } + + // round if needed, else create a clone + var split = splitNumber(value); + var rounded = precision ? roundDigits(split, precision) : split; + var c = rounded.coefficients; + var e = rounded.exponent; + + // append zeros if needed + if (c.length < precision) { + c = c.concat(zeros(precision - c.length)); + } + + // format as `C.CCCe+EEE` or `C.CCCe-EEE` + var first = c.shift(); + return rounded.sign + first + (c.length > 0 ? '.' + c.join('') : '') + 'e' + (e >= 0 ? '+' : '') + e; + } + + /** + * Format a number with a certain precision + * @param {number | string} value + * @param {number} [precision=undefined] Optional number of digits. + * @param {{lowerExp: number | undefined, upperExp: number | undefined}} [options] + * By default: + * lowerExp = -3 (incl) + * upper = +5 (excl) + * @return {string} + */ + function toPrecision(value, precision, options) { + if (isNaN(value) || !isFinite(value)) { + return String(value); + } + + // determine lower and upper bound for exponential notation. + var lowerExp = _toNumberOrDefault$1(options === null || options === void 0 ? void 0 : options.lowerExp, -3); + var upperExp = _toNumberOrDefault$1(options === null || options === void 0 ? void 0 : options.upperExp, 5); + var split = splitNumber(value); + var rounded = precision ? roundDigits(split, precision) : split; + if (rounded.exponent < lowerExp || rounded.exponent >= upperExp) { + // exponential notation + return toExponential$1(value, precision); + } else { + var c = rounded.coefficients; + var e = rounded.exponent; + + // append trailing zeros + if (c.length < precision) { + c = c.concat(zeros(precision - c.length)); + } + + // append trailing zeros + // TODO: simplify the next statement + c = c.concat(zeros(e - c.length + 1 + (c.length < precision ? precision - c.length : 0))); + + // prepend zeros + c = zeros(-e).concat(c); + var dot = e > 0 ? e : 0; + if (dot < c.length - 1) { + c.splice(dot + 1, 0, '.'); + } + return rounded.sign + c.join(''); + } + } + + /** + * Round the number of digits of a number * + * @param {SplitValue} split A value split with .splitNumber(value) + * @param {number} precision A positive integer + * @return {SplitValue} + * Returns an object containing sign, coefficients, and exponent + * with rounded digits + */ + function roundDigits(split, precision) { + // create a clone + var rounded = { + sign: split.sign, + coefficients: split.coefficients, + exponent: split.exponent + }; + var c = rounded.coefficients; + + // prepend zeros if needed + while (precision <= 0) { + c.unshift(0); + rounded.exponent++; + precision++; + } + if (c.length > precision) { + var removed = c.splice(precision, c.length - precision); + if (removed[0] >= 5) { + var i = precision - 1; + c[i]++; + while (c[i] === 10) { + c.pop(); + if (i === 0) { + c.unshift(0); + rounded.exponent++; + i++; + } + i--; + c[i]++; + } + } + } + return rounded; + } + + /** + * Create an array filled with zeros. + * @param {number} length + * @return {Array} + */ + function zeros(length) { + var arr = []; + for (var i = 0; i < length; i++) { + arr.push(0); + } + return arr; + } + + /** + * Count the number of significant digits of a number. + * + * For example: + * 2.34 returns 3 + * 0.0034 returns 2 + * 120.5e+30 returns 4 + * + * @param {number} value + * @return {number} digits Number of significant digits + */ + function digits(value) { + return value.toExponential().replace(/e.*$/, '') // remove exponential notation + .replace(/^0\.?0*|\./, '') // remove decimal point and leading zeros + .length; + } + + /** + * Compares two floating point numbers. + * @param {number} a - First value to compare + * @param {number} b - Second value to compare + * @param {number} [relTol=1e-09] - The relative tolerance, indicating the maximum allowed difference relative to the larger absolute value. Must be greater than 0. + * @param {number} [absTol=1e-12] - The minimum absolute tolerance, useful for comparisons near zero. Must be at least 0. + * @return {boolean} whether the two numbers are nearly equal + * + * @throws {Error} If `relTol` is less than or equal to 0. + * @throws {Error} If `absTol` is less than 0. + * + * @example + * nearlyEqual(1.000000001, 1.0, 1e-8); // true + * nearlyEqual(1.000000002, 1.0, 0); // false + * nearlyEqual(1.0, 1.009, undefined, 0.01); // true + * nearlyEqual(0.000000001, 0.0, undefined, 1e-8); // true + */ + function nearlyEqual$1(a, b) { + var relTol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1e-8; + var absTol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + if (relTol <= 0) { + throw new Error('Relative tolerance must be greater than 0'); + } + if (absTol < 0) { + throw new Error('Absolute tolerance must be at least 0'); + } + + // NaN + if (isNaN(a) || isNaN(b)) { + return false; + } + if (!isFinite(a) || !isFinite(b)) { + return a === b; + } + if (a === b) { + return true; + } + + // abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) + return Math.abs(a - b) <= Math.max(relTol * Math.max(Math.abs(a), Math.abs(b)), absTol); + } + + /** + * Returns a value with the magnitude of x and the sign of y. + * @param {number} x + * @param {number} y + * @returns {number} + */ + function copysign(x, y) { + var signx = true ; + var signy = y > 0 ? true : y < 0 ? false : 1 / y === Infinity; + return signx ^ signy ? -6.283185307179586 : x; + } + function _toNumberOrThrow(value, onError) { + if (isNumber(value)) { + return value; + } else if (isBigNumber(value)) { + return value.toNumber(); + } else { + onError(); + } + } + function _toNumberOrDefault$1(value, defaultValue) { + if (isNumber(value)) { + return value; + } else if (isBigNumber(value)) { + return value.toNumber(); + } else { + return defaultValue; + } + } + + /** + * Create a typed-function which checks the types of the arguments and + * can match them against multiple provided signatures. The typed-function + * automatically converts inputs in order to find a matching signature. + * Typed functions throw informative errors in case of wrong input arguments. + * + * See the library [typed-function](https://github.com/josdejong/typed-function) + * for detailed documentation. + * + * Syntax: + * + * math.typed(name, signatures) : function + * math.typed(signatures) : function + * + * Examples: + * + * // create a typed function with multiple types per argument (type union) + * const fn2 = typed({ + * 'number | boolean': function (b) { + * return 'b is a number or boolean' + * }, + * 'string, number | boolean': function (a, b) { + * return 'a is a string, b is a number or boolean' + * } + * }) + * + * // create a typed function with an any type argument + * const log = typed({ + * 'string, any': function (event, data) { + * console.log('event: ' + event + ', data: ' + JSON.stringify(data)) + * } + * }) + * + * @param {string} [name] Optional name for the typed-function + * @param {Object} signatures Object with one or multiple function signatures + * @returns {function} The created typed-function. + */ + + + // returns a new instance of typed-function + var _createTyped2 = function _createTyped() { + // initially, return the original instance of typed-function + // consecutively, return a new instance from typed.create. + _createTyped2 = typedFunction.create; + return typedFunction; + }; + var dependencies$w = ['?BigNumber', '?Complex', '?DenseMatrix', '?Fraction']; + + /** + * Factory function for creating a new typed instance + * @param {Object} dependencies Object with data types like Complex and BigNumber + * @returns {Function} + */ + var createTyped = /* #__PURE__ */factory('typed', dependencies$w, function createTyped(_ref) { + var { + BigNumber, + Complex, + DenseMatrix, + Fraction + } = _ref; + // TODO: typed-function must be able to silently ignore signatures with unknown data types + + // get a new instance of typed-function + var typed = _createTyped2(); + + // define all types. The order of the types determines in which order function + // arguments are type-checked (so for performance it's important to put the + // most used types first). + typed.clear(); + typed.addTypes([{ + name: 'number', + test: isNumber + }, { + name: 'Complex', + test: isComplex + }, { + name: 'BigNumber', + test: isBigNumber + }, { + name: 'bigint', + test: isBigInt + }, { + name: 'Fraction', + test: isFraction + }, { + name: 'Unit', + test: isUnit + }, + // The following type matches a valid variable name, i.e., an alphanumeric + // string starting with an alphabetic character. It is used (at least) + // in the definition of the derivative() function, as the argument telling + // what to differentiate over must (currently) be a variable. + // TODO: deprecate the identifier type (it's not used anymore, see https://github.com/josdejong/mathjs/issues/3253) + { + name: 'identifier', + test: s => isString && /^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\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1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\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6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\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]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(s) + }, { + name: 'string', + test: isString + }, { + name: 'Chain', + test: isChain + }, { + name: 'Array', + test: isArray + }, { + name: 'Matrix', + test: isMatrix + }, { + name: 'DenseMatrix', + test: isDenseMatrix + }, { + name: 'SparseMatrix', + test: isSparseMatrix + }, { + name: 'Range', + test: isRange + }, { + name: 'Index', + test: isIndex + }, { + name: 'boolean', + test: isBoolean + }, { + name: 'ResultSet', + test: isResultSet + }, { + name: 'Help', + test: isHelp + }, { + name: 'function', + test: isFunction + }, { + name: 'Date', + test: isDate + }, { + name: 'RegExp', + test: isRegExp + }, { + name: 'null', + test: isNull + }, { + name: 'undefined', + test: isUndefined + }, { + name: 'AccessorNode', + test: isAccessorNode + }, { + name: 'ArrayNode', + test: isArrayNode + }, { + name: 'AssignmentNode', + test: isAssignmentNode + }, { + name: 'BlockNode', + test: isBlockNode + }, { + name: 'ConditionalNode', + test: isConditionalNode + }, { + name: 'ConstantNode', + test: isConstantNode + }, { + name: 'FunctionNode', + test: isFunctionNode + }, { + name: 'FunctionAssignmentNode', + test: isFunctionAssignmentNode + }, { + name: 'IndexNode', + test: isIndexNode + }, { + name: 'Node', + test: isNode$1 + }, { + name: 'ObjectNode', + test: isObjectNode + }, { + name: 'OperatorNode', + test: isOperatorNode + }, { + name: 'ParenthesisNode', + test: isParenthesisNode + }, { + name: 'RangeNode', + test: isRangeNode + }, { + name: 'RelationalNode', + test: isRelationalNode + }, { + name: 'SymbolNode', + test: isSymbolNode + }, { + name: 'Map', + test: isMap + }, { + name: 'Object', + test: isObject + } // order 'Object' last, it matches on other classes too + ]); + typed.addConversions([{ + from: 'number', + to: 'BigNumber', + convert: function convert(x) { + if (!BigNumber) { + throwNoBignumber(x); + } + + // note: conversion from number to BigNumber can fail if x has >15 digits + if (digits(x) > 15) { + throw new TypeError('Cannot implicitly convert a number with >15 significant digits to BigNumber ' + '(value: ' + x + '). ' + 'Use function bignumber(x) to convert to BigNumber.'); + } + return new BigNumber(x); + } + }, { + from: 'number', + to: 'Complex', + convert: function convert(x) { + if (!Complex) { + throwNoComplex(x); + } + return new Complex(x, 0); + } + }, { + from: 'BigNumber', + to: 'Complex', + convert: function convert(x) { + if (!Complex) { + throwNoComplex(x); + } + return new Complex(x.toNumber(), 0); + } + }, { + from: 'bigint', + to: 'number', + convert: function convert(x) { + if (x > Number.MAX_SAFE_INTEGER) { + throw new TypeError('Cannot implicitly convert bigint to number: ' + 'value exceeds the max safe integer value (value: ' + x + ')'); + } + return Number(x); + } + }, { + from: 'bigint', + to: 'BigNumber', + convert: function convert(x) { + if (!BigNumber) { + throwNoBignumber(x); + } + return new BigNumber(x.toString()); + } + }, { + from: 'bigint', + to: 'Fraction', + convert: function convert(x) { + if (!Fraction) { + throwNoFraction(x); + } + return new Fraction(x); + } + }, { + from: 'Fraction', + to: 'BigNumber', + convert: function convert(x) { + throw new TypeError('Cannot implicitly convert a Fraction to BigNumber or vice versa. ' + 'Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.'); + } + }, { + from: 'Fraction', + to: 'Complex', + convert: function convert(x) { + if (!Complex) { + throwNoComplex(x); + } + return new Complex(x.valueOf(), 0); + } + }, { + from: 'number', + to: 'Fraction', + convert: function convert(x) { + if (!Fraction) { + throwNoFraction(x); + } + var f = new Fraction(x); + if (f.valueOf() !== x) { + throw new TypeError('Cannot implicitly convert a number to a Fraction when there will be a loss of precision ' + '(value: ' + x + '). ' + 'Use function fraction(x) to convert to Fraction.'); + } + return f; + } + }, { + // FIXME: add conversion from Fraction to number, for example for `sqrt(fraction(1,3))` + // from: 'Fraction', + // to: 'number', + // convert: function (x) { + // return x.valueOf() + // } + // }, { + from: 'string', + to: 'number', + convert: function convert(x) { + var n = Number(x); + if (isNaN(n)) { + throw new Error('Cannot convert "' + x + '" to a number'); + } + return n; + } + }, { + from: 'string', + to: 'BigNumber', + convert: function convert(x) { + if (!BigNumber) { + throwNoBignumber(x); + } + try { + return new BigNumber(x); + } catch (err) { + throw new Error('Cannot convert "' + x + '" to BigNumber'); + } + } + }, { + from: 'string', + to: 'bigint', + convert: function convert(x) { + try { + return BigInt(x); + } catch (err) { + throw new Error('Cannot convert "' + x + '" to BigInt'); + } + } + }, { + from: 'string', + to: 'Fraction', + convert: function convert(x) { + if (!Fraction) { + throwNoFraction(x); + } + try { + return new Fraction(x); + } catch (err) { + throw new Error('Cannot convert "' + x + '" to Fraction'); + } + } + }, { + from: 'string', + to: 'Complex', + convert: function convert(x) { + if (!Complex) { + throwNoComplex(x); + } + try { + return new Complex(x); + } catch (err) { + throw new Error('Cannot convert "' + x + '" to Complex'); + } + } + }, { + from: 'boolean', + to: 'number', + convert: function convert(x) { + return +x; + } + }, { + from: 'boolean', + to: 'BigNumber', + convert: function convert(x) { + if (!BigNumber) { + throwNoBignumber(x); + } + return new BigNumber(+x); + } + }, { + from: 'boolean', + to: 'bigint', + convert: function convert(x) { + return BigInt(+x); + } + }, { + from: 'boolean', + to: 'Fraction', + convert: function convert(x) { + if (!Fraction) { + throwNoFraction(x); + } + return new Fraction(+x); + } + }, { + from: 'boolean', + to: 'string', + convert: function convert(x) { + return String(x); + } + }, { + from: 'Array', + to: 'Matrix', + convert: function convert(array) { + if (!DenseMatrix) { + throwNoMatrix(); + } + return new DenseMatrix(array); + } + }, { + from: 'Matrix', + to: 'Array', + convert: function convert(matrix) { + return matrix.valueOf(); + } + }]); + + // Provide a suggestion on how to call a function elementwise + // This was added primarily as guidance for the v10 -> v11 transition, + // and could potentially be removed in the future if it no longer seems + // to be helpful. + typed.onMismatch = (name, args, signatures) => { + var usualError = typed.createError(name, args, signatures); + if (['wrongType', 'mismatch'].includes(usualError.data.category) && args.length === 1 && isCollection(args[0]) && + // check if the function can be unary: + signatures.some(sig => !sig.params.includes(','))) { + var err = new TypeError("Function '".concat(name, "' doesn't apply to matrices. To call it ") + "elementwise on a matrix 'M', try 'map(M, ".concat(name, ")'.")); + err.data = usualError.data; + throw err; + } + throw usualError; + }; + + // Provide a suggestion on how to call a function elementwise + // This was added primarily as guidance for the v10 -> v11 transition, + // and could potentially be removed in the future if it no longer seems + // to be helpful. + typed.onMismatch = (name, args, signatures) => { + var usualError = typed.createError(name, args, signatures); + if (['wrongType', 'mismatch'].includes(usualError.data.category) && args.length === 1 && isCollection(args[0]) && + // check if the function can be unary: + signatures.some(sig => !sig.params.includes(','))) { + var err = new TypeError("Function '".concat(name, "' doesn't apply to matrices. To call it ") + "elementwise on a matrix 'M', try 'map(M, ".concat(name, ")'.")); + err.data = usualError.data; + throw err; + } + throw usualError; + }; + return typed; + }); + function throwNoBignumber(x) { + throw new Error("Cannot convert value ".concat(x, " into a BigNumber: no class 'BigNumber' provided")); + } + function throwNoComplex(x) { + throw new Error("Cannot convert value ".concat(x, " into a Complex number: no class 'Complex' provided")); + } + function throwNoMatrix() { + throw new Error('Cannot convert array into a Matrix: no class \'DenseMatrix\' provided'); + } + function throwNoFraction(x) { + throw new Error("Cannot convert value ".concat(x, " into a Fraction, no class 'Fraction' provided.")); + } + + /*! + * decimal.js v10.5.0 + * An arbitrary-precision Decimal type for JavaScript. + * https://github.com/MikeMcl/decimal.js + * Copyright (c) 2025 Michael Mclaughlin + * MIT Licence + */ + + + // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ // + + + // The maximum exponent magnitude. + // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`. + var EXP_LIMIT = 9e15, // 0 to 9e15 + + // The limit on the value of `precision`, and on the value of the first argument to + // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`. + MAX_DIGITS = 1e9, // 0 to 1e9 + + // Base conversion alphabet. + NUMERALS = '0123456789abcdef', + + // The natural logarithm of 10 (1025 digits). + LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058', + + // Pi (1025 digits). + PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789', + + + // The initial configuration properties of the Decimal constructor. + DEFAULTS = { + + // These values must be integers within the stated ranges (inclusive). + // Most of these values can be changed at run-time using the `Decimal.config` method. + + // The maximum number of significant digits of the result of a calculation or base conversion. + // E.g. `Decimal.config({ precision: 20 });` + precision: 20, // 1 to MAX_DIGITS + + // The rounding mode used when rounding to `precision`. + // + // ROUND_UP 0 Away from zero. + // ROUND_DOWN 1 Towards zero. + // ROUND_CEIL 2 Towards +Infinity. + // ROUND_FLOOR 3 Towards -Infinity. + // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. + // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + // + // E.g. + // `Decimal.rounding = 4;` + // `Decimal.rounding = Decimal.ROUND_HALF_UP;` + rounding: 4, // 0 to 8 + + // The modulo mode used when calculating the modulus: a mod n. + // The quotient (q = a / n) is calculated according to the corresponding rounding mode. + // The remainder (r) is calculated as: r = a - n * q. + // + // UP 0 The remainder is positive if the dividend is negative, else is negative. + // DOWN 1 The remainder has the same sign as the dividend (JavaScript %). + // FLOOR 3 The remainder has the same sign as the divisor (Python %). + // HALF_EVEN 6 The IEEE 754 remainder function. + // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive. + // + // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian + // division (9) are commonly used for the modulus operation. The other rounding modes can also + // be used, but they may not give useful results. + modulo: 1, // 0 to 9 + + // The exponent value at and beneath which `toString` returns exponential notation. + // JavaScript numbers: -7 + toExpNeg: -7, // 0 to -EXP_LIMIT + + // The exponent value at and above which `toString` returns exponential notation. + // JavaScript numbers: 21 + toExpPos: 21, // 0 to EXP_LIMIT + + // The minimum exponent value, beneath which underflow to zero occurs. + // JavaScript numbers: -324 (5e-324) + minE: -9e15, // -1 to -EXP_LIMIT + + // The maximum exponent value, above which overflow to Infinity occurs. + // JavaScript numbers: 308 (1.7976931348623157e+308) + maxE: EXP_LIMIT, // 1 to EXP_LIMIT + + // Whether to use cryptographically-secure random number generation, if available. + crypto: false // true/false + }, + + + // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- // + + + inexact, quadrant, + external = true, + + decimalError = '[DecimalError] ', + invalidArgument = decimalError + 'Invalid argument: ', + precisionLimitExceeded = decimalError + 'Precision limit exceeded', + cryptoUnavailable = decimalError + 'crypto unavailable', + tag = '[object Decimal]', + + mathfloor = Math.floor, + mathpow = Math.pow, + + isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, + isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, + isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, + isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, + + BASE = 1e7, + LOG_BASE = 7, + MAX_SAFE_INTEGER = 9007199254740991, + + LN10_PRECISION = LN10.length - 1, + PI_PRECISION = PI.length - 1, + + // Decimal.prototype object + P$3 = { toStringTag: tag }; + + + // Decimal prototype methods + + + /* + * absoluteValue abs + * ceil + * clampedTo clamp + * comparedTo cmp + * cosine cos + * cubeRoot cbrt + * decimalPlaces dp + * dividedBy div + * dividedToIntegerBy divToInt + * equals eq + * floor + * greaterThan gt + * greaterThanOrEqualTo gte + * hyperbolicCosine cosh + * hyperbolicSine sinh + * hyperbolicTangent tanh + * inverseCosine acos + * inverseHyperbolicCosine acosh + * inverseHyperbolicSine asinh + * inverseHyperbolicTangent atanh + * inverseSine asin + * inverseTangent atan + * isFinite + * isInteger isInt + * isNaN + * isNegative isNeg + * isPositive isPos + * isZero + * lessThan lt + * lessThanOrEqualTo lte + * logarithm log + * [maximum] [max] + * [minimum] [min] + * minus sub + * modulo mod + * naturalExponential exp + * naturalLogarithm ln + * negated neg + * plus add + * precision sd + * round + * sine sin + * squareRoot sqrt + * tangent tan + * times mul + * toBinary + * toDecimalPlaces toDP + * toExponential + * toFixed + * toFraction + * toHexadecimal toHex + * toNearest + * toNumber + * toOctal + * toPower pow + * toPrecision + * toSignificantDigits toSD + * toString + * truncated trunc + * valueOf toJSON + */ + + + /* + * Return a new Decimal whose value is the absolute value of this Decimal. + * + */ + P$3.absoluteValue = P$3.abs = function () { + var x = new this.constructor(this); + if (x.s < 0) x.s = 1; + return finalise(x); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the + * direction of positive Infinity. + * + */ + P$3.ceil = function () { + return finalise(new this.constructor(this), this.e + 1, 2); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal clamped to the range + * delineated by `min` and `max`. + * + * min {number|string|bigint|Decimal} + * max {number|string|bigint|Decimal} + * + */ + P$3.clampedTo = P$3.clamp = function (min, max) { + var k, + x = this, + Ctor = x.constructor; + min = new Ctor(min); + max = new Ctor(max); + if (!min.s || !max.s) return new Ctor(NaN); + if (min.gt(max)) throw Error(invalidArgument + max); + k = x.cmp(min); + return k < 0 ? min : x.cmp(max) > 0 ? max : new Ctor(x); + }; + + + /* + * Return + * 1 if the value of this Decimal is greater than the value of `y`, + * -1 if the value of this Decimal is less than the value of `y`, + * 0 if they have the same value, + * NaN if the value of either Decimal is NaN. + * + */ + P$3.comparedTo = P$3.cmp = function (y) { + var i, j, xdL, ydL, + x = this, + xd = x.d, + yd = (y = new x.constructor(y)).d, + xs = x.s, + ys = y.s; + + // Either NaN or ±Infinity? + if (!xd || !yd) { + return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1; + } + + // Either zero? + if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0; + + // Signs differ? + if (xs !== ys) return xs; + + // Compare exponents. + if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1; + + xdL = xd.length; + ydL = yd.length; + + // Compare digit by digit. + for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { + if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1; + } + + // Compare lengths. + return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1; + }; + + + /* + * Return a new Decimal whose value is the cosine of the value in radians of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-1, 1] + * + * cos(0) = 1 + * cos(-0) = 1 + * cos(Infinity) = NaN + * cos(-Infinity) = NaN + * cos(NaN) = NaN + * + */ + P$3.cosine = P$3.cos = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.d) return new Ctor(NaN); + + // cos(0) = cos(-0) = 1 + if (!x.d[0]) return new Ctor(1); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + + x = cosine(Ctor, toLessThanHalfPi(Ctor, x)); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true); + }; + + + /* + * + * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * cbrt(0) = 0 + * cbrt(-0) = -0 + * cbrt(1) = 1 + * cbrt(-1) = -1 + * cbrt(N) = N + * cbrt(-I) = -I + * cbrt(I) = I + * + * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3)) + * + */ + P$3.cubeRoot = P$3.cbrt = function () { + var e, m, n, r, rep, s, sd, t, t3, t3plusx, + x = this, + Ctor = x.constructor; + + if (!x.isFinite() || x.isZero()) return new Ctor(x); + external = false; + + // Initial estimate. + s = x.s * mathpow(x.s * x, 1 / 3); + + // Math.cbrt underflow/overflow? + // Pass x to Math.pow as integer, then adjust the exponent of the result. + if (!s || Math.abs(s) == 1 / 0) { + n = digitsToString(x.d); + e = x.e; + + // Adjust n exponent so it is a multiple of 3 away from x exponent. + if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00'); + s = mathpow(n, 1 / 3); + + // Rarely, e may be one less than the result exponent value. + e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)); + + if (s == 1 / 0) { + n = '5e' + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf('e') + 1) + e; + } + + r = new Ctor(n); + r.s = x.s; + } else { + r = new Ctor(s.toString()); + } + + sd = (e = Ctor.precision) + 3; + + // Halley's method. + // TODO? Compare Newton's method. + for (;;) { + t = r; + t3 = t.times(t).times(t); + t3plusx = t3.plus(x); + r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1); + + // TODO? Replace with for-loop and checkRoundingDigits. + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + + // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999 + // , i.e. approaching a rounding boundary, continue the iteration. + if (n == '9999' || !rep && n == '4999') { + + // On the first iteration only, check to see if rounding up gives the exact result as the + // nines may infinitely repeat. + if (!rep) { + finalise(t, e + 1, 0); + + if (t.times(t).times(t).eq(x)) { + r = t; + break; + } + } + + sd += 4; + rep = 1; + } else { + + // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. + // If not, then there are further digits and m will be truthy. + if (!+n || !+n.slice(1) && n.charAt(0) == '5') { + + // Truncate to the first rounding digit. + finalise(r, e + 1, 1); + m = !r.times(r).times(r).eq(x); + } + + break; + } + } + } + + external = true; + + return finalise(r, e, Ctor.rounding, m); + }; + + + /* + * Return the number of decimal places of the value of this Decimal. + * + */ + P$3.decimalPlaces = P$3.dp = function () { + var w, + d = this.d, + n = NaN; + + if (d) { + w = d.length - 1; + n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE; + + // Subtract the number of trailing zeros of the last word. + w = d[w]; + if (w) for (; w % 10 == 0; w /= 10) n--; + if (n < 0) n = 0; + } + + return n; + }; + + + /* + * n / 0 = I + * n / N = N + * n / I = 0 + * 0 / n = 0 + * 0 / 0 = N + * 0 / N = N + * 0 / I = 0 + * N / n = N + * N / 0 = N + * N / N = N + * N / I = N + * I / n = I + * I / 0 = I + * I / N = N + * I / I = N + * + * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + */ + P$3.dividedBy = P$3.div = function (y) { + return divide(this, new this.constructor(y)); + }; + + + /* + * Return a new Decimal whose value is the integer part of dividing the value of this Decimal + * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`. + * + */ + P$3.dividedToIntegerBy = P$3.divToInt = function (y) { + var x = this, + Ctor = x.constructor; + return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding); + }; + + + /* + * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false. + * + */ + P$3.equals = P$3.eq = function (y) { + return this.cmp(y) === 0; + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the + * direction of negative Infinity. + * + */ + P$3.floor = function () { + return finalise(new this.constructor(this), this.e + 1, 3); + }; + + + /* + * Return true if the value of this Decimal is greater than the value of `y`, otherwise return + * false. + * + */ + P$3.greaterThan = P$3.gt = function (y) { + return this.cmp(y) > 0; + }; + + + /* + * Return true if the value of this Decimal is greater than or equal to the value of `y`, + * otherwise return false. + * + */ + P$3.greaterThanOrEqualTo = P$3.gte = function (y) { + var k = this.cmp(y); + return k == 1 || k === 0; + }; + + + /* + * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [1, Infinity] + * + * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ... + * + * cosh(0) = 1 + * cosh(-0) = 1 + * cosh(Infinity) = Infinity + * cosh(-Infinity) = Infinity + * cosh(NaN) = NaN + * + * x time taken (ms) result + * 1000 9 9.8503555700852349694e+433 + * 10000 25 4.4034091128314607936e+4342 + * 100000 171 1.4033316802130615897e+43429 + * 1000000 3817 1.5166076984010437725e+434294 + * 10000000 abandoned after 2 minute wait + * + * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x)) + * + */ + P$3.hyperbolicCosine = P$3.cosh = function () { + var k, n, pr, rm, len, + x = this, + Ctor = x.constructor, + one = new Ctor(1); + + if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN); + if (x.isZero()) return one; + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + + // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1 + // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4)) + + // Estimate the optimum number of times to use the argument reduction. + // TODO? Estimation reused from cosine() and may not be optimal here. + if (len < 32) { + k = Math.ceil(len / 3); + n = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + n = '2.3283064365386962890625e-10'; + } + + x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true); + + // Reverse argument reduction + var cosh2_x, + i = k, + d8 = new Ctor(8); + for (; i--;) { + cosh2_x = x.times(x); + x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); + } + + return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + + + /* + * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-Infinity, Infinity] + * + * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ... + * + * sinh(0) = 0 + * sinh(-0) = -0 + * sinh(Infinity) = Infinity + * sinh(-Infinity) = -Infinity + * sinh(NaN) = NaN + * + * x time taken (ms) + * 10 2 ms + * 100 5 ms + * 1000 14 ms + * 10000 82 ms + * 100000 886 ms 1.4033316802130615897e+43429 + * 200000 2613 ms + * 300000 5407 ms + * 400000 8824 ms + * 500000 13026 ms 8.7080643612718084129e+217146 + * 1000000 48543 ms + * + * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x)) + * + */ + P$3.hyperbolicSine = P$3.sinh = function () { + var k, pr, rm, len, + x = this, + Ctor = x.constructor; + + if (!x.isFinite() || x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + + if (len < 3) { + x = taylorSeries(Ctor, 2, x, x, true); + } else { + + // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x)) + // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3)) + // 3 multiplications and 1 addition + + // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x))) + // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5))) + // 4 multiplications and 2 additions + + // Estimate the optimum number of times to use the argument reduction. + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x, true); + + // Reverse argument reduction + var sinh2_x, + d5 = new Ctor(5), + d16 = new Ctor(16), + d20 = new Ctor(20); + for (; k--;) { + sinh2_x = x.times(x); + x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20)))); + } + } + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(x, pr, rm, true); + }; + + + /* + * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-1, 1] + * + * tanh(x) = sinh(x) / cosh(x) + * + * tanh(0) = 0 + * tanh(-0) = -0 + * tanh(Infinity) = 1 + * tanh(-Infinity) = -1 + * tanh(NaN) = NaN + * + */ + P$3.hyperbolicTangent = P$3.tanh = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(x.s); + if (x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 7; + Ctor.rounding = 1; + + return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm); + }; + + + /* + * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of + * this Decimal. + * + * Domain: [-1, 1] + * Range: [0, pi] + * + * acos(x) = pi/2 - asin(x) + * + * acos(0) = pi/2 + * acos(-0) = pi/2 + * acos(1) = 0 + * acos(-1) = pi + * acos(1/2) = pi/3 + * acos(-1/2) = 2*pi/3 + * acos(|x| > 1) = NaN + * acos(NaN) = NaN + * + */ + P$3.inverseCosine = P$3.acos = function () { + var x = this, + Ctor = x.constructor, + k = x.abs().cmp(1), + pr = Ctor.precision, + rm = Ctor.rounding; + + if (k !== -1) { + return k === 0 + // |x| is 1 + ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) + // |x| > 1 or x is NaN + : new Ctor(NaN); + } + + if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5); + + // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3 + + Ctor.precision = pr + 6; + Ctor.rounding = 1; + + // See https://github.com/MikeMcl/decimal.js/pull/217 + x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan(); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.times(2); + }; + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the + * value of this Decimal. + * + * Domain: [1, Infinity] + * Range: [0, Infinity] + * + * acosh(x) = ln(x + sqrt(x^2 - 1)) + * + * acosh(x < 1) = NaN + * acosh(NaN) = NaN + * acosh(Infinity) = Infinity + * acosh(-Infinity) = NaN + * acosh(0) = NaN + * acosh(-0) = NaN + * acosh(1) = 0 + * acosh(-1) = NaN + * + */ + P$3.inverseHyperbolicCosine = P$3.acosh = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN); + if (!x.isFinite()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4; + Ctor.rounding = 1; + external = false; + + x = x.times(x).minus(1).sqrt().plus(x); + + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.ln(); + }; + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value + * of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-Infinity, Infinity] + * + * asinh(x) = ln(x + sqrt(x^2 + 1)) + * + * asinh(NaN) = NaN + * asinh(Infinity) = Infinity + * asinh(-Infinity) = -Infinity + * asinh(0) = 0 + * asinh(-0) = -0 + * + */ + P$3.inverseHyperbolicSine = P$3.asinh = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite() || x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6; + Ctor.rounding = 1; + external = false; + + x = x.times(x).plus(1).sqrt().plus(x); + + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.ln(); + }; + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the + * value of this Decimal. + * + * Domain: [-1, 1] + * Range: [-Infinity, Infinity] + * + * atanh(x) = 0.5 * ln((1 + x) / (1 - x)) + * + * atanh(|x| > 1) = NaN + * atanh(NaN) = NaN + * atanh(Infinity) = NaN + * atanh(-Infinity) = NaN + * atanh(0) = 0 + * atanh(-0) = -0 + * atanh(1) = Infinity + * atanh(-1) = -Infinity + * + */ + P$3.inverseHyperbolicTangent = P$3.atanh = function () { + var pr, rm, wpr, xsd, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(NaN); + if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN); + + pr = Ctor.precision; + rm = Ctor.rounding; + xsd = x.sd(); + + if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true); + + Ctor.precision = wpr = xsd - x.e; + + x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1); + + Ctor.precision = pr + 4; + Ctor.rounding = 1; + + x = x.ln(); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.times(0.5); + }; + + + /* + * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this + * Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-pi/2, pi/2] + * + * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2))) + * + * asin(0) = 0 + * asin(-0) = -0 + * asin(1/2) = pi/6 + * asin(-1/2) = -pi/6 + * asin(1) = pi/2 + * asin(-1) = -pi/2 + * asin(|x| > 1) = NaN + * asin(NaN) = NaN + * + * TODO? Compare performance of Taylor series. + * + */ + P$3.inverseSine = P$3.asin = function () { + var halfPi, k, + pr, rm, + x = this, + Ctor = x.constructor; + + if (x.isZero()) return new Ctor(x); + + k = x.abs().cmp(1); + pr = Ctor.precision; + rm = Ctor.rounding; + + if (k !== -1) { + + // |x| is 1 + if (k === 0) { + halfPi = getPi(Ctor, pr + 4, rm).times(0.5); + halfPi.s = x.s; + return halfPi; + } + + // |x| > 1 or x is NaN + return new Ctor(NaN); + } + + // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6 + + Ctor.precision = pr + 6; + Ctor.rounding = 1; + + x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan(); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return x.times(2); + }; + + + /* + * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value + * of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-pi/2, pi/2] + * + * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... + * + * atan(0) = 0 + * atan(-0) = -0 + * atan(1) = pi/4 + * atan(-1) = -pi/4 + * atan(Infinity) = pi/2 + * atan(-Infinity) = -pi/2 + * atan(NaN) = NaN + * + */ + P$3.inverseTangent = P$3.atan = function () { + var i, j, k, n, px, t, r, wpr, x2, + x = this, + Ctor = x.constructor, + pr = Ctor.precision, + rm = Ctor.rounding; + + if (!x.isFinite()) { + if (!x.s) return new Ctor(NaN); + if (pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.5); + r.s = x.s; + return r; + } + } else if (x.isZero()) { + return new Ctor(x); + } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.25); + r.s = x.s; + return r; + } + + Ctor.precision = wpr = pr + 10; + Ctor.rounding = 1; + + // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x); + + // Argument reduction + // Ensure |x| < 0.42 + // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2))) + + k = Math.min(28, wpr / LOG_BASE + 2 | 0); + + for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1)); + + external = false; + + j = Math.ceil(wpr / LOG_BASE); + n = 1; + x2 = x.times(x); + r = new Ctor(x); + px = x; + + // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... + for (; i !== -1;) { + px = px.times(x2); + t = r.minus(px.div(n += 2)); + + px = px.times(x2); + r = t.plus(px.div(n += 2)); + + if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;); + } + + if (k) r = r.times(2 << (k - 1)); + + external = true; + + return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + + + /* + * Return true if the value of this Decimal is a finite number, otherwise return false. + * + */ + P$3.isFinite = function () { + return !!this.d; + }; + + + /* + * Return true if the value of this Decimal is an integer, otherwise return false. + * + */ + P$3.isInteger = P$3.isInt = function () { + return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2; + }; + + + /* + * Return true if the value of this Decimal is NaN, otherwise return false. + * + */ + P$3.isNaN = function () { + return !this.s; + }; + + + /* + * Return true if the value of this Decimal is negative, otherwise return false. + * + */ + P$3.isNegative = P$3.isNeg = function () { + return this.s < 0; + }; + + + /* + * Return true if the value of this Decimal is positive, otherwise return false. + * + */ + P$3.isPositive = P$3.isPos = function () { + return this.s > 0; + }; + + + /* + * Return true if the value of this Decimal is 0 or -0, otherwise return false. + * + */ + P$3.isZero = function () { + return !!this.d && this.d[0] === 0; + }; + + + /* + * Return true if the value of this Decimal is less than `y`, otherwise return false. + * + */ + P$3.lessThan = P$3.lt = function (y) { + return this.cmp(y) < 0; + }; + + + /* + * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false. + * + */ + P$3.lessThanOrEqualTo = P$3.lte = function (y) { + return this.cmp(y) < 1; + }; + + + /* + * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * If no base is specified, return log[10](arg). + * + * log[base](arg) = ln(arg) / ln(base) + * + * The result will always be correctly rounded if the base of the log is 10, and 'almost always' + * otherwise: + * + * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen + * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error + * between the result and the correctly rounded result will be one ulp (unit in the last place). + * + * log[-b](a) = NaN + * log[0](a) = NaN + * log[1](a) = NaN + * log[NaN](a) = NaN + * log[Infinity](a) = NaN + * log[b](0) = -Infinity + * log[b](-0) = -Infinity + * log[b](-a) = NaN + * log[b](1) = 0 + * log[b](Infinity) = Infinity + * log[b](NaN) = NaN + * + * [base] {number|string|bigint|Decimal} The base of the logarithm. + * + */ + P$3.logarithm = P$3.log = function (base) { + var isBase10, d, denominator, k, inf, num, sd, r, + arg = this, + Ctor = arg.constructor, + pr = Ctor.precision, + rm = Ctor.rounding, + guard = 5; + + // Default base is 10. + if (base == null) { + base = new Ctor(10); + isBase10 = true; + } else { + base = new Ctor(base); + d = base.d; + + // Return NaN if base is negative, or non-finite, or is 0 or 1. + if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN); + + isBase10 = base.eq(10); + } + + d = arg.d; + + // Is arg negative, non-finite, 0 or 1? + if (arg.s < 0 || !d || !d[0] || arg.eq(1)) { + return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0); + } + + // The result will have a non-terminating decimal expansion if base is 10 and arg is not an + // integer power of 10. + if (isBase10) { + if (d.length > 1) { + inf = true; + } else { + for (k = d[0]; k % 10 === 0;) k /= 10; + inf = k !== 1; + } + } + + external = false; + sd = pr + guard; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + + // The result will have 5 rounding digits. + r = divide(num, denominator, sd, 1); + + // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000, + // calculate 10 further digits. + // + // If the result is known to have an infinite decimal expansion, repeat this until it is clear + // that the result is above or below the boundary. Otherwise, if after calculating the 10 + // further digits, the last 14 are nines, round up and assume the result is exact. + // Also assume the result is exact if the last 14 are zero. + // + // Example of a result that will be incorrectly rounded: + // log[1048576](4503599627370502) = 2.60000000000000009610279511444746... + // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it + // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so + // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal + // place is still 2.6. + if (checkRoundingDigits(r.d, k = pr, rm)) { + + do { + sd += 10; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + r = divide(num, denominator, sd, 1); + + if (!inf) { + + // Check for 14 nines from the 2nd rounding digit, as the first may be 4. + if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + + break; + } + } while (checkRoundingDigits(r.d, k += 10, rm)); + } + + external = true; + + return finalise(r, pr, rm); + }; + + + /* + * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal. + * + * arguments {number|string|bigint|Decimal} + * + P.max = function () { + Array.prototype.push.call(arguments, this); + return maxOrMin(this.constructor, arguments, -1); + }; + */ + + + /* + * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal. + * + * arguments {number|string|bigint|Decimal} + * + P.min = function () { + Array.prototype.push.call(arguments, this); + return maxOrMin(this.constructor, arguments, 1); + }; + */ + + + /* + * n - 0 = n + * n - N = N + * n - I = -I + * 0 - n = -n + * 0 - 0 = 0 + * 0 - N = N + * 0 - I = -I + * N - n = N + * N - 0 = N + * N - N = N + * N - I = N + * I - n = I + * I - 0 = I + * I - N = N + * I - I = N + * + * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + */ + P$3.minus = P$3.sub = function (y) { + var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd, + x = this, + Ctor = x.constructor; + + y = new Ctor(y); + + // If either is not finite... + if (!x.d || !y.d) { + + // Return NaN if either is NaN. + if (!x.s || !y.s) y = new Ctor(NaN); + + // Return y negated if x is finite and y is ±Infinity. + else if (x.d) y.s = -y.s; + + // Return x if y is finite and x is ±Infinity. + // Return x if both are ±Infinity with different signs. + // Return NaN if both are ±Infinity with the same sign. + else y = new Ctor(y.d || x.s !== y.s ? x : NaN); + + return y; + } + + // If signs differ... + if (x.s != y.s) { + y.s = -y.s; + return x.plus(y); + } + + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + + // If either is zero... + if (!xd[0] || !yd[0]) { + + // Return y negated if x is zero and y is non-zero. + if (yd[0]) y.s = -y.s; + + // Return x if y is zero and x is non-zero. + else if (xd[0]) y = new Ctor(x); + + // Return zero if both are zero. + // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity. + else return new Ctor(rm === 3 ? -0 : 0); + + return external ? finalise(y, pr, rm) : y; + } + + // x and y are finite, non-zero numbers with the same sign. + + // Calculate base 1e7 exponents. + e = mathfloor(y.e / LOG_BASE); + xe = mathfloor(x.e / LOG_BASE); + + xd = xd.slice(); + k = xe - e; + + // If base 1e7 exponents differ... + if (k) { + xLTy = k < 0; + + if (xLTy) { + d = xd; + k = -k; + len = yd.length; + } else { + d = yd; + e = xe; + len = xd.length; + } + + // Numbers with massively different exponents would result in a very high number of + // zeros needing to be prepended, but this can be avoided while still ensuring correct + // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`. + i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; + + if (k > i) { + k = i; + d.length = 1; + } + + // Prepend zeros to equalise exponents. + d.reverse(); + for (i = k; i--;) d.push(0); + d.reverse(); + + // Base 1e7 exponents equal. + } else { + + // Check digits to determine which is the bigger number. + + i = xd.length; + len = yd.length; + xLTy = i < len; + if (xLTy) len = i; + + for (i = 0; i < len; i++) { + if (xd[i] != yd[i]) { + xLTy = xd[i] < yd[i]; + break; + } + } + + k = 0; + } + + if (xLTy) { + d = xd; + xd = yd; + yd = d; + y.s = -y.s; + } + + len = xd.length; + + // Append zeros to `xd` if shorter. + // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length. + for (i = yd.length - len; i > 0; --i) xd[len++] = 0; + + // Subtract yd from xd. + for (i = yd.length; i > k;) { + + if (xd[--i] < yd[i]) { + for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1; + --xd[j]; + xd[i] += BASE; + } + + xd[i] -= yd[i]; + } + + // Remove trailing zeros. + for (; xd[--len] === 0;) xd.pop(); + + // Remove leading zeros and adjust exponent accordingly. + for (; xd[0] === 0; xd.shift()) --e; + + // Zero? + if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0); + + y.d = xd; + y.e = getBase10Exponent(xd, e); + + return external ? finalise(y, pr, rm) : y; + }; + + + /* + * n % 0 = N + * n % N = N + * n % I = n + * 0 % n = 0 + * -0 % n = -0 + * 0 % 0 = N + * 0 % N = N + * 0 % I = 0 + * N % n = N + * N % 0 = N + * N % N = N + * N % I = N + * I % n = N + * I % 0 = N + * I % N = N + * I % I = N + * + * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * The result depends on the modulo mode. + * + */ + P$3.modulo = P$3.mod = function (y) { + var q, + x = this, + Ctor = x.constructor; + + y = new Ctor(y); + + // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0. + if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN); + + // Return x if y is ±Infinity or x is ±0. + if (!y.d || x.d && !x.d[0]) { + return finalise(new Ctor(x), Ctor.precision, Ctor.rounding); + } + + // Prevent rounding of intermediate calculations. + external = false; + + if (Ctor.modulo == 9) { + + // Euclidian division: q = sign(y) * floor(x / abs(y)) + // result = x - q * y where 0 <= result < abs(y) + q = divide(x, y.abs(), 0, 3, 1); + q.s *= y.s; + } else { + q = divide(x, y, 0, Ctor.modulo, 1); + } + + q = q.times(y); + + external = true; + + return x.minus(q); + }; + + + /* + * Return a new Decimal whose value is the natural exponential of the value of this Decimal, + * i.e. the base e raised to the power the value of this Decimal, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + */ + P$3.naturalExponential = P$3.exp = function () { + return naturalExponential(this); + }; + + + /* + * Return a new Decimal whose value is the natural logarithm of the value of this Decimal, + * rounded to `precision` significant digits using rounding mode `rounding`. + * + */ + P$3.naturalLogarithm = P$3.ln = function () { + return naturalLogarithm(this); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by + * -1. + * + */ + P$3.negated = P$3.neg = function () { + var x = new this.constructor(this); + x.s = -x.s; + return finalise(x); + }; + + + /* + * n + 0 = n + * n + N = N + * n + I = I + * 0 + n = n + * 0 + 0 = 0 + * 0 + N = N + * 0 + I = I + * N + n = N + * N + 0 = N + * N + N = N + * N + I = N + * I + n = I + * I + 0 = I + * I + N = N + * I + I = I + * + * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + */ + P$3.plus = P$3.add = function (y) { + var carry, d, e, i, k, len, pr, rm, xd, yd, + x = this, + Ctor = x.constructor; + + y = new Ctor(y); + + // If either is not finite... + if (!x.d || !y.d) { + + // Return NaN if either is NaN. + if (!x.s || !y.s) y = new Ctor(NaN); + + // Return x if y is finite and x is ±Infinity. + // Return x if both are ±Infinity with the same sign. + // Return NaN if both are ±Infinity with different signs. + // Return y if x is finite and y is ±Infinity. + else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN); + + return y; + } + + // If signs differ... + if (x.s != y.s) { + y.s = -y.s; + return x.minus(y); + } + + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + + // If either is zero... + if (!xd[0] || !yd[0]) { + + // Return x if y is zero. + // Return y if y is non-zero. + if (!yd[0]) y = new Ctor(x); + + return external ? finalise(y, pr, rm) : y; + } + + // x and y are finite, non-zero numbers with the same sign. + + // Calculate base 1e7 exponents. + k = mathfloor(x.e / LOG_BASE); + e = mathfloor(y.e / LOG_BASE); + + xd = xd.slice(); + i = k - e; + + // If base 1e7 exponents differ... + if (i) { + + if (i < 0) { + d = xd; + i = -i; + len = yd.length; + } else { + d = yd; + e = k; + len = xd.length; + } + + // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1. + k = Math.ceil(pr / LOG_BASE); + len = k > len ? k + 1 : len + 1; + + if (i > len) { + i = len; + d.length = 1; + } + + // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts. + d.reverse(); + for (; i--;) d.push(0); + d.reverse(); + } + + len = xd.length; + i = yd.length; + + // If yd is longer than xd, swap xd and yd so xd points to the longer array. + if (len - i < 0) { + i = len; + d = yd; + yd = xd; + xd = d; + } + + // Only start adding at yd.length - 1 as the further digits of xd can be left as they are. + for (carry = 0; i;) { + carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; + xd[i] %= BASE; + } + + if (carry) { + xd.unshift(carry); + ++e; + } + + // Remove trailing zeros. + // No need to check for zero, as +x + +y != 0 && -x + -y != 0 + for (len = xd.length; xd[--len] == 0;) xd.pop(); + + y.d = xd; + y.e = getBase10Exponent(xd, e); + + return external ? finalise(y, pr, rm) : y; + }; + + + /* + * Return the number of significant digits of the value of this Decimal. + * + * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0. + * + */ + P$3.precision = P$3.sd = function (z) { + var k, + x = this; + + if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); + + if (x.d) { + k = getPrecision(x.d); + if (z && x.e + 1 > k) k = x.e + 1; + } else { + k = NaN; + } + + return k; + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using + * rounding mode `rounding`. + * + */ + P$3.round = function () { + var x = this, + Ctor = x.constructor; + + return finalise(new Ctor(x), x.e + 1, Ctor.rounding); + }; + + + /* + * Return a new Decimal whose value is the sine of the value in radians of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-1, 1] + * + * sin(x) = x - x^3/3! + x^5/5! - ... + * + * sin(0) = 0 + * sin(-0) = -0 + * sin(Infinity) = NaN + * sin(-Infinity) = NaN + * sin(NaN) = NaN + * + */ + P$3.sine = P$3.sin = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + + x = sine(Ctor, toLessThanHalfPi(Ctor, x)); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true); + }; + + + /* + * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * sqrt(-n) = N + * sqrt(N) = N + * sqrt(-I) = N + * sqrt(I) = I + * sqrt(0) = 0 + * sqrt(-0) = -0 + * + */ + P$3.squareRoot = P$3.sqrt = function () { + var m, n, sd, r, rep, t, + x = this, + d = x.d, + e = x.e, + s = x.s, + Ctor = x.constructor; + + // Negative/NaN/Infinity/zero? + if (s !== 1 || !d || !d[0]) { + return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0); + } + + external = false; + + // Initial estimate. + s = Math.sqrt(+x); + + // Math.sqrt underflow/overflow? + // Pass x to Math.sqrt as integer, then adjust the exponent of the result. + if (s == 0 || s == 1 / 0) { + n = digitsToString(d); + + if ((n.length + e) % 2 == 0) n += '0'; + s = Math.sqrt(n); + e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); + + if (s == 1 / 0) { + n = '5e' + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf('e') + 1) + e; + } + + r = new Ctor(n); + } else { + r = new Ctor(s.toString()); + } + + sd = (e = Ctor.precision) + 3; + + // Newton-Raphson iteration. + for (;;) { + t = r; + r = t.plus(divide(x, t, sd + 2, 1)).times(0.5); + + // TODO? Replace with for-loop and checkRoundingDigits. + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + + // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or + // 4999, i.e. approaching a rounding boundary, continue the iteration. + if (n == '9999' || !rep && n == '4999') { + + // On the first iteration only, check to see if rounding up gives the exact result as the + // nines may infinitely repeat. + if (!rep) { + finalise(t, e + 1, 0); + + if (t.times(t).eq(x)) { + r = t; + break; + } + } + + sd += 4; + rep = 1; + } else { + + // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result. + // If not, then there are further digits and m will be truthy. + if (!+n || !+n.slice(1) && n.charAt(0) == '5') { + + // Truncate to the first rounding digit. + finalise(r, e + 1, 1); + m = !r.times(r).eq(x); + } + + break; + } + } + } + + external = true; + + return finalise(r, e, Ctor.rounding, m); + }; + + + /* + * Return a new Decimal whose value is the tangent of the value in radians of this Decimal. + * + * Domain: [-Infinity, Infinity] + * Range: [-Infinity, Infinity] + * + * tan(0) = 0 + * tan(-0) = -0 + * tan(Infinity) = NaN + * tan(-Infinity) = NaN + * tan(NaN) = NaN + * + */ + P$3.tangent = P$3.tan = function () { + var pr, rm, + x = this, + Ctor = x.constructor; + + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 10; + Ctor.rounding = 1; + + x = x.sin(); + x.s = 1; + x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0); + + Ctor.precision = pr; + Ctor.rounding = rm; + + return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true); + }; + + + /* + * n * 0 = 0 + * n * N = N + * n * I = I + * 0 * n = 0 + * 0 * 0 = 0 + * 0 * N = N + * 0 * I = N + * N * n = N + * N * 0 = N + * N * N = N + * N * I = N + * I * n = I + * I * 0 = N + * I * N = N + * I * I = I + * + * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + */ + P$3.times = P$3.mul = function (y) { + var carry, e, i, k, r, rL, t, xdL, ydL, + x = this, + Ctor = x.constructor, + xd = x.d, + yd = (y = new Ctor(y)).d; + + y.s *= x.s; + + // If either is NaN, ±Infinity or ±0... + if (!xd || !xd[0] || !yd || !yd[0]) { + + return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd + + // Return NaN if either is NaN. + // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity. + ? NaN + + // Return ±Infinity if either is ±Infinity. + // Return ±0 if either is ±0. + : !xd || !yd ? y.s / 0 : y.s * 0); + } + + e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE); + xdL = xd.length; + ydL = yd.length; + + // Ensure xd points to the longer array. + if (xdL < ydL) { + r = xd; + xd = yd; + yd = r; + rL = xdL; + xdL = ydL; + ydL = rL; + } + + // Initialise the result array with zeros. + r = []; + rL = xdL + ydL; + for (i = rL; i--;) r.push(0); + + // Multiply! + for (i = ydL; --i >= 0;) { + carry = 0; + for (k = xdL + i; k > i;) { + t = r[k] + yd[i] * xd[k - i - 1] + carry; + r[k--] = t % BASE | 0; + carry = t / BASE | 0; + } + + r[k] = (r[k] + carry) % BASE | 0; + } + + // Remove trailing zeros. + for (; !r[--rL];) r.pop(); + + if (carry) ++e; + else r.shift(); + + y.d = r; + y.e = getBase10Exponent(r, e); + + return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; + }; + + + /* + * Return a string representing the value of this Decimal in base 2, round to `sd` significant + * digits using rounding mode `rm`. + * + * If the optional `sd` argument is present then return binary exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P$3.toBinary = function (sd, rm) { + return toStringBinary(this, 2, sd, rm); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp` + * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted. + * + * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal. + * + * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P$3.toDecimalPlaces = P$3.toDP = function (dp, rm) { + var x = this, + Ctor = x.constructor; + + x = new Ctor(x); + if (dp === void 0) return x; + + checkInt32(dp, 0, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + return finalise(x, dp + x.e + 1, rm); + }; + + + /* + * Return a string representing the value of this Decimal in exponential notation rounded to + * `dp` fixed decimal places using rounding mode `rounding`. + * + * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P$3.toExponential = function (dp, rm) { + var str, + x = this, + Ctor = x.constructor; + + if (dp === void 0) { + str = finiteToString(x, true); + } else { + checkInt32(dp, 0, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + x = finalise(new Ctor(x), dp + 1, rm); + str = finiteToString(x, true, dp + 1); + } + + return x.isNeg() && !x.isZero() ? '-' + str : str; + }; + + + /* + * Return a string representing the value of this Decimal in normal (fixed-point) notation to + * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is + * omitted. + * + * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'. + * + * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. + * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. + * (-0).toFixed(3) is '0.000'. + * (-0.5).toFixed(0) is '-0'. + * + */ + P$3.toFixed = function (dp, rm) { + var str, y, + x = this, + Ctor = x.constructor; + + if (dp === void 0) { + str = finiteToString(x); + } else { + checkInt32(dp, 0, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + y = finalise(new Ctor(x), dp + x.e + 1, rm); + str = finiteToString(y, false, dp + y.e + 1); + } + + // To determine whether to add the minus sign look at the value before it was rounded, + // i.e. look at `x` rather than `y`. + return x.isNeg() && !x.isZero() ? '-' + str : str; + }; + + + /* + * Return an array representing the value of this Decimal as a simple fraction with an integer + * numerator and an integer denominator. + * + * The denominator will be a positive non-zero value less than or equal to the specified maximum + * denominator. If a maximum denominator is not specified, the denominator will be the lowest + * value necessary to represent the number exactly. + * + * [maxD] {number|string|bigint|Decimal} Maximum denominator. Integer >= 1 and < Infinity. + * + */ + P$3.toFraction = function (maxD) { + var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r, + x = this, + xd = x.d, + Ctor = x.constructor; + + if (!xd) return new Ctor(x); + + n1 = d0 = new Ctor(1); + d1 = n0 = new Ctor(0); + + d = new Ctor(d1); + e = d.e = getPrecision(xd) - x.e - 1; + k = e % LOG_BASE; + d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k); + + if (maxD == null) { + + // d is 10**e, the minimum max-denominator needed. + maxD = e > 0 ? d : n1; + } else { + n = new Ctor(maxD); + if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n); + maxD = n.gt(d) ? (e > 0 ? d : n1) : n; + } + + external = false; + n = new Ctor(digitsToString(xd)); + pr = Ctor.precision; + Ctor.precision = e = xd.length * LOG_BASE * 2; + + for (;;) { + q = divide(n, d, 0, 1, 1); + d2 = d0.plus(q.times(d1)); + if (d2.cmp(maxD) == 1) break; + d0 = d1; + d1 = d2; + d2 = n1; + n1 = n0.plus(q.times(d2)); + n0 = d2; + d2 = d; + d = n.minus(q.times(d2)); + n = d2; + } + + d2 = divide(maxD.minus(d0), d1, 0, 1, 1); + n0 = n0.plus(d2.times(n1)); + d0 = d0.plus(d2.times(d1)); + n0.s = n1.s = x.s; + + // Determine which fraction is closer to x, n0/d0 or n1/d1? + r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 + ? [n1, d1] : [n0, d0]; + + Ctor.precision = pr; + external = true; + + return r; + }; + + + /* + * Return a string representing the value of this Decimal in base 16, round to `sd` significant + * digits using rounding mode `rm`. + * + * If the optional `sd` argument is present then return binary exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P$3.toHexadecimal = P$3.toHex = function (sd, rm) { + return toStringBinary(this, 16, sd, rm); + }; + + + /* + * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding + * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal. + * + * The return value will always have the same sign as this Decimal, unless either this Decimal + * or `y` is NaN, in which case the return value will be also be NaN. + * + * The return value is not affected by the value of `precision`. + * + * y {number|string|bigint|Decimal} The magnitude to round to a multiple of. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toNearest() rounding mode not an integer: {rm}' + * 'toNearest() rounding mode out of range: {rm}' + * + */ + P$3.toNearest = function (y, rm) { + var x = this, + Ctor = x.constructor; + + x = new Ctor(x); + + if (y == null) { + + // If x is not finite, return x. + if (!x.d) return x; + + y = new Ctor(1); + rm = Ctor.rounding; + } else { + y = new Ctor(y); + if (rm === void 0) { + rm = Ctor.rounding; + } else { + checkInt32(rm, 0, 8); + } + + // If x is not finite, return x if y is not NaN, else NaN. + if (!x.d) return y.s ? x : y; + + // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN. + if (!y.d) { + if (y.s) y.s = x.s; + return y; + } + } + + // If y is not zero, calculate the nearest multiple of y to x. + if (y.d[0]) { + external = false; + x = divide(x, y, 0, rm, 1).times(y); + external = true; + finalise(x); + + // If y is zero, return zero with the sign of x. + } else { + y.s = x.s; + x = y; + } + + return x; + }; + + + /* + * Return the value of this Decimal converted to a number primitive. + * Zero keeps its sign. + * + */ + P$3.toNumber = function () { + return +this; + }; + + + /* + * Return a string representing the value of this Decimal in base 8, round to `sd` significant + * digits using rounding mode `rm`. + * + * If the optional `sd` argument is present then return binary exponential notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P$3.toOctal = function (sd, rm) { + return toStringBinary(this, 8, sd, rm); + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded + * to `precision` significant digits using rounding mode `rounding`. + * + * ECMAScript compliant. + * + * pow(x, NaN) = NaN + * pow(x, ±0) = 1 + + * pow(NaN, non-zero) = NaN + * pow(abs(x) > 1, +Infinity) = +Infinity + * pow(abs(x) > 1, -Infinity) = +0 + * pow(abs(x) == 1, ±Infinity) = NaN + * pow(abs(x) < 1, +Infinity) = +0 + * pow(abs(x) < 1, -Infinity) = +Infinity + * pow(+Infinity, y > 0) = +Infinity + * pow(+Infinity, y < 0) = +0 + * pow(-Infinity, odd integer > 0) = -Infinity + * pow(-Infinity, even integer > 0) = +Infinity + * pow(-Infinity, odd integer < 0) = -0 + * pow(-Infinity, even integer < 0) = +0 + * pow(+0, y > 0) = +0 + * pow(+0, y < 0) = +Infinity + * pow(-0, odd integer > 0) = -0 + * pow(-0, even integer > 0) = +0 + * pow(-0, odd integer < 0) = -Infinity + * pow(-0, even integer < 0) = +Infinity + * pow(finite x < 0, finite non-integer) = NaN + * + * For non-integer or very large exponents pow(x, y) is calculated using + * + * x^y = exp(y*ln(x)) + * + * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the + * probability of an incorrectly rounded result + * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14 + * i.e. 1 in 250,000,000,000,000 + * + * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place). + * + * y {number|string|bigint|Decimal} The power to which to raise this Decimal. + * + */ + P$3.toPower = P$3.pow = function (y) { + var e, k, pr, r, rm, s, + x = this, + Ctor = x.constructor, + yn = +(y = new Ctor(y)); + + // Either ±Infinity, NaN or ±0? + if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn)); + + x = new Ctor(x); + + if (x.eq(1)) return x; + + pr = Ctor.precision; + rm = Ctor.rounding; + + if (y.eq(1)) return finalise(x, pr, rm); + + // y exponent + e = mathfloor(y.e / LOG_BASE); + + // If y is a small integer use the 'exponentiation by squaring' algorithm. + if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { + r = intPow(Ctor, x, k, pr); + return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm); + } + + s = x.s; + + // if x is negative + if (s < 0) { + + // if y is not an integer + if (e < y.d.length - 1) return new Ctor(NaN); + + // Result is positive if x is negative and the last digit of integer y is even. + if ((y.d[e] & 1) == 0) s = 1; + + // if x.eq(-1) + if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) { + x.s = s; + return x; + } + } + + // Estimate result exponent. + // x^y = 10^e, where e = y * log10(x) + // log10(x) = log10(x_significand) + x_exponent + // log10(x_significand) = ln(x_significand) / ln(10) + k = mathpow(+x, yn); + e = k == 0 || !isFinite(k) + ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) + : new Ctor(k + '').e; + + // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1. + + // Overflow/underflow? + if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0); + + external = false; + Ctor.rounding = x.s = 1; + + // Estimate the extra guard digits needed to ensure five correct rounding digits from + // naturalLogarithm(x). Example of failure without these extra digits (precision: 10): + // new Decimal(2.32456).pow('2087987436534566.46411') + // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815 + k = Math.min(12, (e + '').length); + + // r = x^y = exp(y*ln(x)) + r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr); + + // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40) + if (r.d) { + + // Truncate to the required precision plus five rounding digits. + r = finalise(r, pr + 5, 1); + + // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate + // the result. + if (checkRoundingDigits(r.d, pr, rm)) { + e = pr + 10; + + // Truncate to the increased precision plus five rounding digits. + r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1); + + // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9). + if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + } + } + + r.s = s; + external = true; + Ctor.rounding = rm; + + return finalise(r, pr, rm); + }; + + + /* + * Return a string representing the value of this Decimal rounded to `sd` significant digits + * using rounding mode `rounding`. + * + * Return exponential notation if `sd` is less than the number of digits necessary to represent + * the integer part of the value in normal notation. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + */ + P$3.toPrecision = function (sd, rm) { + var str, + x = this, + Ctor = x.constructor; + + if (sd === void 0) { + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + } else { + checkInt32(sd, 1, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + + x = finalise(new Ctor(x), sd, rm); + str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd); + } + + return x.isNeg() && !x.isZero() ? '-' + str : str; + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd` + * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if + * omitted. + * + * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive. + * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive. + * + * 'toSD() digits out of range: {sd}' + * 'toSD() digits not an integer: {sd}' + * 'toSD() rounding mode not an integer: {rm}' + * 'toSD() rounding mode out of range: {rm}' + * + */ + P$3.toSignificantDigits = P$3.toSD = function (sd, rm) { + var x = this, + Ctor = x.constructor; + + if (sd === void 0) { + sd = Ctor.precision; + rm = Ctor.rounding; + } else { + checkInt32(sd, 1, MAX_DIGITS); + + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } + + return finalise(new Ctor(x), sd, rm); + }; + + + /* + * Return a string representing the value of this Decimal. + * + * Return exponential notation if this Decimal has a positive exponent equal to or greater than + * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`. + * + */ + P$3.toString = function () { + var x = this, + Ctor = x.constructor, + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + + return x.isNeg() && !x.isZero() ? '-' + str : str; + }; + + + /* + * Return a new Decimal whose value is the value of this Decimal truncated to a whole number. + * + */ + P$3.truncated = P$3.trunc = function () { + return finalise(new this.constructor(this), this.e + 1, 1); + }; + + + /* + * Return a string representing the value of this Decimal. + * Unlike `toString`, negative zero will include the minus sign. + * + */ + P$3.valueOf = P$3.toJSON = function () { + var x = this, + Ctor = x.constructor, + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + + return x.isNeg() ? '-' + str : str; + }; + + + // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers. + + + /* + * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower, + * finiteToString, naturalExponential, naturalLogarithm + * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest, + * P.toPrecision, P.toSignificantDigits, toStringBinary, random + * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm + * convertBase toStringBinary, parseOther + * cos P.cos + * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy, + * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction, + * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm, + * taylorSeries, atan2, parseOther + * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh, + * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus, + * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot, + * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed, + * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits, + * P.truncated, divide, getLn10, getPi, naturalExponential, + * naturalLogarithm, ceil, floor, round, trunc + * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf, + * toStringBinary + * getBase10Exponent P.minus, P.plus, P.times, parseOther + * getLn10 P.logarithm, naturalLogarithm + * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2 + * getPrecision P.precision, P.toFraction + * getZeroString digitsToString, finiteToString + * intPow P.toPower, parseOther + * isOdd toLessThanHalfPi + * maxOrMin max, min + * naturalExponential P.naturalExponential, P.toPower + * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm, + * P.toPower, naturalExponential + * nonFiniteToString finiteToString, toStringBinary + * parseDecimal Decimal + * parseOther Decimal + * sin P.sin + * taylorSeries P.cosh, P.sinh, cos, sin + * toLessThanHalfPi P.cos, P.sin + * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal + * truncate intPow + * + * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi, + * naturalLogarithm, config, parseOther, random, Decimal + */ + + + function digitsToString(d) { + var i, k, ws, + indexOfLastWord = d.length - 1, + str = '', + w = d[0]; + + if (indexOfLastWord > 0) { + str += w; + for (i = 1; i < indexOfLastWord; i++) { + ws = d[i] + ''; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + str += ws; + } + + w = d[i]; + ws = w + ''; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + } else if (w === 0) { + return '0'; + } + + // Remove trailing zeros of last w. + for (; w % 10 === 0;) w /= 10; + + return str + w; + } + + + function checkInt32(i, min, max) { + if (i !== ~~i || i < min || i > max) { + throw Error(invalidArgument + i); + } + } + + + /* + * Check 5 rounding digits if `repeating` is null, 4 otherwise. + * `repeating == null` if caller is `log` or `pow`, + * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`. + */ + function checkRoundingDigits(d, i, rm, repeating) { + var di, k, r, rd; + + // Get the length of the first word of the array d. + for (k = d[0]; k >= 10; k /= 10) --i; + + // Is the rounding digit in the first word of d? + if (--i < 0) { + i += LOG_BASE; + di = 0; + } else { + di = Math.ceil((i + 1) / LOG_BASE); + i %= LOG_BASE; + } + + // i is the index (0 - 6) of the rounding digit. + // E.g. if within the word 3487563 the first rounding digit is 5, + // then i = 4, k = 1000, rd = 3487563 % 1000 = 563 + k = mathpow(10, LOG_BASE - i); + rd = d[di] % k | 0; + + if (repeating == null) { + if (i < 3) { + if (i == 0) rd = rd / 100 | 0; + else if (i == 1) rd = rd / 10 | 0; + r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0; + } else { + r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && + (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || + (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0; + } + } else { + if (i < 4) { + if (i == 0) rd = rd / 1000 | 0; + else if (i == 1) rd = rd / 100 | 0; + else if (i == 2) rd = rd / 10 | 0; + r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999; + } else { + r = ((repeating || rm < 4) && rd + 1 == k || + (!repeating && rm > 3) && rd + 1 == k / 2) && + (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1; + } + } + + return r; + } + + + // Convert string of `baseIn` to an array of numbers of `baseOut`. + // Eg. convertBase('255', 10, 16) returns [15, 15]. + // Eg. convertBase('ff', 16, 10) returns [2, 5, 5]. + function convertBase(str, baseIn, baseOut) { + var j, + arr = [0], + arrL, + i = 0, + strL = str.length; + + for (; i < strL;) { + for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn; + arr[0] += NUMERALS.indexOf(str.charAt(i++)); + for (j = 0; j < arr.length; j++) { + if (arr[j] > baseOut - 1) { + if (arr[j + 1] === void 0) arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + + return arr.reverse(); + } + + + /* + * cos(x) = 1 - x^2/2! + x^4/4! - ... + * |x| < pi/2 + * + */ + function cosine(Ctor, x) { + var k, len, y; + + if (x.isZero()) return x; + + // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1 + // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1 + + // Estimate the optimum number of times to use the argument reduction. + len = x.d.length; + if (len < 32) { + k = Math.ceil(len / 3); + y = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + y = '2.3283064365386962890625e-10'; + } + + Ctor.precision += k; + + x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1)); + + // Reverse argument reduction + for (var i = k; i--;) { + var cos2x = x.times(x); + x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1); + } + + Ctor.precision -= k; + + return x; + } + + + /* + * Perform division in the specified base. + */ + var divide = (function () { + + // Assumes non-zero x and k, and hence non-zero result. + function multiplyInteger(x, k, base) { + var temp, + carry = 0, + i = x.length; + + for (x = x.slice(); i--;) { + temp = x[i] * k + carry; + x[i] = temp % base | 0; + carry = temp / base | 0; + } + + if (carry) x.unshift(carry); + + return x; + } + + function compare(a, b, aL, bL) { + var i, r; + + if (aL != bL) { + r = aL > bL ? 1 : -1; + } else { + for (i = r = 0; i < aL; i++) { + if (a[i] != b[i]) { + r = a[i] > b[i] ? 1 : -1; + break; + } + } + } + + return r; + } + + function subtract(a, b, aL, base) { + var i = 0; + + // Subtract b from a. + for (; aL--;) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + + // Remove leading zeros. + for (; !a[0] && a.length > 1;) a.shift(); + } + + return function (x, y, pr, rm, dp, base) { + var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, + yL, yz, + Ctor = x.constructor, + sign = x.s == y.s ? 1 : -1, + xd = x.d, + yd = y.d; + + // Either NaN, Infinity or 0? + if (!xd || !xd[0] || !yd || !yd[0]) { + + return new Ctor(// Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : + + // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. + xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0); + } + + if (base) { + logBase = 1; + e = x.e - y.e; + } else { + base = BASE; + logBase = LOG_BASE; + e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase); + } + + yL = yd.length; + xL = xd.length; + q = new Ctor(sign); + qd = q.d = []; + + // Result exponent may be one less than e. + // The digit array of a Decimal from toStringBinary may have trailing zeros. + for (i = 0; yd[i] == (xd[i] || 0); i++); + + if (yd[i] > (xd[i] || 0)) e--; + + if (pr == null) { + sd = pr = Ctor.precision; + rm = Ctor.rounding; + } else if (dp) { + sd = pr + (x.e - y.e) + 1; + } else { + sd = pr; + } + + if (sd < 0) { + qd.push(1); + more = true; + } else { + + // Convert precision in number of base 10 digits to base 1e7 digits. + sd = sd / logBase + 2 | 0; + i = 0; + + // divisor < 1e7 + if (yL == 1) { + k = 0; + yd = yd[0]; + sd++; + + // k is the carry. + for (; (i < xL || k) && sd--; i++) { + t = k * base + (xd[i] || 0); + qd[i] = t / yd | 0; + k = t % yd | 0; + } + + more = k || i < xL; + + // divisor >= 1e7 + } else { + + // Normalise xd and yd so highest order digit of yd is >= base/2 + k = base / (yd[0] + 1) | 0; + + if (k > 1) { + yd = multiplyInteger(yd, k, base); + xd = multiplyInteger(xd, k, base); + yL = yd.length; + xL = xd.length; + } + + xi = yL; + rem = xd.slice(0, yL); + remL = rem.length; + + // Add zeros to make remainder as long as divisor. + for (; remL < yL;) rem[remL++] = 0; + + yz = yd.slice(); + yz.unshift(0); + yd0 = yd[0]; + + if (yd[1] >= base / 2) ++yd0; + + do { + k = 0; + + // Compare divisor and remainder. + cmp = compare(yd, rem, yL, remL); + + // If divisor < remainder. + if (cmp < 0) { + + // Calculate trial digit, k. + rem0 = rem[0]; + if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); + + // k will be how many times the divisor goes into the current remainder. + k = rem0 / yd0 | 0; + + // Algorithm: + // 1. product = divisor * trial digit (k) + // 2. if product > remainder: product -= divisor, k-- + // 3. remainder -= product + // 4. if product was < remainder at 2: + // 5. compare new remainder and divisor + // 6. If remainder > divisor: remainder -= divisor, k++ + + if (k > 1) { + if (k >= base) k = base - 1; + + // product = divisor * trial digit. + prod = multiplyInteger(yd, k, base); + prodL = prod.length; + remL = rem.length; + + // Compare product and remainder. + cmp = compare(prod, rem, prodL, remL); + + // product > remainder. + if (cmp == 1) { + k--; + + // Subtract divisor from product. + subtract(prod, yL < prodL ? yz : yd, prodL, base); + } + } else { + + // cmp is -1. + // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1 + // to avoid it. If k is 1 there is a need to compare yd and rem again below. + if (k == 0) cmp = k = 1; + prod = yd.slice(); + } + + prodL = prod.length; + if (prodL < remL) prod.unshift(0); + + // Subtract product from remainder. + subtract(rem, prod, remL, base); + + // If product was < previous remainder. + if (cmp == -1) { + remL = rem.length; + + // Compare divisor and new remainder. + cmp = compare(yd, rem, yL, remL); + + // If divisor < new remainder, subtract divisor from remainder. + if (cmp < 1) { + k++; + + // Subtract divisor from remainder. + subtract(rem, yL < remL ? yz : yd, remL, base); + } + } + + remL = rem.length; + } else if (cmp === 0) { + k++; + rem = [0]; + } // if cmp === 1, k will be 0 + + // Add the next digit, k, to the result array. + qd[i++] = k; + + // Update the remainder. + if (cmp && rem[0]) { + rem[remL++] = xd[xi] || 0; + } else { + rem = [xd[xi]]; + remL = 1; + } + + } while ((xi++ < xL || rem[0] !== void 0) && sd--); + + more = rem[0] !== void 0; + } + + // Leading zero? + if (!qd[0]) qd.shift(); + } + + // logBase is 1 when divide is being used for base conversion. + if (logBase == 1) { + q.e = e; + inexact = more; + } else { + + // To calculate q.e, first get the number of digits of qd[0]. + for (i = 1, k = qd[0]; k >= 10; k /= 10) i++; + q.e = i + e * logBase - 1; + + finalise(q, dp ? pr + q.e + 1 : pr, rm, more); + } + + return q; + }; + })(); + + + /* + * Round `x` to `sd` significant digits using rounding mode `rm`. + * Check for over/under-flow. + */ + function finalise(x, sd, rm, isTruncated) { + var digits, i, j, k, rd, roundUp, w, xd, xdi, + Ctor = x.constructor; + + // Don't round if sd is null or undefined. + out: if (sd != null) { + xd = x.d; + + // Infinity/NaN. + if (!xd) return x; + + // rd: the rounding digit, i.e. the digit after the digit that may be rounded up. + // w: the word of xd containing rd, a base 1e7 number. + // xdi: the index of w within xd. + // digits: the number of digits of w. + // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if + // they had leading zeros) + // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero). + + // Get the length of the first word of the digits array xd. + for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++; + i = sd - digits; + + // Is the rounding digit in the first word of xd? + if (i < 0) { + i += LOG_BASE; + j = sd; + w = xd[xdi = 0]; + + // Get the rounding digit at index j of w. + rd = w / mathpow(10, digits - j - 1) % 10 | 0; + } else { + xdi = Math.ceil((i + 1) / LOG_BASE); + k = xd.length; + if (xdi >= k) { + if (isTruncated) { + + // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`. + for (; k++ <= xdi;) xd.push(0); + w = rd = 0; + digits = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + w = k = xd[xdi]; + + // Get the number of digits of w. + for (digits = 1; k >= 10; k /= 10) digits++; + + // Get the index of rd within w. + i %= LOG_BASE; + + // Get the index of rd within w, adjusted for leading zeros. + // The number of leading zeros of w is given by LOG_BASE - digits. + j = i - LOG_BASE + digits; + + // Get the rounding digit at index j of w. + rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0; + } + } + + // Are there any non-zero digits after the rounding digit? + isTruncated = isTruncated || sd < 0 || + xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1)); + + // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right + // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression + // will give 714. + + roundUp = rm < 4 + ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) + : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && + + // Check whether the digit to the left of the rounding digit is odd. + ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 || + rm == (x.s < 0 ? 8 : 7)); + + if (sd < 1 || !xd[0]) { + xd.length = 0; + if (roundUp) { + + // Convert sd to decimal places. + sd -= x.e + 1; + + // 1, 0.1, 0.01, 0.001, 0.0001 etc. + xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); + x.e = -sd || 0; + } else { + + // Zero. + xd[0] = x.e = 0; + } + + return x; + } + + // Remove excess digits. + if (i == 0) { + xd.length = xdi; + k = 1; + xdi--; + } else { + xd.length = xdi + 1; + k = mathpow(10, LOG_BASE - i); + + // E.g. 56700 becomes 56000 if 7 is the rounding digit. + // j > 0 means i > number of leading zeros of w. + xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0; + } + + if (roundUp) { + for (;;) { + + // Is the digit to be rounded up in the first word of xd? + if (xdi == 0) { + + // i will be the length of xd[0] before k is added. + for (i = 1, j = xd[0]; j >= 10; j /= 10) i++; + j = xd[0] += k; + for (k = 1; j >= 10; j /= 10) k++; + + // if i != k the length has increased. + if (i != k) { + x.e++; + if (xd[0] == BASE) xd[0] = 1; + } + + break; + } else { + xd[xdi] += k; + if (xd[xdi] != BASE) break; + xd[xdi--] = 0; + k = 1; + } + } + } + + // Remove trailing zeros. + for (i = xd.length; xd[--i] === 0;) xd.pop(); + } + + if (external) { + + // Overflow? + if (x.e > Ctor.maxE) { + + // Infinity. + x.d = null; + x.e = NaN; + + // Underflow? + } else if (x.e < Ctor.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + // Ctor.underflow = true; + } // else Ctor.underflow = false; + } + + return x; + } + + + function finiteToString(x, isExp, sd) { + if (!x.isFinite()) return nonFiniteToString(x); + var k, + e = x.e, + str = digitsToString(x.d), + len = str.length; + + if (isExp) { + if (sd && (k = sd - len) > 0) { + str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k); + } else if (len > 1) { + str = str.charAt(0) + '.' + str.slice(1); + } + + str = str + (x.e < 0 ? 'e' : 'e+') + x.e; + } else if (e < 0) { + str = '0.' + getZeroString(-e - 1) + str; + if (sd && (k = sd - len) > 0) str += getZeroString(k); + } else if (e >= len) { + str += getZeroString(e + 1 - len); + if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k); + } else { + if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k); + if (sd && (k = sd - len) > 0) { + if (e + 1 === len) str += '.'; + str += getZeroString(k); + } + } + + return str; + } + + + // Calculate the base 10 exponent from the base 1e7 exponent. + function getBase10Exponent(digits, e) { + var w = digits[0]; + + // Add the number of digits of the first word of the digits array. + for ( e *= LOG_BASE; w >= 10; w /= 10) e++; + return e; + } + + + function getLn10(Ctor, sd, pr) { + if (sd > LN10_PRECISION) { + + // Reset global state in case the exception is caught. + external = true; + if (pr) Ctor.precision = pr; + throw Error(precisionLimitExceeded); + } + return finalise(new Ctor(LN10), sd, 1, true); + } + + + function getPi(Ctor, sd, rm) { + if (sd > PI_PRECISION) throw Error(precisionLimitExceeded); + return finalise(new Ctor(PI), sd, rm, true); + } + + + function getPrecision(digits) { + var w = digits.length - 1, + len = w * LOG_BASE + 1; + + w = digits[w]; + + // If non-zero... + if (w) { + + // Subtract the number of trailing zeros of the last word. + for (; w % 10 == 0; w /= 10) len--; + + // Add the number of digits of the first word. + for (w = digits[0]; w >= 10; w /= 10) len++; + } + + return len; + } + + + function getZeroString(k) { + var zs = ''; + for (; k--;) zs += '0'; + return zs; + } + + + /* + * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an + * integer of type number. + * + * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`. + * + */ + function intPow(Ctor, x, n, pr) { + var isTruncated, + r = new Ctor(1), + + // Max n of 9007199254740991 takes 53 loop iterations. + // Maximum digits array length; leaves [28, 34] guard digits. + k = Math.ceil(pr / LOG_BASE + 4); + + external = false; + + for (;;) { + if (n % 2) { + r = r.times(x); + if (truncate(r.d, k)) isTruncated = true; + } + + n = mathfloor(n / 2); + if (n === 0) { + + // To ensure correct rounding when r.d is truncated, increment the last word if it is zero. + n = r.d.length - 1; + if (isTruncated && r.d[n] === 0) ++r.d[n]; + break; + } + + x = x.times(x); + truncate(x.d, k); + } + + external = true; + + return r; + } + + + function isOdd(n) { + return n.d[n.d.length - 1] & 1; + } + + + /* + * Handle `max` (`n` is -1) and `min` (`n` is 1). + */ + function maxOrMin(Ctor, args, n) { + var k, y, + x = new Ctor(args[0]), + i = 0; + + for (; ++i < args.length;) { + y = new Ctor(args[i]); + + // NaN? + if (!y.s) { + x = y; + break; + } + + k = x.cmp(y); + + if (k === n || k === 0 && x.s === n) { + x = y; + } + } + + return x; + } + + + /* + * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant + * digits. + * + * Taylor/Maclaurin series. + * + * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ... + * + * Argument reduction: + * Repeat x = x / 32, k += 5, until |x| < 0.1 + * exp(x) = exp(x / 2^k)^(2^k) + * + * Previously, the argument was initially reduced by + * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10) + * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was + * found to be slower than just dividing repeatedly by 32 as above. + * + * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000 + * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000 + * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324) + * + * exp(Infinity) = Infinity + * exp(-Infinity) = 0 + * exp(NaN) = NaN + * exp(±0) = 1 + * + * exp(x) is non-terminating for any finite, non-zero x. + * + * The result will always be correctly rounded. + * + */ + function naturalExponential(x, sd) { + var denominator, guard, j, pow, sum, t, wpr, + rep = 0, + i = 0, + k = 0, + Ctor = x.constructor, + rm = Ctor.rounding, + pr = Ctor.precision; + + // 0/NaN/Infinity? + if (!x.d || !x.d[0] || x.e > 17) { + + return new Ctor(x.d + ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 + : x.s ? x.s < 0 ? 0 : x : 0 / 0); + } + + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + + t = new Ctor(0.03125); + + // while abs(x) >= 0.1 + while (x.e > -2) { + + // x = x / 2^5 + x = x.times(t); + k += 5; + } + + // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision + // necessary to ensure the first 4 rounding digits are correct. + guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; + wpr += guard; + denominator = pow = sum = new Ctor(1); + Ctor.precision = wpr; + + for (;;) { + pow = finalise(pow.times(x), wpr, 1); + denominator = denominator.times(++i); + t = sum.plus(divide(pow, denominator, wpr, 1)); + + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { + j = k; + while (j--) sum = finalise(sum.times(sum), wpr, 1); + + // Check to see if the first 4 rounding digits are [49]999. + // If so, repeat the summation with a higher precision, otherwise + // e.g. with precision: 18, rounding: 1 + // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123) + // `wpr - guard` is the index of first rounding digit. + if (sd == null) { + + if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += 10; + denominator = pow = t = new Ctor(1); + i = 0; + rep++; + } else { + return finalise(sum, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum; + } + } + + sum = t; + } + } + + + /* + * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant + * digits. + * + * ln(-n) = NaN + * ln(0) = -Infinity + * ln(-0) = -Infinity + * ln(1) = 0 + * ln(Infinity) = Infinity + * ln(-Infinity) = NaN + * ln(NaN) = NaN + * + * ln(n) (n != 1) is non-terminating. + * + */ + function naturalLogarithm(y, sd) { + var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2, + n = 1, + guard = 10, + x = y, + xd = x.d, + Ctor = x.constructor, + rm = Ctor.rounding, + pr = Ctor.precision; + + // Is x negative or Infinity, NaN, 0 or 1? + if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) { + return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x); + } + + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + + Ctor.precision = wpr += guard; + c = digitsToString(xd); + c0 = c.charAt(0); + + if (Math.abs(e = x.e) < 1.5e15) { + + // Argument reduction. + // The series converges faster the closer the argument is to 1, so using + // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b + // multiply the argument by itself until the leading digits of the significand are 7, 8, 9, + // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can + // later be divided by this number, then separate out the power of 10 using + // ln(a*10^b) = ln(a) + b*ln(10). + + // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14). + //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) { + // max n is 6 (gives 0.7 - 1.3) + while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { + x = x.times(y); + c = digitsToString(x.d); + c0 = c.charAt(0); + n++; + } + + e = x.e; + + if (c0 > 1) { + x = new Ctor('0.' + c); + e++; + } else { + x = new Ctor(c0 + '.' + c.slice(1)); + } + } else { + + // The argument reduction method above may result in overflow if the argument y is a massive + // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this + // function using ln(x*10^e) = ln(x) + e*ln(10). + t = getLn10(Ctor, wpr + 2, pr).times(e + ''); + x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t); + Ctor.precision = pr; + + return sd == null ? finalise(x, pr, rm, external = true) : x; + } + + // x1 is x reduced to a value near 1. + x1 = x; + + // Taylor series. + // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...) + // where x = (y - 1)/(y + 1) (|x| < 1) + sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = 3; + + for (;;) { + numerator = finalise(numerator.times(x2), wpr, 1); + t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1)); + + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { + sum = sum.times(2); + + // Reverse the argument reduction. Check that e is not 0 because, besides preventing an + // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0. + if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + '')); + sum = divide(sum, new Ctor(n), wpr, 1); + + // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has + // been repeated previously) and the first 4 rounding digits 9999? + // If so, restart the summation with a higher precision, otherwise + // e.g. with precision: 12, rounding: 1 + // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463. + // `wpr - guard` is the index of first rounding digit. + if (sd == null) { + if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += guard; + t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = rep = 1; + } else { + return finalise(sum, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum; + } + } + + sum = t; + denominator += 2; + } + } + + + // ±Infinity, NaN. + function nonFiniteToString(x) { + // Unsigned. + return String(x.s * x.s / 0); + } + + + /* + * Parse the value of a new Decimal `x` from string `str`. + */ + function parseDecimal(x, str) { + var e, i, len; + + // TODO BigInt str: no need to check for decimal point, exponential form or leading zeros. + // Decimal point? + if ((e = str.indexOf('.')) > -1) str = str.replace('.', ''); + + // Exponential form? + if ((i = str.search(/e/i)) > 0) { + + // Determine exponent. + if (e < 0) e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + + // Integer. + e = str.length; + } + + // Determine leading zeros. + for (i = 0; str.charCodeAt(i) === 48; i++); + + // Determine trailing zeros. + for (len = str.length; str.charCodeAt(len - 1) === 48; --len); + str = str.slice(i, len); + + if (str) { + len -= i; + x.e = e = e - i - 1; + x.d = []; + + // Transform base + + // e is the base 10 exponent. + // i is where to slice str to get the first word of the digits array. + i = (e + 1) % LOG_BASE; + if (e < 0) i += LOG_BASE; + + if (i < len) { + if (i) x.d.push(+str.slice(0, i)); + for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE)); + str = str.slice(i); + i = LOG_BASE - str.length; + } else { + i -= len; + } + + for (; i--;) str += '0'; + x.d.push(+str); + + if (external) { + + // Overflow? + if (x.e > x.constructor.maxE) { + + // Infinity. + x.d = null; + x.e = NaN; + + // Underflow? + } else if (x.e < x.constructor.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + // x.constructor.underflow = true; + } // else x.constructor.underflow = false; + } + } else { + + // Zero. + x.e = 0; + x.d = [0]; + } + + return x; + } + + + /* + * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value. + */ + function parseOther(x, str) { + var base, Ctor, divisor, i, isFloat, len, p, xd, xe; + + if (str.indexOf('_') > -1) { + str = str.replace(/(\d)_(?=\d)/g, '$1'); + if (isDecimal.test(str)) return parseDecimal(x, str); + } else if (str === 'Infinity' || str === 'NaN') { + if (!+str) x.s = NaN; + x.e = NaN; + x.d = null; + return x; + } + + if (isHex.test(str)) { + base = 16; + str = str.toLowerCase(); + } else if (isBinary.test(str)) { + base = 2; + } else if (isOctal.test(str)) { + base = 8; + } else { + throw Error(invalidArgument + str); + } + + // Is there a binary exponent part? + i = str.search(/p/i); + + if (i > 0) { + p = +str.slice(i + 1); + str = str.substring(2, i); + } else { + str = str.slice(2); + } + + // Convert `str` as an integer then divide the result by `base` raised to a power such that the + // fraction part will be restored. + i = str.indexOf('.'); + isFloat = i >= 0; + Ctor = x.constructor; + + if (isFloat) { + str = str.replace('.', ''); + len = str.length; + i = len - i; + + // log[10](16) = 1.2041... , log[10](88) = 1.9444.... + divisor = intPow(Ctor, new Ctor(base), i, i * 2); + } + + xd = convertBase(str, base, BASE); + xe = xd.length - 1; + + // Remove trailing zeros. + for (i = xe; xd[i] === 0; --i) xd.pop(); + if (i < 0) return new Ctor(x.s * 0); + x.e = getBase10Exponent(xd, xe); + x.d = xd; + external = false; + + // At what precision to perform the division to ensure exact conversion? + // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount) + // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412 + // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits. + // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount + // Therefore using 4 * the number of digits of str will always be enough. + if (isFloat) x = divide(x, divisor, len * 4); + + // Multiply by the binary exponent part if present. + if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p)); + external = true; + + return x; + } + + + /* + * sin(x) = x - x^3/3! + x^5/5! - ... + * |x| < pi/2 + * + */ + function sine(Ctor, x) { + var k, + len = x.d.length; + + if (len < 3) { + return x.isZero() ? x : taylorSeries(Ctor, 2, x, x); + } + + // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x) + // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5) + // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20)) + + // Estimate the optimum number of times to use the argument reduction. + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x); + + // Reverse argument reduction + var sin2_x, + d5 = new Ctor(5), + d16 = new Ctor(16), + d20 = new Ctor(20); + for (; k--;) { + sin2_x = x.times(x); + x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20)))); + } + + return x; + } + + + // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`. + function taylorSeries(Ctor, n, x, y, isHyperbolic) { + var j, t, u, x2, + pr = Ctor.precision, + k = Math.ceil(pr / LOG_BASE); + + external = false; + x2 = x.times(x); + u = new Ctor(y); + + for (;;) { + t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1); + u = isHyperbolic ? y.plus(t) : y.minus(t); + y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1); + t = u.plus(y); + + if (t.d[k] !== void 0) { + for (j = k; t.d[j] === u.d[j] && j--;); + if (j == -1) break; + } + + j = u; + u = y; + y = t; + t = j; + } + + external = true; + t.d.length = k + 1; + + return t; + } + + + // Exponent e must be positive and non-zero. + function tinyPow(b, e) { + var n = b; + while (--e) n *= b; + return n; + } + + + // Return the absolute value of `x` reduced to less than or equal to half pi. + function toLessThanHalfPi(Ctor, x) { + var t, + isNeg = x.s < 0, + pi = getPi(Ctor, Ctor.precision, 1), + halfPi = pi.times(0.5); + + x = x.abs(); + + if (x.lte(halfPi)) { + quadrant = isNeg ? 4 : 1; + return x; + } + + t = x.divToInt(pi); + + if (t.isZero()) { + quadrant = isNeg ? 3 : 2; + } else { + x = x.minus(t.times(pi)); + + // 0 <= x < pi + if (x.lte(halfPi)) { + quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1); + return x; + } + + quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2); + } + + return x.minus(pi).abs(); + } + + + /* + * Return the value of Decimal `x` as a string in base `baseOut`. + * + * If the optional `sd` argument is present include a binary exponent suffix. + */ + function toStringBinary(x, baseOut, sd, rm) { + var base, e, i, k, len, roundUp, str, xd, y, + Ctor = x.constructor, + isExp = sd !== void 0; + + if (isExp) { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } else { + sd = Ctor.precision; + rm = Ctor.rounding; + } + + if (!x.isFinite()) { + str = nonFiniteToString(x); + } else { + str = finiteToString(x); + i = str.indexOf('.'); + + // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required: + // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10)) + // minBinaryExponent = floor(decimalExponent * log[2](10)) + // log[2](10) = 3.321928094887362347870319429489390175864 + + if (isExp) { + base = 2; + if (baseOut == 16) { + sd = sd * 4 - 3; + } else if (baseOut == 8) { + sd = sd * 3 - 2; + } + } else { + base = baseOut; + } + + // Convert the number as an integer then divide the result by its base raised to a power such + // that the fraction part will be restored. + + // Non-integer. + if (i >= 0) { + str = str.replace('.', ''); + y = new Ctor(1); + y.e = str.length - i; + y.d = convertBase(finiteToString(y), 10, base); + y.e = y.d.length; + } + + xd = convertBase(str, 10, base); + e = len = xd.length; + + // Remove trailing zeros. + for (; xd[--len] == 0;) xd.pop(); + + if (!xd[0]) { + str = isExp ? '0p+0' : '0'; + } else { + if (i < 0) { + e--; + } else { + x = new Ctor(x); + x.d = xd; + x.e = e; + x = divide(x, y, sd, rm, 0, base); + xd = x.d; + e = x.e; + roundUp = inexact; + } + + // The rounding digit, i.e. the digit after the digit that may be rounded up. + i = xd[sd]; + k = base / 2; + roundUp = roundUp || xd[sd + 1] !== void 0; + + roundUp = rm < 4 + ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) + : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || + rm === (x.s < 0 ? 8 : 7)); + + xd.length = sd; + + if (roundUp) { + + // Rounding up may mean the previous digit has to be rounded up and so on. + for (; ++xd[--sd] > base - 1;) { + xd[sd] = 0; + if (!sd) { + ++e; + xd.unshift(1); + } + } + } + + // Determine trailing zeros. + for (len = xd.length; !xd[len - 1]; --len); + + // E.g. [4, 11, 15] becomes 4bf. + for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]); + + // Add binary exponent suffix? + if (isExp) { + if (len > 1) { + if (baseOut == 16 || baseOut == 8) { + i = baseOut == 16 ? 4 : 3; + for (--len; len % i; len++) str += '0'; + xd = convertBase(str, base, baseOut); + for (len = xd.length; !xd[len - 1]; --len); + + // xd[0] will always be be 1 + for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]); + } else { + str = str.charAt(0) + '.' + str.slice(1); + } + } + + str = str + (e < 0 ? 'p' : 'p+') + e; + } else if (e < 0) { + for (; ++e;) str = '0' + str; + str = '0.' + str; + } else { + if (++e > len) for (e -= len; e-- ;) str += '0'; + else if (e < len) str = str.slice(0, e) + '.' + str.slice(e); + } + } + + str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str; + } + + return x.s < 0 ? '-' + str : str; + } + + + // Does not strip trailing zeros. + function truncate(arr, len) { + if (arr.length > len) { + arr.length = len; + return true; + } + } + + + // Decimal methods + + + /* + * abs + * acos + * acosh + * add + * asin + * asinh + * atan + * atanh + * atan2 + * cbrt + * ceil + * clamp + * clone + * config + * cos + * cosh + * div + * exp + * floor + * hypot + * ln + * log + * log2 + * log10 + * max + * min + * mod + * mul + * pow + * random + * round + * set + * sign + * sin + * sinh + * sqrt + * sub + * sum + * tan + * tanh + * trunc + */ + + + /* + * Return a new Decimal whose value is the absolute value of `x`. + * + * x {number|string|bigint|Decimal} + * + */ + function abs$2(x) { + return new this(x).abs(); + } + + + /* + * Return a new Decimal whose value is the arccosine in radians of `x`. + * + * x {number|string|bigint|Decimal} + * + */ + function acos(x) { + return new this(x).acos(); + } + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function acosh(x) { + return new this(x).acosh(); + } + + + /* + * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function add(x, y) { + return new this(x).plus(y); + } + + + /* + * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function asin(x) { + return new this(x).asin(); + } + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function asinh(x) { + return new this(x).asinh(); + } + + + /* + * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function atan(x) { + return new this(x).atan(); + } + + + /* + * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to + * `precision` significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function atanh(x) { + return new this(x).atanh(); + } + + + /* + * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi + * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`. + * + * Domain: [-Infinity, Infinity] + * Range: [-pi, pi] + * + * y {number|string|bigint|Decimal} The y-coordinate. + * x {number|string|bigint|Decimal} The x-coordinate. + * + * atan2(±0, -0) = ±pi + * atan2(±0, +0) = ±0 + * atan2(±0, -x) = ±pi for x > 0 + * atan2(±0, x) = ±0 for x > 0 + * atan2(-y, ±0) = -pi/2 for y > 0 + * atan2(y, ±0) = pi/2 for y > 0 + * atan2(±y, -Infinity) = ±pi for finite y > 0 + * atan2(±y, +Infinity) = ±0 for finite y > 0 + * atan2(±Infinity, x) = ±pi/2 for finite x + * atan2(±Infinity, -Infinity) = ±3*pi/4 + * atan2(±Infinity, +Infinity) = ±pi/4 + * atan2(NaN, x) = NaN + * atan2(y, NaN) = NaN + * + */ + function atan2(y, x) { + y = new this(y); + x = new this(x); + var r, + pr = this.precision, + rm = this.rounding, + wpr = pr + 4; + + // Either NaN + if (!y.s || !x.s) { + r = new this(NaN); + + // Both ±Infinity + } else if (!y.d && !x.d) { + r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75); + r.s = y.s; + + // x is ±Infinity or y is ±0 + } else if (!x.d || y.isZero()) { + r = x.s < 0 ? getPi(this, pr, rm) : new this(0); + r.s = y.s; + + // y is ±Infinity or x is ±0 + } else if (!y.d || x.isZero()) { + r = getPi(this, wpr, 1).times(0.5); + r.s = y.s; + + // Both non-zero and finite + } else if (x.s < 0) { + this.precision = wpr; + this.rounding = 1; + r = this.atan(divide(y, x, wpr, 1)); + x = getPi(this, wpr, 1); + this.precision = pr; + this.rounding = rm; + r = y.s < 0 ? r.minus(x) : r.plus(x); + } else { + r = this.atan(divide(y, x, wpr, 1)); + } + + return r; + } + + + /* + * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function cbrt(x) { + return new this(x).cbrt(); + } + + + /* + * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`. + * + * x {number|string|bigint|Decimal} + * + */ + function ceil(x) { + return finalise(x = new this(x), x.e + 1, 2); + } + + + /* + * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`. + * + * x {number|string|bigint|Decimal} + * min {number|string|bigint|Decimal} + * max {number|string|bigint|Decimal} + * + */ + function clamp(x, min, max) { + return new this(x).clamp(min, max); + } + + + /* + * Configure global settings for a Decimal constructor. + * + * `obj` is an object with one or more of the following properties, + * + * precision {number} + * rounding {number} + * toExpNeg {number} + * toExpPos {number} + * maxE {number} + * minE {number} + * modulo {number} + * crypto {boolean|number} + * defaults {true} + * + * E.g. Decimal.config({ precision: 20, rounding: 4 }) + * + */ + function config(obj) { + if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected'); + var i, p, v, + useDefaults = obj.defaults === true, + ps = [ + 'precision', 1, MAX_DIGITS, + 'rounding', 0, 8, + 'toExpNeg', -9e15, 0, + 'toExpPos', 0, EXP_LIMIT, + 'maxE', 0, EXP_LIMIT, + 'minE', -9e15, 0, + 'modulo', 0, 9 + ]; + + for (i = 0; i < ps.length; i += 3) { + if (p = ps[i], useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; + else throw Error(invalidArgument + p + ': ' + v); + } + } + + if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (v === true || v === false || v === 0 || v === 1) { + if (v) { + if (typeof crypto != 'undefined' && crypto && + (crypto.getRandomValues || crypto.randomBytes)) { + this[p] = true; + } else { + throw Error(cryptoUnavailable); + } + } else { + this[p] = false; + } + } else { + throw Error(invalidArgument + p + ': ' + v); + } + } + + return this; + } + + + /* + * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function cos(x) { + return new this(x).cos(); + } + + + /* + * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function cosh$1(x) { + return new this(x).cosh(); + } + + + /* + * Create and return a Decimal constructor with the same configuration properties as this Decimal + * constructor. + * + */ + function clone$1(obj) { + var i, p, ps; + + /* + * The Decimal constructor and exported function. + * Return a new Decimal instance. + * + * v {number|string|bigint|Decimal} A numeric value. + * + */ + function Decimal(v) { + var e, i, t, + x = this; + + // Decimal called without new. + if (!(x instanceof Decimal)) return new Decimal(v); + + // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor + // which points to Object. + x.constructor = Decimal; + + if (isDecimalInstance(v)) { + x.s = v.s; + + if (external) { + if (!v.d || v.e > Decimal.maxE) { + + // Infinity. + x.e = NaN; + x.d = null; + } else if (v.e < Decimal.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + } else { + x.e = v.e; + x.d = v.d.slice(); + } + } else { + x.e = v.e; + x.d = v.d ? v.d.slice() : v.d; + } + + return; + } + + t = typeof v; + + if (t === 'number') { + if (v === 0) { + x.s = 1 / v < 0 ? -1 : 1; + x.e = 0; + x.d = [0]; + return; + } + + if (v < 0) { + v = -v; + x.s = -1; + } else { + x.s = 1; + } + + // Fast path for small integers. + if (v === ~~v && v < 1e7) { + for (e = 0, i = v; i >= 10; i /= 10) e++; + + if (external) { + if (e > Decimal.maxE) { + x.e = NaN; + x.d = null; + } else if (e < Decimal.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = e; + x.d = [v]; + } + } else { + x.e = e; + x.d = [v]; + } + + return; + } + + // Infinity or NaN? + if (v * 0 !== 0) { + if (!v) x.s = NaN; + x.e = NaN; + x.d = null; + return; + } + + return parseDecimal(x, v.toString()); + } + + if (t === 'string') { + if ((i = v.charCodeAt(0)) === 45) { // minus sign + v = v.slice(1); + x.s = -1; + } else { + if (i === 43) v = v.slice(1); // plus sign + x.s = 1; + } + + return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v); + } + + if (t === 'bigint') { + if (v < 0) { + v = -v; + x.s = -1; + } else { + x.s = 1; + } + + return parseDecimal(x, v.toString()); + } + + throw Error(invalidArgument + v); + } + + Decimal.prototype = P$3; + + Decimal.ROUND_UP = 0; + Decimal.ROUND_DOWN = 1; + Decimal.ROUND_CEIL = 2; + Decimal.ROUND_FLOOR = 3; + Decimal.ROUND_HALF_UP = 4; + Decimal.ROUND_HALF_DOWN = 5; + Decimal.ROUND_HALF_EVEN = 6; + Decimal.ROUND_HALF_CEIL = 7; + Decimal.ROUND_HALF_FLOOR = 8; + Decimal.EUCLID = 9; + + Decimal.config = Decimal.set = config; + Decimal.clone = clone$1; + Decimal.isDecimal = isDecimalInstance; + + Decimal.abs = abs$2; + Decimal.acos = acos; + Decimal.acosh = acosh; // ES6 + Decimal.add = add; + Decimal.asin = asin; + Decimal.asinh = asinh; // ES6 + Decimal.atan = atan; + Decimal.atanh = atanh; // ES6 + Decimal.atan2 = atan2; + Decimal.cbrt = cbrt; // ES6 + Decimal.ceil = ceil; + Decimal.clamp = clamp; + Decimal.cos = cos; + Decimal.cosh = cosh$1; // ES6 + Decimal.div = div; + Decimal.exp = exp; + Decimal.floor = floor; + Decimal.hypot = hypot$1; // ES6 + Decimal.ln = ln; + Decimal.log = log; + Decimal.log10 = log10; // ES6 + Decimal.log2 = log2; // ES6 + Decimal.max = max$1; + Decimal.min = min$1; + Decimal.mod = mod$1; + Decimal.mul = mul; + Decimal.pow = pow$1; + Decimal.random = random; + Decimal.round = round$1; + Decimal.sign = sign; // ES6 + Decimal.sin = sin; + Decimal.sinh = sinh$1; // ES6 + Decimal.sqrt = sqrt; + Decimal.sub = sub; + Decimal.sum = sum; + Decimal.tan = tan; + Decimal.tanh = tanh; // ES6 + Decimal.trunc = trunc$1; // ES6 + + if (obj === void 0) obj = {}; + if (obj) { + if (obj.defaults !== true) { + ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto']; + for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; + } + } + + Decimal.config(obj); + + return Decimal; + } + + + /* + * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function div(x, y) { + return new this(x).div(y); + } + + + /* + * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} The power to which to raise the base of the natural log. + * + */ + function exp(x) { + return new this(x).exp(); + } + + + /* + * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`. + * + * x {number|string|bigint|Decimal} + * + */ + function floor(x) { + return finalise(x = new this(x), x.e + 1, 3); + } + + + /* + * Return a new Decimal whose value is the square root of the sum of the squares of the arguments, + * rounded to `precision` significant digits using rounding mode `rounding`. + * + * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...) + * + * arguments {number|string|bigint|Decimal} + * + */ + function hypot$1() { + var i, n, + t = new this(0); + + external = false; + + for (i = 0; i < arguments.length;) { + n = new this(arguments[i++]); + if (!n.d) { + if (n.s) { + external = true; + return new this(1 / 0); + } + t = n; + } else if (t.d) { + t = t.plus(n.times(n)); + } + } + + external = true; + + return t.sqrt(); + } + + + /* + * Return true if object is a Decimal instance (where Decimal is any Decimal constructor), + * otherwise return false. + * + */ + function isDecimalInstance(obj) { + return obj instanceof Decimal || obj && obj.toStringTag === tag || false; + } + + + /* + * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function ln(x) { + return new this(x).ln(); + } + + + /* + * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base + * is specified, rounded to `precision` significant digits using rounding mode `rounding`. + * + * log[y](x) + * + * x {number|string|bigint|Decimal} The argument of the logarithm. + * y {number|string|bigint|Decimal} The base of the logarithm. + * + */ + function log(x, y) { + return new this(x).log(y); + } + + + /* + * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function log2(x) { + return new this(x).log(2); + } + + + /* + * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function log10(x) { + return new this(x).log(10); + } + + + /* + * Return a new Decimal whose value is the maximum of the arguments. + * + * arguments {number|string|bigint|Decimal} + * + */ + function max$1() { + return maxOrMin(this, arguments, -1); + } + + + /* + * Return a new Decimal whose value is the minimum of the arguments. + * + * arguments {number|string|bigint|Decimal} + * + */ + function min$1() { + return maxOrMin(this, arguments, 1); + } + + + /* + * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits + * using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function mod$1(x, y) { + return new this(x).mod(y); + } + + + /* + * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function mul(x, y) { + return new this(x).mul(y); + } + + + /* + * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} The base. + * y {number|string|bigint|Decimal} The exponent. + * + */ + function pow$1(x, y) { + return new this(x).pow(y); + } + + + /* + * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with + * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros + * are produced). + * + * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive. + * + */ + function random(sd) { + var d, e, k, n, + i = 0, + r = new this(1), + rd = []; + + if (sd === void 0) sd = this.precision; + else checkInt32(sd, 1, MAX_DIGITS); + + k = Math.ceil(sd / LOG_BASE); + + if (!this.crypto) { + for (; i < k;) rd[i++] = Math.random() * 1e7 | 0; + + // Browsers supporting crypto.getRandomValues. + } else if (crypto.getRandomValues) { + d = crypto.getRandomValues(new Uint32Array(k)); + + for (; i < k;) { + n = d[i]; + + // 0 <= n < 4294967296 + // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865). + if (n >= 4.29e9) { + d[i] = crypto.getRandomValues(new Uint32Array(1))[0]; + } else { + + // 0 <= n <= 4289999999 + // 0 <= (n % 1e7) <= 9999999 + rd[i++] = n % 1e7; + } + } + + // Node.js supporting crypto.randomBytes. + } else if (crypto.randomBytes) { + + // buffer + d = crypto.randomBytes(k *= 4); + + for (; i < k;) { + + // 0 <= n < 2147483648 + n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24); + + // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286). + if (n >= 2.14e9) { + crypto.randomBytes(4).copy(d, i); + } else { + + // 0 <= n <= 2139999999 + // 0 <= (n % 1e7) <= 9999999 + rd.push(n % 1e7); + i += 4; + } + } + + i = k / 4; + } else { + throw Error(cryptoUnavailable); + } + + k = rd[--i]; + sd %= LOG_BASE; + + // Convert trailing digits to zeros according to sd. + if (k && sd) { + n = mathpow(10, LOG_BASE - sd); + rd[i] = (k / n | 0) * n; + } + + // Remove trailing words which are zero. + for (; rd[i] === 0; i--) rd.pop(); + + // Zero? + if (i < 0) { + e = 0; + rd = [0]; + } else { + e = -1; + + // Remove leading words which are zero and adjust exponent accordingly. + for (; rd[0] === 0; e -= LOG_BASE) rd.shift(); + + // Count the digits of the first word of rd to determine leading zeros. + for (k = 1, n = rd[0]; n >= 10; n /= 10) k++; + + // Adjust the exponent for leading zeros of the first word of rd. + if (k < LOG_BASE) e -= LOG_BASE - k; + } + + r.e = e; + r.d = rd; + + return r; + } + + + /* + * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`. + * + * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL). + * + * x {number|string|bigint|Decimal} + * + */ + function round$1(x) { + return finalise(x = new this(x), x.e + 1, this.rounding); + } + + + /* + * Return + * 1 if x > 0, + * -1 if x < 0, + * 0 if x is 0, + * -0 if x is -0, + * NaN otherwise + * + * x {number|string|bigint|Decimal} + * + */ + function sign(x) { + x = new this(x); + return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN; + } + + + /* + * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits + * using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function sin(x) { + return new this(x).sin(); + } + + + /* + * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function sinh$1(x) { + return new this(x).sinh(); + } + + + /* + * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * + */ + function sqrt(x) { + return new this(x).sqrt(); + } + + + /* + * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits + * using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} + * y {number|string|bigint|Decimal} + * + */ + function sub(x, y) { + return new this(x).sub(y); + } + + + /* + * Return a new Decimal whose value is the sum of the arguments, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * Only the result is rounded, not the intermediate calculations. + * + * arguments {number|string|bigint|Decimal} + * + */ + function sum() { + var i = 0, + args = arguments, + x = new this(args[i]); + + external = false; + for (; x.s && ++i < args.length;) x = x.plus(args[i]); + external = true; + + return finalise(x, this.precision, this.rounding); + } + + + /* + * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant + * digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function tan(x) { + return new this(x).tan(); + } + + + /* + * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision` + * significant digits using rounding mode `rounding`. + * + * x {number|string|bigint|Decimal} A value in radians. + * + */ + function tanh(x) { + return new this(x).tanh(); + } + + + /* + * Return a new Decimal whose value is `x` truncated to an integer. + * + * x {number|string|bigint|Decimal} + * + */ + function trunc$1(x) { + return finalise(x = new this(x), x.e + 1, 1); + } + + + P$3[Symbol.for('nodejs.util.inspect.custom')] = P$3.toString; + P$3[Symbol.toStringTag] = 'Decimal'; + + // Create and configure initial Decimal constructor. + var Decimal = P$3.constructor = clone$1(DEFAULTS); + + // Create the internal constants from their string values. + LN10 = new Decimal(LN10); + PI = new Decimal(PI); + + var name$v = 'BigNumber'; + var dependencies$v = ['?on', 'config']; + var createBigNumberClass = /* #__PURE__ */factory(name$v, dependencies$v, _ref => { + var { + on, + config + } = _ref; + var BigNumber = Decimal.clone({ + precision: config.precision, + modulo: Decimal.EUCLID + }); + BigNumber.prototype = Object.create(BigNumber.prototype); + + /** + * Attach type information + */ + BigNumber.prototype.type = 'BigNumber'; + BigNumber.prototype.isBigNumber = true; + + /** + * Get a JSON representation of a BigNumber containing + * type information + * @returns {Object} Returns a JSON object structured as: + * `{"mathjs": "BigNumber", "value": "0.2"}` + */ + BigNumber.prototype.toJSON = function () { + return { + mathjs: 'BigNumber', + value: this.toString() + }; + }; + + /** + * Instantiate a BigNumber from a JSON object + * @param {Object} json a JSON object structured as: + * `{"mathjs": "BigNumber", "value": "0.2"}` + * @return {BigNumber} + */ + BigNumber.fromJSON = function (json) { + return new BigNumber(json.value); + }; + if (on) { + // listen for changed in the configuration, automatically apply changed precision + on('config', function (curr, prev) { + if (curr.precision !== prev.precision) { + BigNumber.config({ + precision: curr.precision + }); + } + }); + } + return BigNumber; + }, { + isClass: true + }); + + /** + * + * This class allows the manipulation of complex numbers. + * You can pass a complex number in different formats. Either as object, double, string or two integer parameters. + * + * Object form + * { re: , im: } + * { arg: , abs: } + * { phi: , r: } + * + * Array / Vector form + * [ real, imaginary ] + * + * Double form + * 99.3 - Single double value + * + * String form + * '23.1337' - Simple real number + * '15+3i' - a simple complex number + * '3-i' - a simple complex number + * + * Example: + * + * const c = new Complex('99.3+8i'); + * c.mul({r: 3, i: 9}).div(4.9).sub(3, 2); + * + */ + + + const cosh = Math.cosh || function (x) { + return Math.abs(x) < 1e-9 ? 1 - x : (Math.exp(x) + Math.exp(-x)) * 0.5; + }; + + const sinh = Math.sinh || function (x) { + return Math.abs(x) < 1e-9 ? x : (Math.exp(x) - Math.exp(-x)) * 0.5; + }; + + /** + * Calculates cos(x) - 1 using Taylor series if x is small (-¼π ≤ x ≤ ¼π). + * + * @param {number} x + * @returns {number} cos(x) - 1 + */ + const cosm1 = function (x) { + + const b = Math.PI / 4; + if (-b > x || x > b) { + return Math.cos(x) - 1.0; + } + + /* Calculate horner form of polynomial of taylor series in Q + let fac = 1, alt = 1, pol = {}; + for (let i = 0; i <= 16; i++) { + fac*= i || 1; + if (i % 2 == 0) { + pol[i] = new Fraction(1, alt * fac); + alt = -alt; + } + } + console.log(new Polynomial(pol).toHorner()); // (((((((1/20922789888000x^2-1/87178291200)x^2+1/479001600)x^2-1/3628800)x^2+1/40320)x^2-1/720)x^2+1/24)x^2-1/2)x^2+1 + */ + + const xx = x * x; + return xx * ( + xx * ( + xx * ( + xx * ( + xx * ( + xx * ( + xx * ( + xx / 20922789888000 + - 1 / 87178291200) + + 1 / 479001600) + - 1 / 3628800) + + 1 / 40320) + - 1 / 720) + + 1 / 24) + - 1 / 2); + }; + + const hypot = function (x, y) { + + x = Math.abs(x); + y = Math.abs(y); + + // Ensure `x` is the larger value + if (x < y) [x, y] = [y, x]; + + // If both are below the threshold, use straightforward Pythagoras + if (x < 1e8) return Math.sqrt(x * x + y * y); + + // For larger values, scale to avoid overflow + y /= x; + return x * Math.sqrt(1 + y * y); + }; + + const parser_exit = function () { + throw SyntaxError('Invalid Param'); + }; + + /** + * Calculates log(sqrt(a^2+b^2)) in a way to avoid overflows + * + * @param {number} a + * @param {number} b + * @returns {number} + */ + function logHypot(a, b) { + + const _a = Math.abs(a); + const _b = Math.abs(b); + + if (a === 0) { + return Math.log(_b); + } + + if (b === 0) { + return Math.log(_a); + } + + if (_a < 3000 && _b < 3000) { + return Math.log(a * a + b * b) * 0.5; + } + + /* I got 4 ideas to compute this property without overflow: + * + * Testing 1000000 times with random samples for a,b ∈ [1, 1000000000] against a big decimal library to get an error estimate + * + * 1. Only eliminate the square root: (OVERALL ERROR: 3.9122483030951116e-11) + + Math.log(a * a + b * b) / 2 + + * + * + * 2. Try to use the non-overflowing pythagoras: (OVERALL ERROR: 8.889760039210159e-10) + + const fn = function(a, b) { + a = Math.abs(a); + b = Math.abs(b); + let t = Math.min(a, b); + a = Math.max(a, b); + t = t / a; + + return Math.log(a) + Math.log(1 + t * t) / 2; + }; + + * 3. Abuse the identity cos(atan(y/x) = x / sqrt(x^2+y^2): (OVERALL ERROR: 3.4780178737037204e-10) + + Math.log(a / Math.cos(Math.atan2(b, a))) + + * 4. Use 3. and apply log rules: (OVERALL ERROR: 1.2014087502620896e-9) + + Math.log(a) - Math.log(Math.cos(Math.atan2(b, a))) + + */ + + a = a * 0.5; + b = b * 0.5; + + return 0.5 * Math.log(a * a + b * b) + Math.LN2; + } + + const P$2 = { 're': 0, 'im': 0 }; + const parse$1 = function (a, b) { + + const z = P$2; + + if (a === undefined || a === null) { + z['re'] = + z['im'] = 0; + } else if (b !== undefined) { + z['re'] = a; + z['im'] = b; + } else + switch (typeof a) { + + case 'object': + + if ('im' in a && 're' in a) { + z['re'] = a['re']; + z['im'] = a['im']; + } else if ('abs' in a && 'arg' in a) { + if (!isFinite(a['abs']) && isFinite(a['arg'])) { + return Complex$1['INFINITY']; + } + z['re'] = a['abs'] * Math.cos(a['arg']); + z['im'] = a['abs'] * Math.sin(a['arg']); + } else if ('r' in a && 'phi' in a) { + if (!isFinite(a['r']) && isFinite(a['phi'])) { + return Complex$1['INFINITY']; + } + z['re'] = a['r'] * Math.cos(a['phi']); + z['im'] = a['r'] * Math.sin(a['phi']); + } else if (a.length === 2) { // Quick array check + z['re'] = a[0]; + z['im'] = a[1]; + } else { + parser_exit(); + } + break; + + case 'string': + + z['im'] = /* void */ + z['re'] = 0; + + const tokens = a.replace(/_/g, '') + .match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g); + let plus = 1; + let minus = 0; + + if (tokens === null) { + parser_exit(); + } + + for (let i = 0; i < tokens.length; i++) { + + const c = tokens[i]; + + if (c === ' ' || c === '\t' || c === '\n') ; else if (c === '+') { + plus++; + } else if (c === '-') { + minus++; + } else if (c === 'i' || c === 'I') { + + if (plus + minus === 0) { + parser_exit(); + } + + if (tokens[i + 1] !== ' ' && !isNaN(tokens[i + 1])) { + z['im'] += parseFloat((minus % 2 ? '-' : '') + tokens[i + 1]); + i++; + } else { + z['im'] += parseFloat((minus % 2 ? '-' : '') + '1'); + } + plus = minus = 0; + + } else { + + if (plus + minus === 0 || isNaN(c)) { + parser_exit(); + } + + if (tokens[i + 1] === 'i' || tokens[i + 1] === 'I') { + z['im'] += parseFloat((minus % 2 ? '-' : '') + c); + i++; + } else { + z['re'] += parseFloat((minus % 2 ? '-' : '') + c); + } + plus = minus = 0; + } + } + + // Still something on the stack + if (plus + minus > 0) { + parser_exit(); + } + break; + + case 'number': + z['im'] = 0; + z['re'] = a; + break; + + default: + parser_exit(); + } + + if (isNaN(z['re']) || isNaN(z['im'])) ; + + return z; + }; + + /** + * @constructor + * @returns {Complex} + */ + function Complex$1(a, b) { + + if (!(this instanceof Complex$1)) { + return new Complex$1(a, b); + } + + const z = parse$1(a, b); + + this['re'] = z['re']; + this['im'] = z['im']; + } + + Complex$1.prototype = { + + 're': 0, + 'im': 0, + + /** + * Calculates the sign of a complex number, which is a normalized complex + * + * @returns {Complex} + */ + 'sign': function () { + + const abs = hypot(this['re'], this['im']); + + return new Complex$1( + this['re'] / abs, + this['im'] / abs); + }, + + /** + * Adds two complex numbers + * + * @returns {Complex} + */ + 'add': function (a, b) { + + const z = parse$1(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + + if (tInfin || zInfin) { + + if (tInfin && zInfin) { + // Infinity + Infinity = NaN + return Complex$1['NAN']; + } + // Infinity + z = Infinity { where z != Infinity } + return Complex$1['INFINITY']; + } + + return new Complex$1( + this['re'] + z['re'], + this['im'] + z['im']); + }, + + /** + * Subtracts two complex numbers + * + * @returns {Complex} + */ + 'sub': function (a, b) { + + const z = parse$1(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + + if (tInfin || zInfin) { + + if (tInfin && zInfin) { + // Infinity - Infinity = NaN + return Complex$1['NAN']; + } + // Infinity - z = Infinity { where z != Infinity } + return Complex$1['INFINITY']; + } + + return new Complex$1( + this['re'] - z['re'], + this['im'] - z['im']); + }, + + /** + * Multiplies two complex numbers + * + * @returns {Complex} + */ + 'mul': function (a, b) { + + const z = parse$1(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + const tIsZero = this['re'] === 0 && this['im'] === 0; + const zIsZero = z['re'] === 0 && z['im'] === 0; + + // Infinity * 0 = NaN + if (tInfin && zIsZero || zInfin && tIsZero) { + return Complex$1['NAN']; + } + + // Infinity * z = Infinity { where z != 0 } + if (tInfin || zInfin) { + return Complex$1['INFINITY']; + } + + // Shortcut for real values + if (z['im'] === 0 && this['im'] === 0) { + return new Complex$1(this['re'] * z['re'], 0); + } + + return new Complex$1( + this['re'] * z['re'] - this['im'] * z['im'], + this['re'] * z['im'] + this['im'] * z['re']); + }, + + /** + * Divides two complex numbers + * + * @returns {Complex} + */ + 'div': function (a, b) { + + const z = parse$1(a, b); + + const tInfin = this['isInfinite'](); + const zInfin = !(isFinite(z['re']) && isFinite(z['im'])); + const tIsZero = this['re'] === 0 && this['im'] === 0; + const zIsZero = z['re'] === 0 && z['im'] === 0; + + // 0 / 0 = NaN and Infinity / Infinity = NaN + if (tIsZero && zIsZero || tInfin && zInfin) { + return Complex$1['NAN']; + } + + // Infinity / 0 = Infinity + if (zIsZero || tInfin) { + return Complex$1['INFINITY']; + } + + // 0 / Infinity = 0 + if (tIsZero || zInfin) { + return Complex$1['ZERO']; + } + + if (0 === z['im']) { + // Divisor is real + return new Complex$1(this['re'] / z['re'], this['im'] / z['re']); + } + + if (Math.abs(z['re']) < Math.abs(z['im'])) { + + const x = z['re'] / z['im']; + const t = z['re'] * x + z['im']; + + return new Complex$1( + (this['re'] * x + this['im']) / t, + (this['im'] * x - this['re']) / t); + + } else { + + const x = z['im'] / z['re']; + const t = z['im'] * x + z['re']; + + return new Complex$1( + (this['re'] + this['im'] * x) / t, + (this['im'] - this['re'] * x) / t); + } + }, + + /** + * Calculate the power of two complex numbers + * + * @returns {Complex} + */ + 'pow': function (a, b) { + + const z = parse$1(a, b); + + const tIsZero = this['re'] === 0 && this['im'] === 0; + const zIsZero = z['re'] === 0 && z['im'] === 0; + + if (zIsZero) { + return Complex$1['ONE']; + } + + // If the exponent is real + if (z['im'] === 0) { + + if (this['im'] === 0 && this['re'] > 0) { + + return new Complex$1(Math.pow(this['re'], z['re']), 0); + + } else if (this['re'] === 0) { // If base is fully imaginary + + switch ((z['re'] % 4 + 4) % 4) { + case 0: + return new Complex$1(Math.pow(this['im'], z['re']), 0); + case 1: + return new Complex$1(0, Math.pow(this['im'], z['re'])); + case 2: + return new Complex$1(-Math.pow(this['im'], z['re']), 0); + case 3: + return new Complex$1(0, -Math.pow(this['im'], z['re'])); + } + } + } + + /* I couldn't find a good formula, so here is a derivation and optimization + * + * z_1^z_2 = (a + bi)^(c + di) + * = exp((c + di) * log(a + bi) + * = pow(a^2 + b^2, (c + di) / 2) * exp(i(c + di)atan2(b, a)) + * =>... + * Re = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * cos(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) + * Im = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * sin(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) + * + * =>... + * Re = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * cos(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) + * Im = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * sin(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) + * + * => + * Re = exp(c * logsq2 - d * arg(z_1)) * cos(d * logsq2 + c * arg(z_1)) + * Im = exp(c * logsq2 - d * arg(z_1)) * sin(d * logsq2 + c * arg(z_1)) + * + */ + + if (tIsZero && z['re'] > 0) { // Same behavior as Wolframalpha, Zero if real part is zero + return Complex$1['ZERO']; + } + + const arg = Math.atan2(this['im'], this['re']); + const loh = logHypot(this['re'], this['im']); + + let re = Math.exp(z['re'] * loh - z['im'] * arg); + let im = z['im'] * loh + z['re'] * arg; + return new Complex$1( + re * Math.cos(im), + re * Math.sin(im)); + }, + + /** + * Calculate the complex square root + * + * @returns {Complex} + */ + 'sqrt': function () { + + const a = this['re']; + const b = this['im']; + + if (b === 0) { + // Real number case + if (a >= 0) { + return new Complex$1(Math.sqrt(a), 0); + } else { + return new Complex$1(0, Math.sqrt(-a)); + } + } + + const r = hypot(a, b); + + let re = Math.sqrt(0.5 * (r + Math.abs(a))); // sqrt(2x) / 2 = sqrt(x / 2) + let im = Math.abs(b) / (2 * re); + + if (a >= 0) { + return new Complex$1(re, b < 0 ? -im : im); + } else { + return new Complex$1(im, b < 0 ? -re : re); + } + }, + + /** + * Calculate the complex exponent + * + * @returns {Complex} + */ + 'exp': function () { + + const er = Math.exp(this['re']); + + if (this['im'] === 0) { + return new Complex$1(er, 0); + } + return new Complex$1( + er * Math.cos(this['im']), + er * Math.sin(this['im'])); + }, + + /** + * Calculate the complex exponent and subtracts one. + * + * This may be more accurate than `Complex(x).exp().sub(1)` if + * `x` is small. + * + * @returns {Complex} + */ + 'expm1': function () { + + /** + * exp(a + i*b) - 1 + = exp(a) * (cos(b) + j*sin(b)) - 1 + = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b) + */ + + const a = this['re']; + const b = this['im']; + + return new Complex$1( + Math.expm1(a) * Math.cos(b) + cosm1(b), + Math.exp(a) * Math.sin(b)); + }, + + /** + * Calculate the natural log + * + * @returns {Complex} + */ + 'log': function () { + + const a = this['re']; + const b = this['im']; + + if (b === 0 && a > 0) { + return new Complex$1(Math.log(a), 0); + } + + return new Complex$1( + logHypot(a, b), + Math.atan2(b, a)); + }, + + /** + * Calculate the magnitude of the complex number + * + * @returns {number} + */ + 'abs': function () { + + return hypot(this['re'], this['im']); + }, + + /** + * Calculate the angle of the complex number + * + * @returns {number} + */ + 'arg': function () { + + return Math.atan2(this['im'], this['re']); + }, + + /** + * Calculate the sine of the complex number + * + * @returns {Complex} + */ + 'sin': function () { + + // sin(z) = ( e^iz - e^-iz ) / 2i + // = sin(a)cosh(b) + i cos(a)sinh(b) + + const a = this['re']; + const b = this['im']; + + return new Complex$1( + Math.sin(a) * cosh(b), + Math.cos(a) * sinh(b)); + }, + + /** + * Calculate the cosine + * + * @returns {Complex} + */ + 'cos': function () { + + // cos(z) = ( e^iz + e^-iz ) / 2 + // = cos(a)cosh(b) - i sin(a)sinh(b) + + const a = this['re']; + const b = this['im']; + + return new Complex$1( + Math.cos(a) * cosh(b), + -Math.sin(a) * sinh(b)); + }, + + /** + * Calculate the tangent + * + * @returns {Complex} + */ + 'tan': function () { + + // tan(z) = sin(z) / cos(z) + // = ( e^iz - e^-iz ) / ( i( e^iz + e^-iz ) ) + // = ( e^2iz - 1 ) / i( e^2iz + 1 ) + // = ( sin(2a) + i sinh(2b) ) / ( cos(2a) + cosh(2b) ) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = Math.cos(a) + cosh(b); + + return new Complex$1( + Math.sin(a) / d, + sinh(b) / d); + }, + + /** + * Calculate the cotangent + * + * @returns {Complex} + */ + 'cot': function () { + + // cot(c) = i(e^(ci) + e^(-ci)) / (e^(ci) - e^(-ci)) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = Math.cos(a) - cosh(b); + + return new Complex$1( + -Math.sin(a) / d, + sinh(b) / d); + }, + + /** + * Calculate the secant + * + * @returns {Complex} + */ + 'sec': function () { + + // sec(c) = 2 / (e^(ci) + e^(-ci)) + + const a = this['re']; + const b = this['im']; + const d = 0.5 * cosh(2 * b) + 0.5 * Math.cos(2 * a); + + return new Complex$1( + Math.cos(a) * cosh(b) / d, + Math.sin(a) * sinh(b) / d); + }, + + /** + * Calculate the cosecans + * + * @returns {Complex} + */ + 'csc': function () { + + // csc(c) = 2i / (e^(ci) - e^(-ci)) + + const a = this['re']; + const b = this['im']; + const d = 0.5 * cosh(2 * b) - 0.5 * Math.cos(2 * a); + + return new Complex$1( + Math.sin(a) * cosh(b) / d, + -Math.cos(a) * sinh(b) / d); + }, + + /** + * Calculate the complex arcus sinus + * + * @returns {Complex} + */ + 'asin': function () { + + // asin(c) = -i * log(ci + sqrt(1 - c^2)) + + const a = this['re']; + const b = this['im']; + + const t1 = new Complex$1( + b * b - a * a + 1, + -2 * a * b)['sqrt'](); + + const t2 = new Complex$1( + t1['re'] - b, + t1['im'] + a)['log'](); + + return new Complex$1(t2['im'], -t2['re']); + }, + + /** + * Calculate the complex arcus cosinus + * + * @returns {Complex} + */ + 'acos': function () { + + // acos(c) = i * log(c - i * sqrt(1 - c^2)) + + const a = this['re']; + const b = this['im']; + + const t1 = new Complex$1( + b * b - a * a + 1, + -2 * a * b)['sqrt'](); + + const t2 = new Complex$1( + t1['re'] - b, + t1['im'] + a)['log'](); + + return new Complex$1(Math.PI / 2 - t2['im'], t2['re']); + }, + + /** + * Calculate the complex arcus tangent + * + * @returns {Complex} + */ + 'atan': function () { + + // atan(c) = i / 2 log((i + x) / (i - x)) + + const a = this['re']; + const b = this['im']; + + if (a === 0) { + + if (b === 1) { + return new Complex$1(0, Infinity); + } + + if (b === -1) { + return new Complex$1(0, -Infinity); + } + } + + const d = a * a + (1.0 - b) * (1.0 - b); + + const t1 = new Complex$1( + (1 - b * b - a * a) / d, + -2 * a / d).log(); + + return new Complex$1(-0.5 * t1['im'], 0.5 * t1['re']); + }, + + /** + * Calculate the complex arcus cotangent + * + * @returns {Complex} + */ + 'acot': function () { + + // acot(c) = i / 2 log((c - i) / (c + i)) + + const a = this['re']; + const b = this['im']; + + if (b === 0) { + return new Complex$1(Math.atan2(1, a), 0); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex$1( + a / d, + -b / d).atan() + : new Complex$1( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).atan(); + }, + + /** + * Calculate the complex arcus secant + * + * @returns {Complex} + */ + 'asec': function () { + + // asec(c) = -i * log(1 / c + sqrt(1 - i / c^2)) + + const a = this['re']; + const b = this['im']; + + if (a === 0 && b === 0) { + return new Complex$1(0, Infinity); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex$1( + a / d, + -b / d).acos() + : new Complex$1( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).acos(); + }, + + /** + * Calculate the complex arcus cosecans + * + * @returns {Complex} + */ + 'acsc': function () { + + // acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2)) + + const a = this['re']; + const b = this['im']; + + if (a === 0 && b === 0) { + return new Complex$1(Math.PI / 2, Infinity); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex$1( + a / d, + -b / d).asin() + : new Complex$1( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).asin(); + }, + + /** + * Calculate the complex sinh + * + * @returns {Complex} + */ + 'sinh': function () { + + // sinh(c) = (e^c - e^-c) / 2 + + const a = this['re']; + const b = this['im']; + + return new Complex$1( + sinh(a) * Math.cos(b), + cosh(a) * Math.sin(b)); + }, + + /** + * Calculate the complex cosh + * + * @returns {Complex} + */ + 'cosh': function () { + + // cosh(c) = (e^c + e^-c) / 2 + + const a = this['re']; + const b = this['im']; + + return new Complex$1( + cosh(a) * Math.cos(b), + sinh(a) * Math.sin(b)); + }, + + /** + * Calculate the complex tanh + * + * @returns {Complex} + */ + 'tanh': function () { + + // tanh(c) = (e^c - e^-c) / (e^c + e^-c) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = cosh(a) + Math.cos(b); + + return new Complex$1( + sinh(a) / d, + Math.sin(b) / d); + }, + + /** + * Calculate the complex coth + * + * @returns {Complex} + */ + 'coth': function () { + + // coth(c) = (e^c + e^-c) / (e^c - e^-c) + + const a = 2 * this['re']; + const b = 2 * this['im']; + const d = cosh(a) - Math.cos(b); + + return new Complex$1( + sinh(a) / d, + -Math.sin(b) / d); + }, + + /** + * Calculate the complex coth + * + * @returns {Complex} + */ + 'csch': function () { + + // csch(c) = 2 / (e^c - e^-c) + + const a = this['re']; + const b = this['im']; + const d = Math.cos(2 * b) - cosh(2 * a); + + return new Complex$1( + -2 * sinh(a) * Math.cos(b) / d, + 2 * cosh(a) * Math.sin(b) / d); + }, + + /** + * Calculate the complex sech + * + * @returns {Complex} + */ + 'sech': function () { + + // sech(c) = 2 / (e^c + e^-c) + + const a = this['re']; + const b = this['im']; + const d = Math.cos(2 * b) + cosh(2 * a); + + return new Complex$1( + 2 * cosh(a) * Math.cos(b) / d, + -2 * sinh(a) * Math.sin(b) / d); + }, + + /** + * Calculate the complex asinh + * + * @returns {Complex} + */ + 'asinh': function () { + + // asinh(c) = log(c + sqrt(c^2 + 1)) + + let tmp = this['im']; + this['im'] = -this['re']; + this['re'] = tmp; + const res = this['asin'](); + + this['re'] = -this['im']; + this['im'] = tmp; + tmp = res['re']; + + res['re'] = -res['im']; + res['im'] = tmp; + return res; + }, + + /** + * Calculate the complex acosh + * + * @returns {Complex} + */ + 'acosh': function () { + + // acosh(c) = log(c + sqrt(c^2 - 1)) + + const res = this['acos'](); + if (res['im'] <= 0) { + const tmp = res['re']; + res['re'] = -res['im']; + res['im'] = tmp; + } else { + const tmp = res['im']; + res['im'] = -res['re']; + res['re'] = tmp; + } + return res; + }, + + /** + * Calculate the complex atanh + * + * @returns {Complex} + */ + 'atanh': function () { + + // atanh(c) = log((1+c) / (1-c)) / 2 + + const a = this['re']; + const b = this['im']; + + const noIM = a > 1 && b === 0; + const oneMinus = 1 - a; + const onePlus = 1 + a; + const d = oneMinus * oneMinus + b * b; + + const x = (d !== 0) + ? new Complex$1( + (onePlus * oneMinus - b * b) / d, + (b * oneMinus + onePlus * b) / d) + : new Complex$1( + (a !== -1) ? (a / 0) : 0, + (b !== 0) ? (b / 0) : 0); + + const temp = x['re']; + x['re'] = logHypot(x['re'], x['im']) / 2; + x['im'] = Math.atan2(x['im'], temp) / 2; + if (noIM) { + x['im'] = -x['im']; + } + return x; + }, + + /** + * Calculate the complex acoth + * + * @returns {Complex} + */ + 'acoth': function () { + + // acoth(c) = log((c+1) / (c-1)) / 2 + + const a = this['re']; + const b = this['im']; + + if (a === 0 && b === 0) { + return new Complex$1(0, Math.PI / 2); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex$1( + a / d, + -b / d).atanh() + : new Complex$1( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).atanh(); + }, + + /** + * Calculate the complex acsch + * + * @returns {Complex} + */ + 'acsch': function () { + + // acsch(c) = log((1+sqrt(1+c^2))/c) + + const a = this['re']; + const b = this['im']; + + if (b === 0) { + + return new Complex$1( + (a !== 0) + ? Math.log(a + Math.sqrt(a * a + 1)) + : Infinity, 0); + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex$1( + a / d, + -b / d).asinh() + : new Complex$1( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).asinh(); + }, + + /** + * Calculate the complex asech + * + * @returns {Complex} + */ + 'asech': function () { + + // asech(c) = log((1+sqrt(1-c^2))/c) + + const a = this['re']; + const b = this['im']; + + if (this['isZero']()) { + return Complex$1['INFINITY']; + } + + const d = a * a + b * b; + return (d !== 0) + ? new Complex$1( + a / d, + -b / d).acosh() + : new Complex$1( + (a !== 0) ? a / 0 : 0, + (b !== 0) ? -b / 0 : 0).acosh(); + }, + + /** + * Calculate the complex inverse 1/z + * + * @returns {Complex} + */ + 'inverse': function () { + + // 1 / 0 = Infinity and 1 / Infinity = 0 + if (this['isZero']()) { + return Complex$1['INFINITY']; + } + + if (this['isInfinite']()) { + return Complex$1['ZERO']; + } + + const a = this['re']; + const b = this['im']; + + const d = a * a + b * b; + + return new Complex$1(a / d, -b / d); + }, + + /** + * Returns the complex conjugate + * + * @returns {Complex} + */ + 'conjugate': function () { + + return new Complex$1(this['re'], -this['im']); + }, + + /** + * Gets the negated complex number + * + * @returns {Complex} + */ + 'neg': function () { + + return new Complex$1(-this['re'], -this['im']); + }, + + /** + * Ceils the actual complex number + * + * @returns {Complex} + */ + 'ceil': function (places) { + + places = Math.pow(10, places || 0); + + return new Complex$1( + Math.ceil(this['re'] * places) / places, + Math.ceil(this['im'] * places) / places); + }, + + /** + * Floors the actual complex number + * + * @returns {Complex} + */ + 'floor': function (places) { + + places = Math.pow(10, places || 0); + + return new Complex$1( + Math.floor(this['re'] * places) / places, + Math.floor(this['im'] * places) / places); + }, + + /** + * Ceils the actual complex number + * + * @returns {Complex} + */ + 'round': function (places) { + + places = Math.pow(10, places || 0); + + return new Complex$1( + Math.round(this['re'] * places) / places, + Math.round(this['im'] * places) / places); + }, + + /** + * Compares two complex numbers + * + * **Note:** new Complex(Infinity).equals(Infinity) === false + * + * @returns {boolean} + */ + 'equals': function (a, b) { + + const z = parse$1(a, b); + + return Math.abs(z['re'] - this['re']) <= Complex$1['EPSILON'] && + Math.abs(z['im'] - this['im']) <= Complex$1['EPSILON']; + }, + + /** + * Clones the actual object + * + * @returns {Complex} + */ + 'clone': function () { + + return new Complex$1(this['re'], this['im']); + }, + + /** + * Gets a string of the actual complex number + * + * @returns {string} + */ + 'toString': function () { + + let a = this['re']; + let b = this['im']; + let ret = ""; + + if (this['isNaN']()) { + return 'NaN'; + } + + if (this['isInfinite']()) { + return 'Infinity'; + } + + if (Math.abs(a) < Complex$1['EPSILON']) { + a = 0; + } + + if (Math.abs(b) < Complex$1['EPSILON']) { + b = 0; + } + + // If is real number + if (b === 0) { + return ret + a; + } + + if (a !== 0) { + ret += a; + ret += " "; + if (b < 0) { + b = -b; + ret += "-"; + } else { + ret += "+"; + } + ret += " "; + } else if (b < 0) { + b = -b; + ret += "-"; + } + + if (1 !== b) { // b is the absolute imaginary part + ret += b; + } + return ret + "i"; + }, + + /** + * Returns the actual number as a vector + * + * @returns {Array} + */ + 'toVector': function () { + + return [this['re'], this['im']]; + }, + + /** + * Returns the actual real value of the current object + * + * @returns {number|null} + */ + 'valueOf': function () { + + if (this['im'] === 0) { + return this['re']; + } + return null; + }, + + /** + * Determines whether a complex number is not on the Riemann sphere. + * + * @returns {boolean} + */ + 'isNaN': function () { + return isNaN(this['re']) || isNaN(this['im']); + }, + + /** + * Determines whether or not a complex number is at the zero pole of the + * Riemann sphere. + * + * @returns {boolean} + */ + 'isZero': function () { + return this['im'] === 0 && this['re'] === 0; + }, + + /** + * Determines whether a complex number is not at the infinity pole of the + * Riemann sphere. + * + * @returns {boolean} + */ + 'isFinite': function () { + return isFinite(this['re']) && isFinite(this['im']); + }, + + /** + * Determines whether or not a complex number is at the infinity pole of the + * Riemann sphere. + * + * @returns {boolean} + */ + 'isInfinite': function () { + return !this['isFinite'](); + } + }; + + Complex$1['ZERO'] = new Complex$1(0, 0); + Complex$1['ONE'] = new Complex$1(1, 0); + Complex$1['I'] = new Complex$1(0, 1); + Complex$1['PI'] = new Complex$1(Math.PI, 0); + Complex$1['E'] = new Complex$1(Math.E, 0); + Complex$1['INFINITY'] = new Complex$1(Infinity, Infinity); + Complex$1['NAN'] = new Complex$1(NaN, NaN); + Complex$1['EPSILON'] = 1e-15; + + var name$u = 'Complex'; + var dependencies$u = []; + var createComplexClass = /* #__PURE__ */factory(name$u, dependencies$u, () => { + /** + * Attach type information + */ + Object.defineProperty(Complex$1, 'name', { + value: 'Complex' + }); + Complex$1.prototype.constructor = Complex$1; + Complex$1.prototype.type = 'Complex'; + Complex$1.prototype.isComplex = true; + + /** + * Get a JSON representation of the complex number + * @returns {Object} Returns a JSON object structured as: + * `{"mathjs": "Complex", "re": 2, "im": 3}` + */ + Complex$1.prototype.toJSON = function () { + return { + mathjs: 'Complex', + re: this.re, + im: this.im + }; + }; + + /* + * Return the value of the complex number in polar notation + * The angle phi will be set in the interval of [-pi, pi]. + * @return {{r: number, phi: number}} Returns and object with properties r and phi. + */ + Complex$1.prototype.toPolar = function () { + return { + r: this.abs(), + phi: this.arg() + }; + }; + + /** + * Get a string representation of the complex number, + * with optional formatting options. + * @param {Object | number | Function} [options] Formatting options. See + * lib/utils/number:format for a + * description of the available + * options. + * @return {string} str + */ + Complex$1.prototype.format = function (options) { + var str = ''; + var im = this.im; + var re = this.re; + var strRe = format$2(this.re, options); + var strIm = format$2(this.im, options); + + // round either re or im when smaller than the configured precision + var precision = isNumber(options) ? options : options ? options.precision : null; + if (precision !== null) { + var epsilon = Math.pow(10, -precision); + if (Math.abs(re / im) < epsilon) { + re = 0; + } + if (Math.abs(im / re) < epsilon) { + im = 0; + } + } + if (im === 0) { + // real value + str = strRe; + } else if (re === 0) { + // purely complex value + if (im === 1) { + str = 'i'; + } else if (im === -1) { + str = '-i'; + } else { + str = strIm + 'i'; + } + } else { + // complex value + if (im < 0) { + if (im === -1) { + str = strRe + ' - i'; + } else { + str = strRe + ' - ' + strIm.substring(1) + 'i'; + } + } else { + if (im === 1) { + str = strRe + ' + i'; + } else { + str = strRe + ' + ' + strIm + 'i'; + } + } + } + return str; + }; + + /** + * Create a complex number from polar coordinates + * + * Usage: + * + * Complex.fromPolar(r: number, phi: number) : Complex + * Complex.fromPolar({r: number, phi: number}) : Complex + * + * @param {*} args... + * @return {Complex} + */ + Complex$1.fromPolar = function (args) { + switch (arguments.length) { + case 1: + { + var arg = arguments[0]; + if (typeof arg === 'object') { + return Complex$1(arg); + } else { + throw new TypeError('Input has to be an object with r and phi keys.'); + } + } + case 2: + { + var r = arguments[0]; + var phi = arguments[1]; + if (isNumber(r)) { + if (isUnit(phi) && phi.hasBase('ANGLE')) { + // convert unit to a number in radians + phi = phi.toNumber('rad'); + } + if (isNumber(phi)) { + return new Complex$1({ + r, + phi + }); + } + throw new TypeError('Phi is not a number nor an angle unit.'); + } else { + throw new TypeError('Radius r is not a number.'); + } + } + default: + throw new SyntaxError('Wrong number of arguments in function fromPolar'); + } + }; + Complex$1.prototype.valueOf = Complex$1.prototype.toString; + + /** + * Create a Complex number from a JSON object + * @param {Object} json A JSON Object structured as + * {"mathjs": "Complex", "re": 2, "im": 3} + * All properties are optional, default values + * for `re` and `im` are 0. + * @return {Complex} Returns a new Complex number + */ + Complex$1.fromJSON = function (json) { + return new Complex$1(json); + }; + + /** + * Compare two complex numbers, `a` and `b`: + * + * - Returns 1 when the real part of `a` is larger than the real part of `b` + * - Returns -1 when the real part of `a` is smaller than the real part of `b` + * - Returns 1 when the real parts are equal + * and the imaginary part of `a` is larger than the imaginary part of `b` + * - Returns -1 when the real parts are equal + * and the imaginary part of `a` is smaller than the imaginary part of `b` + * - Returns 0 when both real and imaginary parts are equal. + * + * @params {Complex} a + * @params {Complex} b + * @returns {number} Returns the comparison result: -1, 0, or 1 + */ + Complex$1.compare = function (a, b) { + if (a.re > b.re) { + return 1; + } + if (a.re < b.re) { + return -1; + } + if (a.im > b.im) { + return 1; + } + if (a.im < b.im) { + return -1; + } + return 0; + }; + return Complex$1; + }, { + isClass: true + }); + + /** + * + * This class offers the possibility to calculate fractions. + * You can pass a fraction in different formats. Either as array, as double, as string or as an integer. + * + * Array/Object form + * [ 0 => , 1 => ] + * { n => , d => } + * + * Integer form + * - Single integer value as BigInt or Number + * + * Double form + * - Single double value as Number + * + * String form + * 123.456 - a simple double + * 123/456 - a string fraction + * 123.'456' - a double with repeating decimal places + * 123.(456) - synonym + * 123.45'6' - a double with repeating last place + * 123.45(6) - synonym + * + * Example: + * let f = new Fraction("9.4'31'"); + * f.mul([-4, 3]).div(4.9); + * + */ + + // Set Identity function to downgrade BigInt to Number if needed + if (typeof BigInt === 'undefined') BigInt = function (n) { if (isNaN(n)) throw new Error(""); return n; }; + + const C_ZERO = BigInt(0); + const C_ONE = BigInt(1); + const C_TWO = BigInt(2); + const C_FIVE = BigInt(5); + const C_TEN = BigInt(10); + + // Maximum search depth for cyclic rational numbers. 2000 should be more than enough. + // Example: 1/7 = 0.(142857) has 6 repeating decimal places. + // If MAX_CYCLE_LEN gets reduced, long cycles will not be detected and toString() only gets the first 10 digits + const MAX_CYCLE_LEN = 2000; + + // Parsed data to avoid calling "new" all the time + const P$1 = { + "s": C_ONE, + "n": C_ZERO, + "d": C_ONE + }; + + function assign(n, s) { + + try { + n = BigInt(n); + } catch (e) { + throw InvalidParameter(); + } + return n * s; + } + + function trunc(x) { + return typeof x === 'bigint' ? x : Math.floor(x); + } + + // Creates a new Fraction internally without the need of the bulky constructor + function newFraction(n, d) { + + if (d === C_ZERO) { + throw DivisionByZero(); + } + + const f = Object.create(Fraction$1.prototype); + f["s"] = n < C_ZERO ? -C_ONE : C_ONE; + + n = n < C_ZERO ? -n : n; + + const a = gcd(n, d); + + f["n"] = n / a; + f["d"] = d / a; + return f; + } + + function factorize(num) { + + const factors = {}; + + let n = num; + let i = C_TWO; + let s = C_FIVE - C_ONE; + + while (s <= n) { + + while (n % i === C_ZERO) { + n /= i; + factors[i] = (factors[i] || C_ZERO) + C_ONE; + } + s += C_ONE + C_TWO * i++; + } + + if (n !== num) { + if (n > 1) + factors[n] = (factors[n] || C_ZERO) + C_ONE; + } else { + factors[num] = (factors[num] || C_ZERO) + C_ONE; + } + return factors; + } + + const parse = function (p1, p2) { + + let n = C_ZERO, d = C_ONE, s = C_ONE; + + if (p1 === undefined || p1 === null) ; else if (p2 !== undefined) { // Two arguments + + if (typeof p1 === "bigint") { + n = p1; + } else if (isNaN(p1)) { + throw InvalidParameter(); + } else if (p1 % 1 !== 0) { + throw NonIntegerParameter(); + } else { + n = BigInt(p1); + } + + if (typeof p2 === "bigint") { + d = p2; + } else if (isNaN(p2)) { + throw InvalidParameter(); + } else if (p2 % 1 !== 0) { + throw NonIntegerParameter(); + } else { + d = BigInt(p2); + } + + s = n * d; + + } else if (typeof p1 === "object") { + if ("d" in p1 && "n" in p1) { + n = BigInt(p1["n"]); + d = BigInt(p1["d"]); + if ("s" in p1) + n *= BigInt(p1["s"]); + } else if (0 in p1) { + n = BigInt(p1[0]); + if (1 in p1) + d = BigInt(p1[1]); + } else if (typeof p1 === "bigint") { + n = p1; + } else { + throw InvalidParameter(); + } + s = n * d; + } else if (typeof p1 === "number") { + + if (isNaN(p1)) { + throw InvalidParameter(); + } + + if (p1 < 0) { + s = -C_ONE; + p1 = -p1; + } + + if (p1 % 1 === 0) { + n = BigInt(p1); + } else { + + let z = 1; + + let A = 0, B = 1; + let C = 1, D = 1; + + let N = 10000000; + + if (p1 >= 1) { + z = 10 ** Math.floor(1 + Math.log10(p1)); + p1 /= z; + } + + // Using Farey Sequences + + while (B <= N && D <= N) { + let M = (A + C) / (B + D); + + if (p1 === M) { + if (B + D <= N) { + n = A + C; + d = B + D; + } else if (D > B) { + n = C; + d = D; + } else { + n = A; + d = B; + } + break; + + } else { + + if (p1 > M) { + A += C; + B += D; + } else { + C += A; + D += B; + } + + if (B > N) { + n = C; + d = D; + } else { + n = A; + d = B; + } + } + } + n = BigInt(n) * BigInt(z); + d = BigInt(d); + } + + } else if (typeof p1 === "string") { + + let ndx = 0; + + let v = C_ZERO, w = C_ZERO, x = C_ZERO, y = C_ONE, z = C_ONE; + + let match = p1.replace(/_/g, '').match(/\d+|./g); + + if (match === null) + throw InvalidParameter(); + + if (match[ndx] === '-') {// Check for minus sign at the beginning + s = -C_ONE; + ndx++; + } else if (match[ndx] === '+') {// Check for plus sign at the beginning + ndx++; + } + + if (match.length === ndx + 1) { // Check if it's just a simple number "1234" + w = assign(match[ndx++], s); + } else if (match[ndx + 1] === '.' || match[ndx] === '.') { // Check if it's a decimal number + + if (match[ndx] !== '.') { // Handle 0.5 and .5 + v = assign(match[ndx++], s); + } + ndx++; + + // Check for decimal places + if (ndx + 1 === match.length || match[ndx + 1] === '(' && match[ndx + 3] === ')' || match[ndx + 1] === "'" && match[ndx + 3] === "'") { + w = assign(match[ndx], s); + y = C_TEN ** BigInt(match[ndx].length); + ndx++; + } + + // Check for repeating places + if (match[ndx] === '(' && match[ndx + 2] === ')' || match[ndx] === "'" && match[ndx + 2] === "'") { + x = assign(match[ndx + 1], s); + z = C_TEN ** BigInt(match[ndx + 1].length) - C_ONE; + ndx += 3; + } + + } else if (match[ndx + 1] === '/' || match[ndx + 1] === ':') { // Check for a simple fraction "123/456" or "123:456" + w = assign(match[ndx], s); + y = assign(match[ndx + 2], C_ONE); + ndx += 3; + } else if (match[ndx + 3] === '/' && match[ndx + 1] === ' ') { // Check for a complex fraction "123 1/2" + v = assign(match[ndx], s); + w = assign(match[ndx + 2], s); + y = assign(match[ndx + 4], C_ONE); + ndx += 5; + } + + if (match.length <= ndx) { // Check for more tokens on the stack + d = y * z; + s = /* void */ + n = x + d * v + z * w; + } else { + throw InvalidParameter(); + } + + } else if (typeof p1 === "bigint") { + n = p1; + s = p1; + d = C_ONE; + } else { + throw InvalidParameter(); + } + + if (d === C_ZERO) { + throw DivisionByZero(); + } + + P$1["s"] = s < C_ZERO ? -C_ONE : C_ONE; + P$1["n"] = n < C_ZERO ? -n : n; + P$1["d"] = d < C_ZERO ? -d : d; + }; + + function modpow(b, e, m) { + + let r = C_ONE; + for (; e > C_ZERO; b = (b * b) % m, e >>= C_ONE) { + + if (e & C_ONE) { + r = (r * b) % m; + } + } + return r; + } + + function cycleLen(n, d) { + + for (; d % C_TWO === C_ZERO; + d /= C_TWO) { + } + + for (; d % C_FIVE === C_ZERO; + d /= C_FIVE) { + } + + if (d === C_ONE) // Catch non-cyclic numbers + return C_ZERO; + + // If we would like to compute really large numbers quicker, we could make use of Fermat's little theorem: + // 10^(d-1) % d == 1 + // However, we don't need such large numbers and MAX_CYCLE_LEN should be the capstone, + // as we want to translate the numbers to strings. + + let rem = C_TEN % d; + let t = 1; + + for (; rem !== C_ONE; t++) { + rem = rem * C_TEN % d; + + if (t > MAX_CYCLE_LEN) + return C_ZERO; // Returning 0 here means that we don't print it as a cyclic number. It's likely that the answer is `d-1` + } + return BigInt(t); + } + + function cycleStart(n, d, len) { + + let rem1 = C_ONE; + let rem2 = modpow(C_TEN, len, d); + + for (let t = 0; t < 300; t++) { // s < ~log10(Number.MAX_VALUE) + // Solve 10^s == 10^(s+t) (mod d) + + if (rem1 === rem2) + return BigInt(t); + + rem1 = rem1 * C_TEN % d; + rem2 = rem2 * C_TEN % d; + } + return 0; + } + + function gcd(a, b) { + + if (!a) + return b; + if (!b) + return a; + + while (1) { + a %= b; + if (!a) + return b; + b %= a; + if (!b) + return a; + } + } + + /** + * Module constructor + * + * @constructor + * @param {number|Fraction=} a + * @param {number=} b + */ + function Fraction$1(a, b) { + + parse(a, b); + + if (this instanceof Fraction$1) { + a = gcd(P$1["d"], P$1["n"]); // Abuse a + this["s"] = P$1["s"]; + this["n"] = P$1["n"] / a; + this["d"] = P$1["d"] / a; + } else { + return newFraction(P$1['s'] * P$1['n'], P$1['d']); + } + } + + var DivisionByZero = function () { return new Error("Division by Zero"); }; + var InvalidParameter = function () { return new Error("Invalid argument"); }; + var NonIntegerParameter = function () { return new Error("Parameters must be integer"); }; + + Fraction$1.prototype = { + + "s": C_ONE, + "n": C_ZERO, + "d": C_ONE, + + /** + * Calculates the absolute value + * + * Ex: new Fraction(-4).abs() => 4 + **/ + "abs": function () { + + return newFraction(this["n"], this["d"]); + }, + + /** + * Inverts the sign of the current fraction + * + * Ex: new Fraction(-4).neg() => 4 + **/ + "neg": function () { + + return newFraction(-this["s"] * this["n"], this["d"]); + }, + + /** + * Adds two rational numbers + * + * Ex: new Fraction({n: 2, d: 3}).add("14.9") => 467 / 30 + **/ + "add": function (a, b) { + + parse(a, b); + return newFraction( + this["s"] * this["n"] * P$1["d"] + P$1["s"] * this["d"] * P$1["n"], + this["d"] * P$1["d"] + ); + }, + + /** + * Subtracts two rational numbers + * + * Ex: new Fraction({n: 2, d: 3}).add("14.9") => -427 / 30 + **/ + "sub": function (a, b) { + + parse(a, b); + return newFraction( + this["s"] * this["n"] * P$1["d"] - P$1["s"] * this["d"] * P$1["n"], + this["d"] * P$1["d"] + ); + }, + + /** + * Multiplies two rational numbers + * + * Ex: new Fraction("-17.(345)").mul(3) => 5776 / 111 + **/ + "mul": function (a, b) { + + parse(a, b); + return newFraction( + this["s"] * P$1["s"] * this["n"] * P$1["n"], + this["d"] * P$1["d"] + ); + }, + + /** + * Divides two rational numbers + * + * Ex: new Fraction("-17.(345)").inverse().div(3) + **/ + "div": function (a, b) { + + parse(a, b); + return newFraction( + this["s"] * P$1["s"] * this["n"] * P$1["d"], + this["d"] * P$1["n"] + ); + }, + + /** + * Clones the actual object + * + * Ex: new Fraction("-17.(345)").clone() + **/ + "clone": function () { + return newFraction(this['s'] * this['n'], this['d']); + }, + + /** + * Calculates the modulo of two rational numbers - a more precise fmod + * + * Ex: new Fraction('4.(3)').mod([7, 8]) => (13/3) % (7/8) = (5/6) + * Ex: new Fraction(20, 10).mod().equals(0) ? "is Integer" + **/ + "mod": function (a, b) { + + if (a === undefined) { + return newFraction(this["s"] * this["n"] % this["d"], C_ONE); + } + + parse(a, b); + if (C_ZERO === P$1["n"] * this["d"]) { + throw DivisionByZero(); + } + + /** + * I derived the rational modulo similar to the modulo for integers + * + * https://raw.org/book/analysis/rational-numbers/ + * + * n1/d1 = (n2/d2) * q + r, where 0 ≤ r < n2/d2 + * => d2 * n1 = n2 * d1 * q + d1 * d2 * r + * => r = (d2 * n1 - n2 * d1 * q) / (d1 * d2) + * = (d2 * n1 - n2 * d1 * floor((d2 * n1) / (n2 * d1))) / (d1 * d2) + * = ((d2 * n1) % (n2 * d1)) / (d1 * d2) + */ + return newFraction( + this["s"] * (P$1["d"] * this["n"]) % (P$1["n"] * this["d"]), + P$1["d"] * this["d"]); + }, + + /** + * Calculates the fractional gcd of two rational numbers + * + * Ex: new Fraction(5,8).gcd(3,7) => 1/56 + */ + "gcd": function (a, b) { + + parse(a, b); + + // https://raw.org/book/analysis/rational-numbers/ + // gcd(a / b, c / d) = gcd(a, c) / lcm(b, d) + + return newFraction(gcd(P$1["n"], this["n"]) * gcd(P$1["d"], this["d"]), P$1["d"] * this["d"]); + }, + + /** + * Calculates the fractional lcm of two rational numbers + * + * Ex: new Fraction(5,8).lcm(3,7) => 15 + */ + "lcm": function (a, b) { + + parse(a, b); + + // https://raw.org/book/analysis/rational-numbers/ + // lcm(a / b, c / d) = lcm(a, c) / gcd(b, d) + + if (P$1["n"] === C_ZERO && this["n"] === C_ZERO) { + return newFraction(C_ZERO, C_ONE); + } + return newFraction(P$1["n"] * this["n"], gcd(P$1["n"], this["n"]) * gcd(P$1["d"], this["d"])); + }, + + /** + * Gets the inverse of the fraction, means numerator and denominator are exchanged + * + * Ex: new Fraction([-3, 4]).inverse() => -4 / 3 + **/ + "inverse": function () { + return newFraction(this["s"] * this["d"], this["n"]); + }, + + /** + * Calculates the fraction to some integer exponent + * + * Ex: new Fraction(-1,2).pow(-3) => -8 + */ + "pow": function (a, b) { + + parse(a, b); + + // Trivial case when exp is an integer + + if (P$1['d'] === C_ONE) { + + if (P$1['s'] < C_ZERO) { + return newFraction((this['s'] * this["d"]) ** P$1['n'], this["n"] ** P$1['n']); + } else { + return newFraction((this['s'] * this["n"]) ** P$1['n'], this["d"] ** P$1['n']); + } + } + + // Negative roots become complex + // (-a/b)^(c/d) = x + // ⇔ (-1)^(c/d) * (a/b)^(c/d) = x + // ⇔ (cos(pi) + i*sin(pi))^(c/d) * (a/b)^(c/d) = x + // ⇔ (cos(c*pi/d) + i*sin(c*pi/d)) * (a/b)^(c/d) = x # DeMoivre's formula + // From which follows that only for c=0 the root is non-complex + if (this['s'] < C_ZERO) return null; + + // Now prime factor n and d + let N = factorize(this['n']); + let D = factorize(this['d']); + + // Exponentiate and take root for n and d individually + let n = C_ONE; + let d = C_ONE; + for (let k in N) { + if (k === '1') continue; + if (k === '0') { + n = C_ZERO; + break; + } + N[k] *= P$1['n']; + + if (N[k] % P$1['d'] === C_ZERO) { + N[k] /= P$1['d']; + } else return null; + n *= BigInt(k) ** N[k]; + } + + for (let k in D) { + if (k === '1') continue; + D[k] *= P$1['n']; + + if (D[k] % P$1['d'] === C_ZERO) { + D[k] /= P$1['d']; + } else return null; + d *= BigInt(k) ** D[k]; + } + + if (P$1['s'] < C_ZERO) { + return newFraction(d, n); + } + return newFraction(n, d); + }, + + /** + * Calculates the logarithm of a fraction to a given rational base + * + * Ex: new Fraction(27, 8).log(9, 4) => 3/2 + */ + "log": function (a, b) { + + parse(a, b); + + if (this['s'] <= C_ZERO || P$1['s'] <= C_ZERO) return null; + + const allPrimes = {}; + + const baseFactors = factorize(P$1['n']); + const T1 = factorize(P$1['d']); + + const numberFactors = factorize(this['n']); + const T2 = factorize(this['d']); + + for (const prime in T1) { + baseFactors[prime] = (baseFactors[prime] || C_ZERO) - T1[prime]; + } + for (const prime in T2) { + numberFactors[prime] = (numberFactors[prime] || C_ZERO) - T2[prime]; + } + + for (const prime in baseFactors) { + if (prime === '1') continue; + allPrimes[prime] = true; + } + for (const prime in numberFactors) { + if (prime === '1') continue; + allPrimes[prime] = true; + } + + let retN = null; + let retD = null; + + // Iterate over all unique primes to determine if a consistent ratio exists + for (const prime in allPrimes) { + + const baseExponent = baseFactors[prime] || C_ZERO; + const numberExponent = numberFactors[prime] || C_ZERO; + + if (baseExponent === C_ZERO) { + if (numberExponent !== C_ZERO) { + return null; // Logarithm cannot be expressed as a rational number + } + continue; // Skip this prime since both exponents are zero + } + + // Calculate the ratio of exponents for this prime + let curN = numberExponent; + let curD = baseExponent; + + // Simplify the current ratio + const gcdValue = gcd(curN, curD); + curN /= gcdValue; + curD /= gcdValue; + + // Check if this is the first ratio; otherwise, ensure ratios are consistent + if (retN === null && retD === null) { + retN = curN; + retD = curD; + } else if (curN * retD !== retN * curD) { + return null; // Ratios do not match, logarithm cannot be rational + } + } + + return retN !== null && retD !== null + ? newFraction(retN, retD) + : null; + }, + + /** + * Check if two rational numbers are the same + * + * Ex: new Fraction(19.6).equals([98, 5]); + **/ + "equals": function (a, b) { + + parse(a, b); + return this["s"] * this["n"] * P$1["d"] === P$1["s"] * P$1["n"] * this["d"]; + }, + + /** + * Check if this rational number is less than another + * + * Ex: new Fraction(19.6).lt([98, 5]); + **/ + "lt": function (a, b) { + + parse(a, b); + return this["s"] * this["n"] * P$1["d"] < P$1["s"] * P$1["n"] * this["d"]; + }, + + /** + * Check if this rational number is less than or equal another + * + * Ex: new Fraction(19.6).lt([98, 5]); + **/ + "lte": function (a, b) { + + parse(a, b); + return this["s"] * this["n"] * P$1["d"] <= P$1["s"] * P$1["n"] * this["d"]; + }, + + /** + * Check if this rational number is greater than another + * + * Ex: new Fraction(19.6).lt([98, 5]); + **/ + "gt": function (a, b) { + + parse(a, b); + return this["s"] * this["n"] * P$1["d"] > P$1["s"] * P$1["n"] * this["d"]; + }, + + /** + * Check if this rational number is greater than or equal another + * + * Ex: new Fraction(19.6).lt([98, 5]); + **/ + "gte": function (a, b) { + + parse(a, b); + return this["s"] * this["n"] * P$1["d"] >= P$1["s"] * P$1["n"] * this["d"]; + }, + + /** + * Compare two rational numbers + * < 0 iff this < that + * > 0 iff this > that + * = 0 iff this = that + * + * Ex: new Fraction(19.6).compare([98, 5]); + **/ + "compare": function (a, b) { + + parse(a, b); + let t = this["s"] * this["n"] * P$1["d"] - P$1["s"] * P$1["n"] * this["d"]; + + return (C_ZERO < t) - (t < C_ZERO); + }, + + /** + * Calculates the ceil of a rational number + * + * Ex: new Fraction('4.(3)').ceil() => (5 / 1) + **/ + "ceil": function (places) { + + places = C_TEN ** BigInt(places || 0); + + return newFraction(trunc(this["s"] * places * this["n"] / this["d"]) + + (places * this["n"] % this["d"] > C_ZERO && this["s"] >= C_ZERO ? C_ONE : C_ZERO), + places); + }, + + /** + * Calculates the floor of a rational number + * + * Ex: new Fraction('4.(3)').floor() => (4 / 1) + **/ + "floor": function (places) { + + places = C_TEN ** BigInt(places || 0); + + return newFraction(trunc(this["s"] * places * this["n"] / this["d"]) - + (places * this["n"] % this["d"] > C_ZERO && this["s"] < C_ZERO ? C_ONE : C_ZERO), + places); + }, + + /** + * Rounds a rational numbers + * + * Ex: new Fraction('4.(3)').round() => (4 / 1) + **/ + "round": function (places) { + + places = C_TEN ** BigInt(places || 0); + + /* Derivation: + + s >= 0: + round(n / d) = trunc(n / d) + (n % d) / d >= 0.5 ? 1 : 0 + = trunc(n / d) + 2(n % d) >= d ? 1 : 0 + s < 0: + round(n / d) =-trunc(n / d) - (n % d) / d > 0.5 ? 1 : 0 + =-trunc(n / d) - 2(n % d) > d ? 1 : 0 + + =>: + + round(s * n / d) = s * trunc(n / d) + s * (C + 2(n % d) > d ? 1 : 0) + where C = s >= 0 ? 1 : 0, to fix the >= for the positve case. + */ + + return newFraction(trunc(this["s"] * places * this["n"] / this["d"]) + + this["s"] * ((this["s"] >= C_ZERO ? C_ONE : C_ZERO) + C_TWO * (places * this["n"] % this["d"]) > this["d"] ? C_ONE : C_ZERO), + places); + }, + + /** + * Rounds a rational number to a multiple of another rational number + * + * Ex: new Fraction('0.9').roundTo("1/8") => 7 / 8 + **/ + "roundTo": function (a, b) { + + /* + k * x/y ≤ a/b < (k+1) * x/y + ⇔ k ≤ a/b / (x/y) < (k+1) + ⇔ k = floor(a/b * y/x) + ⇔ k = floor((a * y) / (b * x)) + */ + + parse(a, b); + + const n = this['n'] * P$1['d']; + const d = this['d'] * P$1['n']; + const r = n % d; + + // round(n / d) = trunc(n / d) + 2(n % d) >= d ? 1 : 0 + let k = trunc(n / d); + if (r + r >= d) { + k++; + } + return newFraction(this['s'] * k * P$1['n'], P$1['d']); + }, + + /** + * Check if two rational numbers are divisible + * + * Ex: new Fraction(19.6).divisible(1.5); + */ + "divisible": function (a, b) { + + parse(a, b); + return !(!(P$1["n"] * this["d"]) || ((this["n"] * P$1["d"]) % (P$1["n"] * this["d"]))); + }, + + /** + * Returns a decimal representation of the fraction + * + * Ex: new Fraction("100.'91823'").valueOf() => 100.91823918239183 + **/ + 'valueOf': function () { + // Best we can do so far + return Number(this["s"] * this["n"]) / Number(this["d"]); + }, + + /** + * Creates a string representation of a fraction with all digits + * + * Ex: new Fraction("100.'91823'").toString() => "100.(91823)" + **/ + 'toString': function (dec) { + + let N = this["n"]; + let D = this["d"]; + + dec = dec || 15; // 15 = decimal places when no repetition + + let cycLen = cycleLen(N, D); // Cycle length + let cycOff = cycleStart(N, D, cycLen); // Cycle start + + let str = this['s'] < C_ZERO ? "-" : ""; + + // Append integer part + str += trunc(N / D); + + N %= D; + N *= C_TEN; + + if (N) + str += "."; + + if (cycLen) { + + for (let i = cycOff; i--;) { + str += trunc(N / D); + N %= D; + N *= C_TEN; + } + str += "("; + for (let i = cycLen; i--;) { + str += trunc(N / D); + N %= D; + N *= C_TEN; + } + str += ")"; + } else { + for (let i = dec; N && i--;) { + str += trunc(N / D); + N %= D; + N *= C_TEN; + } + } + return str; + }, + + /** + * Returns a string-fraction representation of a Fraction object + * + * Ex: new Fraction("1.'3'").toFraction() => "4 1/3" + **/ + 'toFraction': function (showMixed) { + + let n = this["n"]; + let d = this["d"]; + let str = this['s'] < C_ZERO ? "-" : ""; + + if (d === C_ONE) { + str += n; + } else { + let whole = trunc(n / d); + if (showMixed && whole > C_ZERO) { + str += whole; + str += " "; + n %= d; + } + + str += n; + str += '/'; + str += d; + } + return str; + }, + + /** + * Returns a latex representation of a Fraction object + * + * Ex: new Fraction("1.'3'").toLatex() => "\frac{4}{3}" + **/ + 'toLatex': function (showMixed) { + + let n = this["n"]; + let d = this["d"]; + let str = this['s'] < C_ZERO ? "-" : ""; + + if (d === C_ONE) { + str += n; + } else { + let whole = trunc(n / d); + if (showMixed && whole > C_ZERO) { + str += whole; + n %= d; + } + + str += "\\frac{"; + str += n; + str += '}{'; + str += d; + str += '}'; + } + return str; + }, + + /** + * Returns an array of continued fraction elements + * + * Ex: new Fraction("7/8").toContinued() => [0,1,7] + */ + 'toContinued': function () { + + let a = this['n']; + let b = this['d']; + let res = []; + + do { + res.push(trunc(a / b)); + let t = a % b; + a = b; + b = t; + } while (a !== C_ONE); + + return res; + }, + + "simplify": function (eps) { + + const ieps = BigInt(1 / (eps || 0.001) | 0); + + const thisABS = this['abs'](); + const cont = thisABS['toContinued'](); + + for (let i = 1; i < cont.length; i++) { + + let s = newFraction(cont[i - 1], C_ONE); + for (let k = i - 2; k >= 0; k--) { + s = s['inverse']()['add'](cont[k]); + } + + let t = s['sub'](thisABS); + if (t['n'] * ieps < t['d']) { // More robust than Math.abs(t.valueOf()) < eps + return s['mul'](this['s']); + } + } + return this; + } + }; + + var name$t = 'Fraction'; + var dependencies$t = []; + var createFractionClass = /* #__PURE__ */factory(name$t, dependencies$t, () => { + /** + * Attach type information + */ + Object.defineProperty(Fraction$1, 'name', { + value: 'Fraction' + }); + Fraction$1.prototype.constructor = Fraction$1; + Fraction$1.prototype.type = 'Fraction'; + Fraction$1.prototype.isFraction = true; + + /** + * Get a JSON representation of a Fraction containing type information + * @returns {Object} Returns a JSON object structured as: + * `{"mathjs": "Fraction", "n": "3", "d": "8"}` + */ + Fraction$1.prototype.toJSON = function () { + return { + mathjs: 'Fraction', + n: String(this.s * this.n), + d: String(this.d) + }; + }; + + /** + * Instantiate a Fraction from a JSON object + * @param {Object} json a JSON object structured as: + * `{"mathjs": "Fraction", "n": "3", "d": "8"}` + * @return {BigNumber} + */ + Fraction$1.fromJSON = function (json) { + return new Fraction$1(json); + }; + return Fraction$1; + }, { + isClass: true + }); + + var name$s = 'Matrix'; + var dependencies$s = []; + var createMatrixClass = /* #__PURE__ */factory(name$s, dependencies$s, () => { + /** + * @constructor Matrix + * + * A Matrix is a wrapper around an Array. A matrix can hold a multi dimensional + * array. A matrix can be constructed as: + * + * let matrix = math.matrix(data) + * + * Matrix contains the functions to resize, get and set values, get the size, + * clone the matrix and to convert the matrix to a vector, array, or scalar. + * Furthermore, one can iterate over the matrix using map and forEach. + * The internal Array of the Matrix can be accessed using the function valueOf. + * + * Example usage: + * + * let matrix = math.matrix([[1, 2], [3, 4]]) + * matix.size() // [2, 2] + * matrix.resize([3, 2], 5) + * matrix.valueOf() // [[1, 2], [3, 4], [5, 5]] + * matrix.subset([1,2]) // 3 (indexes are zero-based) + * + */ + function Matrix() { + if (!(this instanceof Matrix)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + } + + /** + * Attach type information + */ + Matrix.prototype.type = 'Matrix'; + Matrix.prototype.isMatrix = true; + + /** + * Get the storage format used by the matrix. + * + * Usage: + * const format = matrix.storage() // retrieve storage format + * + * @return {string} The storage format. + */ + Matrix.prototype.storage = function () { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke storage on a Matrix interface'); + }; + + /** + * Get the datatype of the data stored in the matrix. + * + * Usage: + * const format = matrix.datatype() // retrieve matrix datatype + * + * @return {string} The datatype. + */ + Matrix.prototype.datatype = function () { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke datatype on a Matrix interface'); + }; + + /** + * Create a new Matrix With the type of the current matrix instance + * @param {Array | Object} data + * @param {string} [datatype] + */ + Matrix.prototype.create = function (data, datatype) { + throw new Error('Cannot invoke create on a Matrix interface'); + }; + + /** + * Get a subset of the matrix, or replace a subset of the matrix. + * + * Usage: + * const subset = matrix.subset(index) // retrieve subset + * const value = matrix.subset(index, replacement) // replace subset + * + * @param {Index} index + * @param {Array | Matrix | *} [replacement] + * @param {*} [defaultValue=0] Default value, filled in on new entries when + * the matrix is resized. If not provided, + * new matrix elements will be filled with zeros. + */ + Matrix.prototype.subset = function (index, replacement, defaultValue) { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke subset on a Matrix interface'); + }; + + /** + * Get a single element from the matrix. + * @param {number[]} index Zero-based index + * @return {*} value + */ + Matrix.prototype.get = function (index) { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke get on a Matrix interface'); + }; + + /** + * Replace a single element in the matrix. + * @param {number[]} index Zero-based index + * @param {*} value + * @param {*} [defaultValue] Default value, filled in on new entries when + * the matrix is resized. If not provided, + * new matrix elements will be left undefined. + * @return {Matrix} self + */ + Matrix.prototype.set = function (index, value, defaultValue) { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke set on a Matrix interface'); + }; + + /** + * Resize the matrix to the given size. Returns a copy of the matrix when + * `copy=true`, otherwise return the matrix itself (resize in place). + * + * @param {number[]} size The new size the matrix should have. + * @param {*} [defaultValue=0] Default value, filled in on new entries. + * If not provided, the matrix elements will + * be filled with zeros. + * @param {boolean} [copy] Return a resized copy of the matrix + * + * @return {Matrix} The resized matrix + */ + Matrix.prototype.resize = function (size, defaultValue) { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke resize on a Matrix interface'); + }; + + /** + * Reshape the matrix to the given size. Returns a copy of the matrix when + * `copy=true`, otherwise return the matrix itself (reshape in place). + * + * @param {number[]} size The new size the matrix should have. + * @param {boolean} [copy] Return a reshaped copy of the matrix + * + * @return {Matrix} The reshaped matrix + */ + Matrix.prototype.reshape = function (size, defaultValue) { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke reshape on a Matrix interface'); + }; + + /** + * Create a clone of the matrix + * @return {Matrix} clone + */ + Matrix.prototype.clone = function () { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke clone on a Matrix interface'); + }; + + /** + * Retrieve the size of the matrix. + * @returns {number[]} size + */ + Matrix.prototype.size = function () { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke size on a Matrix interface'); + }; + + /** + * Create a new matrix with the results of the callback function executed on + * each entry of the matrix. + * @param {Function} callback The callback function is invoked with three + * parameters: the value of the element, the index + * of the element, and the Matrix being traversed. + * @param {boolean} [skipZeros] Invoke callback function for non-zero values only. + * + * @return {Matrix} matrix + */ + Matrix.prototype.map = function (callback, skipZeros) { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke map on a Matrix interface'); + }; + + /** + * Execute a callback function on each entry of the matrix. + * @param {Function} callback The callback function is invoked with three + * parameters: the value of the element, the index + * of the element, and the Matrix being traversed. + */ + Matrix.prototype.forEach = function (callback) { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke forEach on a Matrix interface'); + }; + + /** + * Iterate over the matrix elements + * @return {Iterable<{ value, index: number[] }>} + */ + Matrix.prototype[Symbol.iterator] = function () { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot iterate a Matrix interface'); + }; + + /** + * Create an Array with a copy of the data of the Matrix + * @returns {Array} array + */ + Matrix.prototype.toArray = function () { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke toArray on a Matrix interface'); + }; + + /** + * Get the primitive value of the Matrix: a multidimensional array + * @returns {Array} array + */ + Matrix.prototype.valueOf = function () { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke valueOf on a Matrix interface'); + }; + + /** + * Get a string representation of the matrix, with optional formatting options. + * @param {Object | number | Function} [options] Formatting options. See + * lib/utils/number:format for a + * description of the available + * options. + * @returns {string} str + */ + Matrix.prototype.format = function (options) { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke format on a Matrix interface'); + }; + + /** + * Get a string representation of the matrix + * @returns {string} str + */ + Matrix.prototype.toString = function () { + // must be implemented by each of the Matrix implementations + throw new Error('Cannot invoke toString on a Matrix interface'); + }; + return Matrix; + }, { + isClass: true + }); + + /** + * Formats a BigNumber in a given base + * @param {BigNumber} n + * @param {number} base + * @param {number} size + * @returns {string} + */ + function formatBigNumberToBase(n, base, size) { + var BigNumberCtor = n.constructor; + var big2 = new BigNumberCtor(2); + var suffix = ''; + if (size) { + if (size < 1) { + throw new Error('size must be in greater than 0'); + } + if (!isInteger(size)) { + throw new Error('size must be an integer'); + } + if (n.greaterThan(big2.pow(size - 1).sub(1)) || n.lessThan(big2.pow(size - 1).mul(-1))) { + throw new Error("Value must be in range [-2^".concat(size - 1, ", 2^").concat(size - 1, "-1]")); + } + if (!n.isInteger()) { + throw new Error('Value must be an integer'); + } + if (n.lessThan(0)) { + n = n.add(big2.pow(size)); + } + suffix = "i".concat(size); + } + switch (base) { + case 2: + return "".concat(n.toBinary()).concat(suffix); + case 8: + return "".concat(n.toOctal()).concat(suffix); + case 16: + return "".concat(n.toHexadecimal()).concat(suffix); + default: + throw new Error("Base ".concat(base, " not supported ")); + } + } + + /** + * Convert a BigNumber to a formatted string representation. + * + * Syntax: + * + * format(value) + * format(value, options) + * format(value, precision) + * format(value, fn) + * + * Where: + * + * {number} value The value to be formatted + * {Object} options An object with formatting options. Available options: + * {string} notation + * Number notation. Choose from: + * 'fixed' Always use regular number notation. + * For example '123.40' and '14000000' + * 'exponential' Always use exponential notation. + * For example '1.234e+2' and '1.4e+7' + * 'auto' (default) Regular number notation for numbers + * having an absolute value between + * `lower` and `upper` bounds, and uses + * exponential notation elsewhere. + * Lower bound is included, upper bound + * is excluded. + * For example '123.4' and '1.4e7'. + * 'bin', 'oct, or + * 'hex' Format the number using binary, octal, + * or hexadecimal notation. + * For example '0b1101' and '0x10fe'. + * {number} wordSize The word size in bits to use for formatting + * in binary, octal, or hexadecimal notation. + * To be used only with 'bin', 'oct', or 'hex' + * values for 'notation' option. When this option + * is defined the value is formatted as a signed + * twos complement integer of the given word size + * and the size suffix is appended to the output. + * For example + * format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'. + * Default value is undefined. + * {number} precision A number between 0 and 16 to round + * the digits of the number. + * In case of notations 'exponential', + * 'engineering', and 'auto', + * `precision` defines the total + * number of significant digits returned. + * In case of notation 'fixed', + * `precision` defines the number of + * significant digits after the decimal + * point. + * `precision` is undefined by default. + * {number} lowerExp Exponent determining the lower boundary + * for formatting a value with an exponent + * when `notation='auto`. + * Default value is `-3`. + * {number} upperExp Exponent determining the upper boundary + * for formatting a value with an exponent + * when `notation='auto`. + * Default value is `5`. + * {Function} fn A custom formatting function. Can be used to override the + * built-in notations. Function `fn` is called with `value` as + * parameter and must return a string. Is useful for example to + * format all values inside a matrix in a particular way. + * + * Examples: + * + * format(6.4) // '6.4' + * format(1240000) // '1.24e6' + * format(1/3) // '0.3333333333333333' + * format(1/3, 3) // '0.333' + * format(21385, 2) // '21000' + * format(12e8, {notation: 'fixed'}) // returns '1200000000' + * format(2.3, {notation: 'fixed', precision: 4}) // returns '2.3000' + * format(52.8, {notation: 'exponential'}) // returns '5.28e+1' + * format(12400, {notation: 'engineering'}) // returns '12.400e+3' + * + * @param {BigNumber} value + * @param {Object | Function | number | BigNumber} [options] + * @return {string} str The formatted value + */ + function format$1(value, options) { + if (typeof options === 'function') { + // handle format(value, fn) + return options(value); + } + + // handle special cases + if (!value.isFinite()) { + return value.isNaN() ? 'NaN' : value.gt(0) ? 'Infinity' : '-Infinity'; + } + var { + notation, + precision, + wordSize + } = normalizeFormatOptions(options); + + // handle the various notations + switch (notation) { + case 'fixed': + return toFixed(value, precision); + case 'exponential': + return toExponential(value, precision); + case 'engineering': + return toEngineering(value, precision); + case 'bin': + return formatBigNumberToBase(value, 2, wordSize); + case 'oct': + return formatBigNumberToBase(value, 8, wordSize); + case 'hex': + return formatBigNumberToBase(value, 16, wordSize); + case 'auto': + { + // determine lower and upper bound for exponential notation. + // TODO: implement support for upper and lower to be BigNumbers themselves + var lowerExp = _toNumberOrDefault(options === null || options === void 0 ? void 0 : options.lowerExp, -3); + var upperExp = _toNumberOrDefault(options === null || options === void 0 ? void 0 : options.upperExp, 5); + + // handle special case zero + if (value.isZero()) return '0'; + + // determine whether or not to output exponential notation + var str; + var rounded = value.toSignificantDigits(precision); + var exp = rounded.e; + if (exp >= lowerExp && exp < upperExp) { + // normal number notation + str = rounded.toFixed(); + } else { + // exponential notation + str = toExponential(value, precision); + } + + // remove trailing zeros after the decimal point + return str.replace(/((\.\d*?)(0+))($|e)/, function () { + var digits = arguments[2]; + var e = arguments[4]; + return digits !== '.' ? digits + e : e; + }); + } + default: + throw new Error('Unknown notation "' + notation + '". ' + 'Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.'); + } + } + + /** + * Format a BigNumber in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3' + * @param {BigNumber} value + * @param {number} [precision] Optional number of significant figures to return. + */ + function toEngineering(value, precision) { + // find nearest lower multiple of 3 for exponent + var e = value.e; + var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3; + + // find difference in exponents, and calculate the value without exponent + var valueWithoutExp = value.mul(Math.pow(10, -newExp)); + var valueStr = valueWithoutExp.toPrecision(precision); + if (valueStr.includes('e')) { + var BigNumber = value.constructor; + valueStr = new BigNumber(valueStr).toFixed(); + } + return valueStr + 'e' + (e >= 0 ? '+' : '') + newExp.toString(); + } + + /** + * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3' + * @param {BigNumber} value + * @param {number} [precision] Number of digits in formatted output. + * If not provided, the maximum available digits + * is used. + * @returns {string} str + */ + function toExponential(value, precision) { + if (precision !== undefined) { + return value.toExponential(precision - 1); // Note the offset of one + } else { + return value.toExponential(); + } + } + + /** + * Format a number with fixed notation. + * @param {BigNumber} value + * @param {number} [precision=undefined] Optional number of decimals after the + * decimal point. Undefined by default. + */ + function toFixed(value, precision) { + return value.toFixed(precision); + } + function _toNumberOrDefault(value, defaultValue) { + if (isNumber(value)) { + return value; + } else if (isBigNumber(value)) { + return value.toNumber(); + } else { + return defaultValue; + } + } + + /** + * Format a value of any type into a string. + * + * Usage: + * math.format(value) + * math.format(value, precision) + * math.format(value, options) + * + * When value is a function: + * + * - When the function has a property `syntax`, it returns this + * syntax description. + * - In other cases, a string `'function'` is returned. + * + * When `value` is an Object: + * + * - When the object contains a property `format` being a function, this + * function is invoked as `value.format(options)` and the result is returned. + * - When the object has its own `toString` method, this method is invoked + * and the result is returned. + * - In other cases the function will loop over all object properties and + * return JSON object notation like '{"a": 2, "b": 3}'. + * + * Example usage: + * math.format(2/7) // '0.2857142857142857' + * math.format(math.pi, 3) // '3.14' + * math.format(new Complex(2, 3)) // '2 + 3i' + * math.format('hello') // '"hello"' + * + * @param {*} value Value to be stringified + * @param {Object | number | Function} [options] + * Formatting options. See src/utils/number.js:format for a + * description of the available options controlling number output. + * This generic "format" also supports the option property `truncate: NN` + * giving the maximum number NN of characters to return (if there would + * have been more, they are deleted and replaced by an ellipsis). + * @return {string} str + */ + function format(value, options) { + var result = _format(value, options); + if (options && typeof options === 'object' && 'truncate' in options && result.length > options.truncate) { + return result.substring(0, options.truncate - 3) + '...'; + } + return result; + } + function _format(value, options) { + if (typeof value === 'number') { + return format$2(value, options); + } + if (isBigNumber(value)) { + return format$1(value, options); + } + + // note: we use unsafe duck-typing here to check for Fractions, this is + // ok here since we're only invoking toString or concatenating its values + if (looksLikeFraction(value)) { + if (!options || options.fraction !== 'decimal') { + // output as ratio, like '1/3' + return "".concat(value.s * value.n, "/").concat(value.d); + } else { + // output as decimal, like '0.(3)' + return value.toString(); + } + } + if (Array.isArray(value)) { + return formatArray(value, options); + } + if (isString(value)) { + return stringify(value); + } + if (typeof value === 'function') { + return value.syntax ? String(value.syntax) : 'function'; + } + if (value && typeof value === 'object') { + if (typeof value.format === 'function') { + return value.format(options); + } else if (value && value.toString(options) !== {}.toString()) { + // this object has a non-native toString method, use that one + return value.toString(options); + } else { + var entries = Object.keys(value).map(key => { + return stringify(key) + ': ' + format(value[key], options); + }); + return '{' + entries.join(', ') + '}'; + } + } + return String(value); + } + + /** + * Stringify a value into a string enclosed in double quotes. + * Unescaped double quotes and backslashes inside the value are escaped. + * @param {*} value + * @return {string} + */ + function stringify(value) { + var text = String(value); + var escaped = ''; + var i = 0; + while (i < text.length) { + var c = text.charAt(i); + escaped += c in controlCharacters ? controlCharacters[c] : c; + i++; + } + return '"' + escaped + '"'; + } + var controlCharacters = { + '"': '\\"', + '\\': '\\\\', + '\b': '\\b', + '\f': '\\f', + '\n': '\\n', + '\r': '\\r', + '\t': '\\t' + }; + + /** + * Recursively format an n-dimensional matrix + * Example output: "[[1, 2], [3, 4]]" + * @param {Array} array + * @param {Object | number | Function} [options] Formatting options. See + * lib/utils/number:format for a + * description of the available + * options. + * @returns {string} str + */ + function formatArray(array, options) { + if (Array.isArray(array)) { + var str = '['; + var len = array.length; + for (var i = 0; i < len; i++) { + if (i !== 0) { + str += ', '; + } + str += formatArray(array[i], options); + } + str += ']'; + return str; + } else { + return format(array, options); + } + } + + /** + * Check whether a value looks like a Fraction (unsafe duck-type check) + * @param {*} value + * @return {boolean} + */ + function looksLikeFraction(value) { + return value && typeof value === 'object' && typeof value.s === 'bigint' && typeof value.n === 'bigint' && typeof value.d === 'bigint' || false; + } + + /** + * Create a range error with the message: + * 'Dimension mismatch ( != )' + * @param {number | number[]} actual The actual size + * @param {number | number[]} expected The expected size + * @param {string} [relation='!='] Optional relation between actual + * and expected size: '!=', '<', etc. + * @extends RangeError + */ + function DimensionError(actual, expected, relation) { + if (!(this instanceof DimensionError)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + this.actual = actual; + this.expected = expected; + this.relation = relation; + this.message = 'Dimension mismatch (' + (Array.isArray(actual) ? '[' + actual.join(', ') + ']' : actual) + ' ' + (this.relation || '!=') + ' ' + (Array.isArray(expected) ? '[' + expected.join(', ') + ']' : expected) + ')'; + this.stack = new Error().stack; + } + DimensionError.prototype = new RangeError(); + DimensionError.prototype.constructor = RangeError; + DimensionError.prototype.name = 'DimensionError'; + DimensionError.prototype.isDimensionError = true; + + /** + * Create a range error with the message: + * 'Index out of range (index < min)' + * 'Index out of range (index < max)' + * + * @param {number} index The actual index + * @param {number} [min=0] Minimum index (included) + * @param {number} [max] Maximum index (excluded) + * @extends RangeError + */ + function IndexError(index, min, max) { + if (!(this instanceof IndexError)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + this.index = index; + if (arguments.length < 3) { + this.min = 0; + this.max = min; + } else { + this.min = min; + this.max = max; + } + if (this.min !== undefined && this.index < this.min) { + this.message = 'Index out of range (' + this.index + ' < ' + this.min + ')'; + } else if (this.max !== undefined && this.index >= this.max) { + this.message = 'Index out of range (' + this.index + ' > ' + (this.max - 1) + ')'; + } else { + this.message = 'Index out of range (' + this.index + ')'; + } + this.stack = new Error().stack; + } + IndexError.prototype = new RangeError(); + IndexError.prototype.constructor = RangeError; + IndexError.prototype.name = 'IndexError'; + IndexError.prototype.isIndexError = true; + + /** + * Calculate the size of a multi dimensional array. + * This function checks the size of the first entry, it does not validate + * whether all dimensions match. (use function `validate` for that) + * @param {Array} x + * @return {number[]} size + */ + function arraySize(x) { + var s = []; + while (Array.isArray(x)) { + s.push(x.length); + x = x[0]; + } + return s; + } + + /** + * Recursively validate whether each element in a multi dimensional array + * has a size corresponding to the provided size array. + * @param {Array} array Array to be validated + * @param {number[]} size Array with the size of each dimension + * @param {number} dim Current dimension + * @throws DimensionError + * @private + */ + function _validate(array, size, dim) { + var i; + var len = array.length; + if (len !== size[dim]) { + throw new DimensionError(len, size[dim]); + } + if (dim < size.length - 1) { + // recursively validate each child array + var dimNext = dim + 1; + for (i = 0; i < len; i++) { + var child = array[i]; + if (!Array.isArray(child)) { + throw new DimensionError(size.length - 1, size.length, '<'); + } + _validate(array[i], size, dimNext); + } + } else { + // last dimension. none of the children may be an array + for (i = 0; i < len; i++) { + if (Array.isArray(array[i])) { + throw new DimensionError(size.length + 1, size.length, '>'); + } + } + } + } + + /** + * Validate whether each element in a multi dimensional array has + * a size corresponding to the provided size array. + * @param {Array} array Array to be validated + * @param {number[]} size Array with the size of each dimension + * @throws DimensionError + */ + function validate(array, size) { + var isScalar = size.length === 0; + if (isScalar) { + // scalar + if (Array.isArray(array)) { + throw new DimensionError(array.length, 0); + } + } else { + // array + _validate(array, size, 0); + } + } + + /** + * Test whether index is an integer number with index >= 0 and index < length + * when length is provided + * @param {number} index Zero-based index + * @param {number} [length] Length of the array + */ + function validateIndex(index, length) { + if (index !== undefined) { + if (!isNumber(index) || !isInteger(index)) { + throw new TypeError('Index must be an integer (value: ' + index + ')'); + } + if (index < 0 || typeof length === 'number' && index >= length) { + throw new IndexError(index, length); + } + } + } + + /** + * Resize a multi dimensional array. The resized array is returned. + * @param {Array | number} array Array to be resized + * @param {number[]} size Array with the size of each dimension + * @param {*} [defaultValue=0] Value to be filled in new entries, + * zero by default. Specify for example `null`, + * to clearly see entries that are not explicitly + * set. + * @return {Array} array The resized array + */ + function resize(array, size, defaultValue) { + // check the type of the arguments + if (!Array.isArray(size)) { + throw new TypeError('Array expected'); + } + if (size.length === 0) { + throw new Error('Resizing to scalar is not supported'); + } + + // check whether size contains positive integers + size.forEach(function (value) { + if (!isNumber(value) || !isInteger(value) || value < 0) { + throw new TypeError('Invalid size, must contain positive integers ' + '(size: ' + format(size) + ')'); + } + }); + + // convert number to an array + if (isNumber(array) || isBigNumber(array)) { + array = [array]; + } + + // recursively resize the array + var _defaultValue = defaultValue !== undefined ? defaultValue : 0; + _resize(array, size, 0, _defaultValue); + return array; + } + + /** + * Recursively resize a multi dimensional array + * @param {Array} array Array to be resized + * @param {number[]} size Array with the size of each dimension + * @param {number} dim Current dimension + * @param {*} [defaultValue] Value to be filled in new entries, + * undefined by default. + * @private + */ + function _resize(array, size, dim, defaultValue) { + var i; + var elem; + var oldLen = array.length; + var newLen = size[dim]; + var minLen = Math.min(oldLen, newLen); + + // apply new length + array.length = newLen; + if (dim < size.length - 1) { + // non-last dimension + var dimNext = dim + 1; + + // resize existing child arrays + for (i = 0; i < minLen; i++) { + // resize child array + elem = array[i]; + if (!Array.isArray(elem)) { + elem = [elem]; // add a dimension + array[i] = elem; + } + _resize(elem, size, dimNext, defaultValue); + } + + // create new child arrays + for (i = minLen; i < newLen; i++) { + // get child array + elem = []; + array[i] = elem; + + // resize new child array + _resize(elem, size, dimNext, defaultValue); + } + } else { + // last dimension + + // remove dimensions of existing values + for (i = 0; i < minLen; i++) { + while (Array.isArray(array[i])) { + array[i] = array[i][0]; + } + } + + // fill new elements with the default value + for (i = minLen; i < newLen; i++) { + array[i] = defaultValue; + } + } + } + + /** + * Re-shape a multi dimensional array to fit the specified dimensions + * @param {Array} array Array to be reshaped + * @param {number[]} sizes List of sizes for each dimension + * @returns {Array} Array whose data has been formatted to fit the + * specified dimensions + * + * @throws {DimensionError} If the product of the new dimension sizes does + * not equal that of the old ones + */ + function reshape(array, sizes) { + var flatArray = flatten(array, true); // since it has rectangular + var currentLength = flatArray.length; + if (!Array.isArray(array) || !Array.isArray(sizes)) { + throw new TypeError('Array expected'); + } + if (sizes.length === 0) { + throw new DimensionError(0, currentLength, '!='); + } + sizes = processSizesWildcard(sizes, currentLength); + var newLength = product$1(sizes); + if (currentLength !== newLength) { + throw new DimensionError(newLength, currentLength, '!='); + } + try { + return _reshape(flatArray, sizes); + } catch (e) { + if (e instanceof DimensionError) { + throw new DimensionError(newLength, currentLength, '!='); + } + throw e; + } + } + + /** + * Replaces the wildcard -1 in the sizes array. + * @param {number[]} sizes List of sizes for each dimension. At most one wildcard. + * @param {number} currentLength Number of elements in the array. + * @throws {Error} If more than one wildcard or unable to replace it. + * @returns {number[]} The sizes array with wildcard replaced. + */ + function processSizesWildcard(sizes, currentLength) { + var newLength = product$1(sizes); + var processedSizes = sizes.slice(); + var WILDCARD = -1; + var wildCardIndex = sizes.indexOf(WILDCARD); + var isMoreThanOneWildcard = sizes.indexOf(WILDCARD, wildCardIndex + 1) >= 0; + if (isMoreThanOneWildcard) { + throw new Error('More than one wildcard in sizes'); + } + var hasWildcard = wildCardIndex >= 0; + var canReplaceWildcard = currentLength % newLength === 0; + if (hasWildcard) { + if (canReplaceWildcard) { + processedSizes[wildCardIndex] = -currentLength / newLength; + } else { + throw new Error('Could not replace wildcard, since ' + currentLength + ' is no multiple of ' + -newLength); + } + } + return processedSizes; + } + + /** + * Computes the product of all array elements. + * @param {number[]} array Array of factors + * @returns {number} Product of all elements + */ + function product$1(array) { + return array.reduce((prev, curr) => prev * curr, 1); + } + + /** + * Iteratively re-shape a multi dimensional array to fit the specified dimensions + * @param {Array} array Array to be reshaped + * @param {number[]} sizes List of sizes for each dimension + * @returns {Array} Array whose data has been formatted to fit the + * specified dimensions + */ + + function _reshape(array, sizes) { + // testing if there are enough elements for the requested shape + var tmpArray = array; + var tmpArray2; + // for each dimension starting by the last one and ignoring the first one + for (var sizeIndex = sizes.length - 1; sizeIndex > 0; sizeIndex--) { + var size = sizes[sizeIndex]; + tmpArray2 = []; + + // aggregate the elements of the current tmpArray in elements of the requested size + var length = tmpArray.length / size; + for (var i = 0; i < length; i++) { + tmpArray2.push(tmpArray.slice(i * size, (i + 1) * size)); + } + // set it as the new tmpArray for the next loop turn or for return + tmpArray = tmpArray2; + } + return tmpArray; + } + + /** + * Unsqueeze a multi dimensional array: add dimensions when missing + * + * Parameter `size` will be mutated to match the new, unsqueezed matrix size. + * + * @param {Array} array + * @param {number} dims Desired number of dimensions of the array + * @param {number} [outer] Number of outer dimensions to be added + * @param {Array} [size] Current size of array. + * @returns {Array} returns the array itself + * @private + */ + function unsqueeze(array, dims, outer, size) { + var s = size || arraySize(array); + + // unsqueeze outer dimensions + if (outer) { + for (var i = 0; i < outer; i++) { + array = [array]; + s.unshift(1); + } + } + + // unsqueeze inner dimensions + array = _unsqueeze(array, dims, 0); + while (s.length < dims) { + s.push(1); + } + return array; + } + + /** + * Recursively unsqueeze a multi dimensional array + * @param {Array} array + * @param {number} dims Required number of dimensions + * @param {number} dim Current dimension + * @returns {Array | *} Returns the unsqueezed array + * @private + */ + function _unsqueeze(array, dims, dim) { + var i, ii; + if (Array.isArray(array)) { + var next = dim + 1; + for (i = 0, ii = array.length; i < ii; i++) { + array[i] = _unsqueeze(array[i], dims, next); + } + } else { + for (var d = dim; d < dims; d++) { + array = [array]; + } + } + return array; + } + /** + * Flatten a multi dimensional array, put all elements in a one dimensional + * array + * @param {Array} array A multi dimensional array + * @param {boolean} isRectangular Optional. If the array is rectangular (not jagged) + * @return {Array} The flattened array (1 dimensional) + */ + function flatten(array) { + var isRectangular = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + if (!Array.isArray(array)) { + // if not an array, return as is + return array; + } + if (typeof isRectangular !== 'boolean') { + throw new TypeError('Boolean expected for second argument of flatten'); + } + var flat = []; + if (isRectangular) { + _flattenRectangular(array); + } else { + _flatten(array); + } + return flat; + function _flatten(array) { + for (var i = 0; i < array.length; i++) { + var item = array[i]; + if (Array.isArray(item)) { + _flatten(item); + } else { + flat.push(item); + } + } + } + function _flattenRectangular(array) { + if (Array.isArray(array[0])) { + for (var i = 0; i < array.length; i++) { + _flattenRectangular(array[i]); + } + } else { + for (var _i = 0; _i < array.length; _i++) { + flat.push(array[_i]); + } + } + } + } + + /** + * Check the datatype of a given object + * This is a low level implementation that should only be used by + * parent Matrix classes such as SparseMatrix or DenseMatrix + * This method does not validate Array Matrix shape + * @param {Array} array + * @param {function} typeOf Callback function to use to determine the type of a value + * @return {string} + */ + function getArrayDataType(array, typeOf) { + var type; // to hold type info + var length = 0; // to hold length value to ensure it has consistent sizes + + for (var i = 0; i < array.length; i++) { + var item = array[i]; + var _isArray = Array.isArray(item); + + // Saving the target matrix row size + if (i === 0 && _isArray) { + length = item.length; + } + + // If the current item is an array but the length does not equal the targetVectorSize + if (_isArray && item.length !== length) { + return undefined; + } + var itemType = _isArray ? getArrayDataType(item, typeOf) // recurse into a nested array + : typeOf(item); + if (type === undefined) { + type = itemType; // first item + } else if (type !== itemType) { + return 'mixed'; + } else ; + } + return type; + } + + /** + * Recursively concatenate two matrices. + * The contents of the matrices are not cloned. + * @param {Array} a Multi dimensional array + * @param {Array} b Multi dimensional array + * @param {number} concatDim The dimension on which to concatenate (zero-based) + * @param {number} dim The current dim (zero-based) + * @return {Array} c The concatenated matrix + * @private + */ + function concatRecursive(a, b, concatDim, dim) { + if (dim < concatDim) { + // recurse into next dimension + if (a.length !== b.length) { + throw new DimensionError(a.length, b.length); + } + var c = []; + for (var i = 0; i < a.length; i++) { + c[i] = concatRecursive(a[i], b[i], concatDim, dim + 1); + } + return c; + } else { + // concatenate this dimension + return a.concat(b); + } + } + + /** + * Concatenates many arrays in the specified direction + * @param {...Array} arrays All the arrays to concatenate + * @param {number} concatDim The dimension on which to concatenate (zero-based) + * @returns {Array} + */ + function concat() { + var arrays = Array.prototype.slice.call(arguments, 0, -1); + var concatDim = Array.prototype.slice.call(arguments, -1); + if (arrays.length === 1) { + return arrays[0]; + } + if (arrays.length > 1) { + return arrays.slice(1).reduce(function (A, B) { + return concatRecursive(A, B, concatDim, 0); + }, arrays[0]); + } else { + throw new Error('Wrong number of arguments in function concat'); + } + } + + /** + * Receives two or more sizes and gets the broadcasted size for both. + * @param {...number[]} sizes Sizes to broadcast together + * @returns {number[]} The broadcasted size + */ + function broadcastSizes() { + for (var _len = arguments.length, sizes = new Array(_len), _key = 0; _key < _len; _key++) { + sizes[_key] = arguments[_key]; + } + var dimensions = sizes.map(s => s.length); + var N = Math.max(...dimensions); + var sizeMax = new Array(N).fill(null); + // check for every size + for (var i = 0; i < sizes.length; i++) { + var size = sizes[i]; + var dim = dimensions[i]; + for (var j = 0; j < dim; j++) { + var n = N - dim + j; + if (size[j] > sizeMax[n]) { + sizeMax[n] = size[j]; + } + } + } + for (var _i2 = 0; _i2 < sizes.length; _i2++) { + checkBroadcastingRules(sizes[_i2], sizeMax); + } + return sizeMax; + } + + /** + * Checks if it's possible to broadcast a size to another size + * @param {number[]} size The size of the array to check + * @param {number[]} toSize The size of the array to validate if it can be broadcasted to + */ + function checkBroadcastingRules(size, toSize) { + var N = toSize.length; + var dim = size.length; + for (var j = 0; j < dim; j++) { + var n = N - dim + j; + if (size[j] < toSize[n] && size[j] > 1 || size[j] > toSize[n]) { + throw new Error("shape mismatch: mismatch is found in arg with shape (".concat(size, ") not possible to broadcast dimension ").concat(dim, " with size ").concat(size[j], " to size ").concat(toSize[n])); + } + } + } + + /** + * Broadcasts a single array to a certain size + * @param {Array} array Array to be broadcasted + * @param {number[]} toSize Size to broadcast the array + * @returns {Array} The broadcasted array + */ + function broadcastTo(array, toSize) { + var Asize = arraySize(array); + if (deepStrictEqual(Asize, toSize)) { + return array; + } + checkBroadcastingRules(Asize, toSize); + var broadcastedSize = broadcastSizes(Asize, toSize); + var N = broadcastedSize.length; + var paddedSize = [...Array(N - Asize.length).fill(1), ...Asize]; + var A = clone(array); + // reshape A if needed to make it ready for concat + if (Asize.length < N) { + A = reshape(A, paddedSize); + Asize = arraySize(A); + } + + // stretches the array on each dimension to make it the same size as index + for (var dim = 0; dim < N; dim++) { + if (Asize[dim] < broadcastedSize[dim]) { + A = stretch(A, broadcastedSize[dim], dim); + Asize = arraySize(A); + } + } + return A; + } + + /** + * Stretches a matrix up to a certain size in a certain dimension + * @param {Array} arrayToStretch + * @param {number[]} sizeToStretch + * @param {number} dimToStretch + * @returns {Array} The stretched array + */ + function stretch(arrayToStretch, sizeToStretch, dimToStretch) { + return concat(...Array(sizeToStretch).fill(arrayToStretch), dimToStretch); + } + + /** + * Retrieves a single element from an array given an index. + * + * @param {Array} array - The array from which to retrieve the value. + * @param {Array} index - An array of indices specifying the position of the desired element in each dimension. + * @returns {*} - The value at the specified position in the array. + * + * @example + * const arr = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]; + * const index = [1, 0, 1]; + * console.log(get(arr, index)); // 6 + */ + function get(array, index) { + if (!Array.isArray(array)) { + throw new Error('Array expected'); + } + var size = arraySize(array); + if (index.length !== size.length) { + throw new DimensionError(index.length, size.length); + } + for (var x = 0; x < index.length; x++) { + validateIndex(index[x], size[x]); + } + return index.reduce((acc, curr) => acc[curr], array); + } + + /** + * Recursively maps over each element of nested array using a provided callback function. + * + * @param {Array} array - The array to be mapped. + * @param {Function} callback - The function to execute on each element, taking three arguments: + * - `value` (any): The current element being processed in the array. + * - `index` (Array): The index of the current element being processed in the array. + * - `array` (Array): The array `deepMap` was called upon. + * @param {boolean} [skipIndex=false] - If true, the callback function is called with only the value. + * @returns {Array} A new array with each element being the result of the callback function. + */ + function deepMap$1(array, callback) { + var skipIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + if (array.length === 0) { + return []; + } + if (skipIndex) { + return recursiveMap(array); + } + var index = []; + return recursiveMapWithIndex(array, 0); + function recursiveMapWithIndex(value, depth) { + if (Array.isArray(value)) { + var N = value.length; + var result = Array(N); + for (var i = 0; i < N; i++) { + index[depth] = i; + result[i] = recursiveMapWithIndex(value[i], depth + 1); + } + return result; + } else { + return callback(value, index.slice(0, depth), array); + } + } + function recursiveMap(value) { + if (Array.isArray(value)) { + var N = value.length; + var result = Array(N); + for (var i = 0; i < N; i++) { + result[i] = recursiveMap(value[i]); + } + return result; + } else { + return callback(value); + } + } + } + + /** + * Deep clones a multidimensional array + * @param {Array} array + * @returns {Array} cloned array + */ + function clone(array) { + return _extends([], array); + } + + /** + * Simplifies a callback function by reducing its complexity and potentially improving its performance. + * + * @param {Function} callback The original callback function to simplify. + * @param {Array|Matrix} array The array that will be used with the callback function. + * @param {string} name The name of the function that is using the callback. + * @param {boolean} [isUnary=false] If true, the callback function is unary and will be optimized as such. + * @returns {Function} Returns a simplified version of the callback function. + */ + function optimizeCallback(callback, array, name) { + var isUnary = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + if (typedFunction.isTypedFunction(callback)) { + var numberOfArguments; + if (isUnary) { + numberOfArguments = 1; + } else { + var firstIndex = (array.isMatrix ? array.size() : arraySize(array)).map(() => 0); + var firstValue = array.isMatrix ? array.get(firstIndex) : get(array, firstIndex); + numberOfArguments = _findNumberOfArgumentsTyped(callback, firstValue, firstIndex, array); + } + var fastCallback; + if (array.isMatrix && array.dataType !== 'mixed' && array.dataType !== undefined) { + var singleSignature = _findSingleSignatureWithArity(callback, numberOfArguments); + fastCallback = singleSignature !== undefined ? singleSignature : callback; + } else { + fastCallback = callback; + } + if (numberOfArguments >= 1 && numberOfArguments <= 3) { + return { + isUnary: numberOfArguments === 1, + fn: function fn() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + return _tryFunctionWithArgs(fastCallback, args.slice(0, numberOfArguments), name, callback.name); + } + }; + } + return { + isUnary: false, + fn: function fn() { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + return _tryFunctionWithArgs(fastCallback, args, name, callback.name); + } + }; + } + if (isUnary === undefined) { + return { + isUnary: _findIfCallbackIsUnary(callback), + fn: callback + }; + } else { + return { + isUnary, + fn: callback + }; + } + } + function _findSingleSignatureWithArity(callback, arity) { + var matchingFunctions = []; + Object.entries(callback.signatures).forEach(_ref => { + var [signature, func] = _ref; + if (signature.split(',').length === arity) { + matchingFunctions.push(func); + } + }); + if (matchingFunctions.length === 1) { + return matchingFunctions[0]; + } + } + + /** + * Determines if a given callback function is unary (i.e., takes exactly one argument). + * + * This function checks the following conditions to determine if the callback is unary: + * 1. The callback function should have exactly one parameter. + * 2. The callback function should not use the `arguments` object. + * 3. The callback function should not use rest parameters (`...`). + * If in doubt, this function shall return `false` to be safe + * + * @param {Function} callback - The callback function to be checked. + * @returns {boolean} - Returns `true` if the callback is unary, otherwise `false`. + */ + function _findIfCallbackIsUnary(callback) { + if (callback.length !== 1) return false; + var callbackStr = callback.toString(); + // Check if the callback function uses `arguments` + if (/arguments/.test(callbackStr)) return false; + + // Extract the parameters of the callback function + var paramsStr = callbackStr.match(/\(.*?\)/); + // Check if the callback function uses rest parameters + if (/\.\.\./.test(paramsStr)) return false; + return true; + } + function _findNumberOfArgumentsTyped(callback, value, index, array) { + var testArgs = [value, index, array]; + for (var i = 3; i > 0; i--) { + var args = testArgs.slice(0, i); + if (typedFunction.resolve(callback, args) !== null) { + return i; + } + } + } + + /** + * @param {function} func The selected function taken from one of the signatures of the callback function + * @param {Array} args List with arguments to apply to the selected signature + * @param {string} mappingFnName the name of the function that is using the callback + * @param {string} callbackName the name of the callback function + * @returns {*} Returns the return value of the invoked signature + * @throws {TypeError} Throws an error when no matching signature was found + */ + function _tryFunctionWithArgs(func, args, mappingFnName, callbackName) { + try { + return func(...args); + } catch (err) { + _createCallbackError(err, args, mappingFnName, callbackName); + } + } + + /** + * Creates and throws a detailed TypeError when a callback function fails. + * + * @param {Error} err The original error thrown by the callback function. + * @param {Array} args The arguments that were passed to the callback function. + * @param {string} mappingFnName The name of the function that is using the callback. + * @param {string} callbackName The name of the callback function. + * @throws {TypeError} Throws a detailed TypeError with enriched error message. + */ + function _createCallbackError(err, args, mappingFnName, callbackName) { + var _err$data; + // Enrich the error message so the user understands that it took place inside the callback function + if (err instanceof TypeError && ((_err$data = err.data) === null || _err$data === void 0 ? void 0 : _err$data.category) === 'wrongType') { + var argsDesc = []; + argsDesc.push("value: ".concat(typeOf(args[0]))); + if (args.length >= 2) { + argsDesc.push("index: ".concat(typeOf(args[1]))); + } + if (args.length >= 3) { + argsDesc.push("array: ".concat(typeOf(args[2]))); + } + throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "".concat(callbackName, "(").concat(argsDesc.join(', '), ") at index ").concat(JSON.stringify(args[1]))); + } else { + throw new TypeError("Function ".concat(mappingFnName, " cannot apply callback arguments ") + "to function ".concat(callbackName, ": ").concat(err.message)); + } + } + + // deno-lint-ignore-file no-this-alias + var name$r = 'DenseMatrix'; + var dependencies$r = ['Matrix']; + var createDenseMatrixClass = /* #__PURE__ */factory(name$r, dependencies$r, _ref => { + var { + Matrix + } = _ref; + /** + * Dense Matrix implementation. A regular, dense matrix, supporting multi-dimensional matrices. This is the default matrix type. + * @class DenseMatrix + * @enum {{ value, index: number[] }} + */ + function DenseMatrix(data, datatype) { + if (!(this instanceof DenseMatrix)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + if (datatype && !isString(datatype)) { + throw new Error('Invalid datatype: ' + datatype); + } + if (isMatrix(data)) { + // check data is a DenseMatrix + if (data.type === 'DenseMatrix') { + // clone data & size + this._data = clone$2(data._data); + this._size = clone$2(data._size); + this._datatype = datatype || data._datatype; + } else { + // build data from existing matrix + this._data = data.toArray(); + this._size = data.size(); + this._datatype = datatype || data._datatype; + } + } else if (data && isArray(data.data) && isArray(data.size)) { + // initialize fields from JSON representation + this._data = data.data; + this._size = data.size; + // verify the dimensions of the array + validate(this._data, this._size); + this._datatype = datatype || data.datatype; + } else if (isArray(data)) { + // replace nested Matrices with Arrays + this._data = preprocess(data); + // get the dimensions of the array + this._size = arraySize(this._data); + // verify the dimensions of the array, TODO: compute size while processing array + validate(this._data, this._size); + // data type unknown + this._datatype = datatype; + } else if (data) { + // unsupported type + throw new TypeError('Unsupported type of data (' + typeOf(data) + ')'); + } else { + // nothing provided + this._data = []; + this._size = [0]; + this._datatype = datatype; + } + } + DenseMatrix.prototype = new Matrix(); + + /** + * Create a new DenseMatrix + */ + DenseMatrix.prototype.createDenseMatrix = function (data, datatype) { + return new DenseMatrix(data, datatype); + }; + + /** + * Attach type information + */ + Object.defineProperty(DenseMatrix, 'name', { + value: 'DenseMatrix' + }); + DenseMatrix.prototype.constructor = DenseMatrix; + DenseMatrix.prototype.type = 'DenseMatrix'; + DenseMatrix.prototype.isDenseMatrix = true; + + /** + * Get the matrix type + * + * Usage: + * const matrixType = matrix.getDataType() // retrieves the matrix type + * + * @memberOf DenseMatrix + * @return {string} type information; if multiple types are found from the Matrix, it will return "mixed" + */ + DenseMatrix.prototype.getDataType = function () { + return getArrayDataType(this._data, typeOf); + }; + + /** + * Get the storage format used by the matrix. + * + * Usage: + * const format = matrix.storage() // retrieve storage format + * + * @memberof DenseMatrix + * @return {string} The storage format. + */ + DenseMatrix.prototype.storage = function () { + return 'dense'; + }; + + /** + * Get the datatype of the data stored in the matrix. + * + * Usage: + * const format = matrix.datatype() // retrieve matrix datatype + * + * @memberof DenseMatrix + * @return {string} The datatype. + */ + DenseMatrix.prototype.datatype = function () { + return this._datatype; + }; + + /** + * Create a new DenseMatrix + * @memberof DenseMatrix + * @param {Array} data + * @param {string} [datatype] + */ + DenseMatrix.prototype.create = function (data, datatype) { + return new DenseMatrix(data, datatype); + }; + + /** + * Get a subset of the matrix, or replace a subset of the matrix. + * + * Usage: + * const subset = matrix.subset(index) // retrieve subset + * const value = matrix.subset(index, replacement) // replace subset + * + * @memberof DenseMatrix + * @param {Index} index + * @param {Array | Matrix | *} [replacement] + * @param {*} [defaultValue=0] Default value, filled in on new entries when + * the matrix is resized. If not provided, + * new matrix elements will be filled with zeros. + */ + DenseMatrix.prototype.subset = function (index, replacement, defaultValue) { + switch (arguments.length) { + case 1: + return _get(this, index); + + // intentional fall through + case 2: + case 3: + return _set(this, index, replacement, defaultValue); + default: + throw new SyntaxError('Wrong number of arguments'); + } + }; + + /** + * Get a single element from the matrix. + * @memberof DenseMatrix + * @param {number[]} index Zero-based index + * @return {*} value + */ + DenseMatrix.prototype.get = function (index) { + return get(this._data, index); + }; + + /** + * Replace a single element in the matrix. + * @memberof DenseMatrix + * @param {number[]} index Zero-based index + * @param {*} value + * @param {*} [defaultValue] Default value, filled in on new entries when + * the matrix is resized. If not provided, + * new matrix elements will be left undefined. + * @return {DenseMatrix} self + */ + DenseMatrix.prototype.set = function (index, value, defaultValue) { + if (!isArray(index)) { + throw new TypeError('Array expected'); + } + if (index.length < this._size.length) { + throw new DimensionError(index.length, this._size.length, '<'); + } + var i, ii, indexI; + + // enlarge matrix when needed + var size = index.map(function (i) { + return i + 1; + }); + _fit(this, size, defaultValue); + + // traverse over the dimensions + var data = this._data; + for (i = 0, ii = index.length - 1; i < ii; i++) { + indexI = index[i]; + validateIndex(indexI, data.length); + data = data[indexI]; + } + + // set new value + indexI = index[index.length - 1]; + validateIndex(indexI, data.length); + data[indexI] = value; + return this; + }; + + /** + * Get a submatrix of this matrix + * @memberof DenseMatrix + * @param {DenseMatrix} matrix + * @param {Index} index Zero-based index + * @private + */ + function _get(matrix, index) { + if (!isIndex(index)) { + throw new TypeError('Invalid index'); + } + var isScalar = index.isScalar(); + if (isScalar) { + // return a scalar + return matrix.get(index.min()); + } else { + // validate dimensions + var size = index.size(); + if (size.length !== matrix._size.length) { + throw new DimensionError(size.length, matrix._size.length); + } + + // validate if any of the ranges in the index is out of range + var min = index.min(); + var max = index.max(); + for (var i = 0, ii = matrix._size.length; i < ii; i++) { + validateIndex(min[i], matrix._size[i]); + validateIndex(max[i], matrix._size[i]); + } + + // retrieve submatrix + // TODO: more efficient when creating an empty matrix and setting _data and _size manually + return new DenseMatrix(_getSubmatrix(matrix._data, index, size.length, 0), matrix._datatype); + } + } + + /** + * Recursively get a submatrix of a multi dimensional matrix. + * Index is not checked for correct number or length of dimensions. + * @memberof DenseMatrix + * @param {Array} data + * @param {Index} index + * @param {number} dims Total number of dimensions + * @param {number} dim Current dimension + * @return {Array} submatrix + * @private + */ + function _getSubmatrix(data, index, dims, dim) { + var last = dim === dims - 1; + var range = index.dimension(dim); + if (last) { + return range.map(function (i) { + validateIndex(i, data.length); + return data[i]; + }).valueOf(); + } else { + return range.map(function (i) { + validateIndex(i, data.length); + var child = data[i]; + return _getSubmatrix(child, index, dims, dim + 1); + }).valueOf(); + } + } + + /** + * Replace a submatrix in this matrix + * Indexes are zero-based. + * @memberof DenseMatrix + * @param {DenseMatrix} matrix + * @param {Index} index + * @param {DenseMatrix | Array | *} submatrix + * @param {*} defaultValue Default value, filled in on new entries when + * the matrix is resized. + * @return {DenseMatrix} matrix + * @private + */ + function _set(matrix, index, submatrix, defaultValue) { + if (!index || index.isIndex !== true) { + throw new TypeError('Invalid index'); + } + + // get index size and check whether the index contains a single value + var iSize = index.size(); + var isScalar = index.isScalar(); + + // calculate the size of the submatrix, and convert it into an Array if needed + var sSize; + if (isMatrix(submatrix)) { + sSize = submatrix.size(); + submatrix = submatrix.valueOf(); + } else { + sSize = arraySize(submatrix); + } + if (isScalar) { + // set a scalar + + // check whether submatrix is a scalar + if (sSize.length !== 0) { + throw new TypeError('Scalar expected'); + } + matrix.set(index.min(), submatrix, defaultValue); + } else { + // set a submatrix + + // broadcast submatrix + if (!deepStrictEqual(sSize, iSize)) { + try { + if (sSize.length === 0) { + submatrix = broadcastTo([submatrix], iSize); + } else { + submatrix = broadcastTo(submatrix, iSize); + } + sSize = arraySize(submatrix); + } catch (_unused) {} + } + + // validate dimensions + if (iSize.length < matrix._size.length) { + throw new DimensionError(iSize.length, matrix._size.length, '<'); + } + if (sSize.length < iSize.length) { + // calculate number of missing outer dimensions + var i = 0; + var outer = 0; + while (iSize[i] === 1 && sSize[i] === 1) { + i++; + } + while (iSize[i] === 1) { + outer++; + i++; + } + + // unsqueeze both outer and inner dimensions + submatrix = unsqueeze(submatrix, iSize.length, outer, sSize); + } + + // check whether the size of the submatrix matches the index size + if (!deepStrictEqual(iSize, sSize)) { + throw new DimensionError(iSize, sSize, '>'); + } + + // enlarge matrix when needed + var size = index.max().map(function (i) { + return i + 1; + }); + _fit(matrix, size, defaultValue); + + // insert the sub matrix + var dims = iSize.length; + var dim = 0; + _setSubmatrix(matrix._data, index, submatrix, dims, dim); + } + return matrix; + } + + /** + * Replace a submatrix of a multi dimensional matrix. + * @memberof DenseMatrix + * @param {Array} data + * @param {Index} index + * @param {Array} submatrix + * @param {number} dims Total number of dimensions + * @param {number} dim + * @private + */ + function _setSubmatrix(data, index, submatrix, dims, dim) { + var last = dim === dims - 1; + var range = index.dimension(dim); + if (last) { + range.forEach(function (dataIndex, subIndex) { + validateIndex(dataIndex); + data[dataIndex] = submatrix[subIndex[0]]; + }); + } else { + range.forEach(function (dataIndex, subIndex) { + validateIndex(dataIndex); + _setSubmatrix(data[dataIndex], index, submatrix[subIndex[0]], dims, dim + 1); + }); + } + } + + /** + * Resize the matrix to the given size. Returns a copy of the matrix when + * `copy=true`, otherwise return the matrix itself (resize in place). + * + * @memberof DenseMatrix + * @param {number[] || Matrix} size The new size the matrix should have. + * @param {*} [defaultValue=0] Default value, filled in on new entries. + * If not provided, the matrix elements will + * be filled with zeros. + * @param {boolean} [copy] Return a resized copy of the matrix + * + * @return {Matrix} The resized matrix + */ + DenseMatrix.prototype.resize = function (size, defaultValue, copy) { + // validate arguments + if (!isCollection(size)) { + throw new TypeError('Array or Matrix expected'); + } + + // SparseMatrix input is always 2d, flatten this into 1d if it's indeed a vector + var sizeArray = size.valueOf().map(value => { + return Array.isArray(value) && value.length === 1 ? value[0] : value; + }); + + // matrix to resize + var m = copy ? this.clone() : this; + // resize matrix + return _resize(m, sizeArray, defaultValue); + }; + function _resize(matrix, size, defaultValue) { + // check size + if (size.length === 0) { + // first value in matrix + var v = matrix._data; + // go deep + while (isArray(v)) { + v = v[0]; + } + return v; + } + // resize matrix + matrix._size = size.slice(0); // copy the array + matrix._data = resize(matrix._data, matrix._size, defaultValue); + // return matrix + return matrix; + } + + /** + * Reshape the matrix to the given size. Returns a copy of the matrix when + * `copy=true`, otherwise return the matrix itself (reshape in place). + * + * NOTE: This might be better suited to copy by default, instead of modifying + * in place. For now, it operates in place to remain consistent with + * resize(). + * + * @memberof DenseMatrix + * @param {number[]} size The new size the matrix should have. + * @param {boolean} [copy] Return a reshaped copy of the matrix + * + * @return {Matrix} The reshaped matrix + */ + DenseMatrix.prototype.reshape = function (size, copy) { + var m = copy ? this.clone() : this; + m._data = reshape(m._data, size); + var currentLength = m._size.reduce((length, size) => length * size); + m._size = processSizesWildcard(size, currentLength); + return m; + }; + + /** + * Enlarge the matrix when it is smaller than given size. + * If the matrix is larger or equal sized, nothing is done. + * @memberof DenseMatrix + * @param {DenseMatrix} matrix The matrix to be resized + * @param {number[]} size + * @param {*} defaultValue Default value, filled in on new entries. + * @private + */ + function _fit(matrix, size, defaultValue) { + var + // copy the array + newSize = matrix._size.slice(0); + var changed = false; + + // add dimensions when needed + while (newSize.length < size.length) { + newSize.push(0); + changed = true; + } + + // enlarge size when needed + for (var i = 0, ii = size.length; i < ii; i++) { + if (size[i] > newSize[i]) { + newSize[i] = size[i]; + changed = true; + } + } + if (changed) { + // resize only when size is changed + _resize(matrix, newSize, defaultValue); + } + } + + /** + * Create a clone of the matrix + * @memberof DenseMatrix + * @return {DenseMatrix} clone + */ + DenseMatrix.prototype.clone = function () { + var m = new DenseMatrix({ + data: clone$2(this._data), + size: clone$2(this._size), + datatype: this._datatype + }); + return m; + }; + + /** + * Retrieve the size of the matrix. + * @memberof DenseMatrix + * @returns {number[]} size + */ + DenseMatrix.prototype.size = function () { + return this._size.slice(0); // return a clone of _size + }; + + /** + * Applies a callback function to a reference to each element of the matrix + * @memberof DenseMatrix + * @param {Function} callback The callback function is invoked with three + * parameters: the array containing the element, + * the index of the element within that array (as an integer), + * and for non unarry callbacks copy of the current index (as an array of integers). + */ + DenseMatrix.prototype._forEach = function (callback) { + var isUnary = callback.length === 2; // callback has 2 parameters: value, index + var maxDepth = this._size.length - 1; + if (maxDepth < 0) return; + if (isUnary) { + iterateUnary(this._data); + return; + } + if (maxDepth === 0) { + for (var i = 0; i < this._data.length; i++) { + callback(this._data, i, [i]); + } + return; + } + var index = new Array(maxDepth + 1); + iterate(this._data); + function iterate(data) { + var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + if (depth < maxDepth) { + for (var _i = 0; _i < data.length; _i++) { + index[depth] = _i; + iterate(data[_i], depth + 1); + } + } else { + for (var _i2 = 0; _i2 < data.length; _i2++) { + index[depth] = _i2; + callback(data, _i2, index.slice()); + } + } + } + function iterateUnary(data) { + var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + if (depth < maxDepth) { + for (var _i3 = 0; _i3 < data.length; _i3++) { + iterateUnary(data[_i3], depth + 1); + } + } else { + for (var _i4 = 0; _i4 < data.length; _i4++) { + callback(data, _i4); + } + } + } + }; + + /** + * Create a new matrix with the results of the callback function executed on + * each entry of the matrix. + * @memberof DenseMatrix + * @param {Function} callback The callback function is invoked with three + * parameters: the value of the element, the index + * of the element, and the Matrix being traversed. + * @param {boolean} skipZeros If true, the callback function is invoked only for non-zero entries + * @param {boolean} isUnary If true, the callback function is invoked with one parameter + * + * @return {DenseMatrix} matrix + */ + DenseMatrix.prototype.map = function (callback) { + var isUnary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var me = this; + var result = new DenseMatrix(me); + var fastCallback = optimizeCallback(callback, me._data, 'map', isUnary); + var applyCallback = isUnary || fastCallback.isUnary ? (arr, i) => { + arr[i] = fastCallback.fn(arr[i]); + } : (arr, i, index) => { + arr[i] = fastCallback.fn(arr[i], index, me); + }; + result._forEach(applyCallback); + return result; + }; + + /** + * Execute a callback function on each entry of the matrix. + * @memberof DenseMatrix + * @param {Function} callback The callback function is invoked with three + * parameters: the value of the element, the index + * of the element, and the Matrix being traversed. + * @param {boolean} skipZeros If true, the callback function is invoked only for non-zero entries + * @param {boolean} isUnary If true, the callback function is invoked with one parameter + */ + DenseMatrix.prototype.forEach = function (callback) { + var isUnary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var me = this; + var fastCallback = optimizeCallback(callback, me._data, 'map', isUnary); + var applyCallback = isUnary || fastCallback.isUnary ? (arr, i) => { + fastCallback.fn(arr[i]); + } : (arr, i, index) => { + fastCallback.fn(arr[i], index, me); + }; + me._forEach(applyCallback); + }; + + /** + * Iterate over the matrix elements + * @return {Iterable<{ value, index: number[] }>} + */ + DenseMatrix.prototype[Symbol.iterator] = function* () { + var maxDepth = this._size.length - 1; + if (maxDepth < 0) { + return; + } + if (maxDepth === 0) { + for (var i = 0; i < this._data.length; i++) { + yield { + value: this._data[i], + index: [i] + }; + } + return; + } + var index = []; + var _recurse = function* recurse(value, depth) { + if (depth < maxDepth) { + for (var _i5 = 0; _i5 < value.length; _i5++) { + index[depth] = _i5; + yield* _recurse(value[_i5], depth + 1); + } + } else { + for (var _i6 = 0; _i6 < value.length; _i6++) { + index[depth] = _i6; + yield { + value: value[_i6], + index: index.slice() + }; + } + } + }; + yield* _recurse(this._data, 0); + }; + + /** + * Returns an array containing the rows of a 2D matrix + * @returns {Array} + */ + DenseMatrix.prototype.rows = function () { + var result = []; + var s = this.size(); + if (s.length !== 2) { + throw new TypeError('Rows can only be returned for a 2D matrix.'); + } + var data = this._data; + for (var row of data) { + result.push(new DenseMatrix([row], this._datatype)); + } + return result; + }; + + /** + * Returns an array containing the columns of a 2D matrix + * @returns {Array} + */ + DenseMatrix.prototype.columns = function () { + var _this = this; + var result = []; + var s = this.size(); + if (s.length !== 2) { + throw new TypeError('Rows can only be returned for a 2D matrix.'); + } + var data = this._data; + var _loop = function _loop(i) { + var col = data.map(row => [row[i]]); + result.push(new DenseMatrix(col, _this._datatype)); + }; + for (var i = 0; i < s[1]; i++) { + _loop(i); + } + return result; + }; + + /** + * Create an Array with a copy of the data of the DenseMatrix + * @memberof DenseMatrix + * @returns {Array} array + */ + DenseMatrix.prototype.toArray = function () { + return clone$2(this._data); + }; + + /** + * Get the primitive value of the DenseMatrix: a multidimensional array + * @memberof DenseMatrix + * @returns {Array} array + */ + DenseMatrix.prototype.valueOf = function () { + return this._data; + }; + + /** + * Get a string representation of the matrix, with optional formatting options. + * @memberof DenseMatrix + * @param {Object | number | Function} [options] Formatting options. See + * lib/utils/number:format for a + * description of the available + * options. + * @returns {string} str + */ + DenseMatrix.prototype.format = function (options) { + return format(this._data, options); + }; + + /** + * Get a string representation of the matrix + * @memberof DenseMatrix + * @returns {string} str + */ + DenseMatrix.prototype.toString = function () { + return format(this._data); + }; + + /** + * Get a JSON representation of the matrix + * @memberof DenseMatrix + * @returns {Object} + */ + DenseMatrix.prototype.toJSON = function () { + return { + mathjs: 'DenseMatrix', + data: this._data, + size: this._size, + datatype: this._datatype + }; + }; + + /** + * Get the kth Matrix diagonal. + * + * @memberof DenseMatrix + * @param {number | BigNumber} [k=0] The kth diagonal where the vector will retrieved. + * + * @returns {Matrix} The matrix with the diagonal values. + */ + DenseMatrix.prototype.diagonal = function (k) { + // validate k if any + if (k) { + // convert BigNumber to a number + if (isBigNumber(k)) { + k = k.toNumber(); + } + // is must be an integer + if (!isNumber(k) || !isInteger(k)) { + throw new TypeError('The parameter k must be an integer number'); + } + } else { + // default value + k = 0; + } + var kSuper = k > 0 ? k : 0; + var kSub = k < 0 ? -k : 0; + + // rows & columns + var rows = this._size[0]; + var columns = this._size[1]; + + // number diagonal values + var n = Math.min(rows - kSub, columns - kSuper); + + // x is a matrix get diagonal from matrix + var data = []; + + // loop rows + for (var i = 0; i < n; i++) { + data[i] = this._data[i + kSub][i + kSuper]; + } + + // create DenseMatrix + return new DenseMatrix({ + data, + size: [n], + datatype: this._datatype + }); + }; + + /** + * Create a diagonal matrix. + * + * @memberof DenseMatrix + * @param {Array} size The matrix size. + * @param {number | Matrix | Array } value The values for the diagonal. + * @param {number | BigNumber} [k=0] The kth diagonal where the vector will be filled in. + * @param {number} [defaultValue] The default value for non-diagonal + * @param {string} [datatype] The datatype for the diagonal + * + * @returns {DenseMatrix} + */ + DenseMatrix.diagonal = function (size, value, k, defaultValue) { + if (!isArray(size)) { + throw new TypeError('Array expected, size parameter'); + } + if (size.length !== 2) { + throw new Error('Only two dimensions matrix are supported'); + } + + // map size & validate + size = size.map(function (s) { + // check it is a big number + if (isBigNumber(s)) { + // convert it + s = s.toNumber(); + } + // validate arguments + if (!isNumber(s) || !isInteger(s) || s < 1) { + throw new Error('Size values must be positive integers'); + } + return s; + }); + + // validate k if any + if (k) { + // convert BigNumber to a number + if (isBigNumber(k)) { + k = k.toNumber(); + } + // is must be an integer + if (!isNumber(k) || !isInteger(k)) { + throw new TypeError('The parameter k must be an integer number'); + } + } else { + // default value + k = 0; + } + var kSuper = k > 0 ? k : 0; + var kSub = k < 0 ? -k : 0; + + // rows and columns + var rows = size[0]; + var columns = size[1]; + + // number of non-zero items + var n = Math.min(rows - kSub, columns - kSuper); + + // value extraction function + var _value; + + // check value + if (isArray(value)) { + // validate array + if (value.length !== n) { + // number of values in array must be n + throw new Error('Invalid value array length'); + } + // define function + _value = function _value(i) { + // return value @ i + return value[i]; + }; + } else if (isMatrix(value)) { + // matrix size + var ms = value.size(); + // validate matrix + if (ms.length !== 1 || ms[0] !== n) { + // number of values in array must be n + throw new Error('Invalid matrix length'); + } + // define function + _value = function _value(i) { + // return value @ i + return value.get([i]); + }; + } else { + // define function + _value = function _value() { + // return value + return value; + }; + } + + // discover default value if needed + if (!defaultValue) { + // check first value in array + defaultValue = isBigNumber(_value(0)) ? _value(0).mul(0) // trick to create a BigNumber with value zero + : 0; + } + + // empty array + var data = []; + + // check we need to resize array + if (size.length > 0) { + // resize array + data = resize(data, size, defaultValue); + // fill diagonal + for (var d = 0; d < n; d++) { + data[d + kSub][d + kSuper] = _value(d); + } + } + + // create DenseMatrix + return new DenseMatrix({ + data, + size: [rows, columns] + }); + }; + + /** + * Generate a matrix from a JSON object + * @memberof DenseMatrix + * @param {Object} json An object structured like + * `{"mathjs": "DenseMatrix", data: [], size: []}`, + * where mathjs is optional + * @returns {DenseMatrix} + */ + DenseMatrix.fromJSON = function (json) { + return new DenseMatrix(json); + }; + + /** + * Swap rows i and j in Matrix. + * + * @memberof DenseMatrix + * @param {number} i Matrix row index 1 + * @param {number} j Matrix row index 2 + * + * @return {Matrix} The matrix reference + */ + DenseMatrix.prototype.swapRows = function (i, j) { + // check index + if (!isNumber(i) || !isInteger(i) || !isNumber(j) || !isInteger(j)) { + throw new Error('Row index must be positive integers'); + } + // check dimensions + if (this._size.length !== 2) { + throw new Error('Only two dimensional matrix is supported'); + } + // validate index + validateIndex(i, this._size[0]); + validateIndex(j, this._size[0]); + + // swap rows + DenseMatrix._swapRows(i, j, this._data); + // return current instance + return this; + }; + + /** + * Swap rows i and j in Dense Matrix data structure. + * + * @param {number} i Matrix row index 1 + * @param {number} j Matrix row index 2 + * @param {Array} data Matrix data + */ + DenseMatrix._swapRows = function (i, j, data) { + // swap values i <-> j + var vi = data[i]; + data[i] = data[j]; + data[j] = vi; + }; + + /** + * Preprocess data, which can be an Array or DenseMatrix with nested Arrays and + * Matrices. Clones all (nested) Arrays, and replaces all nested Matrices with Arrays + * @memberof DenseMatrix + * @param {Array | Matrix} data + * @return {Array} data + */ + function preprocess(data) { + if (isMatrix(data)) { + return preprocess(data.valueOf()); + } + if (isArray(data)) { + return data.map(preprocess); + } + return data; + } + return DenseMatrix; + }, { + isClass: true + }); + + /** + * Execute the callback function element wise for each element in array and any + * nested array + * Returns an array with the results + * @param {Array | Matrix} array + * @param {Function} callback The callback is called with two parameters: + * value1 and value2, which contain the current + * element of both arrays. + * @param {boolean} [skipZeros] Invoke callback function for non-zero values only. + * + * @return {Array | Matrix} res + */ + function deepMap(array, callback, skipZeros) { + if (!skipZeros) { + if (isMatrix(array)) { + return array.map(x => callback(x), false, true); + } else { + return deepMap$1(array, callback, true); + } + } + var skipZerosCallback = x => x === 0 ? x : callback(x); + if (isMatrix(array)) { + return array.map(x => skipZerosCallback(x), false, true); + } else { + return deepMap$1(array, skipZerosCallback, true); + } + } + + var n1 = 'number'; + var n2 = 'number, number'; + function absNumber(a) { + return Math.abs(a); + } + absNumber.signature = n1; + function addNumber(a, b) { + return a + b; + } + addNumber.signature = n2; + function subtractNumber(a, b) { + return a - b; + } + subtractNumber.signature = n2; + function multiplyNumber(a, b) { + return a * b; + } + multiplyNumber.signature = n2; + function unaryMinusNumber(x) { + return -x; + } + unaryMinusNumber.signature = n1; + + /** + * Calculates the power of x to y, x^y, for two numbers. + * @param {number} x + * @param {number} y + * @return {number} res + */ + function powNumber(x, y) { + // x^Infinity === 0 if -1 < x < 1 + // A real number 0 is returned instead of complex(0) + if (x * x < 1 && y === Infinity || x * x > 1 && y === -Infinity) { + return 0; + } + return Math.pow(x, y); + } + powNumber.signature = n2; + + /** @param {number} i + * @param {number} n + * @returns {number} product of i to n + */ + function product(i, n) { + if (n < i) { + return 1; + } + if (n === i) { + return n; + } + var half = n + i >> 1; // divide (n + i) by 2 and truncate to integer + return product(i, half) * product(half + 1, n); + } + + /* eslint-disable no-loss-of-precision */ + + function gammaNumber(n) { + var x; + if (isInteger(n)) { + if (n <= 0) { + return isFinite(n) ? Infinity : NaN; + } + if (n > 171) { + return Infinity; // Will overflow + } + return product(1, n - 1); + } + if (n < 0.5) { + return Math.PI / (Math.sin(Math.PI * n) * gammaNumber(1 - n)); + } + if (n >= 171.35) { + return Infinity; // will overflow + } + if (n > 85.0) { + // Extended Stirling Approx + var twoN = n * n; + var threeN = twoN * n; + var fourN = threeN * n; + var fiveN = fourN * n; + return Math.sqrt(2 * Math.PI / n) * Math.pow(n / Math.E, n) * (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + 5246819 / (75246796800 * fiveN * n)); + } + --n; + x = gammaP[0]; + for (var i = 1; i < gammaP.length; ++i) { + x += gammaP[i] / (n + i); + } + var t = n + gammaG + 0.5; + return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x; + } + gammaNumber.signature = 'number'; + + // TODO: comment on the variables g and p + + var gammaG = 4.7421875; + var gammaP = [0.99999999999999709182, 57.156235665862923517, -59.59796035547549, 14.136097974741747174, -0.4919138160976202, 0.33994649984811888699e-4, 0.46523628927048575665e-4, -9837447530487956e-20, 0.15808870322491248884e-3, -21026444172410488e-20, 0.21743961811521264320e-3, -1643181065367639e-19, 0.84418223983852743293e-4, -26190838401581408e-21, 0.36899182659531622704e-5]; + + // lgamma implementation ref: https://mrob.com/pub/ries/lanczos-gamma.html#code + + // log(2 * pi) / 2 + var lnSqrt2PI = 0.91893853320467274178; + var lgammaG = 5; // Lanczos parameter "g" + var lgammaN = 7; // Range of coefficients "n" + + var lgammaSeries = [1.000000000190015, 76.18009172947146, -86.50532032941678, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -5395239384953e-18]; + function lgammaNumber(n) { + if (n < 0) return NaN; + if (n === 0) return Infinity; + if (!isFinite(n)) return n; + if (n < 0.5) { + // Use Euler's reflection formula: + // gamma(z) = PI / (sin(PI * z) * gamma(1 - z)) + return Math.log(Math.PI / Math.sin(Math.PI * n)) - lgammaNumber(1 - n); + } + + // Compute the logarithm of the Gamma function using the Lanczos method + + n = n - 1; + var base = n + lgammaG + 0.5; // Base of the Lanczos exponential + var sum = lgammaSeries[0]; + + // We start with the terms that have the smallest coefficients and largest denominator + for (var i = lgammaN - 1; i >= 1; i--) { + sum += lgammaSeries[i] / (n + i); + } + return lnSqrt2PI + (n + 0.5) * Math.log(base) - base + Math.log(sum); + } + lgammaNumber.signature = 'number'; + + /** + * Compares two BigNumbers. + * @param {BigNumber} a - First value to compare + * @param {BigNumber} b - Second value to compare + * @param {number} [relTol=1e-09] - The relative tolerance, indicating the maximum allowed difference relative to the larger absolute value. Must be greater than 0. + * @param {number} [absTol=0] - The minimum absolute tolerance, useful for comparisons near zero. Must be at least 0. + * @returns {boolean} whether the two numbers are nearly equal + * @throws {Error} If `relTol` is less than or equal to 0. + * @throws {Error} If `absTol` is less than 0. + * + * @example + * nearlyEqual(1.000000001, 1.0, 1e-9); // true + * nearlyEqual(1.000000002, 1.0, 0); // false + * nearlyEqual(1.0, 1.009, undefined, 0.02); // true + * nearlyEqual(0.000000001, 0.0, undefined, 1e-8); // true + */ + function nearlyEqual(a, b) { + var relTol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1e-9; + var absTol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + if (relTol <= 0) { + throw new Error('Relative tolerance must be greater than 0'); + } + if (absTol < 0) { + throw new Error('Absolute tolerance must be at least 0'); + } + // NaN + if (a.isNaN() || b.isNaN()) { + return false; + } + if (!a.isFinite() || !b.isFinite()) { + return a.eq(b); + } + // use "==" operator, handles infinities + if (a.eq(b)) { + return true; + } + // abs(a-b) <= max(relTol * max(abs(a), abs(b)), absTol) + return a.minus(b).abs().lte(a.constructor.max(a.constructor.max(a.abs(), b.abs()).mul(relTol), absTol)); + } + + var name$q = 'isZero'; + var dependencies$q = ['typed', 'equalScalar']; + var createIsZero = /* #__PURE__ */factory(name$q, dependencies$q, _ref => { + var { + typed, + equalScalar + } = _ref; + /** + * Test whether a value is zero. + * The function can check for zero for types `number`, `BigNumber`, `Fraction`, + * `Complex`, and `Unit`. + * + * The function is evaluated element-wise in case of Array or Matrix input. + * + * Syntax: + * + * math.isZero(x) + * + * Examples: + * + * math.isZero(0) // returns true + * math.isZero(2) // returns false + * math.isZero(0.5) // returns false + * math.isZero(math.bignumber(0)) // returns true + * math.isZero(math.fraction(0)) // returns true + * math.isZero(math.fraction(1,3)) // returns false + * math.isZero(math.complex('2 - 4i')) // returns false + * math.isZero(math.complex('0i')) // returns true + * math.isZero('0') // returns true + * math.isZero('2') // returns false + * math.isZero([2, 0, -3]) // returns [false, true, false] + * + * See also: + * + * isNumeric, isPositive, isNegative, isInteger + * + * @param {number | BigNumber | bigint | Complex | Fraction | Unit | Array | Matrix} x Value to be tested + * @return {boolean} Returns true when `x` is zero. + * Throws an error in case of an unknown data type. + */ + return typed(name$q, { + 'number | BigNumber | Complex | Fraction': x => equalScalar(x, 0), + bigint: x => x === 0n, + Unit: typed.referToSelf(self => x => typed.find(self, x.valueType())(x.value)), + 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self)) + }); + }); + + /** + * Test whether two complex values are equal provided a given relTol and absTol. + * Does not use or change the global Complex.EPSILON setting + * @param {Complex} x - The first complex number for comparison. + * @param {Complex} y - The second complex number for comparison. + * @param {number} relTol - The relative tolerance for comparison. + * @param {number} absTol - The absolute tolerance for comparison. + * @returns {boolean} - Returns true if the two complex numbers are equal within the given tolerances, otherwise returns false. + */ + function complexEquals(x, y, relTol, absTol) { + return nearlyEqual$1(x.re, y.re, relTol, absTol) && nearlyEqual$1(x.im, y.im, relTol, absTol); + } + + var createCompareUnits = /* #__PURE__ */factory('compareUnits', ['typed'], _ref => { + var { + typed + } = _ref; + return { + 'Unit, Unit': typed.referToSelf(self => (x, y) => { + if (!x.equalBase(y)) { + throw new Error('Cannot compare units with different base'); + } + return typed.find(self, [x.valueType(), y.valueType()])(x.value, y.value); + }) + }; + }); + + var name$p = 'equalScalar'; + var dependencies$p = ['typed', 'config']; + var createEqualScalar = /* #__PURE__ */factory(name$p, dependencies$p, _ref => { + var { + typed, + config + } = _ref; + var compareUnits = createCompareUnits({ + typed + }); + + /** + * Test whether two scalar values are nearly equal. + * + * @param {number | BigNumber | bigint | Fraction | boolean | Complex | Unit} x First value to compare + * @param {number | BigNumber | bigint | Fraction | boolean | Complex} y Second value to compare + * @return {boolean} Returns true when the compared values are equal, else returns false + * @private + */ + return typed(name$p, { + 'boolean, boolean': function boolean_boolean(x, y) { + return x === y; + }, + 'number, number': function number_number(x, y) { + return nearlyEqual$1(x, y, config.relTol, config.absTol); + }, + 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) { + return x.eq(y) || nearlyEqual(x, y, config.relTol, config.absTol); + }, + 'bigint, bigint': function bigint_bigint(x, y) { + return x === y; + }, + 'Fraction, Fraction': function Fraction_Fraction(x, y) { + return x.equals(y); + }, + 'Complex, Complex': function Complex_Complex(x, y) { + return complexEquals(x, y, config.relTol, config.absTol); + } + }, compareUnits); + }); + factory(name$p, ['typed', 'config'], _ref2 => { + var { + typed, + config + } = _ref2; + return typed(name$p, { + 'number, number': function number_number(x, y) { + return nearlyEqual$1(x, y, config.relTol, config.absTol); + } + }); + }); + + var name$o = 'SparseMatrix'; + var dependencies$o = ['typed', 'equalScalar', 'Matrix']; + var createSparseMatrixClass = /* #__PURE__ */factory(name$o, dependencies$o, _ref => { + var { + typed, + equalScalar, + Matrix + } = _ref; + /** + * Sparse Matrix implementation. This type implements + * a [Compressed Column Storage](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_(CSC_or_CCS)) + * format for two-dimensional sparse matrices. + * @class SparseMatrix + */ + function SparseMatrix(data, datatype) { + if (!(this instanceof SparseMatrix)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + if (datatype && !isString(datatype)) { + throw new Error('Invalid datatype: ' + datatype); + } + if (isMatrix(data)) { + // create from matrix + _createFromMatrix(this, data, datatype); + } else if (data && isArray(data.index) && isArray(data.ptr) && isArray(data.size)) { + // initialize fields + this._values = data.values; + this._index = data.index; + this._ptr = data.ptr; + this._size = data.size; + this._datatype = datatype || data.datatype; + } else if (isArray(data)) { + // create from array + _createFromArray(this, data, datatype); + } else if (data) { + // unsupported type + throw new TypeError('Unsupported type of data (' + typeOf(data) + ')'); + } else { + // nothing provided + this._values = []; + this._index = []; + this._ptr = [0]; + this._size = [0, 0]; + this._datatype = datatype; + } + } + function _createFromMatrix(matrix, source, datatype) { + // check matrix type + if (source.type === 'SparseMatrix') { + // clone arrays + matrix._values = source._values ? clone$2(source._values) : undefined; + matrix._index = clone$2(source._index); + matrix._ptr = clone$2(source._ptr); + matrix._size = clone$2(source._size); + matrix._datatype = datatype || source._datatype; + } else { + // build from matrix data + _createFromArray(matrix, source.valueOf(), datatype || source._datatype); + } + } + function _createFromArray(matrix, data, datatype) { + // initialize fields + matrix._values = []; + matrix._index = []; + matrix._ptr = []; + matrix._datatype = datatype; + // discover rows & columns, do not use math.size() to avoid looping array twice + var rows = data.length; + var columns = 0; + + // equal signature to use + var eq = equalScalar; + // zero value + var zero = 0; + if (isString(datatype)) { + // find signature that matches (datatype, datatype) + eq = typed.find(equalScalar, [datatype, datatype]) || equalScalar; + // convert 0 to the same datatype + zero = typed.convert(0, datatype); + } + + // check we have rows (empty array) + if (rows > 0) { + // column index + var j = 0; + do { + // store pointer to values index + matrix._ptr.push(matrix._index.length); + // loop rows + for (var i = 0; i < rows; i++) { + // current row + var row = data[i]; + // check row is an array + if (isArray(row)) { + // update columns if needed (only on first column) + if (j === 0 && columns < row.length) { + columns = row.length; + } + // check row has column + if (j < row.length) { + // value + var v = row[j]; + // check value != 0 + if (!eq(v, zero)) { + // store value + matrix._values.push(v); + // index + matrix._index.push(i); + } + } + } else { + // update columns if needed (only on first column) + if (j === 0 && columns < 1) { + columns = 1; + } + // check value != 0 (row is a scalar) + if (!eq(row, zero)) { + // store value + matrix._values.push(row); + // index + matrix._index.push(i); + } + } + } + // increment index + j++; + } while (j < columns); + } + // store number of values in ptr + matrix._ptr.push(matrix._index.length); + // size + matrix._size = [rows, columns]; + } + SparseMatrix.prototype = new Matrix(); + + /** + * Create a new SparseMatrix + */ + SparseMatrix.prototype.createSparseMatrix = function (data, datatype) { + return new SparseMatrix(data, datatype); + }; + + /** + * Attach type information + */ + Object.defineProperty(SparseMatrix, 'name', { + value: 'SparseMatrix' + }); + SparseMatrix.prototype.constructor = SparseMatrix; + SparseMatrix.prototype.type = 'SparseMatrix'; + SparseMatrix.prototype.isSparseMatrix = true; + + /** + * Get the matrix type + * + * Usage: + * const matrixType = matrix.getDataType() // retrieves the matrix type + * + * @memberOf SparseMatrix + * @return {string} type information; if multiple types are found from the Matrix, it will return "mixed" + */ + SparseMatrix.prototype.getDataType = function () { + return getArrayDataType(this._values, typeOf); + }; + + /** + * Get the storage format used by the matrix. + * + * Usage: + * const format = matrix.storage() // retrieve storage format + * + * @memberof SparseMatrix + * @return {string} The storage format. + */ + SparseMatrix.prototype.storage = function () { + return 'sparse'; + }; + + /** + * Get the datatype of the data stored in the matrix. + * + * Usage: + * const format = matrix.datatype() // retrieve matrix datatype + * + * @memberof SparseMatrix + * @return {string} The datatype. + */ + SparseMatrix.prototype.datatype = function () { + return this._datatype; + }; + + /** + * Create a new SparseMatrix + * @memberof SparseMatrix + * @param {Array} data + * @param {string} [datatype] + */ + SparseMatrix.prototype.create = function (data, datatype) { + return new SparseMatrix(data, datatype); + }; + + /** + * Get the matrix density. + * + * Usage: + * const density = matrix.density() // retrieve matrix density + * + * @memberof SparseMatrix + * @return {number} The matrix density. + */ + SparseMatrix.prototype.density = function () { + // rows & columns + var rows = this._size[0]; + var columns = this._size[1]; + // calculate density + return rows !== 0 && columns !== 0 ? this._index.length / (rows * columns) : 0; + }; + + /** + * Get a subset of the matrix, or replace a subset of the matrix. + * + * Usage: + * const subset = matrix.subset(index) // retrieve subset + * const value = matrix.subset(index, replacement) // replace subset + * + * @memberof SparseMatrix + * @param {Index} index + * @param {Array | Matrix | *} [replacement] + * @param {*} [defaultValue=0] Default value, filled in on new entries when + * the matrix is resized. If not provided, + * new matrix elements will be filled with zeros. + */ + SparseMatrix.prototype.subset = function (index, replacement, defaultValue) { + // check it is a pattern matrix + if (!this._values) { + throw new Error('Cannot invoke subset on a Pattern only matrix'); + } + + // check arguments + switch (arguments.length) { + case 1: + return _getsubset(this, index); + + // intentional fall through + case 2: + case 3: + return _setsubset(this, index, replacement, defaultValue); + default: + throw new SyntaxError('Wrong number of arguments'); + } + }; + function _getsubset(matrix, idx) { + // check idx + if (!isIndex(idx)) { + throw new TypeError('Invalid index'); + } + var isScalar = idx.isScalar(); + if (isScalar) { + // return a scalar + return matrix.get(idx.min()); + } + // validate dimensions + var size = idx.size(); + if (size.length !== matrix._size.length) { + throw new DimensionError(size.length, matrix._size.length); + } + + // vars + var i, ii, k, kk; + + // validate if any of the ranges in the index is out of range + var min = idx.min(); + var max = idx.max(); + for (i = 0, ii = matrix._size.length; i < ii; i++) { + validateIndex(min[i], matrix._size[i]); + validateIndex(max[i], matrix._size[i]); + } + + // matrix arrays + var mvalues = matrix._values; + var mindex = matrix._index; + var mptr = matrix._ptr; + + // rows & columns dimensions for result matrix + var rows = idx.dimension(0); + var columns = idx.dimension(1); + + // workspace & permutation vector + var w = []; + var pv = []; + + // loop rows in resulting matrix + rows.forEach(function (i, r) { + // update permutation vector + pv[i] = r[0]; + // mark i in workspace + w[i] = true; + }); + + // result matrix arrays + var values = mvalues ? [] : undefined; + var index = []; + var ptr = []; + + // loop columns in result matrix + columns.forEach(function (j) { + // update ptr + ptr.push(index.length); + // loop values in column j + for (k = mptr[j], kk = mptr[j + 1]; k < kk; k++) { + // row + i = mindex[k]; + // check row is in result matrix + if (w[i] === true) { + // push index + index.push(pv[i]); + // check we need to process values + if (values) { + values.push(mvalues[k]); + } + } + } + }); + // update ptr + ptr.push(index.length); + + // return matrix + return new SparseMatrix({ + values, + index, + ptr, + size, + datatype: matrix._datatype + }); + } + function _setsubset(matrix, index, submatrix, defaultValue) { + // check index + if (!index || index.isIndex !== true) { + throw new TypeError('Invalid index'); + } + + // get index size and check whether the index contains a single value + var iSize = index.size(); + var isScalar = index.isScalar(); + + // calculate the size of the submatrix, and convert it into an Array if needed + var sSize; + if (isMatrix(submatrix)) { + // submatrix size + sSize = submatrix.size(); + // use array representation + submatrix = submatrix.toArray(); + } else { + // get submatrix size (array, scalar) + sSize = arraySize(submatrix); + } + + // check index is a scalar + if (isScalar) { + // verify submatrix is a scalar + if (sSize.length !== 0) { + throw new TypeError('Scalar expected'); + } + // set value + matrix.set(index.min(), submatrix, defaultValue); + } else { + // validate dimensions, index size must be one or two dimensions + if (iSize.length !== 1 && iSize.length !== 2) { + throw new DimensionError(iSize.length, matrix._size.length, '<'); + } + + // check submatrix and index have the same dimensions + if (sSize.length < iSize.length) { + // calculate number of missing outer dimensions + var i = 0; + var outer = 0; + while (iSize[i] === 1 && sSize[i] === 1) { + i++; + } + while (iSize[i] === 1) { + outer++; + i++; + } + // unsqueeze both outer and inner dimensions + submatrix = unsqueeze(submatrix, iSize.length, outer, sSize); + } + + // check whether the size of the submatrix matches the index size + if (!deepStrictEqual(iSize, sSize)) { + throw new DimensionError(iSize, sSize, '>'); + } + + // insert the sub matrix + if (iSize.length === 1) { + // if the replacement index only has 1 dimension, go trough each one and set its value + var range = index.dimension(0); + range.forEach(function (dataIndex, subIndex) { + validateIndex(dataIndex); + matrix.set([dataIndex, 0], submatrix[subIndex[0]], defaultValue); + }); + } else { + // if the replacement index has 2 dimensions, go through each one and set the value in the correct index + var firstDimensionRange = index.dimension(0); + var secondDimensionRange = index.dimension(1); + firstDimensionRange.forEach(function (firstDataIndex, firstSubIndex) { + validateIndex(firstDataIndex); + secondDimensionRange.forEach(function (secondDataIndex, secondSubIndex) { + validateIndex(secondDataIndex); + matrix.set([firstDataIndex, secondDataIndex], submatrix[firstSubIndex[0]][secondSubIndex[0]], defaultValue); + }); + }); + } + } + return matrix; + } + + /** + * Get a single element from the matrix. + * @memberof SparseMatrix + * @param {number[]} index Zero-based index + * @return {*} value + */ + SparseMatrix.prototype.get = function (index) { + if (!isArray(index)) { + throw new TypeError('Array expected'); + } + if (index.length !== this._size.length) { + throw new DimensionError(index.length, this._size.length); + } + + // check it is a pattern matrix + if (!this._values) { + throw new Error('Cannot invoke get on a Pattern only matrix'); + } + + // row and column + var i = index[0]; + var j = index[1]; + + // check i, j are valid + validateIndex(i, this._size[0]); + validateIndex(j, this._size[1]); + + // find value index + var k = _getValueIndex(i, this._ptr[j], this._ptr[j + 1], this._index); + // check k is prior to next column k and it is in the correct row + if (k < this._ptr[j + 1] && this._index[k] === i) { + return this._values[k]; + } + return 0; + }; + + /** + * Replace a single element in the matrix. + * @memberof SparseMatrix + * @param {number[]} index Zero-based index + * @param {*} v + * @param {*} [defaultValue] Default value, filled in on new entries when + * the matrix is resized. If not provided, + * new matrix elements will be set to zero. + * @return {SparseMatrix} self + */ + SparseMatrix.prototype.set = function (index, v, defaultValue) { + if (!isArray(index)) { + throw new TypeError('Array expected'); + } + if (index.length !== this._size.length) { + throw new DimensionError(index.length, this._size.length); + } + + // check it is a pattern matrix + if (!this._values) { + throw new Error('Cannot invoke set on a Pattern only matrix'); + } + + // row and column + var i = index[0]; + var j = index[1]; + + // rows & columns + var rows = this._size[0]; + var columns = this._size[1]; + + // equal signature to use + var eq = equalScalar; + // zero value + var zero = 0; + if (isString(this._datatype)) { + // find signature that matches (datatype, datatype) + eq = typed.find(equalScalar, [this._datatype, this._datatype]) || equalScalar; + // convert 0 to the same datatype + zero = typed.convert(0, this._datatype); + } + + // check we need to resize matrix + if (i > rows - 1 || j > columns - 1) { + // resize matrix + _resize(this, Math.max(i + 1, rows), Math.max(j + 1, columns), defaultValue); + // update rows & columns + rows = this._size[0]; + columns = this._size[1]; + } + + // check i, j are valid + validateIndex(i, rows); + validateIndex(j, columns); + + // find value index + var k = _getValueIndex(i, this._ptr[j], this._ptr[j + 1], this._index); + // check k is prior to next column k and it is in the correct row + if (k < this._ptr[j + 1] && this._index[k] === i) { + // check value != 0 + if (!eq(v, zero)) { + // update value + this._values[k] = v; + } else { + // remove value from matrix + _remove(k, j, this._values, this._index, this._ptr); + } + } else { + if (!eq(v, zero)) { + // insert value @ (i, j) + _insert(k, i, j, v, this._values, this._index, this._ptr); + } + } + return this; + }; + function _getValueIndex(i, top, bottom, index) { + // check row is on the bottom side + if (bottom - top === 0) { + return bottom; + } + // loop rows [top, bottom[ + for (var r = top; r < bottom; r++) { + // check we found value index + if (index[r] === i) { + return r; + } + } + // we did not find row + return top; + } + function _remove(k, j, values, index, ptr) { + // remove value @ k + values.splice(k, 1); + index.splice(k, 1); + // update pointers + for (var x = j + 1; x < ptr.length; x++) { + ptr[x]--; + } + } + function _insert(k, i, j, v, values, index, ptr) { + // insert value + values.splice(k, 0, v); + // update row for k + index.splice(k, 0, i); + // update column pointers + for (var x = j + 1; x < ptr.length; x++) { + ptr[x]++; + } + } + + /** + * Resize the matrix to the given size. Returns a copy of the matrix when + * `copy=true`, otherwise return the matrix itself (resize in place). + * + * @memberof SparseMatrix + * @param {number[] | Matrix} size The new size the matrix should have. + * Since sparse matrices are always two-dimensional, + * size must be two numbers in either an array or a matrix + * @param {*} [defaultValue=0] Default value, filled in on new entries. + * If not provided, the matrix elements will + * be filled with zeros. + * @param {boolean} [copy] Return a resized copy of the matrix + * + * @return {Matrix} The resized matrix + */ + SparseMatrix.prototype.resize = function (size, defaultValue, copy) { + // validate arguments + if (!isCollection(size)) { + throw new TypeError('Array or Matrix expected'); + } + + // SparseMatrix input is always 2d, flatten this into 1d if it's indeed a vector + var sizeArray = size.valueOf().map(value => { + return Array.isArray(value) && value.length === 1 ? value[0] : value; + }); + if (sizeArray.length !== 2) { + throw new Error('Only two dimensions matrix are supported'); + } + + // check sizes + sizeArray.forEach(function (value) { + if (!isNumber(value) || !isInteger(value) || value < 0) { + throw new TypeError('Invalid size, must contain positive integers ' + '(size: ' + format(sizeArray) + ')'); + } + }); + + // matrix to resize + var m = copy ? this.clone() : this; + // resize matrix + return _resize(m, sizeArray[0], sizeArray[1], defaultValue); + }; + function _resize(matrix, rows, columns, defaultValue) { + // value to insert at the time of growing matrix + var value = defaultValue || 0; + + // equal signature to use + var eq = equalScalar; + // zero value + var zero = 0; + if (isString(matrix._datatype)) { + // find signature that matches (datatype, datatype) + eq = typed.find(equalScalar, [matrix._datatype, matrix._datatype]) || equalScalar; + // convert 0 to the same datatype + zero = typed.convert(0, matrix._datatype); + // convert value to the same datatype + value = typed.convert(value, matrix._datatype); + } + + // should we insert the value? + var ins = !eq(value, zero); + + // old columns and rows + var r = matrix._size[0]; + var c = matrix._size[1]; + var i, j, k; + + // check we need to increase columns + if (columns > c) { + // loop new columns + for (j = c; j < columns; j++) { + // update matrix._ptr for current column + matrix._ptr[j] = matrix._values.length; + // check we need to insert matrix._values + if (ins) { + // loop rows + for (i = 0; i < r; i++) { + // add new matrix._values + matrix._values.push(value); + // update matrix._index + matrix._index.push(i); + } + } + } + // store number of matrix._values in matrix._ptr + matrix._ptr[columns] = matrix._values.length; + } else if (columns < c) { + // truncate matrix._ptr + matrix._ptr.splice(columns + 1, c - columns); + // truncate matrix._values and matrix._index + matrix._values.splice(matrix._ptr[columns], matrix._values.length); + matrix._index.splice(matrix._ptr[columns], matrix._index.length); + } + // update columns + c = columns; + + // check we need to increase rows + if (rows > r) { + // check we have to insert values + if (ins) { + // inserts + var n = 0; + // loop columns + for (j = 0; j < c; j++) { + // update matrix._ptr for current column + matrix._ptr[j] = matrix._ptr[j] + n; + // where to insert matrix._values + k = matrix._ptr[j + 1] + n; + // pointer + var p = 0; + // loop new rows, initialize pointer + for (i = r; i < rows; i++, p++) { + // add value + matrix._values.splice(k + p, 0, value); + // update matrix._index + matrix._index.splice(k + p, 0, i); + // increment inserts + n++; + } + } + // store number of matrix._values in matrix._ptr + matrix._ptr[c] = matrix._values.length; + } + } else if (rows < r) { + // deletes + var d = 0; + // loop columns + for (j = 0; j < c; j++) { + // update matrix._ptr for current column + matrix._ptr[j] = matrix._ptr[j] - d; + // where matrix._values start for next column + var k0 = matrix._ptr[j]; + var k1 = matrix._ptr[j + 1] - d; + // loop matrix._index + for (k = k0; k < k1; k++) { + // row + i = matrix._index[k]; + // check we need to delete value and matrix._index + if (i > rows - 1) { + // remove value + matrix._values.splice(k, 1); + // remove item from matrix._index + matrix._index.splice(k, 1); + // increase deletes + d++; + } + } + } + // update matrix._ptr for current column + matrix._ptr[j] = matrix._values.length; + } + // update matrix._size + matrix._size[0] = rows; + matrix._size[1] = columns; + // return matrix + return matrix; + } + + /** + * Reshape the matrix to the given size. Returns a copy of the matrix when + * `copy=true`, otherwise return the matrix itself (reshape in place). + * + * NOTE: This might be better suited to copy by default, instead of modifying + * in place. For now, it operates in place to remain consistent with + * resize(). + * + * @memberof SparseMatrix + * @param {number[]} sizes The new size the matrix should have. + * Since sparse matrices are always two-dimensional, + * size must be two numbers in either an array or a matrix + * @param {boolean} [copy] Return a reshaped copy of the matrix + * + * @return {Matrix} The reshaped matrix + */ + SparseMatrix.prototype.reshape = function (sizes, copy) { + // validate arguments + if (!isArray(sizes)) { + throw new TypeError('Array expected'); + } + if (sizes.length !== 2) { + throw new Error('Sparse matrices can only be reshaped in two dimensions'); + } + + // check sizes + sizes.forEach(function (value) { + if (!isNumber(value) || !isInteger(value) || value <= -2 || value === 0) { + throw new TypeError('Invalid size, must contain positive integers or -1 ' + '(size: ' + format(sizes) + ')'); + } + }); + var currentLength = this._size[0] * this._size[1]; + sizes = processSizesWildcard(sizes, currentLength); + var newLength = sizes[0] * sizes[1]; + + // m * n must not change + if (currentLength !== newLength) { + throw new Error('Reshaping sparse matrix will result in the wrong number of elements'); + } + + // matrix to reshape + var m = copy ? this.clone() : this; + + // return unchanged if the same shape + if (this._size[0] === sizes[0] && this._size[1] === sizes[1]) { + return m; + } + + // Convert to COO format (generate a column index) + var colIndex = []; + for (var i = 0; i < m._ptr.length; i++) { + for (var j = 0; j < m._ptr[i + 1] - m._ptr[i]; j++) { + colIndex.push(i); + } + } + + // Clone the values array + var values = m._values.slice(); + + // Clone the row index array + var rowIndex = m._index.slice(); + + // Transform the (row, column) indices + for (var _i = 0; _i < m._index.length; _i++) { + var r1 = rowIndex[_i]; + var c1 = colIndex[_i]; + var flat = r1 * m._size[1] + c1; + colIndex[_i] = flat % sizes[1]; + rowIndex[_i] = Math.floor(flat / sizes[1]); + } + + // Now reshaping is supposed to preserve the row-major order, BUT these sparse matrices are stored + // in column-major order, so we have to reorder the value array now. One option is to use a multisort, + // sorting several arrays based on some other array. + + // OR, we could easily just: + + // 1. Remove all values from the matrix + m._values.length = 0; + m._index.length = 0; + m._ptr.length = sizes[1] + 1; + m._size = sizes.slice(); + for (var _i2 = 0; _i2 < m._ptr.length; _i2++) { + m._ptr[_i2] = 0; + } + + // 2. Re-insert all elements in the proper order (simplified code from SparseMatrix.prototype.set) + // This step is probably the most time-consuming + for (var h = 0; h < values.length; h++) { + var _i3 = rowIndex[h]; + var _j = colIndex[h]; + var v = values[h]; + var k = _getValueIndex(_i3, m._ptr[_j], m._ptr[_j + 1], m._index); + _insert(k, _i3, _j, v, m._values, m._index, m._ptr); + } + + // The value indices are inserted out of order, but apparently that's... still OK? + + return m; + }; + + /** + * Create a clone of the matrix + * @memberof SparseMatrix + * @return {SparseMatrix} clone + */ + SparseMatrix.prototype.clone = function () { + var m = new SparseMatrix({ + values: this._values ? clone$2(this._values) : undefined, + index: clone$2(this._index), + ptr: clone$2(this._ptr), + size: clone$2(this._size), + datatype: this._datatype + }); + return m; + }; + + /** + * Retrieve the size of the matrix. + * @memberof SparseMatrix + * @returns {number[]} size + */ + SparseMatrix.prototype.size = function () { + return this._size.slice(0); // copy the Array + }; + + /** + * Create a new matrix with the results of the callback function executed on + * each entry of the matrix. + * @memberof SparseMatrix + * @param {Function} callback The callback function is invoked with three + * parameters: the value of the element, the index + * of the element, and the Matrix being traversed. + * @param {boolean} [skipZeros] Invoke callback function for non-zero values only. + * + * @return {SparseMatrix} matrix + */ + SparseMatrix.prototype.map = function (callback, skipZeros) { + // check it is a pattern matrix + if (!this._values) { + throw new Error('Cannot invoke map on a Pattern only matrix'); + } + // matrix instance + var me = this; + // rows and columns + var rows = this._size[0]; + var columns = this._size[1]; + var fastCallback = optimizeCallback(callback, me, 'map'); + // invoke callback + var invoke = function invoke(v, i, j) { + // invoke callback + return fastCallback.fn(v, [i, j], me); + }; + // invoke _map + return _map(this, 0, rows - 1, 0, columns - 1, invoke, skipZeros); + }; + + /** + * Create a new matrix with the results of the callback function executed on the interval + * [minRow..maxRow, minColumn..maxColumn]. + */ + function _map(matrix, minRow, maxRow, minColumn, maxColumn, callback, skipZeros) { + // result arrays + var values = []; + var index = []; + var ptr = []; + + // equal signature to use + var eq = equalScalar; + // zero value + var zero = 0; + if (isString(matrix._datatype)) { + // find signature that matches (datatype, datatype) + eq = typed.find(equalScalar, [matrix._datatype, matrix._datatype]) || equalScalar; + // convert 0 to the same datatype + zero = typed.convert(0, matrix._datatype); + } + + // invoke callback + var invoke = function invoke(v, x, y) { + // invoke callback + var value = callback(v, x, y); + // check value != 0 + if (!eq(value, zero)) { + // store value + values.push(value); + // index + index.push(x); + } + }; + // loop columns + for (var j = minColumn; j <= maxColumn; j++) { + // store pointer to values index + ptr.push(values.length); + // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1] + var k0 = matrix._ptr[j]; + var k1 = matrix._ptr[j + 1]; + if (skipZeros) { + // loop k within [k0, k1[ + for (var k = k0; k < k1; k++) { + // row index + var i = matrix._index[k]; + // check i is in range + if (i >= minRow && i <= maxRow) { + // value @ k + invoke(matrix._values[k], i - minRow, j - minColumn); + } + } + } else { + // create a cache holding all defined values + var _values = {}; + for (var _k = k0; _k < k1; _k++) { + var _i4 = matrix._index[_k]; + _values[_i4] = matrix._values[_k]; + } + + // loop over all rows (indexes can be unordered so we can't use that), + // and either read the value or zero + for (var _i5 = minRow; _i5 <= maxRow; _i5++) { + var value = _i5 in _values ? _values[_i5] : 0; + invoke(value, _i5 - minRow, j - minColumn); + } + } + } + + // store number of values in ptr + ptr.push(values.length); + // return sparse matrix + return new SparseMatrix({ + values, + index, + ptr, + size: [maxRow - minRow + 1, maxColumn - minColumn + 1] + }); + } + + /** + * Execute a callback function on each entry of the matrix. + * @memberof SparseMatrix + * @param {Function} callback The callback function is invoked with three + * parameters: the value of the element, the index + * of the element, and the Matrix being traversed. + * @param {boolean} [skipZeros] Invoke callback function for non-zero values only. + * If false, the indices are guaranteed to be in order, + * if true, the indices can be unordered. + */ + SparseMatrix.prototype.forEach = function (callback, skipZeros) { + // check it is a pattern matrix + if (!this._values) { + throw new Error('Cannot invoke forEach on a Pattern only matrix'); + } + // matrix instance + var me = this; + // rows and columns + var rows = this._size[0]; + var columns = this._size[1]; + var fastCallback = optimizeCallback(callback, me, 'forEach'); + // loop columns + for (var j = 0; j < columns; j++) { + // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1] + var k0 = this._ptr[j]; + var k1 = this._ptr[j + 1]; + if (skipZeros) { + // loop k within [k0, k1[ + for (var k = k0; k < k1; k++) { + // row index + var i = this._index[k]; + + // value @ k + // TODO apply a non indexed version of algorithm in case fastCallback is not optimized + fastCallback.fn(this._values[k], [i, j], me); + } + } else { + // create a cache holding all defined values + var values = {}; + for (var _k2 = k0; _k2 < k1; _k2++) { + var _i6 = this._index[_k2]; + values[_i6] = this._values[_k2]; + } + + // loop over all rows (indexes can be unordered so we can't use that), + // and either read the value or zero + for (var _i7 = 0; _i7 < rows; _i7++) { + var value = _i7 in values ? values[_i7] : 0; + fastCallback.fn(value, [_i7, j], me); + } + } + } + }; + + /** + * Iterate over the matrix elements, skipping zeros + * @return {Iterable<{ value, index: number[] }>} + */ + SparseMatrix.prototype[Symbol.iterator] = function* () { + if (!this._values) { + throw new Error('Cannot iterate a Pattern only matrix'); + } + var columns = this._size[1]; + for (var j = 0; j < columns; j++) { + var k0 = this._ptr[j]; + var k1 = this._ptr[j + 1]; + for (var k = k0; k < k1; k++) { + // row index + var i = this._index[k]; + yield { + value: this._values[k], + index: [i, j] + }; + } + } + }; + + /** + * Create an Array with a copy of the data of the SparseMatrix + * @memberof SparseMatrix + * @returns {Array} array + */ + SparseMatrix.prototype.toArray = function () { + return _toArray(this._values, this._index, this._ptr, this._size, true); + }; + + /** + * Get the primitive value of the SparseMatrix: a two dimensions array + * @memberof SparseMatrix + * @returns {Array} array + */ + SparseMatrix.prototype.valueOf = function () { + return _toArray(this._values, this._index, this._ptr, this._size, false); + }; + function _toArray(values, index, ptr, size, copy) { + // rows and columns + var rows = size[0]; + var columns = size[1]; + // result + var a = []; + // vars + var i, j; + // initialize array + for (i = 0; i < rows; i++) { + a[i] = []; + for (j = 0; j < columns; j++) { + a[i][j] = 0; + } + } + + // loop columns + for (j = 0; j < columns; j++) { + // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1] + var k0 = ptr[j]; + var k1 = ptr[j + 1]; + // loop k within [k0, k1[ + for (var k = k0; k < k1; k++) { + // row index + i = index[k]; + // set value (use one for pattern matrix) + a[i][j] = values ? copy ? clone$2(values[k]) : values[k] : 1; + } + } + return a; + } + + /** + * Get a string representation of the matrix, with optional formatting options. + * @memberof SparseMatrix + * @param {Object | number | Function} [options] Formatting options. See + * lib/utils/number:format for a + * description of the available + * options. + * @returns {string} str + */ + SparseMatrix.prototype.format = function (options) { + // rows and columns + var rows = this._size[0]; + var columns = this._size[1]; + // density + var density = this.density(); + // rows & columns + var str = 'Sparse Matrix [' + format(rows, options) + ' x ' + format(columns, options) + '] density: ' + format(density, options) + '\n'; + // loop columns + for (var j = 0; j < columns; j++) { + // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1] + var k0 = this._ptr[j]; + var k1 = this._ptr[j + 1]; + // loop k within [k0, k1[ + for (var k = k0; k < k1; k++) { + // row index + var i = this._index[k]; + // append value + str += '\n (' + format(i, options) + ', ' + format(j, options) + ') ==> ' + (this._values ? format(this._values[k], options) : 'X'); + } + } + return str; + }; + + /** + * Get a string representation of the matrix + * @memberof SparseMatrix + * @returns {string} str + */ + SparseMatrix.prototype.toString = function () { + return format(this.toArray()); + }; + + /** + * Get a JSON representation of the matrix + * @memberof SparseMatrix + * @returns {Object} + */ + SparseMatrix.prototype.toJSON = function () { + return { + mathjs: 'SparseMatrix', + values: this._values, + index: this._index, + ptr: this._ptr, + size: this._size, + datatype: this._datatype + }; + }; + + /** + * Get the kth Matrix diagonal. + * + * @memberof SparseMatrix + * @param {number | BigNumber} [k=0] The kth diagonal where the vector will retrieved. + * + * @returns {Matrix} The matrix vector with the diagonal values. + */ + SparseMatrix.prototype.diagonal = function (k) { + // validate k if any + if (k) { + // convert BigNumber to a number + if (isBigNumber(k)) { + k = k.toNumber(); + } + // is must be an integer + if (!isNumber(k) || !isInteger(k)) { + throw new TypeError('The parameter k must be an integer number'); + } + } else { + // default value + k = 0; + } + var kSuper = k > 0 ? k : 0; + var kSub = k < 0 ? -k : 0; + + // rows & columns + var rows = this._size[0]; + var columns = this._size[1]; + + // number diagonal values + var n = Math.min(rows - kSub, columns - kSuper); + + // diagonal arrays + var values = []; + var index = []; + var ptr = []; + // initial ptr value + ptr[0] = 0; + // loop columns + for (var j = kSuper; j < columns && values.length < n; j++) { + // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1] + var k0 = this._ptr[j]; + var k1 = this._ptr[j + 1]; + // loop x within [k0, k1[ + for (var x = k0; x < k1; x++) { + // row index + var i = this._index[x]; + // check row + if (i === j - kSuper + kSub) { + // value on this column + values.push(this._values[x]); + // store row + index[values.length - 1] = i - kSub; + // exit loop + break; + } + } + } + // close ptr + ptr.push(values.length); + // return matrix + return new SparseMatrix({ + values, + index, + ptr, + size: [n, 1] + }); + }; + + /** + * Generate a matrix from a JSON object + * @memberof SparseMatrix + * @param {Object} json An object structured like + * `{"mathjs": "SparseMatrix", "values": [], "index": [], "ptr": [], "size": []}`, + * where mathjs is optional + * @returns {SparseMatrix} + */ + SparseMatrix.fromJSON = function (json) { + return new SparseMatrix(json); + }; + + /** + * Create a diagonal matrix. + * + * @memberof SparseMatrix + * @param {Array} size The matrix size. + * @param {number | Array | Matrix } value The values for the diagonal. + * @param {number | BigNumber} [k=0] The kth diagonal where the vector will be filled in. + * @param {number} [defaultValue] The default value for non-diagonal + * @param {string} [datatype] The Matrix datatype, values must be of this datatype. + * + * @returns {SparseMatrix} + */ + SparseMatrix.diagonal = function (size, value, k, defaultValue, datatype) { + if (!isArray(size)) { + throw new TypeError('Array expected, size parameter'); + } + if (size.length !== 2) { + throw new Error('Only two dimensions matrix are supported'); + } + + // map size & validate + size = size.map(function (s) { + // check it is a big number + if (isBigNumber(s)) { + // convert it + s = s.toNumber(); + } + // validate arguments + if (!isNumber(s) || !isInteger(s) || s < 1) { + throw new Error('Size values must be positive integers'); + } + return s; + }); + + // validate k if any + if (k) { + // convert BigNumber to a number + if (isBigNumber(k)) { + k = k.toNumber(); + } + // is must be an integer + if (!isNumber(k) || !isInteger(k)) { + throw new TypeError('The parameter k must be an integer number'); + } + } else { + // default value + k = 0; + } + + // equal signature to use + var eq = equalScalar; + // zero value + var zero = 0; + if (isString(datatype)) { + // find signature that matches (datatype, datatype) + eq = typed.find(equalScalar, [datatype, datatype]) || equalScalar; + // convert 0 to the same datatype + zero = typed.convert(0, datatype); + } + var kSuper = k > 0 ? k : 0; + var kSub = k < 0 ? -k : 0; + + // rows and columns + var rows = size[0]; + var columns = size[1]; + + // number of non-zero items + var n = Math.min(rows - kSub, columns - kSuper); + + // value extraction function + var _value; + + // check value + if (isArray(value)) { + // validate array + if (value.length !== n) { + // number of values in array must be n + throw new Error('Invalid value array length'); + } + // define function + _value = function _value(i) { + // return value @ i + return value[i]; + }; + } else if (isMatrix(value)) { + // matrix size + var ms = value.size(); + // validate matrix + if (ms.length !== 1 || ms[0] !== n) { + // number of values in array must be n + throw new Error('Invalid matrix length'); + } + // define function + _value = function _value(i) { + // return value @ i + return value.get([i]); + }; + } else { + // define function + _value = function _value() { + // return value + return value; + }; + } + + // create arrays + var values = []; + var index = []; + var ptr = []; + + // loop items + for (var j = 0; j < columns; j++) { + // number of rows with value + ptr.push(values.length); + // diagonal index + var i = j - kSuper; + // check we need to set diagonal value + if (i >= 0 && i < n) { + // get value @ i + var v = _value(i); + // check for zero + if (!eq(v, zero)) { + // column + index.push(i + kSub); + // add value + values.push(v); + } + } + } + // last value should be number of values + ptr.push(values.length); + // create SparseMatrix + return new SparseMatrix({ + values, + index, + ptr, + size: [rows, columns] + }); + }; + + /** + * Swap rows i and j in Matrix. + * + * @memberof SparseMatrix + * @param {number} i Matrix row index 1 + * @param {number} j Matrix row index 2 + * + * @return {Matrix} The matrix reference + */ + SparseMatrix.prototype.swapRows = function (i, j) { + // check index + if (!isNumber(i) || !isInteger(i) || !isNumber(j) || !isInteger(j)) { + throw new Error('Row index must be positive integers'); + } + // check dimensions + if (this._size.length !== 2) { + throw new Error('Only two dimensional matrix is supported'); + } + // validate index + validateIndex(i, this._size[0]); + validateIndex(j, this._size[0]); + + // swap rows + SparseMatrix._swapRows(i, j, this._size[1], this._values, this._index, this._ptr); + // return current instance + return this; + }; + + /** + * Loop rows with data in column j. + * + * @param {number} j Column + * @param {Array} values Matrix values + * @param {Array} index Matrix row indeces + * @param {Array} ptr Matrix column pointers + * @param {Function} callback Callback function invoked for every row in column j + */ + SparseMatrix._forEachRow = function (j, values, index, ptr, callback) { + // indeces for column j + var k0 = ptr[j]; + var k1 = ptr[j + 1]; + + // loop + for (var k = k0; k < k1; k++) { + // invoke callback + callback(index[k], values[k]); + } + }; + + /** + * Swap rows x and y in Sparse Matrix data structures. + * + * @param {number} x Matrix row index 1 + * @param {number} y Matrix row index 2 + * @param {number} columns Number of columns in matrix + * @param {Array} values Matrix values + * @param {Array} index Matrix row indeces + * @param {Array} ptr Matrix column pointers + */ + SparseMatrix._swapRows = function (x, y, columns, values, index, ptr) { + // loop columns + for (var j = 0; j < columns; j++) { + // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1] + var k0 = ptr[j]; + var k1 = ptr[j + 1]; + // find value index @ x + var kx = _getValueIndex(x, k0, k1, index); + // find value index @ x + var ky = _getValueIndex(y, k0, k1, index); + // check both rows exist in matrix + if (kx < k1 && ky < k1 && index[kx] === x && index[ky] === y) { + // swap values (check for pattern matrix) + if (values) { + var v = values[kx]; + values[kx] = values[ky]; + values[ky] = v; + } + // next column + continue; + } + // check x row exist & no y row + if (kx < k1 && index[kx] === x && (ky >= k1 || index[ky] !== y)) { + // value @ x (check for pattern matrix) + var vx = values ? values[kx] : undefined; + // insert value @ y + index.splice(ky, 0, y); + if (values) { + values.splice(ky, 0, vx); + } + // remove value @ x (adjust array index if needed) + index.splice(ky <= kx ? kx + 1 : kx, 1); + if (values) { + values.splice(ky <= kx ? kx + 1 : kx, 1); + } + // next column + continue; + } + // check y row exist & no x row + if (ky < k1 && index[ky] === y && (kx >= k1 || index[kx] !== x)) { + // value @ y (check for pattern matrix) + var vy = values ? values[ky] : undefined; + // insert value @ x + index.splice(kx, 0, x); + if (values) { + values.splice(kx, 0, vy); + } + // remove value @ y (adjust array index if needed) + index.splice(kx <= ky ? ky + 1 : ky, 1); + if (values) { + values.splice(kx <= ky ? ky + 1 : ky, 1); + } + } + } + }; + return SparseMatrix; + }, { + isClass: true + }); + + var name$n = 'number'; + var dependencies$n = ['typed']; + + /** + * Separates the radix, integer part, and fractional part of a non decimal number string + * @param {string} input string to parse + * @returns {object} the parts of the string or null if not a valid input + */ + function getNonDecimalNumberParts(input) { + var nonDecimalWithRadixMatch = input.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/); + if (nonDecimalWithRadixMatch) { + var radix = { + '0b': 2, + '0o': 8, + '0x': 16 + }[nonDecimalWithRadixMatch[1]]; + var integerPart = nonDecimalWithRadixMatch[2]; + var fractionalPart = nonDecimalWithRadixMatch[3]; + return { + input, + radix, + integerPart, + fractionalPart + }; + } else { + return null; + } + } + + /** + * Makes a number from a radix, and integer part, and a fractional part + * @param {parts} [x] parts of the number string (from getNonDecimalNumberParts) + * @returns {number} the number + */ + function makeNumberFromNonDecimalParts(parts) { + var n = parseInt(parts.integerPart, parts.radix); + var f = 0; + for (var i = 0; i < parts.fractionalPart.length; i++) { + var digitValue = parseInt(parts.fractionalPart[i], parts.radix); + f += digitValue / Math.pow(parts.radix, i + 1); + } + var result = n + f; + if (isNaN(result)) { + throw new SyntaxError('String "' + parts.input + '" is not a valid number'); + } + return result; + } + var createNumber = /* #__PURE__ */factory(name$n, dependencies$n, _ref => { + var { + typed + } = _ref; + /** + * Create a number or convert a string, boolean, or unit to a number. + * When value is a matrix, all elements will be converted to number. + * + * Syntax: + * + * math.number(value) + * math.number(unit, valuelessUnit) + * + * Examples: + * + * math.number(2) // returns number 2 + * math.number('7.2') // returns number 7.2 + * math.number(true) // returns number 1 + * math.number([true, false, true, true]) // returns [1, 0, 1, 1] + * math.number(math.unit('52cm'), 'm') // returns 0.52 + * + * See also: + * + * bignumber, bigint, boolean, numeric, complex, index, matrix, string, unit + * + * @param {string | number | BigNumber | Fraction | boolean | Array | Matrix | Unit | null} [value] Value to be converted + * @param {Unit | string} [valuelessUnit] A valueless unit, used to convert a unit to a number + * @return {number | Array | Matrix} The created number + */ + var number = typed('number', { + '': function _() { + return 0; + }, + number: function number(x) { + return x; + }, + string: function string(x) { + if (x === 'NaN') return NaN; + var nonDecimalNumberParts = getNonDecimalNumberParts(x); + if (nonDecimalNumberParts) { + return makeNumberFromNonDecimalParts(nonDecimalNumberParts); + } + var size = 0; + var wordSizeSuffixMatch = x.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/); + if (wordSizeSuffixMatch) { + // x includes a size suffix like 0xffffi32, so we extract + // the suffix and remove it from x + size = Number(wordSizeSuffixMatch[2]); + x = wordSizeSuffixMatch[1]; + } + var num = Number(x); + if (isNaN(num)) { + throw new SyntaxError('String "' + x + '" is not a valid number'); + } + if (wordSizeSuffixMatch) { + // x is a signed bin, oct, or hex literal + // num is the value of string x if x is interpreted as unsigned + if (num > 2 ** size - 1) { + // literal is too large for size suffix + throw new SyntaxError("String \"".concat(x, "\" is out of range")); + } + // check if the bit at index size - 1 is set and if so do the twos complement + if (num >= 2 ** (size - 1)) { + num = num - 2 ** size; + } + } + return num; + }, + BigNumber: function BigNumber(x) { + return x.toNumber(); + }, + bigint: function bigint(x) { + return Number(x); + }, + Fraction: function Fraction(x) { + return x.valueOf(); + }, + Unit: typed.referToSelf(self => x => { + var clone = x.clone(); + clone.value = self(x.value); + return clone; + }), + null: function _null(x) { + return 0; + }, + 'Unit, string | Unit': function Unit_string__Unit(unit, valuelessUnit) { + return unit.toNumber(valuelessUnit); + }, + 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self)) + }); + + // reviver function to parse a JSON object like: + // + // {"mathjs":"number","value":"2.3"} + // + // into a number 2.3 + number.fromJSON = function (json) { + return parseFloat(json.value); + }; + return number; + }); + + var name$m = 'bignumber'; + var dependencies$m = ['typed', 'BigNumber']; + var createBignumber = /* #__PURE__ */factory(name$m, dependencies$m, _ref => { + var { + typed, + BigNumber + } = _ref; + /** + * Create a BigNumber, which can store numbers with arbitrary precision. + * When a matrix is provided, all elements will be converted to BigNumber. + * + * Syntax: + * + * math.bignumber(x) + * + * Examples: + * + * 0.1 + 0.2 // returns number 0.30000000000000004 + * math.bignumber(0.1) + math.bignumber(0.2) // returns BigNumber 0.3 + * + * + * 7.2e500 // returns number Infinity + * math.bignumber('7.2e500') // returns BigNumber 7.2e500 + * + * See also: + * + * number, bigint, boolean, complex, index, matrix, string, unit + * + * @param {number | string | Fraction | BigNumber | bigint | Array | Matrix | boolean | null} [value] Value for the big number, + * 0 by default. + * @returns {BigNumber} The created bignumber + */ + return typed('bignumber', { + '': function _() { + return new BigNumber(0); + }, + number: function number(x) { + // convert to string to prevent errors in case of >15 digits + return new BigNumber(x + ''); + }, + string: function string(x) { + var wordSizeSuffixMatch = x.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/); + if (wordSizeSuffixMatch) { + // x has a word size suffix + var size = wordSizeSuffixMatch[2]; + var n = BigNumber(wordSizeSuffixMatch[1]); + var twoPowSize = new BigNumber(2).pow(Number(size)); + if (n.gt(twoPowSize.sub(1))) { + throw new SyntaxError("String \"".concat(x, "\" is out of range")); + } + var twoPowSizeSubOne = new BigNumber(2).pow(Number(size) - 1); + if (n.gte(twoPowSizeSubOne)) { + return n.sub(twoPowSize); + } else { + return n; + } + } + return new BigNumber(x); + }, + BigNumber: function BigNumber(x) { + // we assume a BigNumber is immutable + return x; + }, + bigint: function bigint(x) { + return new BigNumber(x.toString()); + }, + Unit: typed.referToSelf(self => x => { + var clone = x.clone(); + clone.value = self(x.value); + return clone; + }), + Fraction: function Fraction(x) { + return new BigNumber(String(x.n)).div(String(x.d)).times(String(x.s)); + }, + null: function _null(_x) { + return new BigNumber(0); + }, + 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self)) + }); + }); + + var name$l = 'fraction'; + var dependencies$l = ['typed', 'Fraction']; + var createFraction = /* #__PURE__ */factory(name$l, dependencies$l, _ref => { + var { + typed, + Fraction + } = _ref; + /** + * Create a fraction or convert a value to a fraction. + * + * With one numeric argument, produces the closest rational approximation to the + * input. + * With two arguments, the first is the numerator and the second is the denominator, + * and creates the corresponding fraction. Both numerator and denominator must be + * integers. + * With one object argument, looks for the integer numerator as the value of property + * 'n' and the integer denominator as the value of property 'd'. + * With a matrix argument, creates a matrix of the same shape with entries + * converted into fractions. + * + * Syntax: + * math.fraction(value) + * math.fraction(numerator, denominator) + * math.fraction({n: numerator, d: denominator}) + * math.fraction(matrix: Array | Matrix) + * + * Examples: + * + * math.fraction(6.283) // returns Fraction 6283/1000 + * math.fraction(1, 3) // returns Fraction 1/3 + * math.fraction('2/3') // returns Fraction 2/3 + * math.fraction({n: 2, d: 3}) // returns Fraction 2/3 + * math.fraction([0.2, 0.25, 1.25]) // returns Array [1/5, 1/4, 5/4] + * math.fraction(4, 5.1) // throws Error: Parameters must be integer + * + * See also: + * + * bignumber, number, string, unit + * + * @param {number | string | Fraction | BigNumber | bigint | Unit | Array | Matrix} [args] + * Arguments specifying the value, or numerator and denominator of + * the fraction + * @return {Fraction | Array | Matrix} Returns a fraction + */ + return typed('fraction', { + number: function number(x) { + if (!isFinite(x) || isNaN(x)) { + throw new Error(x + ' cannot be represented as a fraction'); + } + return new Fraction(x); + }, + string: function string(x) { + return new Fraction(x); + }, + 'number, number': function number_number(numerator, denominator) { + return new Fraction(numerator, denominator); + }, + 'bigint, bigint': function bigint_bigint(numerator, denominator) { + return new Fraction(numerator, denominator); + }, + null: function _null(x) { + return new Fraction(0); + }, + BigNumber: function BigNumber(x) { + return new Fraction(x.toString()); + }, + bigint: function bigint(x) { + return new Fraction(x.toString()); + }, + Fraction: function Fraction(x) { + return x; // fractions are immutable + }, + Unit: typed.referToSelf(self => x => { + var clone = x.clone(); + clone.value = self(x.value); + return clone; + }), + Object: function Object(x) { + return new Fraction(x); + }, + 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self)) + }); + }); + + var name$k = 'matrix'; + var dependencies$k = ['typed', 'Matrix', 'DenseMatrix', 'SparseMatrix']; + var createMatrix = /* #__PURE__ */factory(name$k, dependencies$k, _ref => { + var { + typed, + Matrix, + DenseMatrix, + SparseMatrix + } = _ref; + /** + * Create a Matrix. The function creates a new `math.Matrix` object from + * an `Array`. A Matrix has utility functions to manipulate the data in the + * matrix, like getting the size and getting or setting values in the matrix. + * Supported storage formats are 'dense' and 'sparse'. + * + * Syntax: + * + * math.matrix() // creates an empty matrix using default storage format (dense). + * math.matrix(data) // creates a matrix with initial data using default storage format (dense). + * math.matrix('dense') // creates an empty matrix using the given storage format. + * math.matrix(data, 'dense') // creates a matrix with initial data using the given storage format. + * math.matrix(data, 'sparse') // creates a sparse matrix with initial data. + * math.matrix(data, 'sparse', 'number') // creates a sparse matrix with initial data, number data type. + * + * Examples: + * + * let m = math.matrix([[1, 2], [3, 4]]) + * m.size() // Array [2, 2] + * m.resize([3, 2], 5) + * m.valueOf() // Array [[1, 2], [3, 4], [5, 5]] + * m.get([1, 0]) // number 3 + * + * See also: + * + * bignumber, boolean, complex, index, number, string, unit, sparse + * + * @param {Array | Matrix} [data] A multi dimensional array + * @param {string} [format] The Matrix storage format, either `'dense'` or `'sparse'` + * @param {string} [datatype] Type of the values + * + * @return {Matrix} The created matrix + */ + return typed(name$k, { + '': function _() { + return _create([]); + }, + string: function string(format) { + return _create([], format); + }, + 'string, string': function string_string(format, datatype) { + return _create([], format, datatype); + }, + Array: function Array(data) { + return _create(data); + }, + Matrix: function Matrix(data) { + return _create(data, data.storage()); + }, + 'Array | Matrix, string': _create, + 'Array | Matrix, string, string': _create + }); + + /** + * Create a new Matrix with given storage format + * @param {Array} data + * @param {string} [format] + * @param {string} [datatype] + * @returns {Matrix} Returns a new Matrix + * @private + */ + function _create(data, format, datatype) { + // get storage format constructor + if (format === 'dense' || format === 'default' || format === undefined) { + return new DenseMatrix(data, datatype); + } + if (format === 'sparse') { + return new SparseMatrix(data, datatype); + } + throw new TypeError('Unknown matrix type ' + JSON.stringify(format) + '.'); + } + }); + + var name$j = 'unaryMinus'; + var dependencies$j = ['typed']; + var createUnaryMinus = /* #__PURE__ */factory(name$j, dependencies$j, _ref => { + var { + typed + } = _ref; + /** + * Inverse the sign of a value, apply a unary minus operation. + * + * For matrices, the function is evaluated element wise. Boolean values and + * strings will be converted to a number. For complex numbers, both real and + * complex value are inverted. + * + * Syntax: + * + * math.unaryMinus(x) + * + * Examples: + * + * math.unaryMinus(3.5) // returns -3.5 + * math.unaryMinus(-4.2) // returns 4.2 + * + * See also: + * + * add, subtract, unaryPlus + * + * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x Number to be inverted. + * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Returns the value with inverted sign. + */ + return typed(name$j, { + number: unaryMinusNumber, + 'Complex | BigNumber | Fraction': x => x.neg(), + bigint: x => -x, + Unit: typed.referToSelf(self => x => { + var res = x.clone(); + res.value = typed.find(self, res.valueType())(x.value); + return res; + }), + // deep map collection, skip zeros since unaryMinus(0) = 0 + 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self, true)) + + // TODO: add support for string + }); + }); + + var name$i = 'abs'; + var dependencies$i = ['typed']; + var createAbs = /* #__PURE__ */factory(name$i, dependencies$i, _ref => { + var { + typed + } = _ref; + /** + * Calculate the absolute value of a number. For matrices, the function is + * evaluated element wise. + * + * Syntax: + * + * math.abs(x) + * + * Examples: + * + * math.abs(3.5) // returns number 3.5 + * math.abs(-4.2) // returns number 4.2 + * + * math.abs([3, -5, -1, 0, 2]) // returns Array [3, 5, 1, 0, 2] + * + * See also: + * + * sign + * + * @param {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit} x + * A number or matrix for which to get the absolute value + * @return {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit} + * Absolute value of `x` + */ + return typed(name$i, { + number: absNumber, + 'Complex | BigNumber | Fraction | Unit': x => x.abs(), + bigint: x => x < 0n ? -x : x, + // deep map collection, skip zeros since abs(0) = 0 + 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self, true)) + }); + }); + + var name$h = 'addScalar'; + var dependencies$h = ['typed']; + var createAddScalar = /* #__PURE__ */factory(name$h, dependencies$h, _ref => { + var { + typed + } = _ref; + /** + * Add two scalar values, `x + y`. + * This function is meant for internal use: it is used by the public function + * `add` + * + * This function does not support collections (Array or Matrix). + * + * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value to add + * @param {number | BigNumber | bigint | Fraction | Complex} y Second value to add + * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Sum of `x` and `y` + * @private + */ + return typed(name$h, { + 'number, number': addNumber, + 'Complex, Complex': function Complex_Complex(x, y) { + return x.add(y); + }, + 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) { + return x.plus(y); + }, + 'bigint, bigint': function bigint_bigint(x, y) { + return x + y; + }, + 'Fraction, Fraction': function Fraction_Fraction(x, y) { + return x.add(y); + }, + 'Unit, Unit': typed.referToSelf(self => (x, y) => { + if (x.value === null || x.value === undefined) { + throw new Error('Parameter x contains a unit with undefined value'); + } + if (y.value === null || y.value === undefined) { + throw new Error('Parameter y contains a unit with undefined value'); + } + if (!x.equalBase(y)) throw new Error('Units do not match'); + var res = x.clone(); + res.value = typed.find(self, [res.valueType(), y.valueType()])(res.value, y.value); + res.fixPrefix = false; + return res; + }) + }); + }); + + var name$g = 'subtractScalar'; + var dependencies$g = ['typed']; + var createSubtractScalar = /* #__PURE__ */factory(name$g, dependencies$g, _ref => { + var { + typed + } = _ref; + /** + * Subtract two scalar values, `x - y`. + * This function is meant for internal use: it is used by the public function + * `subtract` + * + * This function does not support collections (Array or Matrix). + * + * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value + * @param {number | BigNumber | bigint | Fraction | Complex} y Second value to be subtracted from `x` + * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Difference of `x` and `y` + * @private + */ + return typed(name$g, { + 'number, number': subtractNumber, + 'Complex, Complex': function Complex_Complex(x, y) { + return x.sub(y); + }, + 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) { + return x.minus(y); + }, + 'bigint, bigint': function bigint_bigint(x, y) { + return x - y; + }, + 'Fraction, Fraction': function Fraction_Fraction(x, y) { + return x.sub(y); + }, + 'Unit, Unit': typed.referToSelf(self => (x, y) => { + if (x.value === null || x.value === undefined) { + throw new Error('Parameter x contains a unit with undefined value'); + } + if (y.value === null || y.value === undefined) { + throw new Error('Parameter y contains a unit with undefined value'); + } + if (!x.equalBase(y)) throw new Error('Units do not match'); + var res = x.clone(); + res.value = typed.find(self, [res.valueType(), y.valueType()])(res.value, y.value); + res.fixPrefix = false; + return res; + }) + }); + }); + + var name$f = 'matAlgo11xS0s'; + var dependencies$f = ['typed', 'equalScalar']; + var createMatAlgo11xS0s = /* #__PURE__ */factory(name$f, dependencies$f, _ref => { + var { + typed, + equalScalar + } = _ref; + /** + * Iterates over SparseMatrix S nonzero items and invokes the callback function f(Sij, b). + * Callback function invoked NZ times (number of nonzero items in S). + * + * + * ┌ f(Sij, b) ; S(i,j) !== 0 + * C(i,j) = ┤ + * └ 0 ; otherwise + * + * + * @param {Matrix} s The SparseMatrix instance (S) + * @param {Scalar} b The Scalar value + * @param {Function} callback The f(Aij,b) operation to invoke + * @param {boolean} inverse A true value indicates callback should be invoked f(b,Sij) + * + * @return {Matrix} SparseMatrix (C) + * + * https://github.com/josdejong/mathjs/pull/346#issuecomment-97626813 + */ + return function matAlgo11xS0s(s, b, callback, inverse) { + // sparse matrix arrays + var avalues = s._values; + var aindex = s._index; + var aptr = s._ptr; + var asize = s._size; + var adt = s._datatype; + + // sparse matrix cannot be a Pattern matrix + if (!avalues) { + throw new Error('Cannot perform operation on Pattern Sparse Matrix and Scalar value'); + } + + // rows & columns + var rows = asize[0]; + var columns = asize[1]; + + // datatype + var dt; + // equal signature to use + var eq = equalScalar; + // zero value + var zero = 0; + // callback signature to use + var cf = callback; + + // process data types + if (typeof adt === 'string') { + // datatype + dt = adt; + // find signature that matches (dt, dt) + eq = typed.find(equalScalar, [dt, dt]); + // convert 0 to the same datatype + zero = typed.convert(0, dt); + // convert b to the same datatype + b = typed.convert(b, dt); + // callback + cf = typed.find(callback, [dt, dt]); + } + + // result arrays + var cvalues = []; + var cindex = []; + var cptr = []; + + // loop columns + for (var j = 0; j < columns; j++) { + // initialize ptr + cptr[j] = cindex.length; + // values in j + for (var k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) { + // row + var i = aindex[k]; + // invoke callback + var v = inverse ? cf(b, avalues[k]) : cf(avalues[k], b); + // check value is zero + if (!eq(v, zero)) { + // push index & value + cindex.push(i); + cvalues.push(v); + } + } + } + // update ptr + cptr[columns] = cindex.length; + + // return sparse matrix + return s.createSparseMatrix({ + values: cvalues, + index: cindex, + ptr: cptr, + size: [rows, columns], + datatype: dt + }); + }; + }); + + var name$e = 'matAlgo14xDs'; + var dependencies$e = ['typed']; + var createMatAlgo14xDs = /* #__PURE__ */factory(name$e, dependencies$e, _ref => { + var { + typed + } = _ref; + /** + * Iterates over DenseMatrix items and invokes the callback function f(Aij..z, b). + * Callback function invoked MxN times. + * + * C(i,j,...z) = f(Aij..z, b) + * + * @param {Matrix} a The DenseMatrix instance (A) + * @param {Scalar} b The Scalar value + * @param {Function} callback The f(Aij..z,b) operation to invoke + * @param {boolean} inverse A true value indicates callback should be invoked f(b,Aij..z) + * + * @return {Matrix} DenseMatrix (C) + * + * https://github.com/josdejong/mathjs/pull/346#issuecomment-97659042 + */ + return function matAlgo14xDs(a, b, callback, inverse) { + // a arrays + var adata = a._data; + var asize = a._size; + var adt = a._datatype; + + // datatype + var dt; + // callback signature to use + var cf = callback; + + // process data types + if (typeof adt === 'string') { + // datatype + dt = adt; + // convert b to the same datatype + b = typed.convert(b, dt); + // callback + cf = typed.find(callback, [dt, dt]); + } + + // populate cdata, iterate through dimensions + var cdata = asize.length > 0 ? _iterate(cf, 0, asize, asize[0], adata, b, inverse) : []; + + // c matrix + return a.createDenseMatrix({ + data: cdata, + size: clone$2(asize), + datatype: dt + }); + }; + + // recursive function + function _iterate(f, level, s, n, av, bv, inverse) { + // initialize array for this level + var cv = []; + // check we reach the last level + if (level === s.length - 1) { + // loop arrays in last level + for (var i = 0; i < n; i++) { + // invoke callback and store value + cv[i] = inverse ? f(bv, av[i]) : f(av[i], bv); + } + } else { + // iterate current level + for (var j = 0; j < n; j++) { + // iterate next level + cv[j] = _iterate(f, level + 1, s, s[level + 1], av[j], bv, inverse); + } + } + return cv; + } + }); + + var name$d = 'multiplyScalar'; + var dependencies$d = ['typed']; + var createMultiplyScalar = /* #__PURE__ */factory(name$d, dependencies$d, _ref => { + var { + typed + } = _ref; + /** + * Multiply two scalar values, `x * y`. + * This function is meant for internal use: it is used by the public function + * `multiply` + * + * This function does not support collections (Array or Matrix). + * + * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value to multiply + * @param {number | BigNumber | bigint | Fraction | Complex} y Second value to multiply + * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Multiplication of `x` and `y` + * @private + */ + return typed('multiplyScalar', { + 'number, number': multiplyNumber, + 'Complex, Complex': function Complex_Complex(x, y) { + return x.mul(y); + }, + 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) { + return x.times(y); + }, + 'bigint, bigint': function bigint_bigint(x, y) { + return x * y; + }, + 'Fraction, Fraction': function Fraction_Fraction(x, y) { + return x.mul(y); + }, + 'number | Fraction | BigNumber | Complex, Unit': (x, y) => y.multiply(x), + 'Unit, number | Fraction | BigNumber | Complex | Unit': (x, y) => x.multiply(y) + }); + }); + + var name$c = 'multiply'; + var dependencies$c = ['typed', 'matrix', 'addScalar', 'multiplyScalar', 'equalScalar', 'dot']; + var createMultiply = /* #__PURE__ */factory(name$c, dependencies$c, _ref => { + var { + typed, + matrix, + addScalar, + multiplyScalar, + equalScalar, + dot + } = _ref; + var matAlgo11xS0s = createMatAlgo11xS0s({ + typed, + equalScalar + }); + var matAlgo14xDs = createMatAlgo14xDs({ + typed + }); + function _validateMatrixDimensions(size1, size2) { + // check left operand dimensions + switch (size1.length) { + case 1: + // check size2 + switch (size2.length) { + case 1: + // Vector x Vector + if (size1[0] !== size2[0]) { + // throw error + throw new RangeError('Dimension mismatch in multiplication. Vectors must have the same length'); + } + break; + case 2: + // Vector x Matrix + if (size1[0] !== size2[0]) { + // throw error + throw new RangeError('Dimension mismatch in multiplication. Vector length (' + size1[0] + ') must match Matrix rows (' + size2[0] + ')'); + } + break; + default: + throw new Error('Can only multiply a 1 or 2 dimensional matrix (Matrix B has ' + size2.length + ' dimensions)'); + } + break; + case 2: + // check size2 + switch (size2.length) { + case 1: + // Matrix x Vector + if (size1[1] !== size2[0]) { + // throw error + throw new RangeError('Dimension mismatch in multiplication. Matrix columns (' + size1[1] + ') must match Vector length (' + size2[0] + ')'); + } + break; + case 2: + // Matrix x Matrix + if (size1[1] !== size2[0]) { + // throw error + throw new RangeError('Dimension mismatch in multiplication. Matrix A columns (' + size1[1] + ') must match Matrix B rows (' + size2[0] + ')'); + } + break; + default: + throw new Error('Can only multiply a 1 or 2 dimensional matrix (Matrix B has ' + size2.length + ' dimensions)'); + } + break; + default: + throw new Error('Can only multiply a 1 or 2 dimensional matrix (Matrix A has ' + size1.length + ' dimensions)'); + } + } + + /** + * C = A * B + * + * @param {Matrix} a Dense Vector (N) + * @param {Matrix} b Dense Vector (N) + * + * @return {number} Scalar value + */ + function _multiplyVectorVector(a, b, n) { + // check empty vector + if (n === 0) { + throw new Error('Cannot multiply two empty vectors'); + } + return dot(a, b); + } + + /** + * C = A * B + * + * @param {Matrix} a Dense Vector (M) + * @param {Matrix} b Matrix (MxN) + * + * @return {Matrix} Dense Vector (N) + */ + function _multiplyVectorMatrix(a, b) { + // process storage + if (b.storage() !== 'dense') { + throw new Error('Support for SparseMatrix not implemented'); + } + return _multiplyVectorDenseMatrix(a, b); + } + + /** + * C = A * B + * + * @param {Matrix} a Dense Vector (M) + * @param {Matrix} b Dense Matrix (MxN) + * + * @return {Matrix} Dense Vector (N) + */ + function _multiplyVectorDenseMatrix(a, b) { + // a dense + var adata = a._data; + var asize = a._size; + var adt = a._datatype || a.getDataType(); + // b dense + var bdata = b._data; + var bsize = b._size; + var bdt = b._datatype || b.getDataType(); + // rows & columns + var alength = asize[0]; + var bcolumns = bsize[1]; + + // datatype + var dt; + // addScalar signature to use + var af = addScalar; + // multiplyScalar signature to use + var mf = multiplyScalar; + + // process data types + if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') { + // datatype + dt = adt; + // find signatures that matches (dt, dt) + af = typed.find(addScalar, [dt, dt]); + mf = typed.find(multiplyScalar, [dt, dt]); + } + + // result + var c = []; + + // loop matrix columns + for (var j = 0; j < bcolumns; j++) { + // sum (do not initialize it with zero) + var sum = mf(adata[0], bdata[0][j]); + // loop vector + for (var i = 1; i < alength; i++) { + // multiply & accumulate + sum = af(sum, mf(adata[i], bdata[i][j])); + } + c[j] = sum; + } + + // return matrix + return a.createDenseMatrix({ + data: c, + size: [bcolumns], + datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined + }); + } + + /** + * C = A * B + * + * @param {Matrix} a Matrix (MxN) + * @param {Matrix} b Dense Vector (N) + * + * @return {Matrix} Dense Vector (M) + */ + var _multiplyMatrixVector = typed('_multiplyMatrixVector', { + 'DenseMatrix, any': _multiplyDenseMatrixVector, + 'SparseMatrix, any': _multiplySparseMatrixVector + }); + + /** + * C = A * B + * + * @param {Matrix} a Matrix (MxN) + * @param {Matrix} b Matrix (NxC) + * + * @return {Matrix} Matrix (MxC) + */ + var _multiplyMatrixMatrix = typed('_multiplyMatrixMatrix', { + 'DenseMatrix, DenseMatrix': _multiplyDenseMatrixDenseMatrix, + 'DenseMatrix, SparseMatrix': _multiplyDenseMatrixSparseMatrix, + 'SparseMatrix, DenseMatrix': _multiplySparseMatrixDenseMatrix, + 'SparseMatrix, SparseMatrix': _multiplySparseMatrixSparseMatrix + }); + + /** + * C = A * B + * + * @param {Matrix} a DenseMatrix (MxN) + * @param {Matrix} b Dense Vector (N) + * + * @return {Matrix} Dense Vector (M) + */ + function _multiplyDenseMatrixVector(a, b) { + // a dense + var adata = a._data; + var asize = a._size; + var adt = a._datatype || a.getDataType(); + // b dense + var bdata = b._data; + var bdt = b._datatype || b.getDataType(); + // rows & columns + var arows = asize[0]; + var acolumns = asize[1]; + + // datatype + var dt; + // addScalar signature to use + var af = addScalar; + // multiplyScalar signature to use + var mf = multiplyScalar; + + // process data types + if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') { + // datatype + dt = adt; + // find signatures that matches (dt, dt) + af = typed.find(addScalar, [dt, dt]); + mf = typed.find(multiplyScalar, [dt, dt]); + } + + // result + var c = []; + + // loop matrix a rows + for (var i = 0; i < arows; i++) { + // current row + var row = adata[i]; + // sum (do not initialize it with zero) + var sum = mf(row[0], bdata[0]); + // loop matrix a columns + for (var j = 1; j < acolumns; j++) { + // multiply & accumulate + sum = af(sum, mf(row[j], bdata[j])); + } + c[i] = sum; + } + + // return matrix + return a.createDenseMatrix({ + data: c, + size: [arows], + datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined + }); + } + + /** + * C = A * B + * + * @param {Matrix} a DenseMatrix (MxN) + * @param {Matrix} b DenseMatrix (NxC) + * + * @return {Matrix} DenseMatrix (MxC) + */ + function _multiplyDenseMatrixDenseMatrix(a, b) { + // getDataType() + // a dense + var adata = a._data; + var asize = a._size; + var adt = a._datatype || a.getDataType(); + // b dense + var bdata = b._data; + var bsize = b._size; + var bdt = b._datatype || b.getDataType(); + // rows & columns + var arows = asize[0]; + var acolumns = asize[1]; + var bcolumns = bsize[1]; + + // datatype + var dt; + // addScalar signature to use + var af = addScalar; + // multiplyScalar signature to use + var mf = multiplyScalar; + + // process data types + if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed' && adt !== 'mixed') { + // datatype + dt = adt; + // find signatures that matches (dt, dt) + af = typed.find(addScalar, [dt, dt]); + mf = typed.find(multiplyScalar, [dt, dt]); + } + + // result + var c = []; + + // loop matrix a rows + for (var i = 0; i < arows; i++) { + // current row + var row = adata[i]; + // initialize row array + c[i] = []; + // loop matrix b columns + for (var j = 0; j < bcolumns; j++) { + // sum (avoid initializing sum to zero) + var sum = mf(row[0], bdata[0][j]); + // loop matrix a columns + for (var x = 1; x < acolumns; x++) { + // multiply & accumulate + sum = af(sum, mf(row[x], bdata[x][j])); + } + c[i][j] = sum; + } + } + + // return matrix + return a.createDenseMatrix({ + data: c, + size: [arows, bcolumns], + datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined + }); + } + + /** + * C = A * B + * + * @param {Matrix} a DenseMatrix (MxN) + * @param {Matrix} b SparseMatrix (NxC) + * + * @return {Matrix} SparseMatrix (MxC) + */ + function _multiplyDenseMatrixSparseMatrix(a, b) { + // a dense + var adata = a._data; + var asize = a._size; + var adt = a._datatype || a.getDataType(); + // b sparse + var bvalues = b._values; + var bindex = b._index; + var bptr = b._ptr; + var bsize = b._size; + var bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType(); + // validate b matrix + if (!bvalues) { + throw new Error('Cannot multiply Dense Matrix times Pattern only Matrix'); + } + // rows & columns + var arows = asize[0]; + var bcolumns = bsize[1]; + + // datatype + var dt; + // addScalar signature to use + var af = addScalar; + // multiplyScalar signature to use + var mf = multiplyScalar; + // equalScalar signature to use + var eq = equalScalar; + // zero value + var zero = 0; + + // process data types + if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') { + // datatype + dt = adt; + // find signatures that matches (dt, dt) + af = typed.find(addScalar, [dt, dt]); + mf = typed.find(multiplyScalar, [dt, dt]); + eq = typed.find(equalScalar, [dt, dt]); + // convert 0 to the same datatype + zero = typed.convert(0, dt); + } + + // result + var cvalues = []; + var cindex = []; + var cptr = []; + // c matrix + var c = b.createSparseMatrix({ + values: cvalues, + index: cindex, + ptr: cptr, + size: [arows, bcolumns], + datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined + }); + + // loop b columns + for (var jb = 0; jb < bcolumns; jb++) { + // update ptr + cptr[jb] = cindex.length; + // indeces in column jb + var kb0 = bptr[jb]; + var kb1 = bptr[jb + 1]; + // do not process column jb if no data exists + if (kb1 > kb0) { + // last row mark processed + var last = 0; + // loop a rows + for (var i = 0; i < arows; i++) { + // column mark + var mark = i + 1; + // C[i, jb] + var cij = void 0; + // values in b column j + for (var kb = kb0; kb < kb1; kb++) { + // row + var ib = bindex[kb]; + // check value has been initialized + if (last !== mark) { + // first value in column jb + cij = mf(adata[i][ib], bvalues[kb]); + // update mark + last = mark; + } else { + // accumulate value + cij = af(cij, mf(adata[i][ib], bvalues[kb])); + } + } + // check column has been processed and value != 0 + if (last === mark && !eq(cij, zero)) { + // push row & value + cindex.push(i); + cvalues.push(cij); + } + } + } + } + // update ptr + cptr[bcolumns] = cindex.length; + + // return sparse matrix + return c; + } + + /** + * C = A * B + * + * @param {Matrix} a SparseMatrix (MxN) + * @param {Matrix} b Dense Vector (N) + * + * @return {Matrix} SparseMatrix (M, 1) + */ + function _multiplySparseMatrixVector(a, b) { + // a sparse + var avalues = a._values; + var aindex = a._index; + var aptr = a._ptr; + var adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType(); + // validate a matrix + if (!avalues) { + throw new Error('Cannot multiply Pattern only Matrix times Dense Matrix'); + } + // b dense + var bdata = b._data; + var bdt = b._datatype || b.getDataType(); + // rows & columns + var arows = a._size[0]; + var brows = b._size[0]; + // result + var cvalues = []; + var cindex = []; + var cptr = []; + + // datatype + var dt; + // addScalar signature to use + var af = addScalar; + // multiplyScalar signature to use + var mf = multiplyScalar; + // equalScalar signature to use + var eq = equalScalar; + // zero value + var zero = 0; + + // process data types + if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') { + // datatype + dt = adt; + // find signatures that matches (dt, dt) + af = typed.find(addScalar, [dt, dt]); + mf = typed.find(multiplyScalar, [dt, dt]); + eq = typed.find(equalScalar, [dt, dt]); + // convert 0 to the same datatype + zero = typed.convert(0, dt); + } + + // workspace + var x = []; + // vector with marks indicating a value x[i] exists in a given column + var w = []; + + // update ptr + cptr[0] = 0; + // rows in b + for (var ib = 0; ib < brows; ib++) { + // b[ib] + var vbi = bdata[ib]; + // check b[ib] != 0, avoid loops + if (!eq(vbi, zero)) { + // A values & index in ib column + for (var ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) { + // a row + var ia = aindex[ka]; + // check value exists in current j + if (!w[ia]) { + // ia is new entry in j + w[ia] = true; + // add i to pattern of C + cindex.push(ia); + // x(ia) = A + x[ia] = mf(vbi, avalues[ka]); + } else { + // i exists in C already + x[ia] = af(x[ia], mf(vbi, avalues[ka])); + } + } + } + } + // copy values from x to column jb of c + for (var p1 = cindex.length, p = 0; p < p1; p++) { + // row + var ic = cindex[p]; + // copy value + cvalues[p] = x[ic]; + } + // update ptr + cptr[1] = cindex.length; + + // matrix to return + return a.createSparseMatrix({ + values: cvalues, + index: cindex, + ptr: cptr, + size: [arows, 1], + datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined + }); + } + + /** + * C = A * B + * + * @param {Matrix} a SparseMatrix (MxN) + * @param {Matrix} b DenseMatrix (NxC) + * + * @return {Matrix} SparseMatrix (MxC) + */ + function _multiplySparseMatrixDenseMatrix(a, b) { + // a sparse + var avalues = a._values; + var aindex = a._index; + var aptr = a._ptr; + var adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType(); + // validate a matrix + if (!avalues) { + throw new Error('Cannot multiply Pattern only Matrix times Dense Matrix'); + } + // b dense + var bdata = b._data; + var bdt = b._datatype || b.getDataType(); + // rows & columns + var arows = a._size[0]; + var brows = b._size[0]; + var bcolumns = b._size[1]; + + // datatype + var dt; + // addScalar signature to use + var af = addScalar; + // multiplyScalar signature to use + var mf = multiplyScalar; + // equalScalar signature to use + var eq = equalScalar; + // zero value + var zero = 0; + + // process data types + if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') { + // datatype + dt = adt; + // find signatures that matches (dt, dt) + af = typed.find(addScalar, [dt, dt]); + mf = typed.find(multiplyScalar, [dt, dt]); + eq = typed.find(equalScalar, [dt, dt]); + // convert 0 to the same datatype + zero = typed.convert(0, dt); + } + + // result + var cvalues = []; + var cindex = []; + var cptr = []; + // c matrix + var c = a.createSparseMatrix({ + values: cvalues, + index: cindex, + ptr: cptr, + size: [arows, bcolumns], + datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined + }); + + // workspace + var x = []; + // vector with marks indicating a value x[i] exists in a given column + var w = []; + + // loop b columns + for (var jb = 0; jb < bcolumns; jb++) { + // update ptr + cptr[jb] = cindex.length; + // mark in workspace for current column + var mark = jb + 1; + // rows in jb + for (var ib = 0; ib < brows; ib++) { + // b[ib, jb] + var vbij = bdata[ib][jb]; + // check b[ib, jb] != 0, avoid loops + if (!eq(vbij, zero)) { + // A values & index in ib column + for (var ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) { + // a row + var ia = aindex[ka]; + // check value exists in current j + if (w[ia] !== mark) { + // ia is new entry in j + w[ia] = mark; + // add i to pattern of C + cindex.push(ia); + // x(ia) = A + x[ia] = mf(vbij, avalues[ka]); + } else { + // i exists in C already + x[ia] = af(x[ia], mf(vbij, avalues[ka])); + } + } + } + } + // copy values from x to column jb of c + for (var p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) { + // row + var ic = cindex[p]; + // copy value + cvalues[p] = x[ic]; + } + } + // update ptr + cptr[bcolumns] = cindex.length; + + // return sparse matrix + return c; + } + + /** + * C = A * B + * + * @param {Matrix} a SparseMatrix (MxN) + * @param {Matrix} b SparseMatrix (NxC) + * + * @return {Matrix} SparseMatrix (MxC) + */ + function _multiplySparseMatrixSparseMatrix(a, b) { + // a sparse + var avalues = a._values; + var aindex = a._index; + var aptr = a._ptr; + var adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType(); + // b sparse + var bvalues = b._values; + var bindex = b._index; + var bptr = b._ptr; + var bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType(); + + // rows & columns + var arows = a._size[0]; + var bcolumns = b._size[1]; + // flag indicating both matrices (a & b) contain data + var values = avalues && bvalues; + + // datatype + var dt; + // addScalar signature to use + var af = addScalar; + // multiplyScalar signature to use + var mf = multiplyScalar; + + // process data types + if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') { + // datatype + dt = adt; + // find signatures that matches (dt, dt) + af = typed.find(addScalar, [dt, dt]); + mf = typed.find(multiplyScalar, [dt, dt]); + } + + // result + var cvalues = values ? [] : undefined; + var cindex = []; + var cptr = []; + // c matrix + var c = a.createSparseMatrix({ + values: cvalues, + index: cindex, + ptr: cptr, + size: [arows, bcolumns], + datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined + }); + + // workspace + var x = values ? [] : undefined; + // vector with marks indicating a value x[i] exists in a given column + var w = []; + // variables + var ka, ka0, ka1, kb, kb0, kb1, ia, ib; + // loop b columns + for (var jb = 0; jb < bcolumns; jb++) { + // update ptr + cptr[jb] = cindex.length; + // mark in workspace for current column + var mark = jb + 1; + // B values & index in j + for (kb0 = bptr[jb], kb1 = bptr[jb + 1], kb = kb0; kb < kb1; kb++) { + // b row + ib = bindex[kb]; + // check we need to process values + if (values) { + // loop values in a[:,ib] + for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) { + // row + ia = aindex[ka]; + // check value exists in current j + if (w[ia] !== mark) { + // ia is new entry in j + w[ia] = mark; + // add i to pattern of C + cindex.push(ia); + // x(ia) = A + x[ia] = mf(bvalues[kb], avalues[ka]); + } else { + // i exists in C already + x[ia] = af(x[ia], mf(bvalues[kb], avalues[ka])); + } + } + } else { + // loop values in a[:,ib] + for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) { + // row + ia = aindex[ka]; + // check value exists in current j + if (w[ia] !== mark) { + // ia is new entry in j + w[ia] = mark; + // add i to pattern of C + cindex.push(ia); + } + } + } + } + // check we need to process matrix values (pattern matrix) + if (values) { + // copy values from x to column jb of c + for (var p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) { + // row + var ic = cindex[p]; + // copy value + cvalues[p] = x[ic]; + } + } + } + // update ptr + cptr[bcolumns] = cindex.length; + + // return sparse matrix + return c; + } + + /** + * Multiply two or more values, `x * y`. + * For matrices, the matrix product is calculated. + * + * Syntax: + * + * math.multiply(x, y) + * math.multiply(x, y, z, ...) + * + * Examples: + * + * math.multiply(4, 5.2) // returns number 20.8 + * math.multiply(2, 3, 4) // returns number 24 + * + * const a = math.complex(2, 3) + * const b = math.complex(4, 1) + * math.multiply(a, b) // returns Complex 5 + 14i + * + * const c = [[1, 2], [4, 3]] + * const d = [[1, 2, 3], [3, -4, 7]] + * math.multiply(c, d) // returns Array [[7, -6, 17], [13, -4, 33]] + * + * const e = math.unit('2.1 km') + * math.multiply(3, e) // returns Unit 6.3 km + * + * See also: + * + * divide, prod, cross, dot + * + * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x First value to multiply + * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} y Second value to multiply + * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Multiplication of `x` and `y` + */ + return typed(name$c, multiplyScalar, { + // we extend the signatures of multiplyScalar with signatures dealing with matrices + + 'Array, Array': typed.referTo('Matrix, Matrix', selfMM => (x, y) => { + // check dimensions + _validateMatrixDimensions(arraySize(x), arraySize(y)); + + // use dense matrix implementation + var m = selfMM(matrix(x), matrix(y)); + // return array or scalar + return isMatrix(m) ? m.valueOf() : m; + }), + 'Matrix, Matrix': function Matrix_Matrix(x, y) { + // dimensions + var xsize = x.size(); + var ysize = y.size(); + + // check dimensions + _validateMatrixDimensions(xsize, ysize); + + // process dimensions + if (xsize.length === 1) { + // process y dimensions + if (ysize.length === 1) { + // Vector * Vector + return _multiplyVectorVector(x, y, xsize[0]); + } + // Vector * Matrix + return _multiplyVectorMatrix(x, y); + } + // process y dimensions + if (ysize.length === 1) { + // Matrix * Vector + return _multiplyMatrixVector(x, y); + } + // Matrix * Matrix + return _multiplyMatrixMatrix(x, y); + }, + 'Matrix, Array': typed.referTo('Matrix,Matrix', selfMM => (x, y) => selfMM(x, matrix(y))), + 'Array, Matrix': typed.referToSelf(self => (x, y) => { + // use Matrix * Matrix implementation + return self(matrix(x, y.storage()), y); + }), + 'SparseMatrix, any': function SparseMatrix_any(x, y) { + return matAlgo11xS0s(x, y, multiplyScalar, false); + }, + 'DenseMatrix, any': function DenseMatrix_any(x, y) { + return matAlgo14xDs(x, y, multiplyScalar, false); + }, + 'any, SparseMatrix': function any_SparseMatrix(x, y) { + return matAlgo11xS0s(y, x, multiplyScalar, true); + }, + 'any, DenseMatrix': function any_DenseMatrix(x, y) { + return matAlgo14xDs(y, x, multiplyScalar, true); + }, + 'Array, any': function Array_any(x, y) { + // use matrix implementation + return matAlgo14xDs(matrix(x), y, multiplyScalar, false).valueOf(); + }, + 'any, Array': function any_Array(x, y) { + // use matrix implementation + return matAlgo14xDs(matrix(y), x, multiplyScalar, true).valueOf(); + }, + 'any, any': multiplyScalar, + 'any, any, ...any': typed.referToSelf(self => (x, y, rest) => { + var result = self(x, y); + for (var i = 0; i < rest.length; i++) { + result = self(result, rest[i]); + } + return result; + }) + }); + }); + + var name$b = 'conj'; + var dependencies$b = ['typed']; + var createConj = /* #__PURE__ */factory(name$b, dependencies$b, _ref => { + var { + typed + } = _ref; + /** + * Compute the complex conjugate of a complex value. + * If `x = a+bi`, the complex conjugate of `x` is `a - bi`. + * + * For matrices, the function is evaluated element wise. + * + * Syntax: + * + * math.conj(x) + * + * Examples: + * + * math.conj(math.complex('2 + 3i')) // returns Complex 2 - 3i + * math.conj(math.complex('2 - 3i')) // returns Complex 2 + 3i + * math.conj(math.complex('-5.2i')) // returns Complex 5.2i + * + * See also: + * + * re, im, arg, abs + * + * @param {number | BigNumber | Complex | Array | Matrix} x + * A complex number or array with complex numbers + * @return {number | BigNumber | Complex | Array | Matrix} + * The complex conjugate of x + */ + return typed(name$b, { + 'number | BigNumber | Fraction': x => x, + Complex: x => x.conjugate(), + 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self)) + }); + }); + + var name$a = 'identity'; + var dependencies$a = ['typed', 'config', 'matrix', 'BigNumber', 'DenseMatrix', 'SparseMatrix']; + var createIdentity = /* #__PURE__ */factory(name$a, dependencies$a, _ref => { + var { + typed, + config, + matrix, + BigNumber, + DenseMatrix, + SparseMatrix + } = _ref; + /** + * Create a 2-dimensional identity matrix with size m x n or n x n. + * The matrix has ones on the diagonal and zeros elsewhere. + * + * Syntax: + * + * math.identity(n) + * math.identity(n, format) + * math.identity(m, n) + * math.identity(m, n, format) + * math.identity([m, n]) + * math.identity([m, n], format) + * + * Examples: + * + * math.identity(3) // returns [[1, 0, 0], [0, 1, 0], [0, 0, 1]] + * math.identity(3, 2) // returns [[1, 0], [0, 1], [0, 0]] + * + * const A = [[1, 2, 3], [4, 5, 6]] + * math.identity(math.size(A)) // returns [[1, 0, 0], [0, 1, 0]] + * + * See also: + * + * diag, ones, zeros, size, range + * + * @param {...number | Matrix | Array} size The size for the matrix + * @param {string} [format] The Matrix storage format + * + * @return {Matrix | Array | number} A matrix with ones on the diagonal. + */ + return typed(name$a, { + '': function _() { + return config.matrix === 'Matrix' ? matrix([]) : []; + }, + string: function string(format) { + return matrix(format); + }, + 'number | BigNumber': function number__BigNumber(rows) { + return _identity(rows, rows, config.matrix === 'Matrix' ? 'dense' : undefined); + }, + 'number | BigNumber, string': function number__BigNumber_string(rows, format) { + return _identity(rows, rows, format); + }, + 'number | BigNumber, number | BigNumber': function number__BigNumber_number__BigNumber(rows, cols) { + return _identity(rows, cols, config.matrix === 'Matrix' ? 'dense' : undefined); + }, + 'number | BigNumber, number | BigNumber, string': function number__BigNumber_number__BigNumber_string(rows, cols, format) { + return _identity(rows, cols, format); + }, + Array: function Array(size) { + return _identityVector(size); + }, + 'Array, string': function Array_string(size, format) { + return _identityVector(size, format); + }, + Matrix: function Matrix(size) { + return _identityVector(size.valueOf(), size.storage()); + }, + 'Matrix, string': function Matrix_string(size, format) { + return _identityVector(size.valueOf(), format); + } + }); + function _identityVector(size, format) { + switch (size.length) { + case 0: + return format ? matrix(format) : []; + case 1: + return _identity(size[0], size[0], format); + case 2: + return _identity(size[0], size[1], format); + default: + throw new Error('Vector containing two values expected'); + } + } + + /** + * Create an identity matrix + * @param {number | BigNumber} rows + * @param {number | BigNumber} cols + * @param {string} [format] + * @returns {Matrix} + * @private + */ + function _identity(rows, cols, format) { + // BigNumber constructor with the right precision + var Big = isBigNumber(rows) || isBigNumber(cols) ? BigNumber : null; + if (isBigNumber(rows)) rows = rows.toNumber(); + if (isBigNumber(cols)) cols = cols.toNumber(); + if (!isInteger(rows) || rows < 1) { + throw new Error('Parameters in function identity must be positive integers'); + } + if (!isInteger(cols) || cols < 1) { + throw new Error('Parameters in function identity must be positive integers'); + } + var one = Big ? new BigNumber(1) : 1; + var defaultValue = Big ? new Big(0) : 0; + var size = [rows, cols]; + + // check we need to return a matrix + if (format) { + // create diagonal matrix (use optimized implementation for storage format) + if (format === 'sparse') { + return SparseMatrix.diagonal(size, one, 0, defaultValue); + } + if (format === 'dense') { + return DenseMatrix.diagonal(size, one, 0, defaultValue); + } + throw new TypeError("Unknown matrix type \"".concat(format, "\"")); + } + + // create and resize array + var res = resize([], size, defaultValue); + // fill in ones on the diagonal + var minimum = rows < cols ? rows : cols; + // fill diagonal + for (var d = 0; d < minimum; d++) { + res[d][d] = one; + } + return res; + } + }); + + function noBignumber() { + throw new Error('No "bignumber" implementation available'); + } + function noFraction() { + throw new Error('No "fraction" implementation available'); + } + function noMatrix() { + throw new Error('No "matrix" implementation available'); + } + + var name$9 = 'size'; + var dependencies$9 = ['typed', 'config', '?matrix']; + var createSize = /* #__PURE__ */factory(name$9, dependencies$9, _ref => { + var { + typed, + config, + matrix + } = _ref; + /** + * Calculate the size of a matrix or scalar. + * + * Syntax: + * + * math.size(x) + * + * Examples: + * + * math.size(2.3) // returns [] + * math.size('hello world') // returns [11] + * + * const A = [[1, 2, 3], [4, 5, 6]] + * math.size(A) // returns [2, 3] + * math.size(math.range(1,6).toArray()) // returns [5] + * + * See also: + * + * count, resize, squeeze, subset + * + * @param {boolean | number | Complex | Unit | string | Array | Matrix} x A matrix + * @return {Array | Matrix} A vector with size of `x`. + */ + return typed(name$9, { + Matrix: function Matrix(x) { + return x.create(x.size(), 'number'); + }, + Array: arraySize, + string: function string(x) { + return config.matrix === 'Array' ? [x.length] : matrix([x.length], 'dense', 'number'); + }, + 'number | Complex | BigNumber | Unit | boolean | null': function number__Complex__BigNumber__Unit__boolean__null(x) { + // scalar + return config.matrix === 'Array' ? [] : matrix ? matrix([], 'dense', 'number') : noMatrix(); + } + }); + }); + + /* eslint-disable no-loss-of-precision */ + + var name$8 = 'erf'; + var dependencies$8 = ['typed']; + var createErf = /* #__PURE__ */factory(name$8, dependencies$8, _ref => { + var { + typed + } = _ref; + /** + * Compute the erf function of a value using a rational Chebyshev + * approximations for different intervals of x. + * + * This is a translation of W. J. Cody's Fortran implementation from 1987 + * ( https://www.netlib.org/specfun/erf ). See the AMS publication + * "Rational Chebyshev Approximations for the Error Function" by W. J. Cody + * for an explanation of this process. + * + * For matrices, the function is evaluated element wise. + * + * Syntax: + * + * math.erf(x) + * + * Examples: + * + * math.erf(0.2) // returns 0.22270258921047847 + * math.erf(-0.5) // returns -0.5204998778130465 + * math.erf(4) // returns 0.9999999845827421 + * + * See also: + * zeta + * + * @param {number | Array | Matrix} x A real number + * @return {number | Array | Matrix} The erf of `x` + */ + return typed('name', { + number: function number(x) { + var y = Math.abs(x); + if (y >= MAX_NUM) { + return sign$1(x); + } + if (y <= THRESH) { + return sign$1(x) * erf1(y); + } + if (y <= 4.0) { + return sign$1(x) * (1 - erfc2(y)); + } + return sign$1(x) * (1 - erfc3(y)); + }, + 'Array | Matrix': typed.referToSelf(self => n => deepMap(n, self)) + + // TODO: For complex numbers, use the approximation for the Faddeeva function + // from "More Efficient Computation of the Complex Error Function" (AMS) + }); + + /** + * Approximates the error function erf() for x <= 0.46875 using this function: + * n + * erf(x) = x * sum (p_j * x^(2j)) / (q_j * x^(2j)) + * j=0 + */ + function erf1(y) { + var ysq = y * y; + var xnum = P[0][4] * ysq; + var xden = ysq; + var i; + for (i = 0; i < 3; i += 1) { + xnum = (xnum + P[0][i]) * ysq; + xden = (xden + Q[0][i]) * ysq; + } + return y * (xnum + P[0][3]) / (xden + Q[0][3]); + } + + /** + * Approximates the complement of the error function erfc() for + * 0.46875 <= x <= 4.0 using this function: + * n + * erfc(x) = e^(-x^2) * sum (p_j * x^j) / (q_j * x^j) + * j=0 + */ + function erfc2(y) { + var xnum = P[1][8] * y; + var xden = y; + var i; + for (i = 0; i < 7; i += 1) { + xnum = (xnum + P[1][i]) * y; + xden = (xden + Q[1][i]) * y; + } + var result = (xnum + P[1][7]) / (xden + Q[1][7]); + var ysq = parseInt(y * 16) / 16; + var del = (y - ysq) * (y + ysq); + return Math.exp(-ysq * ysq) * Math.exp(-del) * result; + } + + /** + * Approximates the complement of the error function erfc() for x > 4.0 using + * this function: + * + * erfc(x) = (e^(-x^2) / x) * [ 1/sqrt(pi) + + * n + * 1/(x^2) * sum (p_j * x^(-2j)) / (q_j * x^(-2j)) ] + * j=0 + */ + function erfc3(y) { + var ysq = 1 / (y * y); + var xnum = P[2][5] * ysq; + var xden = ysq; + var i; + for (i = 0; i < 4; i += 1) { + xnum = (xnum + P[2][i]) * ysq; + xden = (xden + Q[2][i]) * ysq; + } + var result = ysq * (xnum + P[2][4]) / (xden + Q[2][4]); + result = (SQRPI - result) / y; + ysq = parseInt(y * 16) / 16; + var del = (y - ysq) * (y + ysq); + return Math.exp(-ysq * ysq) * Math.exp(-del) * result; + } + }); + + /** + * Upper bound for the first approximation interval, 0 <= x <= THRESH + * @constant + */ + var THRESH = 0.46875; + + /** + * Constant used by W. J. Cody's Fortran77 implementation to denote sqrt(pi) + * @constant + */ + var SQRPI = 5.6418958354775628695e-1; + + /** + * Coefficients for each term of the numerator sum (p_j) for each approximation + * interval (see W. J. Cody's paper for more details) + * @constant + */ + var P = [[3.16112374387056560e00, 1.13864154151050156e02, 3.77485237685302021e02, 3.20937758913846947e03, 1.85777706184603153e-1], [5.64188496988670089e-1, 8.88314979438837594e00, 6.61191906371416295e01, 2.98635138197400131e02, 8.81952221241769090e02, 1.71204761263407058e03, 2.05107837782607147e03, 1.23033935479799725e03, 2.15311535474403846e-8], [3.05326634961232344e-1, 3.60344899949804439e-1, 1.25781726111229246e-1, 1.60837851487422766e-2, 6.58749161529837803e-4, 1.63153871373020978e-2]]; + + /** + * Coefficients for each term of the denominator sum (q_j) for each approximation + * interval (see W. J. Cody's paper for more details) + * @constant + */ + var Q = [[2.36012909523441209e01, 2.44024637934444173e02, 1.28261652607737228e03, 2.84423683343917062e03], [1.57449261107098347e01, 1.17693950891312499e02, 5.37181101862009858e02, 1.62138957456669019e03, 3.29079923573345963e03, 4.36261909014324716e03, 3.43936767414372164e03, 1.23033935480374942e03], [2.56852019228982242e00, 1.87295284992346047e00, 5.27905102951428412e-1, 6.05183413124413191e-2, 2.33520497626869185e-3]]; + + /** + * Maximum/minimum safe numbers to input to erf() (in ES6+, this number is + * Number.[MAX|MIN]_SAFE_INTEGER). erf() for all numbers beyond this limit will + * return 1 + */ + var MAX_NUM = Math.pow(2, 53); + + var name$7 = 'numeric'; + var dependencies$7 = ['number', '?bignumber', '?fraction']; + var createNumeric = /* #__PURE__ */factory(name$7, dependencies$7, _ref => { + var { + number: _number, + bignumber, + fraction + } = _ref; + var validInputTypes = { + string: true, + number: true, + BigNumber: true, + Fraction: true + }; + + // Load the conversion functions for each output type + var validOutputTypes = { + number: x => _number(x), + BigNumber: bignumber ? x => bignumber(x) : noBignumber, + bigint: x => BigInt(x), + Fraction: fraction ? x => fraction(x) : noFraction + }; + + /** + * Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction. + * + * Syntax: + * + * math.numeric(x) + * + * Examples: + * + * math.numeric('4') // returns 4 + * math.numeric('4', 'number') // returns 4 + * math.numeric('4', 'bigint') // returns 4n + * math.numeric('4', 'BigNumber') // returns BigNumber 4 + * math.numeric('4', 'Fraction') // returns Fraction 4 + * math.numeric(4, 'Fraction') // returns Fraction 4 + * math.numeric(math.fraction(2, 5), 'number') // returns 0.4 + * + * See also: + * + * number, fraction, bignumber, bigint, string, format + * + * @param {string | number | BigNumber | bigint | Fraction } value + * A numeric value or a string containing a numeric value + * @param {string} outputType + * Desired numeric output type. + * Available values: 'number', 'BigNumber', or 'Fraction' + * @return {number | BigNumber | bigint | Fraction} + * Returns an instance of the numeric in the requested type + */ + return function numeric(value) { + var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'number'; + var check = arguments.length > 2 ? arguments[2] : undefined; + if (check !== undefined) { + throw new SyntaxError('numeric() takes one or two arguments'); + } + var inputType = typeOf(value); + if (!(inputType in validInputTypes)) { + throw new TypeError('Cannot convert ' + value + ' of type "' + inputType + '"; valid input types are ' + Object.keys(validInputTypes).join(', ')); + } + if (!(outputType in validOutputTypes)) { + throw new TypeError('Cannot convert ' + value + ' to type "' + outputType + '"; valid output types are ' + Object.keys(validOutputTypes).join(', ')); + } + if (outputType === inputType) { + return value; + } else { + return validOutputTypes[outputType](value); + } + }; + }); + + var name$6 = 'divideScalar'; + var dependencies$6 = ['typed', 'numeric']; + var createDivideScalar = /* #__PURE__ */factory(name$6, dependencies$6, _ref => { + var { + typed, + numeric + } = _ref; + /** + * Divide two scalar values, `x / y`. + * This function is meant for internal use: it is used by the public functions + * `divide` and `inv`. + * + * This function does not support collections (Array or Matrix). + * + * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x Numerator + * @param {number | BigNumber | bigint | Fraction | Complex} y Denominator + * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Quotient, `x / y` + * @private + */ + return typed(name$6, { + 'number, number': function number_number(x, y) { + return x / y; + }, + 'Complex, Complex': function Complex_Complex(x, y) { + return x.div(y); + }, + 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) { + return x.div(y); + }, + 'bigint, bigint': function bigint_bigint(x, y) { + return x / y; + }, + 'Fraction, Fraction': function Fraction_Fraction(x, y) { + return x.div(y); + }, + 'Unit, number | Complex | Fraction | BigNumber | Unit': (x, y) => x.divide(y), + 'number | Fraction | Complex | BigNumber, Unit': (x, y) => y.divideInto(x) + }); + }); + + var name$5 = 'pow'; + var dependencies$5 = ['typed', 'config', 'identity', 'multiply', 'matrix', 'inv', 'fraction', 'number', 'Complex']; + var createPow = /* #__PURE__ */factory(name$5, dependencies$5, _ref => { + var { + typed, + config, + identity, + multiply, + matrix, + inv, + number, + fraction, + Complex + } = _ref; + /** + * Calculates the power of x to y, `x ^ y`. + * + * Matrix exponentiation is supported for square matrices `x` and integers `y`: + * when `y` is nonnegative, `x` may be any square matrix; and when `y` is + * negative, `x` must be invertible, and then this function returns + * inv(x)^(-y). + * + * For cubic roots of negative numbers, the function returns the principal + * root by default. In order to let the function return the real root, + * math.js can be configured with `math.config({predictable: true})`. + * To retrieve all cubic roots of a value, use `math.cbrt(x, true)`. + * + * Syntax: + * + * math.pow(x, y) + * + * Examples: + * + * math.pow(2, 3) // returns number 8 + * + * const a = math.complex(2, 3) + * math.pow(a, 2) // returns Complex -5 + 12i + * + * const b = [[1, 2], [4, 3]] + * math.pow(b, 2) // returns Array [[9, 8], [16, 17]] + * + * const c = [[1, 2], [4, 3]] + * math.pow(c, -1) // returns Array [[-0.6, 0.4], [0.8, -0.2]] + * + * See also: + * + * multiply, sqrt, cbrt, nthRoot + * + * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} x The base + * @param {number | BigNumber | bigint | Complex} y The exponent + * @return {number | BigNumber | bigint | Complex | Array | Matrix} The value of `x` to the power `y` + */ + return typed(name$5, { + 'number, number': _pow, + 'Complex, Complex': function Complex_Complex(x, y) { + return x.pow(y); + }, + 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) { + if (y.isInteger() || x >= 0 || config.predictable) { + return x.pow(y); + } else { + return new Complex(x.toNumber(), 0).pow(y.toNumber(), 0); + } + }, + 'bigint, bigint': (x, y) => x ** y, + 'Fraction, Fraction': function Fraction_Fraction(x, y) { + var result = x.pow(y); + if (result != null) { + return result; + } + if (config.predictable) { + throw new Error('Result of pow is non-rational and cannot be expressed as a fraction'); + } else { + return _pow(x.valueOf(), y.valueOf()); + } + }, + 'Array, number': _powArray, + 'Array, BigNumber': function Array_BigNumber(x, y) { + return _powArray(x, y.toNumber()); + }, + 'Matrix, number': _powMatrix, + 'Matrix, BigNumber': function Matrix_BigNumber(x, y) { + return _powMatrix(x, y.toNumber()); + }, + 'Unit, number | BigNumber': function Unit_number__BigNumber(x, y) { + return x.pow(y); + } + }); + + /** + * Calculates the power of x to y, x^y, for two numbers. + * @param {number} x + * @param {number} y + * @return {number | Complex} res + * @private + */ + function _pow(x, y) { + // Alternatively could define a 'realmode' config option or something, but + // 'predictable' will work for now + if (config.predictable && !isInteger(y) && x < 0) { + // Check to see if y can be represented as a fraction + try { + var yFrac = fraction(y); + var yNum = number(yFrac); + if (y === yNum || Math.abs((y - yNum) / y) < 1e-14) { + if (yFrac.d % 2n === 1n) { + return (yFrac.n % 2n === 0n ? 1 : -1) * Math.pow(-x, y); + } + } + } catch (ex) { + // fraction() throws an error if y is Infinity, etc. + } + + // Unable to express y as a fraction, so continue on + } + + // **for predictable mode** x^Infinity === NaN if x < -1 + // N.B. this behavour is different from `Math.pow` which gives + // (-2)^Infinity === Infinity + if (config.predictable && (x < -1 && y === Infinity || x > -1 && x < 0 && y === -Infinity)) { + return NaN; + } + if (isInteger(y) || x >= 0 || config.predictable) { + return powNumber(x, y); + } else { + // TODO: the following infinity checks are duplicated from powNumber. Deduplicate this somehow + + // x^Infinity === 0 if -1 < x < 1 + // A real number 0 is returned instead of complex(0) + if (x * x < 1 && y === Infinity || x * x > 1 && y === -Infinity) { + return 0; + } + return new Complex(x, 0).pow(y, 0); + } + } + + /** + * Calculate the power of a 2d array + * @param {Array} x must be a 2 dimensional, square matrix + * @param {number} y a integer value (positive if `x` is not invertible) + * @returns {Array} + * @private + */ + function _powArray(x, y) { + if (!isInteger(y)) { + throw new TypeError('For A^b, b must be an integer (value is ' + y + ')'); + } + // verify that A is a 2 dimensional square matrix + var s = arraySize(x); + if (s.length !== 2) { + throw new Error('For A^b, A must be 2 dimensional (A has ' + s.length + ' dimensions)'); + } + if (s[0] !== s[1]) { + throw new Error('For A^b, A must be square (size is ' + s[0] + 'x' + s[1] + ')'); + } + if (y < 0) { + try { + return _powArray(inv(x), -y); + } catch (error) { + if (error.message === 'Cannot calculate inverse, determinant is zero') { + throw new TypeError('For A^b, when A is not invertible, b must be a positive integer (value is ' + y + ')'); + } + throw error; + } + } + var res = identity(s[0]).valueOf(); + var px = x; + while (y >= 1) { + if ((y & 1) === 1) { + res = multiply(px, res); + } + y >>= 1; + px = multiply(px, px); + } + return res; + } + + /** + * Calculate the power of a 2d matrix + * @param {Matrix} x must be a 2 dimensional, square matrix + * @param {number} y a positive, integer value + * @returns {Matrix} + * @private + */ + function _powMatrix(x, y) { + return matrix(_powArray(x.valueOf(), y)); + } + }); + + function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + } + + function getAugmentedNamespace(n) { + if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n; + var f = n.default; + if (typeof f == "function") { + var a = function a () { + if (this instanceof a) { + return Reflect.construct(f, arguments, this.constructor); + } + return f.apply(this, arguments); + }; + a.prototype = f.prototype; + } else a = {}; + Object.defineProperty(a, '__esModule', {value: true}); + Object.keys(n).forEach(function (k) { + var d = Object.getOwnPropertyDescriptor(n, k); + Object.defineProperty(a, k, d.get ? d : { + enumerable: true, + get: function () { + return n[k]; + } + }); + }); + return a; + } + + var name$4 = 'dot'; + var dependencies$4 = ['typed', 'addScalar', 'multiplyScalar', 'conj', 'size']; + var createDot = /* #__PURE__ */factory(name$4, dependencies$4, _ref => { + var { + typed, + addScalar, + multiplyScalar, + conj, + size + } = _ref; + /** + * Calculate the dot product of two vectors. The dot product of + * `A = [a1, a2, ..., an]` and `B = [b1, b2, ..., bn]` is defined as: + * + * dot(A, B) = conj(a1) * b1 + conj(a2) * b2 + ... + conj(an) * bn + * + * Syntax: + * + * math.dot(x, y) + * + * Examples: + * + * math.dot([2, 4, 1], [2, 2, 3]) // returns number 15 + * math.multiply([2, 4, 1], [2, 2, 3]) // returns number 15 + * + * See also: + * + * multiply, cross + * + * @param {Array | Matrix} x First vector + * @param {Array | Matrix} y Second vector + * @return {number} Returns the dot product of `x` and `y` + */ + return typed(name$4, { + 'Array | DenseMatrix, Array | DenseMatrix': _denseDot, + 'SparseMatrix, SparseMatrix': _sparseDot + }); + function _validateDim(x, y) { + var xSize = _size(x); + var ySize = _size(y); + var xLen, yLen; + if (xSize.length === 1) { + xLen = xSize[0]; + } else if (xSize.length === 2 && xSize[1] === 1) { + xLen = xSize[0]; + } else { + throw new RangeError('Expected a column vector, instead got a matrix of size (' + xSize.join(', ') + ')'); + } + if (ySize.length === 1) { + yLen = ySize[0]; + } else if (ySize.length === 2 && ySize[1] === 1) { + yLen = ySize[0]; + } else { + throw new RangeError('Expected a column vector, instead got a matrix of size (' + ySize.join(', ') + ')'); + } + if (xLen !== yLen) throw new RangeError('Vectors must have equal length (' + xLen + ' != ' + yLen + ')'); + if (xLen === 0) throw new RangeError('Cannot calculate the dot product of empty vectors'); + return xLen; + } + function _denseDot(a, b) { + var N = _validateDim(a, b); + var adata = isMatrix(a) ? a._data : a; + var adt = isMatrix(a) ? a._datatype || a.getDataType() : undefined; + var bdata = isMatrix(b) ? b._data : b; + var bdt = isMatrix(b) ? b._datatype || b.getDataType() : undefined; + + // are these 2-dimensional column vectors? (as opposed to 1-dimensional vectors) + var aIsColumn = _size(a).length === 2; + var bIsColumn = _size(b).length === 2; + var add = addScalar; + var mul = multiplyScalar; + + // process data types + if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') { + var dt = adt; + // find signatures that matches (dt, dt) + add = typed.find(addScalar, [dt, dt]); + mul = typed.find(multiplyScalar, [dt, dt]); + } + + // both vectors 1-dimensional + if (!aIsColumn && !bIsColumn) { + var c = mul(conj(adata[0]), bdata[0]); + for (var i = 1; i < N; i++) { + c = add(c, mul(conj(adata[i]), bdata[i])); + } + return c; + } + + // a is 1-dim, b is column + if (!aIsColumn && bIsColumn) { + var _c = mul(conj(adata[0]), bdata[0][0]); + for (var _i = 1; _i < N; _i++) { + _c = add(_c, mul(conj(adata[_i]), bdata[_i][0])); + } + return _c; + } + + // a is column, b is 1-dim + if (aIsColumn && !bIsColumn) { + var _c2 = mul(conj(adata[0][0]), bdata[0]); + for (var _i2 = 1; _i2 < N; _i2++) { + _c2 = add(_c2, mul(conj(adata[_i2][0]), bdata[_i2])); + } + return _c2; + } + + // both vectors are column + if (aIsColumn && bIsColumn) { + var _c3 = mul(conj(adata[0][0]), bdata[0][0]); + for (var _i3 = 1; _i3 < N; _i3++) { + _c3 = add(_c3, mul(conj(adata[_i3][0]), bdata[_i3][0])); + } + return _c3; + } + } + function _sparseDot(x, y) { + _validateDim(x, y); + var xindex = x._index; + var xvalues = x._values; + var yindex = y._index; + var yvalues = y._values; + + // TODO optimize add & mul using datatype + var c = 0; + var add = addScalar; + var mul = multiplyScalar; + var i = 0; + var j = 0; + while (i < xindex.length && j < yindex.length) { + var I = xindex[i]; + var J = yindex[j]; + if (I < J) { + i++; + continue; + } + if (I > J) { + j++; + continue; + } + if (I === J) { + c = add(c, mul(xvalues[i], yvalues[j])); + i++; + j++; + } + } + return c; + } + + // TODO remove this once #1771 is fixed + function _size(x) { + return isMatrix(x) ? x.size() : size(x); + } + }); + + var name$3 = 'det'; + var dependencies$3 = ['typed', 'matrix', 'subtractScalar', 'multiply', 'divideScalar', 'isZero', 'unaryMinus']; + var createDet = /* #__PURE__ */factory(name$3, dependencies$3, _ref => { + var { + typed, + matrix, + subtractScalar, + multiply, + divideScalar, + isZero, + unaryMinus + } = _ref; + /** + * Calculate the determinant of a matrix. + * + * Syntax: + * + * math.det(x) + * + * Examples: + * + * math.det([[1, 2], [3, 4]]) // returns -2 + * + * const A = [ + * [-2, 2, 3], + * [-1, 1, 3], + * [2, 0, -1] + * ] + * math.det(A) // returns 6 + * + * See also: + * + * inv + * + * @param {Array | Matrix} x A matrix + * @return {number} The determinant of `x` + */ + return typed(name$3, { + any: function any(x) { + return clone$2(x); + }, + 'Array | Matrix': function det(x) { + var size; + if (isMatrix(x)) { + size = x.size(); + } else if (Array.isArray(x)) { + x = matrix(x); + size = x.size(); + } else { + // a scalar + size = []; + } + switch (size.length) { + case 0: + // scalar + return clone$2(x); + case 1: + // vector + if (size[0] === 1) { + return clone$2(x.valueOf()[0]); + } + if (size[0] === 0) { + return 1; // det of an empty matrix is per definition 1 + } else { + throw new RangeError('Matrix must be square ' + '(size: ' + format(size) + ')'); + } + case 2: + { + // two-dimensional array + var rows = size[0]; + var cols = size[1]; + if (rows === cols) { + return _det(x.clone().valueOf(), rows); + } + if (cols === 0) { + return 1; // det of an empty matrix is per definition 1 + } else { + throw new RangeError('Matrix must be square ' + '(size: ' + format(size) + ')'); + } + } + default: + // multi dimensional array + throw new RangeError('Matrix must be two dimensional ' + '(size: ' + format(size) + ')'); + } + } + }); + + /** + * Calculate the determinant of a matrix + * @param {Array[]} matrix A square, two dimensional matrix + * @param {number} rows Number of rows of the matrix (zero-based) + * @param {number} cols Number of columns of the matrix (zero-based) + * @returns {number} det + * @private + */ + function _det(matrix, rows, cols) { + if (rows === 1) { + // this is a 1 x 1 matrix + return clone$2(matrix[0][0]); + } else if (rows === 2) { + // this is a 2 x 2 matrix + // the determinant of [a11,a12;a21,a22] is det = a11*a22-a21*a12 + return subtractScalar(multiply(matrix[0][0], matrix[1][1]), multiply(matrix[1][0], matrix[0][1])); + } else { + // Bareiss algorithm + // this algorithm have same complexity as LUP decomposition (O(n^3)) + // but it preserve precision of floating point more relative to the LUP decomposition + var negated = false; + var rowIndices = new Array(rows).fill(0).map((_, i) => i); // matrix index of row i + for (var k = 0; k < rows; k++) { + var k_ = rowIndices[k]; + if (isZero(matrix[k_][k])) { + var _k = void 0; + for (_k = k + 1; _k < rows; _k++) { + if (!isZero(matrix[rowIndices[_k]][k])) { + k_ = rowIndices[_k]; + rowIndices[_k] = rowIndices[k]; + rowIndices[k] = k_; + negated = !negated; + break; + } + } + if (_k === rows) return matrix[k_][k]; // some zero of the type + } + var piv = matrix[k_][k]; + var piv_ = k === 0 ? 1 : matrix[rowIndices[k - 1]][k - 1]; + for (var i = k + 1; i < rows; i++) { + var i_ = rowIndices[i]; + for (var j = k + 1; j < rows; j++) { + matrix[i_][j] = divideScalar(subtractScalar(multiply(matrix[i_][j], piv), multiply(matrix[i_][k], matrix[k_][j])), piv_); + } + } + } + var det = matrix[rowIndices[rows - 1]][rows - 1]; + return negated ? unaryMinus(det) : det; + } + } + }); + + var name$2 = 'inv'; + var dependencies$2 = ['typed', 'matrix', 'divideScalar', 'addScalar', 'multiply', 'unaryMinus', 'det', 'identity', 'abs']; + var createInv = /* #__PURE__ */factory(name$2, dependencies$2, _ref => { + var { + typed, + matrix, + divideScalar, + addScalar, + multiply, + unaryMinus, + det, + identity, + abs + } = _ref; + /** + * Calculate the inverse of a square matrix. + * + * Syntax: + * + * math.inv(x) + * + * Examples: + * + * math.inv([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]] + * math.inv(4) // returns 0.25 + * 1 / 4 // returns 0.25 + * + * See also: + * + * det, transpose + * + * @param {number | Complex | Array | Matrix} x Matrix to be inversed + * @return {number | Complex | Array | Matrix} The inverse of `x`. + */ + return typed(name$2, { + 'Array | Matrix': function Array__Matrix(x) { + var size = isMatrix(x) ? x.size() : arraySize(x); + switch (size.length) { + case 1: + // vector + if (size[0] === 1) { + if (isMatrix(x)) { + return matrix([divideScalar(1, x.valueOf()[0])]); + } else { + return [divideScalar(1, x[0])]; + } + } else { + throw new RangeError('Matrix must be square ' + '(size: ' + format(size) + ')'); + } + case 2: + // two dimensional array + { + var rows = size[0]; + var cols = size[1]; + if (rows === cols) { + if (isMatrix(x)) { + return matrix(_inv(x.valueOf(), rows, cols), x.storage()); + } else { + // return an Array + return _inv(x, rows, cols); + } + } else { + throw new RangeError('Matrix must be square ' + '(size: ' + format(size) + ')'); + } + } + default: + // multi dimensional array + throw new RangeError('Matrix must be two dimensional ' + '(size: ' + format(size) + ')'); + } + }, + any: function any(x) { + // scalar + return divideScalar(1, x); // FIXME: create a BigNumber one when configured for bignumbers + } + }); + + /** + * Calculate the inverse of a square matrix + * @param {Array[]} mat A square matrix + * @param {number} rows Number of rows + * @param {number} cols Number of columns, must equal rows + * @return {Array[]} inv Inverse matrix + * @private + */ + function _inv(mat, rows, cols) { + var r, s, f, value, temp; + if (rows === 1) { + // this is a 1 x 1 matrix + value = mat[0][0]; + if (value === 0) { + throw Error('Cannot calculate inverse, determinant is zero'); + } + return [[divideScalar(1, value)]]; + } else if (rows === 2) { + // this is a 2 x 2 matrix + var d = det(mat); + if (d === 0) { + throw Error('Cannot calculate inverse, determinant is zero'); + } + return [[divideScalar(mat[1][1], d), divideScalar(unaryMinus(mat[0][1]), d)], [divideScalar(unaryMinus(mat[1][0]), d), divideScalar(mat[0][0], d)]]; + } else { + // this is a matrix of 3 x 3 or larger + // calculate inverse using gauss-jordan elimination + // https://en.wikipedia.org/wiki/Gaussian_elimination + // http://mathworld.wolfram.com/MatrixInverse.html + // http://math.uww.edu/~mcfarlat/inverse.htm + + // make a copy of the matrix (only the arrays, not of the elements) + var A = mat.concat(); + for (r = 0; r < rows; r++) { + A[r] = A[r].concat(); + } + + // create an identity matrix which in the end will contain the + // matrix inverse + var B = identity(rows).valueOf(); + + // loop over all columns, and perform row reductions + for (var c = 0; c < cols; c++) { + // Pivoting: Swap row c with row r, where row r contains the largest element A[r][c] + var ABig = abs(A[c][c]); + var rBig = c; + r = c + 1; + while (r < rows) { + if (abs(A[r][c]) > ABig) { + ABig = abs(A[r][c]); + rBig = r; + } + r++; + } + if (ABig === 0) { + throw Error('Cannot calculate inverse, determinant is zero'); + } + r = rBig; + if (r !== c) { + temp = A[c]; + A[c] = A[r]; + A[r] = temp; + temp = B[c]; + B[c] = B[r]; + B[r] = temp; + } + + // eliminate non-zero values on the other rows at column c + var Ac = A[c]; + var Bc = B[c]; + for (r = 0; r < rows; r++) { + var Ar = A[r]; + var Br = B[r]; + if (r !== c) { + // eliminate value at column c and row r + if (Ar[c] !== 0) { + f = divideScalar(unaryMinus(Ar[c]), Ac[c]); + + // add (f * row c) to row r to eliminate the value + // at column c + for (s = c; s < cols; s++) { + Ar[s] = addScalar(Ar[s], multiply(f, Ac[s])); + } + for (s = 0; s < cols; s++) { + Br[s] = addScalar(Br[s], multiply(f, Bc[s])); + } + } + } else { + // normalize value at Acc to 1, + // divide each value on row r with the value at Acc + f = Ac[c]; + for (s = c; s < cols; s++) { + Ar[s] = divideScalar(Ar[s], f); + } + for (s = 0; s < cols; s++) { + Br[s] = divideScalar(Br[s], f); + } + } + } + } + return B; + } + } + }); + + var name$1 = 'gamma'; + var dependencies$1 = ['typed', 'config', 'multiplyScalar', 'pow', 'BigNumber', 'Complex']; + var createGamma = /* #__PURE__ */factory(name$1, dependencies$1, _ref => { + var { + typed, + config, + multiplyScalar, + pow, + BigNumber: _BigNumber, + Complex + } = _ref; + /** + * Compute the gamma function of a value using Lanczos approximation for + * small values, and an extended Stirling approximation for large values. + * + * To avoid confusion with the matrix Gamma function, this function does + * not apply to matrices. + * + * Syntax: + * + * math.gamma(n) + * + * Examples: + * + * math.gamma(5) // returns 24 + * math.gamma(-0.5) // returns -3.5449077018110335 + * math.gamma(math.i) // returns -0.15494982830180973 - 0.49801566811835596i + * + * See also: + * + * combinations, factorial, permutations + * + * @param {number | BigNumber | Complex} n A real or complex number + * @return {number | BigNumber | Complex} The gamma of `n` + */ + + function gammaComplex(n) { + if (n.im === 0) { + return gammaNumber(n.re); + } + + // Lanczos approximation doesn't work well with real part lower than 0.5 + // So reflection formula is required + if (n.re < 0.5) { + // Euler's reflection formula + // gamma(1-z) * gamma(z) = PI / sin(PI * z) + // real part of Z should not be integer [sin(PI) == 0 -> 1/0 - undefined] + // thanks to imperfect sin implementation sin(PI * n) != 0 + // we can safely use it anyway + var _t = new Complex(1 - n.re, -n.im); + var r = new Complex(Math.PI * n.re, Math.PI * n.im); + return new Complex(Math.PI).div(r.sin()).div(gammaComplex(_t)); + } + + // Lanczos approximation + // z -= 1 + n = new Complex(n.re - 1, n.im); + + // x = gammaPval[0] + var x = new Complex(gammaP[0], 0); + // for (i, gammaPval) in enumerate(gammaP): + for (var i = 1; i < gammaP.length; ++i) { + // x += gammaPval / (z + i) + var gammaPval = new Complex(gammaP[i], 0); + x = x.add(gammaPval.div(n.add(i))); + } + // t = z + gammaG + 0.5 + var t = new Complex(n.re + gammaG + 0.5, n.im); + + // y = sqrt(2 * pi) * t ** (z + 0.5) * exp(-t) * x + var twoPiSqrt = Math.sqrt(2 * Math.PI); + var tpow = t.pow(n.add(0.5)); + var expt = t.neg().exp(); + + // y = [x] * [sqrt(2 * pi)] * [t ** (z + 0.5)] * [exp(-t)] + return x.mul(twoPiSqrt).mul(tpow).mul(expt); + } + return typed(name$1, { + number: gammaNumber, + Complex: gammaComplex, + BigNumber: function BigNumber(n) { + if (n.isInteger()) { + return n.isNegative() || n.isZero() ? new _BigNumber(Infinity) : bigFactorial(n.minus(1)); + } + if (!n.isFinite()) { + return new _BigNumber(n.isNegative() ? NaN : Infinity); + } + throw new Error('Integer BigNumber expected'); + } + }); + + /** + * Calculate factorial for a BigNumber + * @param {BigNumber} n + * @returns {BigNumber} Returns the factorial of n + */ + function bigFactorial(n) { + if (n < 8) { + return new _BigNumber([1, 1, 2, 6, 24, 120, 720, 5040][n]); + } + var precision = config.precision + (Math.log(n.toNumber()) | 0); + var Big = _BigNumber.clone({ + precision + }); + if (n % 2 === 1) { + return n.times(bigFactorial(new _BigNumber(n - 1))); + } + var p = n; + var prod = new Big(n); + var sum = n.toNumber(); + while (p > 2) { + p -= 2; + sum += p; + prod = prod.times(sum); + } + return new _BigNumber(prod.toPrecision(_BigNumber.precision)); + } + }); + + /* eslint-disable no-loss-of-precision */ + + var name = 'lgamma'; + var dependencies = ['Complex', 'typed']; + var createLgamma = /* #__PURE__ */factory(name, dependencies, _ref => { + var { + Complex, + typed + } = _ref; + // Stirling series is non-convergent, we need to use the recurrence `lgamma(z) = lgamma(z+1) - log z` to get + // sufficient accuracy. + // + // These two values are copied from Scipy implementation: + // https://github.com/scipy/scipy/blob/v1.8.0/scipy/special/_loggamma.pxd#L37 + var SMALL_RE = 7; + var SMALL_IM = 7; + + /** + * The coefficients are B[2*n]/(2*n*(2*n - 1)) where B[2*n] is the (2*n)th Bernoulli number. See (1.1) in [1]. + * + * If you cannot access the paper, can also get these values from the formula in [2]. + * + * 1 / 12 = 0.00833333333333333333333333333333 + * 1 / 360 = 0.00277777777777777777777777777778 + * ... + * 3617 / 133400 = 0.02955065359477124183006535947712 + */ + var coeffs = [-0.029550653594771242, 6.4102564102564102564e-3, -0.0019175269175269176, 8.4175084175084175084e-4, -5952380952380953e-19, 7.9365079365079365079e-4, -0.002777777777777778, 8.3333333333333333333e-2]; + + /** + * Logarithm of the gamma function for real, positive numbers and complex numbers, + * using Lanczos approximation for numbers and Stirling series for complex numbers. + * + * Syntax: + * + * math.lgamma(n) + * + * Examples: + * + * math.lgamma(5) // returns 3.178053830347945 + * math.lgamma(0) // returns Infinity + * math.lgamma(-0.5) // returns NaN + * math.lgamma(math.i) // returns -0.6509231993018536 - 1.8724366472624294i + * + * See also: + * + * gamma + * + * @param {number | Complex} n A real or complex number + * @return {number | Complex} The log gamma of `n` + */ + return typed(name, { + number: lgammaNumber, + Complex: lgammaComplex, + BigNumber: function BigNumber() { + throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber"); + } + }); + function lgammaComplex(n) { + var TWOPI = 6.2831853071795864769252842; // 2*pi + var LOGPI = 1.1447298858494001741434262; // log(pi) + + var REFLECTION = 0.1; + if (n.isNaN()) { + return new Complex(NaN, NaN); + } else if (n.im === 0) { + return new Complex(lgammaNumber(n.re), 0); + } else if (n.re >= SMALL_RE || Math.abs(n.im) >= SMALL_IM) { + return lgammaStirling(n); + } else if (n.re <= REFLECTION) { + // Reflection formula. see Proposition 3.1 in [1] + var tmp = copysign(TWOPI, n.im) * Math.floor(0.5 * n.re + 0.25); + var a = n.mul(Math.PI).sin().log(); + var b = lgammaComplex(new Complex(1 - n.re, -n.im)); + return new Complex(LOGPI, tmp).sub(a).sub(b); + } else if (n.im >= 0) { + return lgammaRecurrence(n); + } else { + return lgammaRecurrence(n.conjugate()).conjugate(); + } + } + function lgammaStirling(z) { + // formula ref in [2] + // computation ref: + // https://github.com/scipy/scipy/blob/v1.8.0/scipy/special/_loggamma.pxd#L101 + + // left part + + // x (log(x) - 1) + 1/2 (log(2PI) - log(x)) + // => (x - 0.5) * log(x) - x + log(2PI) / 2 + var leftPart = z.sub(0.5).mul(z.log()).sub(z).add(lnSqrt2PI); + + // right part + + var rz = new Complex(1, 0).div(z); + var rzz = rz.div(z); + var a = coeffs[0]; + var b = coeffs[1]; + var r = 2 * rzz.re; + var s = rzz.re * rzz.re + rzz.im * rzz.im; + for (var i = 2; i < 8; i++) { + var tmp = b; + b = -s * a + coeffs[i]; + a = r * a + tmp; + } + var rightPart = rz.mul(rzz.mul(a).add(b)); + + // plus left and right + + return leftPart.add(rightPart); + } + function lgammaRecurrence(z) { + // computation ref: + // https://github.com/scipy/scipy/blob/v1.8.0/scipy/special/_loggamma.pxd#L78 + + var signflips = 0; + var sb = 0; + var shiftprod = z; + z = z.add(1); + while (z.re <= SMALL_RE) { + shiftprod = shiftprod.mul(z); + var nsb = shiftprod.im < 0 ? 1 : 0; + if (nsb !== 0 && sb === 0) signflips++; + sb = nsb; + z = z.add(1); + } + return lgammaStirling(z).sub(shiftprod.log()).sub(new Complex(0, signflips * 2 * Math.PI * 1)); + } + }); + + /** + * THIS FILE IS AUTO-GENERATED + * DON'T MAKE CHANGES HERE + */ + var BigNumber = /* #__PURE__ */createBigNumberClass({ + config: config$1 + }); + var Complex = /* #__PURE__ */createComplexClass({}); + var Fraction = /* #__PURE__ */createFractionClass({}); + var Matrix = /* #__PURE__ */createMatrixClass({}); + var DenseMatrix = /* #__PURE__ */createDenseMatrixClass({ + Matrix + }); + var typed = /* #__PURE__ */createTyped({ + BigNumber, + Complex, + DenseMatrix, + Fraction + }); + var abs$1 = /* #__PURE__ */createAbs({ + typed + }); + var addScalar = /* #__PURE__ */createAddScalar({ + typed + }); + var conj = /* #__PURE__ */createConj({ + typed + }); + var equalScalar = /* #__PURE__ */createEqualScalar({ + config: config$1, + typed + }); + var erf = /* #__PURE__ */createErf({ + typed + }); + var isZero = /* #__PURE__ */createIsZero({ + equalScalar, + typed + }); + var lgamma = /* #__PURE__ */createLgamma({ + Complex, + typed + }); + var multiplyScalar = /* #__PURE__ */createMultiplyScalar({ + typed + }); + var number = /* #__PURE__ */createNumber({ + typed + }); + var SparseMatrix = /* #__PURE__ */createSparseMatrixClass({ + Matrix, + equalScalar, + typed + }); + var subtractScalar = /* #__PURE__ */createSubtractScalar({ + typed + }); + var bignumber = /* #__PURE__ */createBignumber({ + BigNumber, + typed + }); + var matrix = /* #__PURE__ */createMatrix({ + DenseMatrix, + Matrix, + SparseMatrix, + typed + }); + var fraction = /* #__PURE__ */createFraction({ + Fraction, + typed + }); + var identity = /* #__PURE__ */createIdentity({ + BigNumber, + DenseMatrix, + SparseMatrix, + config: config$1, + matrix, + typed + }); + var numeric = /* #__PURE__ */createNumeric({ + bignumber, + fraction, + number + }); + var size = /* #__PURE__ */createSize({ + matrix, + config: config$1, + typed + }); + var unaryMinus = /* #__PURE__ */createUnaryMinus({ + typed + }); + var divideScalar = /* #__PURE__ */createDivideScalar({ + numeric, + typed + }); + var dot = /* #__PURE__ */createDot({ + addScalar, + conj, + multiplyScalar, + size, + typed + }); + var multiply = /* #__PURE__ */createMultiply({ + addScalar, + dot, + equalScalar, + matrix, + multiplyScalar, + typed + }); + var det = /* #__PURE__ */createDet({ + divideScalar, + isZero, + matrix, + multiply, + subtractScalar, + typed, + unaryMinus + }); + var inv = /* #__PURE__ */createInv({ + abs: abs$1, + addScalar, + det, + divideScalar, + identity, + matrix, + multiply, + typed, + unaryMinus + }); + var pow = /* #__PURE__ */createPow({ + Complex, + config: config$1, + fraction, + identity, + inv, + matrix, + multiply, + number, + typed + }); + var gamma = /* #__PURE__ */createGamma({ + BigNumber, + Complex, + config: config$1, + multiplyScalar, + pow, + typed + }); + + class Stack { + constructor() { + // Bottom of the array is at index 0 + this.storage = []; + } + push(...items) { + for (const item of items) { + this.storage.push(item); + } + } + pop() { + return this.storage.pop(); + } + peek() { + if (this.isEmpty()) { + return undefined; + } + return this.storage[this.size() - 1]; + } + size() { + return this.storage.length; + } + isEmpty() { + return this.size() == 0; + } + getStack() { + // return a copy of the stack's contents + return [...this.storage]; + } + some(predicate) { + return this.storage.some(predicate); + } + // required for first-class continuations, + // which directly mutate this stack globally. + setTo(otherStack) { + this.storage = otherStack.storage; + } + } + + /** + * Create a StatementSequence node. + */ + const statementSequence = (body, loc) => ({ + type: 'StatementSequence', + body, + loc, + innerComments: undefined, + }); + const isNode = (item) => { + return typeof item === 'object' && item !== null && 'type' in item; + }; + const isBlockStatement = (node) => { + return node.type === 'BlockStatement'; + }; + const hasDeclarations = (node) => { + return node.body.some(stmt => stmt.type === 'VariableDeclaration' || stmt.type === 'FunctionDeclaration'); + }; + const blockArrowFunction = (params, body, loc) => ({ + type: 'ArrowFunctionExpression', + expression: false, + generator: false, + params, + body: Array.isArray(body) ? blockStatement(body) : body, + loc + }); + const blockStatement = (body, loc) => ({ + type: 'BlockStatement', + body, + loc + }); + const constantDeclaration = (name, init, loc) => declaration(name, 'declaration', init, loc); + const declaration = (name, kind, init, loc) => ({ + type: 'VariableDeclaration', + declarations: [ + { + type: 'VariableDeclarator', + id: identifier(name), + init + } + ], + kind: 'declaration', + loc + }); + const identifier = (name, loc) => ({ + type: 'Identifier', + name, + loc + }); + const returnStatement = (argument, loc) => ({ + type: 'ReturnStatement', + argument, + loc + }); + const hasReturnStatement = (block) => { + let hasReturn = false; + for (const statement of block.body) { + if (isReturnStatement(statement)) { + hasReturn = true; + } + else if (isIfStatement(statement)) { + // Parser enforces that if/else have braces (block statement) + hasReturn = hasReturn || hasReturnStatementIf(statement); + } + else if (isBlockStatement(statement) || isStatementSequence$1(statement)) { + hasReturn = hasReturn && hasReturnStatement(statement); + } + } + return hasReturn; + }; + const isReturnStatement = (node) => { + return node.type == 'ReturnStatement'; + }; + const isIfStatement = (node) => { + return node.type == 'IfStatement'; + }; + const hasReturnStatementIf = (statement) => { + let hasReturn = true; + // Parser enforces that if/else have braces (block statement) + hasReturn = hasReturn && hasReturnStatement(statement.consequent); + if (statement.alternate) { + if (isIfStatement(statement.alternate)) { + hasReturn = hasReturn && hasReturnStatementIf(statement.alternate); + } + else if (isBlockStatement(statement.alternate) || isStatementSequence$1(statement.alternate)) { + hasReturn = hasReturn && hasReturnStatement(statement.alternate); + } + } + return hasReturn; + }; + const isStatementSequence$1 = (node) => { + return node.type == 'StatementSequence'; + }; + const literal = (value, loc) => ({ + type: 'Literal', + value, + loc + }); + + /** + * The heap stores all objects in each environment. + */ + class Heap { + constructor() { + this.storage = null; + } + add(...items) { + var _a; + (_a = this.storage) !== null && _a !== void 0 ? _a : (this.storage = new Set()); + for (const item of items) { + this.storage.add(item); + } + } + /** Checks the existence of `item` in the heap. */ + contains(item) { + var _a, _b; + return (_b = (_a = this.storage) === null || _a === void 0 ? void 0 : _a.has(item)) !== null && _b !== void 0 ? _b : false; + } + /** Gets the number of items in the heap. */ + size() { + var _a, _b; + return (_b = (_a = this.storage) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0; + } + /** + * Removes `item` from current heap and adds it to `otherHeap`. + * If the current heap does not contain `item`, nothing happens. + * @returns whether the item transfer is successful + */ + move(item, otherHeap) { + if (!this.contains(item)) + return false; + this.storage.delete(item); + otherHeap.add(item); + return true; + } + /** Returns a copy of the heap's contents. */ + getHeap() { + return new Set(this.storage); + } + } + + const uniqueId = (context) => { + return `${context.runtime.objectCount++}`; + }; + const createEnvironment = (context, closure, args, callExpression) => { + const environment = { + // TODO: name + name: '', + tail: closure.environment, + head: {}, + heap: new Heap(), + id: uniqueId(context), + callExpression: Object.assign({}, callExpression) + }; + // console.info('closure.node.params:', closure.node.params); + // console.info('Number of params:', closure.node.params.length); + closure.node.params.forEach((param, index) => { + if (isRestElement(param)) { + const array = args.slice(index); + handleArrayCreation(context, array, environment); + environment.head[param.argument.name] = array; + } + else { + environment.head[param.name] = args[index]; + } + }); + return environment; + }; + const createSimpleEnvironment = (context, name, tail = null) => { + return { + id: uniqueId(context), + name, + tail, + head: {}, + heap: new Heap(), + // callExpression 和 thisContext 可选,根据需要传递 + }; + }; + const createProgramEnvironment = (context, isPrelude) => { + return createSimpleEnvironment(context, isPrelude ? 'prelude' : 'programEnvironment'); + }; + const createBlockEnvironment = (context, name = 'blockEnvironment') => { + return { + name, + tail: currentEnvironment(context), + head: {}, + heap: new Heap(), + id: uniqueId(context) + }; + }; + const isRestElement = (node) => { + return node.type === 'RestElement'; + }; + const handleArrayCreation = (context, array, envOverride) => { + const environment = envOverride !== null && envOverride !== void 0 ? envOverride : currentEnvironment(context); + Object.defineProperties(array, { + id: { value: uniqueId(context) }, + environment: { value: environment, writable: true } + }); + environment.heap.add(array); // 假设 heap.add 已定义 + }; + const currentEnvironment = (context) => { + return context.runtime.environments[0]; + }; + const popEnvironment = (context) => context.runtime.environments.shift(); + const pushEnvironment = (context, environment) => { + context.runtime.environments.unshift(environment); + context.runtime.environmentTree.insert(environment); + }; + + var InstrType; + (function (InstrType) { + InstrType["RESET"] = "Reset"; + InstrType["WHILE"] = "While"; + InstrType["FOR"] = "For"; + InstrType["ASSIGNMENT"] = "Assignment"; + InstrType["ANN_ASSIGNMENT"] = "AnnAssignment"; + InstrType["APPLICATION"] = "Application"; + InstrType["UNARY_OP"] = "UnaryOperation"; + InstrType["BINARY_OP"] = "BinaryOperation"; + InstrType["BOOL_OP"] = "BoolOperation"; + InstrType["COMPARE"] = "Compare"; + InstrType["CALL"] = "Call"; + InstrType["RETURN"] = "Return"; + InstrType["BREAK"] = "Break"; + InstrType["CONTINUE"] = "Continue"; + InstrType["IF"] = "If"; + InstrType["FUNCTION_DEF"] = "FunctionDef"; + InstrType["LAMBDA"] = "Lambda"; + InstrType["MULTI_LAMBDA"] = "MultiLambda"; + InstrType["GROUPING"] = "Grouping"; + InstrType["LITERAL"] = "Literal"; + InstrType["VARIABLE"] = "Variable"; + InstrType["TERNARY"] = "Ternary"; + InstrType["PASS"] = "Pass"; + InstrType["ASSERT"] = "Assert"; + InstrType["IMPORT"] = "Import"; + InstrType["GLOBAL"] = "Global"; + InstrType["NONLOCAL"] = "NonLocal"; + InstrType["Program"] = "Program"; + InstrType["BRANCH"] = "Branch"; + InstrType["POP"] = "Pop"; + InstrType["ENVIRONMENT"] = "environment"; + InstrType["MARKER"] = "marker"; + })(InstrType || (InstrType = {})); + + const popInstr = (srcNode) => ({ instrType: InstrType.POP, srcNode }); + const assmtInstr = (symbol, constant, declaration, srcNode) => ({ + instrType: InstrType.ASSIGNMENT, + symbol, + constant, + declaration, + srcNode + }); + const appInstr = (numOfArgs, srcNode) => ({ + instrType: InstrType.APPLICATION, + numOfArgs, + srcNode + }); + const envInstr = (env, srcNode) => ({ + instrType: InstrType.ENVIRONMENT, + env, + srcNode + }); + const markerInstr = (srcNode) => ({ + instrType: InstrType.MARKER, + srcNode + }); + const binOpInstr = (symbol, srcNode) => ({ + instrType: InstrType.BINARY_OP, + symbol, + srcNode + }); + const resetInstr = (srcNode) => ({ + instrType: InstrType.RESET, + srcNode + }); + const branchInstr = (consequent, alternate, srcNode) => ({ + instrType: InstrType.BRANCH, + consequent, + alternate, + srcNode + }); + const conditionalExpression = (test, consequent, alternate, loc) => ({ + type: 'ConditionalExpression', + test, + consequent, + alternate, + loc + }); + const unOpInstr = (symbol, srcNode) => ({ + instrType: InstrType.UNARY_OP, + symbol, + srcNode + }); + + // closure.ts + class Closure { + constructor(node, environment, context, predefined = false) { + this.node = node; + this.environment = environment; + this.context = context; + this.predefined = predefined; + this.originalNode = node; + } + static makeFromArrowFunction(node, environment, context, dummyReturn = false, predefined = false) { + const functionBody = !isBlockStatement(node.body) && !isStatementSequence(node.body) + ? blockStatement([returnStatement(node.body, node.body.loc)], node.body.loc) + : dummyReturn && !hasReturnStatement(node.body) + ? blockStatement([ + ...node.body.body, + returnStatement(identifier('undefined', node.body.loc), node.body.loc) + ], node.body.loc) + : node.body; + const closure = new Closure(blockArrowFunction(node.params, functionBody, node.loc), environment, context, predefined); + closure.originalNode = node; + return closure; + } + } + const isStatementSequence = (node) => { + return node.type == 'StatementSequence'; + }; + + // todo + // just put on here temporarily + const UNKNOWN_LOCATION = { + start: { + line: -1, + column: -1 + }, + end: { + line: -1, + column: -1 + } + }; + class RuntimeSourceError { + constructor(node) { + var _a; + this.type = ErrorType.RUNTIME; + this.severity = ErrorSeverity.ERROR; + this.message = 'Error'; + this.location = (_a = node === null || node === void 0 ? void 0 : node.loc) !== null && _a !== void 0 ? _a : UNKNOWN_LOCATION; + } + explain() { + return ''; + } + elaborate() { + return this.explain(); + } + } + + class TypeConcatenateError extends RuntimeSourceError { + constructor(node) { + super(node); + this.type = ErrorType.TYPE; + } + explain() { + return `TypeError: can only concatenate str (not "int") to str.`; + } + elaborate() { + return `You are trying to concatenate a string with an integer. To fix this, convert the integer to a string using str(), or ensure both operands are of the same type.`; + } + } + class MissingRequiredPositionalError extends RuntimeSourceError { + constructor(node, functionName, params, args) { + super(node); + this.type = ErrorType.TYPE; + this.functionName = functionName; + this.missingParamCnt = params.length - args.length; + const missingNames = []; + for (let i = args.length; i < params.length; i++) { + const param = params[i]; + missingNames.push("\'" + param.name + "\'"); + } + this.missingParamName = this.joinWithCommasAndAnd(missingNames); + } + explain() { + return `TypeError: ${this.functionName}() missing ${this.missingParamCnt} required positional argument: ${this.missingParamName}`; + } + elaborate() { + return `You called ${this.functionName}() without providing the required positional argument ${this.missingParamName}. Make sure to pass all required arguments when calling ${this.functionName}.`; + } + joinWithCommasAndAnd(names) { + if (names.length === 0) { + return ''; + } + else if (names.length === 1) { + return names[0]; + } + else if (names.length === 2) { + return `${names[0]} and ${names[1]}`; + } + else { + const last = names.pop(); + return `${names.join(', ')} and ${last}`; + } + } + } + class TooManyPositionalArgumentsError extends RuntimeSourceError { + constructor(node, functionName, params, args) { + super(node); + this.type = ErrorType.TYPE; + this.functionName = functionName; + this.expectedCount = params.length; + this.givenCount = args.length; + } + explain() { + return `TypeError: ${this.functionName}() takes ${this.expectedCount} positional arguments but ${this.givenCount} were given`; + } + elaborate() { + return `You called ${this.functionName}() with ${this.givenCount} positional arguments, but it only expects ${this.expectedCount}. Make sure to pass the correct number of arguments when calling ${this.functionName}.`; + } + } + + const isIdentifier = (node) => { + return node.name !== undefined; + }; + const setToTrue = (item) => { + item.isEnvDependent = true; + return item; + }; + const setToFalse = (item) => { + item.isEnvDependent = false; + return item; + }; + const propertySetter = new Map([ + // AST Nodes + [ + 'Program', + (item) => { + const node = item; + node.isEnvDependent = node.body.some(elem => isEnvDependent(elem)); + return node; + } + ], + ['Literal', setToFalse], + ['ImportDeclaration', setToFalse], + ['BreakStatement', setToFalse], + ['ContinueStatement', setToFalse], + ['DebuggerStatement', setToFalse], + ['VariableDeclaration', setToTrue], + ['FunctionDeclaration', setToTrue], + ['ArrowFunctionExpression', setToTrue], + ['Identifier', setToTrue], + [ + 'LogicalExpression', + (item) => { + const node = item; + node.isEnvDependent = isEnvDependent(node.left) || isEnvDependent(node.right); + return node; + } + ], + [ + 'BinaryExpression', + (item) => { + const node = item; + node.isEnvDependent = isEnvDependent(node.left) || isEnvDependent(node.right); + return node; + } + ], + [ + 'UnaryExpression', + (item) => { + const node = item; + node.isEnvDependent = isEnvDependent(node.argument); + return node; + } + ], + [ + 'ConditionalExpression', + (item) => { + const node = item; + node.isEnvDependent = + isEnvDependent(node.consequent) || + isEnvDependent(node.alternate) || + isEnvDependent(node.test); + return node; + } + ], + [ + 'MemberExpression', + (item) => { + const node = item; + node.isEnvDependent = isEnvDependent(node.property) || isEnvDependent(node.object); + return node; + } + ], + [ + 'ArrayExpression', + (item) => { + const node = item; + node.isEnvDependent = node.elements.some(elem => isEnvDependent(elem)); + return node; + } + ], + [ + 'AssignmentExpression', + (item) => { + const node = item; + node.isEnvDependent = isEnvDependent(node.left) || isEnvDependent(node.right); + return node; + } + ], + [ + 'ReturnStatement', + (item) => { + const node = item; + node.isEnvDependent = isEnvDependent(node.argument); + return node; + } + ], + [ + 'CallExpression', + (item) => { + const node = item; + node.isEnvDependent = + isEnvDependent(node.callee) || node.arguments.some(arg => isEnvDependent(arg)); + return node; + } + ], + [ + 'ExpressionStatement', + (item) => { + const node = item; + node.isEnvDependent = isEnvDependent(node.expression); + return node; + } + ], + [ + 'IfStatement', + (item) => { + const node = item; + node.isEnvDependent = + isEnvDependent(node.test) || + isEnvDependent(node.consequent) || + isEnvDependent(node.alternate); + return node; + } + ], + [ + 'ForStatement', + (item) => { + const node = item; + node.isEnvDependent = + isEnvDependent(node.body) || + isEnvDependent(node.init) || + isEnvDependent(node.test) || + isEnvDependent(node.update); + return node; + } + ], + [ + 'WhileStatement', + (item) => { + const node = item; + node.isEnvDependent = isEnvDependent(node.body) || isEnvDependent(node.test); + return node; + } + ], + [ + 'BlockStatement', + (item) => { + const node = item; + node.isEnvDependent = node.body.some(stm => isEnvDependent(stm)); + return node; + } + ], + [ + 'StatementSequence', + (item) => { + const node = item; + node.isEnvDependent = node.body.some(stm => isEnvDependent(stm)); + return node; + } + ], + ['ImportSpecifier', setToTrue], + ['ImportDefaultSpecifier', setToTrue], + // InstrType + [InstrType.RESET, setToFalse], + [InstrType.UNARY_OP, setToFalse], + [InstrType.BINARY_OP, setToFalse], + [InstrType.CONTINUE, setToFalse], + [InstrType.ASSIGNMENT, setToTrue], + [ + InstrType.WHILE, + (item) => { + const instr = item; + instr.isEnvDependent = isEnvDependent(instr.test) || isEnvDependent(instr.body); + return instr; + } + ], + [ + InstrType.FOR, + (item) => { + const instr = item; + instr.isEnvDependent = + isEnvDependent(instr.init) || + isEnvDependent(instr.test) || + isEnvDependent(instr.update) || + isEnvDependent(instr.body); + return instr; + } + ], + [ + InstrType.BRANCH, + (item) => { + const instr = item; + instr.isEnvDependent = isEnvDependent(instr.consequent) || isEnvDependent(instr.alternate); + return instr; + } + ] + ]); + /** + * Checks whether the evaluation of the given control item depends on the current environment. + * The item is also considered environment dependent if its evaluation introduces + * environment dependent items + * @param item The control item to be checked + * @return `true` if the item is environment depedent, else `false`. + */ + function isEnvDependent(item) { + var _a, _b; + if (item === null || item === undefined) { + return false; + } + // If result is already calculated, return it + if (item.isEnvDependent !== undefined) { + return item.isEnvDependent; + } + let setter; + if (isNode(item)) { + setter = propertySetter.get(item.type); + } + else if (isInstr(item)) { + setter = propertySetter.get(item.instrType); + } + if (setter) { + return (_b = (_a = setter(item)) === null || _a === void 0 ? void 0 : _a.isEnvDependent) !== null && _b !== void 0 ? _b : false; + } + return false; + } + // function isInstr(item: ControlItem): item is Instr & { isEnvDependent?: boolean } { + // return (item as Instr).instrType !== undefined; + // } + // export const envChanging = (command: ControlItem): boolean => { + // if (isNode(command)) { + // const type = command.type + // return ( + // type === 'Program' || + // type === 'BlockStatement' || + // type === 'ArrowFunctionExpression' || + // (type === 'ExpressionStatement' && command.expression.type === 'ArrowFunctionExpression') + // ) + // } else { + // const type = command.instrType + // return ( + // type === InstrType.ENVIRONMENT || + // type === InstrType.ARRAY_LITERAL || + // type === InstrType.ASSIGNMENT || + // type === InstrType.ARRAY_ASSIGNMENT || + // (type === InstrType.APPLICATION && (command as AppInstr).numOfArgs > 0) + // ) + // } + // } + const envChanging = (command) => { + if (isNode(command)) { + const type = command.type; + return (type === 'Program' || + type === 'BlockStatement' || + type === 'ArrowFunctionExpression' || + (type === 'ExpressionStatement' && command.expression.type === 'ArrowFunctionExpression')); + } + else if (isInstr(command)) { + command.instrType; + return (false); + } + else { + return false; + } + }; + function declareFunctionsAndVariables(context, node, environment) { + for (const statement of node.body) { + switch (statement.type) { + case 'VariableDeclaration': + declareVariables(context, statement, environment); + break; + case 'FunctionDeclaration': + // FunctionDeclaration is always of type constant + declareIdentifier(context, statement.id.name, statement, environment, true); + break; + } + } + } + function declareVariables(context, node, environment) { + for (const declaration of node.declarations) { + // Retrieve declaration type from node + const constant = node.kind === 'const'; + declareIdentifier(context, declaration.id.name, node, environment, constant); + } + } + function declareIdentifier(context, name, node, environment, constant = false) { + if (environment.head.hasOwnProperty(name)) { + Object.getOwnPropertyDescriptors(environment.head); + // return handleRuntimeError( + // context, + // new errors.VariableRedeclaration(node, name, descriptors[name].writable) + // ) + } + //environment.head[name] = constant ? UNASSIGNED_CONST : UNASSIGNED_LET + environment.head[name] = 'declaration'; + return environment; + } + const handleSequence = (seq) => { + const result = []; + let valueProduced = false; + for (const command of seq) { + //if (!isImportDeclaration(command)) { + if (valueProducing(command)) { + // Value producing statements have an extra pop instruction + if (valueProduced) { + result.push(popInstr(command)); + } + else { + valueProduced = true; + } + } + result.push(command); + //} + } + // Push statements in reverse order + return result.reverse(); + }; + const valueProducing = (command) => { + const type = command.type; + return (type !== 'VariableDeclaration' && + type !== 'FunctionDeclaration' && + type !== 'ContinueStatement' && + type !== 'BreakStatement' && + type !== 'DebuggerStatement' && + (type !== 'BlockStatement' || command.body.some(valueProducing))); + }; + function defineVariable(context, name, value, constant = false, node) { + const environment = currentEnvironment(context); + if (environment.head[name] !== 'declaration') ; + if (constant && value instanceof Closure) { + value.declaredName = name; + } + Object.defineProperty(environment.head, name, { + value, + writable: !constant, + enumerable: true + }); + return environment; + } + const getVariable = (context, name, node) => { + let environment = currentEnvironment(context); + while (environment) { + if (environment.head.hasOwnProperty(name)) { + if (environment.head[name] === 'declaration') ; + else { + return environment.head[name]; + } + } + else { + environment = environment.tail; + } + } + //return handleRuntimeError(context, new errors.UndefinedVariable(name, node)) + }; + const checkNumberOfArguments = (command, context, callee, args, exp) => { + if (callee instanceof Closure) { + // User-defined or Pre-defined functions + const params = callee.node.params; + // console.info("params: ", params); + // console.info("args: ", args); + //const hasVarArgs = params[params.length - 1]?.type === 'RestElement' + if (params.length > args.length) { + handleRuntimeError(context, new MissingRequiredPositionalError(command, callee.declaredName, params, args)); + } + else if (params.length !== args.length) { + handleRuntimeError(context, new TooManyPositionalArgumentsError(command, callee.declaredName, params, args)); + } + //} + // if (hasVarArgs ? params.length - 1 > args.length : params.length !== args.length) { + // // error + // // return handleRuntimeError( + // // context, + // // new errors.InvalidNumberOfArguments( + // // exp, + // // hasVarArgs ? params.length - 1 : params.length, + // // args.length, + // // hasVarArgs + // // ) + // // ) + // } + } + else { + // Pre-built functions + const hasVarArgs = callee.minArgsNeeded != undefined; + if (hasVarArgs ? callee.minArgsNeeded > args.length : callee.length !== args.length) ; + } + return undefined; + }; + const isInstr = (command) => { + return command.instrType !== undefined; + }; + const isSimpleFunction = (node) => { + if (node.body.type !== 'BlockStatement' && node.body.type !== 'StatementSequence') { + return true; + } + else { + const block = node.body; + return block.body.length === 1 && block.body[0].type === 'ReturnStatement'; + } + }; + const reduceConditional = (node) => { + return [branchInstr(node.consequent, node.alternate, node), node.test]; + }; + const handleRuntimeError = (context, error) => { + context.errors.push(error); + console.error(error.explain()); + console.error(error.elaborate()); + //console.log("Location:", `Line ${e.location.start.line}, Column ${e.location.start.column}`); + throw error; + }; + function pythonMod(a, b) { + const mod = a % b; + if ((mod >= 0 && b > 0) || (mod <= 0 && b < 0)) { + return mod; + } + else { + return mod + b; + } + } + function hasImportDeclarations(node) { + for (const statement of node.body) { + if (statement.type === 'ImportDeclaration') { + return true; + } + } + return false; + } + const isImportDeclaration = (node) => node.type === 'ImportDeclaration'; + function getModuleDeclarationSource(node) { + var _a, _b; + assert(typeof ((_a = node.source) === null || _a === void 0 ? void 0 : _a.value) === 'string', `Expected ${node.type} to have a source value of type string, got ${(_b = node.source) === null || _b === void 0 ? void 0 : _b.value}`); + return node.source.value; + } + class AssertionError extends RuntimeSourceError { + constructor(message) { + super(); + this.message = message; + } + explain() { + return this.message; + } + elaborate() { + return 'Please contact the administrators to let them know that this error has occurred'; + } + } + function assert(condition, message) { + if (!condition) { + throw new AssertionError(message); + } + } + + class Control extends Stack { + constructor(program) { + super(); + this.numEnvDependentItems = 0; + // Load program into control stack + program ? this.push(program) : null; + } + canAvoidEnvInstr() { + return this.numEnvDependentItems === 0; + } + // For testing purposes + getNumEnvDependentItems() { + return this.numEnvDependentItems; + } + pop() { + const item = super.pop(); + if (item !== undefined && isEnvDependent(item)) { + this.numEnvDependentItems--; + } + return item; + } + push(...items) { + const itemsNew = Control.simplifyBlocksWithoutDeclarations(...items); + itemsNew.forEach((item) => { + if (isEnvDependent(item)) { + this.numEnvDependentItems++; + } + }); + super.push(...itemsNew); + } + /** + * Before pushing block statements on the control stack, we check if the block statement has any declarations. + * If not, the block is converted to a StatementSequence. + * @param items The items being pushed on the control. + * @returns The same set of control items, but with block statements without declarations converted to StatementSequences. + * NOTE: this function handles any case where StatementSequence has to be converted back into BlockStatement due to type issues + */ + static simplifyBlocksWithoutDeclarations(...items) { + const itemsNew = []; + items.forEach(item => { + if (isNode(item) && isBlockStatement(item) && !hasDeclarations(item)) { + // Push block body as statement sequence + const seq = statementSequence(item.body, item.loc); + itemsNew.push(seq); + } + else { + itemsNew.push(item); + } + }); + return itemsNew; + } + copy() { + const newControl = new Control(); + const stackCopy = super.getStack(); + newControl.push(...stackCopy); + return newControl; + } + } + + class Stash extends Stack { + constructor() { + super(); + } + copy() { + const newStash = new Stash(); + const stackCopy = super.getStack(); + newStash.push(...stackCopy); + return newStash; + } + } + + // export function evaluateBinaryExpression(operator: BinaryOperator, left: any, right: any) { + // switch (operator) { + // case '+': + // return left + right + // case '-': + // return left - right + // case '*': + // return left * right + // case '/': + // return left / right + // case '%': + // return left % right + // case '===': + // return left === right + // case '!==': + // return left !== right + // case '<=': + // return left <= right + // case '<': + // return left < right + // case '>': + // return left > right + // case '>=': + // return left >= right + // default: + // return undefined + // } + // } + function evaluateUnaryExpression(operator, value) { + if (operator === '!') { + if (value.type === 'bool') { + return { + type: 'bool', + value: !(Boolean(value.value)) + }; + } + } + else if (operator === '-') { + if (value.type === 'bigint') { + return { + type: 'bigint', + value: -value.value + }; + } + else if (value.type === 'number') { + return { + type: 'number', + value: -Number(value.value) + }; + } + else ; + // else if (value.type === 'bool') { + // return { + // type: 'bigint', + // value: Boolean(value.value)?BigInt(-1):BigInt(0) + // }; + // } + } + else if (operator === 'typeof') { + // todo + return { + type: String, + value: typeof value.value + }; + } + else { + return value; + } + } + function evaluateBinaryExpression(context, identifier, left, right) { + //if(isIdentifier(identifier)){ + //if(identifier.name === '__py_adder') { + if (left.type === 'string' && right.type === 'string' && identifier.name === '__py_adder') { + if (isIdentifier(identifier) && identifier.name === '__py_adder') { + return { + type: 'string', + value: left.value + right.value + }; + } + else { + let ret_value; + if (identifier === '>') { + ret_value = left.value > right.value; + } + else if (identifier === '>=') { + ret_value = left.value >= right.value; + } + else if (identifier === '<') { + ret_value = left.value < right.value; + } + else if (identifier === '<=') { + ret_value = left.value <= right.value; + } + else if (identifier === '===') { + ret_value = left.value === right.value; + } + else if (identifier === '!==') { + ret_value = left.value !== right.value; + } + else ; + return { + type: 'bool', + value: ret_value + }; + } + } + else { + // numbers: only int and float, not bool + const numericTypes = ['number', 'bigint', 'complex']; //, 'bool' + if (!numericTypes.includes(left.type) || !numericTypes.includes(right.type)) ; + // if (left.type === 'bool') { + // left.type = 'bigint'; + // left.value = left.value?BigInt(1):BigInt(0); + // } + // if (right.type === 'bool') { + // right.type = 'bigint'; + // right.value = right.value?BigInt(1):BigInt(0); + // } + let originalLeft = { type: left.type, value: left.value }; + let originalRight = { type: right.type, value: right.value }; + if (left.type !== right.type) { + // left.type = 'number'; + // left.value = Number(left.value); + // right.type = 'number'; + // right.value = Number(right.value); + if (left.type === 'complex' || right.type === 'complex') { + left.type = 'complex'; + right.type = 'complex'; + left.value = PyComplexNumber.fromValue(left.value); + right.value = PyComplexNumber.fromValue(right.value); + } + else if (left.type === 'number' || right.type === 'number') { + left.type = 'number'; + right.type = 'number'; + left.value = Number(left.value); + right.value = Number(right.value); + } + } + let ret_value; + let ret_type = left.type; + if (isIdentifier(identifier)) { + if (identifier.name === '__py_adder') { + if (left.type === 'complex' || right.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.add(rightComplex); + } + else { + ret_value = left.value + right.value; + } + } + else if (identifier.name === '__py_minuser') { + if (left.type === 'complex' || right.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.sub(rightComplex); + } + else { + ret_value = left.value - right.value; + } + } + else if (identifier.name === '__py_multiplier') { + if (left.type === 'complex' || right.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.mul(rightComplex); + } + else { + ret_value = left.value * right.value; + } + } + else if (identifier.name === '__py_divider') { + if (left.type === 'complex' || right.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.div(rightComplex); + } + else { + if (right.value !== 0) { + ret_type = 'number'; + ret_value = Number(left.value) / Number(right.value); + } + } + } + else if (identifier.name === '__py_modder') { + if (left.type === 'complex') ; + ret_value = pythonMod(left.value, right.value); + } + else if (identifier.name === '__py_floorer') { + // TODO: floorer not in python now + ret_value = 0; + } + else if (identifier.name === '__py_powerer') { + if (left.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.pow(rightComplex); + } + else { + if (left.type === 'bigint' && right.value < 0) { + ret_value = Number(left.value) ** Number(right.value); + ret_type = 'number'; + } + else { + ret_value = left.value ** right.value; + } + } + } + else ; + } + else { + ret_type = 'bool'; + // one of them is complex, convert all to complex then compare + // for complex, only '==' and '!=' valid + if (left.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + if (identifier === '===') { + ret_value = leftComplex.equals(rightComplex); + } + else if (identifier === '!==') { + ret_value = !leftComplex.equals(rightComplex); + } + else ; + } + else if (originalLeft.type !== originalRight.type) { + let int_num; + let floatNum; + let compare_res; + if (originalLeft.type === 'bigint') { + int_num = originalLeft; + floatNum = originalRight; + compare_res = pyCompare(int_num, floatNum); + } + else { + int_num = originalRight; + floatNum = originalLeft; + compare_res = -pyCompare(int_num, floatNum); + } + if (identifier === '>') { + ret_value = compare_res > 0; + } + else if (identifier === '>=') { + ret_value = compare_res >= 0; + } + else if (identifier === '<') { + ret_value = compare_res < 0; + } + else if (identifier === '<=') { + ret_value = compare_res <= 0; + } + else if (identifier === '===') { + ret_value = compare_res === 0; + } + else if (identifier === '!==') { + ret_value = compare_res !== 0; + } + else ; + } + else { + if (identifier === '>') { + ret_value = left.value > right.value; + } + else if (identifier === '>=') { + ret_value = left.value >= right.value; + } + else if (identifier === '<') { + ret_value = left.value < right.value; + } + else if (identifier === '<=') { + ret_value = left.value <= right.value; + } + else if (identifier === '===') { + ret_value = left.value === right.value; + } + else if (identifier === '!==') { + ret_value = left.value !== right.value; + } + else ; + } + } + return { + type: ret_type, + value: ret_value + }; + } + } + function pyCompare(int_num, float_num) { + // int_num.value < float_num.value => -1 + // int_num.value = float_num.value => 0 + // int_num.value > float_num.value => 1 + // If float_num is positive Infinity, then int_num is considered smaller. + if (float_num.value === Infinity) { + return -1; + } + if (float_num.value === -Infinity) { + return 1; + } + const signInt = (int_num.value < 0) ? -1 : (int_num.value > 0 ? 1 : 0); + const signFlt = Math.sign(float_num.value); // -1, 0, or 1 + if (signInt < signFlt) + return -1; // e.g. int<0, float>=0 => int < float + if (signInt > signFlt) + return 1; // e.g. int>=0, float<0 => int > float + // Both have the same sign (including 0). + // If both are zero, treat them as equal. + if (signInt === 0 && signFlt === 0) { + return 0; + } + // Both are either positive or negative. + // If |int_num.value| is within 2^53, it can be safely converted to a JS number for an exact comparison. + const absInt = int_num.value < 0 ? -int_num.value : int_num.value; + const MAX_SAFE = 9007199254740991; // 2^53 - 1 + if (absInt <= MAX_SAFE) { + // Safe conversion to double. + const intAsNum = Number(int_num.value); + const diff = intAsNum - float_num.value; + if (diff === 0) + return 0; + return diff < 0 ? -1 : 1; + } + // For large integers exceeding 2^53, we need to distinguish more carefully. + // General idea: Determine the order of magnitude of float_num.value (via log10) and compare it with + // the number of digits of int_num.value. An approximate comparison can indicate whether + // int_num.value is greater or less than float_num.value. + // First, check if float_num.value is nearly zero (but not zero). + if (float_num.value === 0) { + // Although signFlt would be 0 and handled above, just to be safe: + return signInt; + } + const absFlt = Math.abs(float_num.value); + // Determine the order of magnitude. + const exponent = Math.floor(Math.log10(absFlt)); + // For example, if float_num.value = 3.333333e49, exponent = 49, indicating roughly 50 digits in its integer part. + // Get the decimal string representation of the absolute integer. + const intStr = absInt.toString(); + const intDigits = intStr.length; + // If exponent + 1 is less than intDigits, then |int_num.value| has more digits + // and is larger (if positive) or smaller (if negative) than float_num.value. + // Conversely, if exponent + 1 is greater than intDigits, int_num.value has fewer digits. + const integerPartLen = exponent + 1; + if (integerPartLen < intDigits) { + // length of int_num.value is larger => all positive => int_num.value > float_num.value + // => all negative => int_num.value < float_num.value + return (signInt > 0) ? 1 : -1; + } + else if (integerPartLen > intDigits) { + // length of int_num.value is smaller => all positive => int_num.value < float_num.value + // => all negative => int_num.value > float_num.value + return (signInt > 0) ? -1 : 1; + } + else { + // (5.2) If the number of digits is the same, they may be extremely close. + // Method: Convert float_num.value into an approximate BigInt string and perform a lexicographical comparison. + const floatApproxStr = approximateBigIntString(absFlt, 30); + const aTrim = intStr.replace(/^0+/, ''); + const bTrim = floatApproxStr.replace(/^0+/, ''); + // If lengths differ after trimming, the one with more digits is larger. + if (aTrim.length > bTrim.length) { + return (signInt > 0) ? 1 : -1; + } + else if (aTrim.length < bTrim.length) { + return (signInt > 0) ? -1 : 1; + } + else { + // Same length: use lexicographical comparison. + const cmp = aTrim.localeCompare(bTrim); + if (cmp === 0) { + return 0; + } + // cmp>0 => aTrim > bTrim => aVal > bVal + return (cmp > 0) ? (signInt > 0 ? 1 : -1) + : (signInt > 0 ? -1 : 1); + } + } + } + function approximateBigIntString(num, precision) { + // Use scientific notation to obtain a string in the form "3.333333333333333e+49" + const s = num.toExponential(precision); + // Split into mantissa and exponent parts. + // The regular expression matches strings of the form: /^([\d.]+)e([+\-]\d+)$/ + const match = s.match(/^([\d.]+)e([+\-]\d+)$/); + if (!match) { + // For extremely small or extremely large numbers, toExponential() should follow this format. + // As a fallback, return Math.floor(num).toString() + return Math.floor(num).toString(); + } + let mantissaStr = match[1]; // "3.3333333333..." + const exp = parseInt(match[2], 10); // e.g. +49 + // Remove the decimal point + mantissaStr = mantissaStr.replace('.', ''); + // Get the current length of the mantissa string + const len = mantissaStr.length; + // Calculate the required integer length: for exp ≥ 0, we want the integer part + // to have (1 + exp) digits. + const integerLen = 1 + exp; + if (integerLen <= 0) { + // This indicates num < 1 (e.g., exponent = -1, mantissa = "3" results in 0.xxx) + // For big integer comparison, such a number is very small, so simply return "0" + return "0"; + } + if (len < integerLen) { + // The mantissa is not long enough; pad with zeros at the end. + return mantissaStr.padEnd(integerLen, '0'); + } + // If the mantissa is too long, truncate it (this is equivalent to taking the floor). + // Rounding could be applied if necessary, but truncation is sufficient for comparison. + return mantissaStr.slice(0, integerLen); + } + + class CseError { + constructor(message) { + this.message = message; + } + } + + /** + * Python style dictionary + */ + class Dict { + constructor(internalMap = new Map()) { + this.internalMap = internalMap; + } + get size() { + return this.internalMap.size; + } + [Symbol.iterator]() { + return this.internalMap[Symbol.iterator](); + } + get(key) { + return this.internalMap.get(key); + } + set(key, value) { + return this.internalMap.set(key, value); + } + has(key) { + return this.internalMap.has(key); + } + /** + * Similar to how the python dictionary's setdefault function works: + * If the key is not present, it is set to the given value, then that value is returned + * Otherwise, `setdefault` returns the value stored in the dictionary without + * modifying it + */ + setdefault(key, value) { + if (!this.has(key)) { + this.set(key, value); + } + return this.get(key); + } + update(key, defaultVal, updater) { + const value = this.setdefault(key, defaultVal); + const newValue = updater(value); + this.set(key, newValue); + return newValue; + } + entries() { + return [...this.internalMap.entries()]; + } + forEach(func) { + this.internalMap.forEach((v, k) => func(k, v)); + } + /** + * Similar to `mapAsync`, but for an async mapping function that does not return any value + */ + forEachAsync(func) { + return __awaiter(this, void 0, void 0, function* () { + yield Promise.all(this.map((key, value, i) => func(key, value, i))); + }); + } + map(func) { + return this.entries().map(([k, v], i) => func(k, v, i)); + } + /** + * Using a mapping function that returns a promise, transform a map + * to another map with different keys and values. All calls to the mapping function + * execute asynchronously + */ + mapAsync(func) { + return Promise.all(this.map((key, value, i) => func(key, value, i))); + } + flatMap(func) { + return this.entries().flatMap(([k, v], i) => func(k, v, i)); + } + } + /** + * Convenience class for maps that store an array of values + */ + class ArrayMap extends Dict { + add(key, item) { + this.setdefault(key, []).push(item); + } + } + function filterImportDeclarations({ body }) { + return body.reduce(([importNodes, otherNodes], node) => { + if (!isImportDeclaration(node)) + return [importNodes, [...otherNodes, node]]; + const moduleName = getModuleDeclarationSource(node); + importNodes.add(moduleName, node); + return [importNodes, otherNodes]; + }, [new ArrayMap(), []]); + } + + /** + * This interpreter implements an explicit-control evaluator. + * + * Heavily adapted from https://github.com/source-academy/JSpike/ + */ + let cseFinalPrint = ""; + function addPrint(str) { + cseFinalPrint = cseFinalPrint + str + "\n"; + } + /** + * Function that returns the appropriate Promise given the output of CSE machine evaluating, depending + * on whether the program is finished evaluating, ran into a breakpoint or ran into an error. + * @param context The context of the program. + * @param value The value of CSE machine evaluating the program. + * @returns The corresponding promise. + */ + function CSEResultPromise(context, value) { + return new Promise((resolve, reject) => { + if (value instanceof CSEBreak) { + resolve({ status: 'suspended-cse-eval', context }); + } + else if (value instanceof CseError) { + resolve({ status: 'error' }); + } + else { + //const rep: Value = { type: "string", value: cseFinalPrint }; + const representation = new Representation(value); + resolve({ status: 'finished', context, value, representation }); + } + }); + } + /** + * Function to be called when a program is to be interpreted using + * the explicit control evaluator. + * + * @param program The program to evaluate. + * @param context The context to evaluate the program in. + * @param options Evaluation options. + * @returns The result of running the CSE machine. + */ + function evaluate(program, context, options = {}) { + // TODO: should call transformer like in js-slang + // seq.transform(program) + try { + context.runtime.isRunning = true; + context.control = new Control(program); + context.stash = new Stash(); + // Adaptation for new feature + const result = runCSEMachine$1(context, context.control, context.stash, options.envSteps, options.stepLimit, options.isPrelude); + const rep = { type: "string", value: cseFinalPrint }; + return rep; + } + catch (error) { + context.errors.push(new CseError(error.message)); + return { type: 'error', message: error.message }; + } + finally { + context.runtime.isRunning = false; + } + } + function evaluateImports(program, context) { + try { + const [importNodeMap] = filterImportDeclarations(program); + const environment = currentEnvironment(context); + for (const [moduleName, nodes] of importNodeMap) { + const functions = context.nativeStorage.loadedModules[moduleName]; + for (const node of nodes) { + for (const spec of node.specifiers) { + declareIdentifier(context, spec.local.name, node, environment); + let obj; + switch (spec.type) { + case 'ImportSpecifier': { + if (spec.imported.type === 'Identifier') { + obj = functions[spec.imported.name]; + } + else { + throw new Error(`Unexpected literal import: ${spec.imported.value}`); + } + //obj = functions[(spec.imported).name] + break; + } + case 'ImportDefaultSpecifier': { + obj = functions.default; + break; + } + case 'ImportNamespaceSpecifier': { + obj = functions; + break; + } + } + defineVariable(context, spec.local.name, obj, true, node); + } + } + } + } + catch (error) { + handleRuntimeError(context, error); + } + } + /** + * The primary runner/loop of the explicit control evaluator. + * + * @param context The context to evaluate the program in. + * @param control Points to the current Control stack. + * @param stash Points to the current Stash. + * @param envSteps Number of environment steps to run. + * @param stepLimit Maximum number of steps to execute. + * @param isPrelude Whether the program is the prelude. + * @returns The top value of the stash after execution. + */ + function runCSEMachine$1(context, control, stash, envSteps, stepLimit, isPrelude = false) { + const eceState = generateCSEMachineStateStream(context, control, stash, envSteps, stepLimit, isPrelude); + // Execute the generator until it completes + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const value of eceState) { + } + // Return the value at the top of the storage as the result + const result = stash.peek(); + return result !== undefined ? result : { type: 'undefined' }; + } + /** + * Generator function that yields the state of the CSE Machine at each step. + * + * @param context The context of the program. + * @param control The control stack. + * @param stash The stash storage. + * @param envSteps Number of environment steps to run. + * @param stepLimit Maximum number of steps to execute. + * @param isPrelude Whether the program is the prelude. + * @yields The current state of the stash, control stack, and step count. + */ + function* generateCSEMachineStateStream(context, control, stash, envSteps, stepLimit, isPrelude = false) { + // steps: number of steps completed + let steps = 0; + let command = control.peek(); + // Push first node to be evaluated into context. + // The typeguard is there to guarantee that we are pushing a node (which should always be the case) + if (command && isNode(command)) { + context.runtime.nodes.unshift(command); + } + while (command) { + // For local debug only + // console.info('next command to be evaluated'); + // console.info(command); + // Return to capture a snapshot of the control and stash after the target step count is reached + if (!isPrelude && steps === envSteps) { + yield { stash, control, steps }; + return; + } + // Step limit reached, stop further evaluation + if (!isPrelude && steps === stepLimit) { + break; + } + if (!isPrelude && envChanging(command)) { + // command is evaluated on the next step + // Hence, next step will change the environment + context.runtime.changepointSteps.push(steps + 1); + } + control.pop(); + if (isNode(command)) { + context.runtime.nodes.shift(); + context.runtime.nodes.unshift(command); + //checkEditorBreakpoints(context, command) + cmdEvaluators[command.type](command, context, control, stash, isPrelude); + if (context.runtime.break && context.runtime.debuggerOn) ; + } + else { + // Command is an instruction + cmdEvaluators[command.instrType](command, context, control, stash, isPrelude); + } + // Push undefined into the stack if both control and stash is empty + if (control.isEmpty() && stash.isEmpty()) ; + command = control.peek(); + steps += 1; + if (!isPrelude) { + context.runtime.envStepsTotal = steps; + } + // printEnvironmentVariables(context.runtime.environments); + yield { stash, control, steps }; + } + } + const cmdEvaluators = { + /** + * AST Nodes + */ + Program: function (command, context, control, stash, isPrelude) { + // Clean up non-global, non-program, and non-preparation environments + while (currentEnvironment(context).name !== 'global' && + currentEnvironment(context).name !== 'programEnvironment' && + currentEnvironment(context).name !== 'prelude') { + popEnvironment(context); + } + if (hasDeclarations(command) || hasImportDeclarations(command)) { + if (currentEnvironment(context).name != 'programEnvironment') { + const programEnv = createProgramEnvironment(context, isPrelude); + pushEnvironment(context, programEnv); + } + const environment = currentEnvironment(context); + evaluateImports(command, context); + declareFunctionsAndVariables(context, command, environment); + } + if (command.body.length === 1) { + // If the program contains only a single statement, execute it immediately + const next = command.body[0]; + cmdEvaluators[next.type](next, context, control, stash, isPrelude); + } + else { + // Push the block body as a sequence of statements onto the control stack + const seq = statementSequence(command.body, command.loc); + control.push(seq); + } + }, + BlockStatement: function (command, context, control) { + const next = control.peek(); + // for some of the block statements, such as if, for, + // no need to create a new environment + if (!command.skipEnv) { + // If environment instructions need to be pushed + if (next && + !(isInstr(next) && next.instrType === InstrType.ENVIRONMENT) && + !control.canAvoidEnvInstr()) { + control.push(envInstr(currentEnvironment(context), command)); + } + // create new block environment (for function) + const environment = createBlockEnvironment(context, 'blockEnvironment'); + declareFunctionsAndVariables(context, command, environment); + pushEnvironment(context, environment); + } + // Push the block body onto the control stack as a sequence of statements + const seq = statementSequence(command.body, command.loc); + control.push(seq); + }, + StatementSequence: function (command, context, control, stash, isPrelude) { + if (command.body.length === 1) { + // If the program contains only a single statement, execute it immediately + const next = command.body[0]; + cmdEvaluators[next.type](next, context, control, stash, isPrelude); + } + else { + // Split and push individual nodes + control.push(...handleSequence(command.body)); + } + }, + // WhileStatement: function ( + // command: es.WhileStatement, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // if (hasBreakStatement(command.body as es.BlockStatement)) { + // control.push(instr.breakMarkerInstr(command)); + // } + // control.push(instr.whileInstr(command.test, command.body, command)); + // control.push(command.test); + // control.push(ast.identifier('undefined', command.loc)); // 如果没有循环执行,返回 undefined + // }, + // ForStatement: function ( + // command: es.ForStatement, + // context: Context, + // control: Control + // ) { + // const init = command.init!; + // const test = command.test!; + // const update = command.update!; + // if (init.type === 'VariableDeclaration' && init.kind === 'let') { + // const id = init.declarations[0].id as es.Identifier; + // const valueExpression = init.declarations[0].init!; + // control.push( + // ast.blockStatement( + // [ + // init, + // ast.forStatement( + // ast.assignmentExpression(id, valueExpression, command.loc), + // test, + // update, + // ast.blockStatement( + // [ + // ast.variableDeclaration( + // [ + // ast.variableDeclarator( + // ast.identifier(`_copy_of_${id.name}`, command.loc), + // ast.identifier(id.name, command.loc), + // command.loc + // ) + // ], + // command.loc + // ), + // ast.blockStatement( + // [ + // ast.variableDeclaration( + // [ + // ast.variableDeclarator( + // ast.identifier(id.name, command.loc), + // ast.identifier(`_copy_of_${id.name}`, command.loc), + // command.loc + // ) + // ], + // command.loc + // ), + // command.body + // ], + // command.loc + // ) + // ], + // command.loc + // ), + // command.loc + // ) + // ], + // command.loc + // ) + // ); + // } else { + // if (hasBreakStatement(command.body as es.BlockStatement)) { + // control.push(instr.breakMarkerInstr(command)); + // } + // control.push(instr.forInstr(init, test, update, command.body, command)); + // control.push(test); + // control.push(instr.popInstr(command)); // Pop value from init assignment + // control.push(init); + // control.push(ast.identifier('undefined', command.loc)); // Return undefined if there is no loop execution + // } + // }, + IfStatement: function (command, //es.IfStatement, + context, control, stash) { + control.push(...reduceConditional(command)); + }, + ExpressionStatement: function (command, //es.ExpressionStatement, + context, control, stash, isPrelude) { + cmdEvaluators[command.expression.type](command.expression, context, control, stash, isPrelude); + }, + // DebuggerStatement: function ( + // command: es.DebuggerStatement, + // context: Context + // ) { + // context.runtime.break = true; + // }, + VariableDeclaration: function (command, context, control) { + const declaration = command.declarations[0]; + const id = declaration.id; + const init = declaration.init; + control.push(popInstr(command)); + control.push(assmtInstr(id.name, command.kind === 'const', true, command)); + control.push(init); + }, + FunctionDeclaration: function (command, //es.FunctionDeclaration, + context, control) { + const lambdaExpression = blockArrowFunction(command.params, command.body, command.loc); + const lambdaDeclaration = constantDeclaration(command.id.name, lambdaExpression, command.loc); + control.push(lambdaDeclaration); + }, + ReturnStatement: function (command, //as es.ReturnStatement, + context, control) { + const next = control.peek(); + if (next && isInstr(next) && next.instrType === InstrType.MARKER) { + control.pop(); + } + else { + control.push(resetInstr(command)); + } + if (command.argument) { + control.push(command.argument); + } + }, + // ContinueStatement: function ( + // command: es.ContinueStatement, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // control.push(instr.contInstr(command)); + // }, + // BreakStatement: function ( + // command: es.BreakStatement, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // control.push(instr.breakInstr(command)); + // }, + ImportDeclaration: function () { }, + /** + * Expressions + */ + Literal: function (command, //es.Literal + context, control, stash) { + const literalValue = command.value; + const bigintValue = command.bigint; + const complexValue = command.complex; + if (literalValue !== undefined) { + let value; + if (typeof literalValue === 'number') { + value = { type: 'number', value: literalValue }; + } + else if (typeof literalValue === 'string') { + value = { type: 'string', value: literalValue }; + } + else if (typeof literalValue === 'boolean') { + value = { type: 'bool', value: literalValue }; + //value = literalValue; + } + else { + //handleRuntimeError(context, new CseError('Unsupported literal type')); + return; + } + stash.push(value); + } + else if (bigintValue !== undefined) { + let fixedBigintValue = bigintValue.toString().replace(/_/g, ""); + let value; + try { + value = { type: 'bigint', value: BigInt(fixedBigintValue) }; + } + catch (e) { + //handleRuntimeError(context, new CseError('Invalid BigInt literal')); + return; + } + stash.push(value); + } + else if (complexValue !== undefined) { + let value; + let pyComplexNumber = new PyComplexNumber(complexValue.real, complexValue.imag); + try { + value = { type: 'complex', value: pyComplexNumber }; + } + catch (e) { + //handleRuntimeError(context, new CseError('Invalid BigInt literal')); + return; + } + stash.push(value); + } + else ; + }, + NoneType: function (command, //es.Literal + context, control, stash) { + stash.push({ type: 'NoneType', value: undefined }); + }, + // AssignmentExpression: function ( + // command: es.AssignmentExpression, + // context: Context, + // control: Control + // ) { + // if (command.left.type === 'MemberExpression') { + // control.push(instr.arrAssmtInstr(command)); + // control.push(command.right); + // control.push(command.left.property); + // control.push(command.left.object); + // } else if (command.left.type === 'Identifier') { + // const id = command.left; + // control.push(instr.assmtInstr(id.name, false, false, command)); + // control.push(command.right); + // } + // }, + // ArrayExpression: function ( + // command: es.ArrayExpression, + // context: Context, + // control: Control + // ) { + // const elems = command.elements as es.Expression[]; + // reverse(elems); + // const len = elems.length; + // control.push(instr.arrLitInstr(len, command)); + // for (const elem of elems) { + // control.push(elem); + // } + // }, + // MemberExpression: function ( + // command: es.MemberExpression, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // control.push(instr.arrAccInstr(command)); + // control.push(command.property); + // control.push(command.object); + // }, + ConditionalExpression: function (command, //es.ConditionalExpression, + context, control, stash) { + control.push(...reduceConditional(command)); + }, + Identifier: function (command, //es.Identifier, + context, control, stash) { + if (builtInConstants.has(command.name)) { + const builtinCons = builtInConstants.get(command.name); + try { + stash.push(builtinCons); + return; + } + catch (error) { + // Error + if (error instanceof Error) { + throw new Error(error.message); + } + else { + throw new Error(); + } + // if (error instanceof RuntimeSourceError) { + // throw error; + // } else { + // throw new RuntimeSourceError(`Error in builtin function ${funcName}: ${error}`); + // } + } + } + else { + stash.push(getVariable(context, command.name)); + } + }, + UnaryExpression: function (command, //es.UnaryExpression, + context, control) { + control.push(unOpInstr(command.operator, command)); + control.push(command.argument); + }, + BinaryExpression: function (command, //es.BinaryExpression, + context, control) { + // currently for if statement + control.push(binOpInstr(command.operator, command)); + control.push(command.right); + control.push(command.left); + }, + LogicalExpression: function (command, //es.LogicalExpression, + context, control) { + if (command.operator === '&&') { + control.push(conditionalExpression(command.left, command.right, literal(false), command.loc)); + } + else { + control.push(conditionalExpression(command.left, literal(true), command.right, command.loc)); + } + }, + ArrowFunctionExpression: function (command, //es.ArrowFunctionExpression, + context, control, stash, isPrelude) { + const closure = Closure.makeFromArrowFunction(command, currentEnvironment(context), context, true, isPrelude); + stash.push(closure); + }, + CallExpression: function (command, //es.CallExpression, + context, control) { + // add + if (isIdentifier(command.callee)) { + let name = command.callee.name; + if (name === '__py_adder' || name === '__py_minuser' || + name === '__py_multiplier' || name === '__py_divider' || + name === '__py_modder' || name === '__py_floorer' || + name === '__py_powerer') { + control.push(binOpInstr(command.callee, command)); + control.push(command.arguments[1]); + control.push(command.arguments[0]); + return; + } + } + control.push(appInstr(command.arguments.length, command)); + for (let index = command.arguments.length - 1; index >= 0; index--) { + control.push(command.arguments[index]); + } + control.push(command.callee); + }, + // /** + // * Instructions + // */ + [InstrType.RESET]: function (command, //Instr, + context, control, stash) { + const cmdNext = control.pop(); + if (cmdNext && (isNode(cmdNext) || cmdNext.instrType !== InstrType.MARKER)) { + control.push(resetInstr(command.srcNode)); + } + }, + // [InstrType.WHILE]: function ( + // command: WhileInstr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const test = stash.pop(); + // const error = rttc.checkIfStatement(command.srcNode, test, context.chapter); + // if (error) { + // handleRuntimeError(context, error); + // } + // if (test) { + // control.push(command); + // control.push(command.test); + // if (hasContinueStatement(command.body as es.BlockStatement)) { + // control.push(instr.contMarkerInstr(command.srcNode)); + // } + // if (!valueProducing(command.body)) { + // control.push(ast.identifier('undefined', command.body.loc)); + // } + // control.push(command.body); + // control.push(instr.popInstr(command.srcNode)); // Pop previous body value + // } + // }, + // [InstrType.FOR]: function ( + // command: ForInstr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const test = stash.pop(); + // const error = rttc.checkIfStatement(command.srcNode, test, context.chapter); + // if (error) { + // handleRuntimeError(context, error); + // } + // if (test) { + // control.push(command); + // control.push(command.test); + // control.push(instr.popInstr(command.srcNode)); // Pop value from update + // control.push(command.update); + // if (hasContinueStatement(command.body as es.BlockStatement)) { + // control.push(instr.contMarkerInstr(command.srcNode)); + // } + // if (!valueProducing(command.body)) { + // control.push(ast.identifier('undefined', command.body.loc)); + // } + // control.push(command.body); + // control.push(instr.popInstr(command.srcNode)); // Pop previous body value + // } + // }, + [InstrType.ASSIGNMENT]: function (command, //AssmtInstr, + context, control, stash) { + if (command.declaration) { + //if () + defineVariable(context, command.symbol, stash.peek(), command.constant, command.srcNode); + } + }, + [InstrType.UNARY_OP]: function (command, //UnOpInstr, + context, control, stash) { + const argument = stash.pop(); + // const error = rttc.checkUnaryExpression( + // command.srcNode, + // command.symbol as es.UnaryOperator, + // argument, + // context.chapter + // ); + // if (error) { + // handleRuntimeError(context, error); + // } + stash.push(evaluateUnaryExpression(command.symbol, argument)); + }, + [InstrType.BINARY_OP]: function (command, //BinOpInstr, + context, control, stash) { + const right = stash.pop(); + const left = stash.pop(); + // const error = rttc.checkBinaryExpression( + // command.srcNode, + // command.symbol as es.BinaryOperator, + // context.chapter, + // left, + // right + // ); + // if (error) { + // handleRuntimeError(context, error); + // } + if ((left.type === 'string' && right.type !== 'string') || + (left.type !== 'string' && right.type === 'string')) { + handleRuntimeError(context, new TypeConcatenateError(command)); + } + stash.push(evaluateBinaryExpression(context, command.symbol, left, right)); + }, + [InstrType.POP]: function (command, //Instr, + context, control, stash) { + stash.pop(); + }, + [InstrType.APPLICATION]: function (command, //AppInstr, + context, control, stash) { + var _a; + const args = []; + for (let index = 0; index < command.numOfArgs; index++) { + args.unshift(stash.pop()); + } + const func = stash.pop(); + // continuation in python? + // func instanceof Closure + if (func instanceof Closure) { + // Check for number of arguments mismatch error + checkNumberOfArguments(command, context, func, args, command.srcNode); + const next = control.peek(); + // Push ENVIRONMENT instruction if needed - if next control stack item + // exists and is not an environment instruction, OR the control only contains + // environment indepedent items + if (next && + !(isInstr(next) && next.instrType === InstrType.ENVIRONMENT) && + !control.canAvoidEnvInstr()) { + control.push(envInstr(currentEnvironment(context), command.srcNode)); + } + // Create environment for function parameters if the function isn't nullary. + // Name the environment if the function call expression is not anonymous + if (args.length > 0) { + const environment = createEnvironment(context, func, args, command.srcNode); + pushEnvironment(context, environment); + } + else { + context.runtime.environments.unshift(func.environment); + } + // Handle special case if function is simple + if (isSimpleFunction(func.node)) { + // Closures convert ArrowExpressionStatements to BlockStatements + const block = func.node.body; + const returnStatement = block.body[0]; + control.push((_a = returnStatement.argument) !== null && _a !== void 0 ? _a : identifier('undefined', returnStatement.loc)); + } + else { + if (control.peek()) { + // push marker if control not empty + control.push(markerInstr(command.srcNode)); + } + control.push(func.node.body); + // console.info((func as Closure).node.body); + } + return; + } + // Value is a built-in function + let function_name = command.srcNode.callee.name; + if (builtIns.has(function_name)) { + const builtinFunc = builtIns.get(function_name); + try { + stash.push(builtinFunc(args)); + return; + } + catch (error) { + // Error + if (error instanceof Error) { + throw new Error(error.message); + } + else { + throw new Error(); + } + // if (error instanceof RuntimeSourceError) { + // throw error; + // } else { + // throw new RuntimeSourceError(`Error in builtin function ${funcName}: ${error}`); + // } + } + } + }, + [InstrType.BRANCH]: function (command, //BranchInstr, + context, control, stash) { + const test = stash.pop(); + // const error = rttc.checkIfStatement(command.srcNode, test, context.chapter); + // if (error) { + // handleRuntimeError(context, error); + // } + if (test.value) { + if (!valueProducing(command.consequent)) { + control.push(identifier('undefined', command.consequent.loc)); + } + command.consequent.skipEnv = true; + control.push(command.consequent); + } + else if (command.alternate) { + if (!valueProducing(command.alternate)) { + control.push(identifier('undefined', command.alternate.loc)); + } + command.alternate.skipEnv = true; + control.push(command.alternate); + } + else { + control.push(identifier('undefined', command.srcNode.loc)); + } + }, + [InstrType.ENVIRONMENT]: function (command, //EnvInstr, + context) { + while (currentEnvironment(context).id !== command.env.id) { + popEnvironment(context); + } + }, + // [InstrType.ARRAY_LITERAL]: function ( + // command: ArrLitInstr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const arity = command.arity; + // const array: any[] = []; + // for (let i = 0; i < arity; ++i) { + // array.unshift(stash.pop()); + // } + // handleArrayCreation(context, array); + // stash.push(array); + // }, + // [InstrType.ARRAY_ACCESS]: function ( + // command: Instr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const index = stash.pop(); + // const array = stash.pop(); + // stash.push(array[index]); + // }, + // [InstrType.ARRAY_ASSIGNMENT]: function ( + // command: Instr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const value = stash.pop(); + // const index = stash.pop(); + // const array = stash.pop(); + // array[index] = value; + // stash.push(value); + // }, + // [InstrType.CONTINUE]: function ( + // command: Instr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const next = control.pop() as ControlItem; + // if (isInstr(next) && next.instrType === InstrType.CONTINUE_MARKER) { + // } else if (isInstr(next) && next.instrType === InstrType.ENVIRONMENT) { + // control.push(command); + // control.push(next); + // } else { + // control.push(command); + // } + // }, + // [InstrType.CONTINUE_MARKER]: function () { + // }, + // [InstrType.BREAK]: function ( + // command: Instr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const next = control.pop() as ControlItem; + // if (isInstr(next) && next.instrType === InstrType.BREAK_MARKER) { + // } else if (isInstr(next) && next.instrType === InstrType.ENVIRONMENT) { + // control.push(command); + // control.push(next); + // } else { + // control.push(command); + // } + // }, + // [InstrType.BREAK_MARKER]: function () { + // } + }; + + // npm install mathjs + /* + Create a map to hold built-in constants. + Each constant is stored with a string key and its corresponding value object. + */ + const builtInConstants = new Map(); + const math_e = { type: 'number', value: Math.E }; + const math_inf = { type: 'number', value: Infinity }; + const math_nan = { type: 'number', value: NaN }; + const math_pi = { type: 'number', value: Math.PI }; + const math_tau = { type: 'number', value: 2 * Math.PI }; + builtInConstants.set('math_e', math_e); + builtInConstants.set('math_inf', math_inf); + builtInConstants.set('math_nan', math_nan); + builtInConstants.set('math_pi', math_pi); + builtInConstants.set('math_tau', math_tau); + /* + Create a map to hold built-in functions. + The keys are strings (function names) and the values are functions that can take any arguments. + */ + const builtIns = new Map(); + builtIns.set('_int', _int); + builtIns.set('_int_from_string', _int_from_string); + builtIns.set('abs', abs); + builtIns.set('char_at', char_at); + builtIns.set('error', error); + builtIns.set('input', input); + builtIns.set('isinstance', isinstance); + builtIns.set('math_acos', math_acos); + builtIns.set('math_acosh', math_acosh); + builtIns.set('math_asin', math_asin); + builtIns.set('math_asinh', math_asinh); + builtIns.set('math_atan', math_atan); + builtIns.set('math_atan2', math_atan2); + builtIns.set('math_atanh', math_atanh); + builtIns.set('math_cbrt', math_cbrt); + builtIns.set('math_ceil', math_ceil); + builtIns.set('math_comb', math_comb); + builtIns.set('math_copysign', math_copysign); + builtIns.set('math_cos', math_cos); + builtIns.set('math_cosh', math_cosh); + builtIns.set('math_degrees', math_degrees); + builtIns.set('math_erf', math_erf); + builtIns.set('math_erfc', math_erfc); + builtIns.set('math_exp', math_exp); + builtIns.set('math_exp2', math_exp2); + builtIns.set('math_expm1', math_expm1); + builtIns.set('math_fabs', math_fabs); + builtIns.set('math_factorial', math_factorial); + builtIns.set('math_floor', math_floor); + builtIns.set('math_fma', math_fma); + builtIns.set('math_fmod', math_fmod); + builtIns.set('math_gamma', math_gamma); + builtIns.set('math_lgamma', math_lgamma); + builtIns.set('math_gcd', math_gcd); + builtIns.set('math_isfinite', math_isfinite); + builtIns.set('math_isinf', math_isinf); + builtIns.set('math_isnan', math_isnan); + builtIns.set('math_isqrt', math_isqrt); + builtIns.set('math_lcm', math_lcm); + builtIns.set('math_ldexp', math_ldexp); + builtIns.set('math_log', math_log); + builtIns.set('math_log10', math_log10); + builtIns.set('math_log1p', math_log1p); + builtIns.set('math_log2', math_log2); + builtIns.set('math_nextafter', math_nextafter); + builtIns.set('math_perm', math_perm); + builtIns.set('math_pow', math_pow); + builtIns.set('math_radians', math_radians); + builtIns.set('math_remainder', math_remainder); + builtIns.set('math_sin', math_sin); + builtIns.set('math_sinh', math_sinh); + builtIns.set('math_sqrt', math_sqrt); + builtIns.set('math_tan', math_tan); + builtIns.set('math_tanh', math_tanh); + builtIns.set('math_trunc', math_trunc); + builtIns.set('math_ulp', math_ulp); + builtIns.set('max', max); + builtIns.set('min', min); + builtIns.set('print', print); + builtIns.set('random_random', random_random); + builtIns.set('round', round); + builtIns.set('str', str); + builtIns.set('time_time', time_time); + function _int(args) { + if (args.length === 0) { + return { type: 'bigint', value: '0' }; + } + if (args.length > 1) { + throw new Error(`_int() expects at most 1 argument, but got ${args.length}`); + } + const arg = args[0]; + // If the value is a number, use Math.trunc to truncate toward zero. + if (arg.type === 'number') { + const truncated = Math.trunc(arg.value); + return { type: 'bigint', value: BigInt(truncated) }; + } + // If the value is a bigint, simply return the same value. + if (arg.type === 'bigint') { + return { type: 'bigint', value: arg.value }; + } + throw new Error(`_int() expects a numeric argument (number or bigint), but got ${arg.type}`); + } + function _int_from_string(args) { + if (args.length < 1) { + throw new Error(`_int_from_string() expects at least 1 argument, but got 0`); + } + if (args.length > 2) { + throw new Error(`_int_from_string() expects at most 2 arguments, but got ${args.length}`); + } + const strVal = args[0]; + if (strVal.type !== 'string') { + throw new Error(`_int_from_string: first argument must be a string, got ${strVal.type}`); + } + let base = 10; + if (args.length === 2) { + // The second argument must be either a bigint or a number (it will be converted to a number for uniform processing). + const baseVal = args[1]; + if (baseVal.type === 'bigint') { + base = Number(baseVal.value); + } + else { + throw new Error(`_int_from_string: second argument must be an integer (number or bigint), got ${baseVal.type}`); + } + } + // base should be in between 2 and 36 + if (base < 2 || base > 36) { + throw new Error(`_int_from_string: base must be in [2..36], got ${base}`); + } + let str = strVal.value; + str = str.trim(); + str = str.replace(/_/g, ''); + // Parse the sign (determine if the value is positive or negative) + let sign = BigInt(1); + if (str.startsWith('+')) { + str = str.slice(1); + } + else if (str.startsWith('-')) { + sign = BigInt(-1); + str = str.slice(1); + } + // The remaining portion must consist of valid characters for the specified base. + const parsedNumber = parseInt(str, base); + if (isNaN(parsedNumber)) { + throw new Error(`_int_from_string: cannot parse "${strVal.value}" with base ${base}`); + } + const result = sign * BigInt(parsedNumber); + return { type: 'bigint', value: result }; + } + function abs(args) { + if (args.length !== 1) { + throw new Error(`abs expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + switch (x.type) { + case 'bigint': { + const intVal = x.value; + const result = intVal < 0 ? -intVal : intVal; + return { type: 'int', value: result }; + } + case 'number': { + return { type: 'number', value: Math.abs(x.value) }; + } + case 'complex': { + // Calculate the modulus (absolute value) of a complex number. + const real = x.value.real; + const imag = x.value.imag; + const modulus = Math.sqrt(real * real + imag * imag); + return { type: 'number', value: modulus }; + } + default: + throw new Error(`abs: unsupported type ${x.type}`); + } + } + function toStr(val) { + return String(val.value); + } + function error(args) { + const output = "Error: " + args.map(arg => toStr(arg)).join(' ') + '\n'; + throw new Error(output); + } + function isinstance(args) { + if (args.length !== 2) { + throw new Error(`isinstance expects exactly 2 arguments, but got ${args.length}`); + } + const obj = args[0]; + const classinfo = args[1]; + let expectedType; + if (classinfo.type === 'string') { + switch (classinfo.value) { + case 'int': + expectedType = 'bigint'; + break; + case 'float': + expectedType = 'number'; + break; + case 'string': + expectedType = 'string'; + break; + case 'bool': + expectedType = 'bool'; + break; + case 'complex': + expectedType = 'complex'; + break; + case 'NoneType': + expectedType = 'NoneType'; + break; + default: + throw new Error(`isinstance: unknown type '${classinfo.value}'`); + } + } + else { + // TODO: If the value is not in string format, additional handling can be added as needed. + throw new Error(`isinstance: second argument must be a string representing a type, got ${classinfo.type}`); + } + const result = obj.type === expectedType; + return { type: 'bool', value: result }; + } + function math_acos(args) { + if (args.length !== 1) { + throw new Error(`math_acos expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_acos: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + if (num < -1 || num > 1) { + throw new Error(`math_acos: argument must be in the interval [-1, 1], but got ${num}`); + } + const result = Math.acos(num); + return { type: 'number', value: result }; + } + function math_acosh(args) { + if (args.length !== 1) { + throw new Error(`math_acosh expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_acosh: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + if (num < 1) { + throw new Error(`math_acosh: argument must be greater than or equal to 1, but got ${num}`); + } + const result = Math.acosh(num); + return { type: 'number', value: result }; + } + function math_asin(args) { + if (args.length !== 1) { + throw new Error(`math_asin expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_asin: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + if (num < -1 || num > 1) { + throw new Error(`math_asin: argument must be in the interval [-1, 1], but got ${num}`); + } + const result = Math.asin(num); + return { type: 'number', value: result }; + } + function math_asinh(args) { + if (args.length !== 1) { + throw new Error(`math_asinh expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_asinh: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = Math.asinh(num); + return { type: 'number', value: result }; + } + function math_atan(args) { + if (args.length !== 1) { + throw new Error(`math_atan expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'int' && x.type !== 'bigint') { + throw new Error(`math_atan: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = Math.atan(num); + return { type: 'number', value: result }; + } + function math_atan2(args) { + if (args.length !== 2) { + throw new Error(`math_atan2 expects exactly 2 arguments, but got ${args.length}`); + } + const y = args[0]; + const x = args[1]; + if ((y.type !== 'number' && y.type !== 'bigint') || + (x.type !== 'number' && x.type !== 'bigint')) { + throw new Error(`math_atan2: both arguments must be a number, int, or bigint`); + } + let yNum, xNum; + if (y.type === 'number') { + yNum = y.value; + } + else { + yNum = Number(y.value); + } + if (x.type === 'number') { + xNum = x.value; + } + else { + xNum = Number(x.value); + } + const result = Math.atan2(yNum, xNum); + return { type: 'number', value: result }; + } + function math_atanh(args) { + if (args.length !== 1) { + throw new Error(`math_atanh expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_atanh: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + if (num <= -1 || num >= 1) { + throw new Error(`math_atanh: argument must be in the interval (-1, 1), but got ${num}`); + } + const result = Math.atanh(num); + return { type: 'number', value: result }; + } + function math_cos(args) { + if (args.length !== 1) { + throw new Error(`math_cos expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_cos: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = Math.cos(num); + return { type: 'number', value: result }; + } + function math_cosh(args) { + if (args.length !== 1) { + throw new Error(`math_cosh expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_cosh: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = Math.cosh(num); + return { type: 'number', value: result }; + } + function math_degrees(args) { + if (args.length !== 1) { + throw new Error(`math_degrees expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_degrees: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = num * 180 / Math.PI; + return { type: 'number', value: result }; + } + function math_erf(args) { + if (args.length !== 1) { + throw new Error(`math_erf expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_erf: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const erfnum = erf(num); + return { type: 'number', value: erfnum }; + } + function math_erfc(args) { + if (args.length !== 1) { + throw new Error(`math_erfc expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_erfc: argument must be a number, int, or bigint, but got ${x.type}`); + } + const erfc = 1 - math_erf(args[0]).value; + return { type: 'number', value: erfc }; + } + function char_at(args) { + if (args.length !== 2) { + throw new Error(`char_at expects exactly 2 arguments, but got ${args.length}`); + } + const s = args[0]; + const i = args[1]; + if (s.type !== 'string') { + throw new Error(`char_at: first argument must be a string, but got ${typeof s}`); + } + if (i.type !== 'number' && i.type !== 'bigint') { + throw new Error(`char_at: second argument must be a number, but got ${typeof i}`); + } + const index = i.value; + return { type: 'string', value: (s.value)[index] }; + } + function math_comb(args) { + if (args.length !== 2) { + throw new Error(`comb expects exactly 2 arguments, but got ${args.length}`); + } + const n = args[0]; + const k = args[1]; + if (n.type !== 'bigint' || k.type !== 'bigint') { + throw new Error(`comb: both arguments must be 'bigint', but got n=${n.type}, k=${k.type}`); + } + const nVal = BigInt(n.value); + const kVal = BigInt(k.value); + if (nVal < 0 || kVal < 0) { + throw new Error(`comb: n and k must be non-negative, got n=${nVal}, k=${kVal}`); + } + if (kVal > nVal) { + return { type: 'bigint', value: BigInt(0) }; + } + let result = BigInt(1); + let kk = kVal > nVal - kVal ? nVal - kVal : kVal; + for (let i = BigInt(0); i < kk; i++) { + result = result * (nVal - i) / (i + BigInt(1)); + } + return { type: 'bigint', value: result }; + } + function math_factorial(args) { + if (args.length !== 1) { + throw new Error(`factorial expects exactly 1 argument, but got ${args.length}`); + } + const n = args[0]; + if (n.type !== 'bigint') { + throw new Error(`factorial: argument must be an integer (bigint), but got ${n.type}`); + } + const nVal = BigInt(n.value); + if (nVal < 0) { + throw new Error(`factorial: argument must be non-negative, but got ${nVal}`); + } + // 0! = 1 + if (nVal === BigInt(0)) { + return { type: 'bigint', value: BigInt(1) }; + } + let result = BigInt(1); + for (let i = BigInt(1); i <= nVal; i++) { + result *= i; + } + return { type: 'bigint', value: result }; + } + function math_gcd(args) { + if (args.length === 0) { + return { type: 'bigint', value: BigInt(0) }; + } + const values = args.map((v, idx) => { + if (v.type !== 'bigint') { + throw new Error(`gcd: argument #${idx + 1} must be an integer (bigint), got ${v.type}`); + } + return BigInt(v.value); + }); + const allZero = values.every(val => val === BigInt(0)); + if (allZero) { + return { type: 'bigint', value: BigInt(0) }; + } + let currentGcd = values[0] < 0 ? -values[0] : values[0]; + for (let i = 1; i < values.length; i++) { + currentGcd = gcdOfTwo(currentGcd, values[i] < 0 ? -values[i] : values[i]); + if (currentGcd === BigInt(1)) { + break; + } + } + return { type: 'bigint', value: currentGcd }; + } + function gcdOfTwo(a, b) { + let x = a; + let y = b; + while (y !== BigInt(0)) { + const temp = x % y; + x = y; + y = temp; + } + return x < 0 ? -x : x; + } + function math_isqrt(args) { + if (args.length !== 1) { + throw new Error(`isqrt expects exactly 1 argument, but got ${args.length}`); + } + const nValObj = args[0]; + if (nValObj.type !== 'bigint') { + throw new Error(`isqrt: argument must be a nonnegative integer (bigint), but got ${nValObj.type}`); + } + const n = nValObj.value; + if (n < 0) { + throw new Error(`isqrt: argument must be nonnegative, but got ${n}`); + } + if (n < 2) { + return { type: 'bigint', value: n }; + } + let low = BigInt(1); + let high = n; + while (low < high) { + const mid = (low + high + BigInt(1)) >> BigInt(1); + const sq = mid * mid; + if (sq <= n) { + low = mid; + } + else { + high = mid - BigInt(1); + } + } + return { type: 'bigint', value: low }; + } + function math_lcm(args) { + if (args.length === 0) { + return { type: 'bigint', value: BigInt(1) }; + } + const values = args.map((val, idx) => { + if (val.type !== 'bigint') { + throw new Error(`lcm: argument #${idx + 1} must be a bigint, got ${val.type}`); + } + return BigInt(val.value); + }); + if (values.some(v => v === BigInt(0))) { + return { type: 'bigint', value: BigInt(0) }; + } + let currentLcm = absBigInt(values[0]); + for (let i = 1; i < values.length; i++) { + currentLcm = lcmOfTwo(currentLcm, absBigInt(values[i])); + if (currentLcm === BigInt(0)) { + break; + } + } + return { type: 'bigint', value: currentLcm }; + } + function lcmOfTwo(a, b) { + const gcdVal = gcdOfTwo(a, b); + return BigInt((a / gcdVal) * b); + } + function absBigInt(x) { + return x < 0 ? -x : x; + } + function math_perm(args) { + if (args.length < 1 || args.length > 2) { + throw new Error(`perm expects 1 or 2 arguments, but got ${args.length}`); + } + const nValObj = args[0]; + if (nValObj.type !== 'bigint') { + throw new Error(`perm: first argument n must be an integer (bigint), but got ${nValObj.type}`); + } + const n = BigInt(nValObj.value); + let k = n; + if (args.length === 2) { + const kValObj = args[1]; + if (kValObj.type === 'null' || kValObj.type === 'undefined') { + k = n; + } + else if (kValObj.type === 'bigint') { + k = BigInt(kValObj.value); + } + else { + throw new Error(`perm: second argument k must be an integer (bigint) or None, but got ${kValObj.type}`); + } + } + if (n < 0 || k < 0) { + throw new Error(`perm: n and k must be non-negative, got n=${n}, k=${k}`); + } + if (k > n) { + return { type: 'bigint', value: BigInt(0) }; + } + let result = BigInt(1); + for (let i = BigInt(0); i < k; i++) { + result *= (n - i); + } + return { type: 'bigint', value: result }; + } + function math_ceil(args) { + if (args.length !== 1) { + throw new Error(`ceil expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type === 'bigint') { + return x; + } + if (x.type === 'number') { + const numVal = x.value; + if (typeof numVal !== 'number') { + throw new Error(`ceil: value must be a JavaScript number, got ${typeof numVal}`); + } + const ceiled = BigInt(Math.ceil(numVal)); + return { type: 'bigint', value: ceiled }; + } + throw new Error(`ceil: unsupported type '${x.type}'. If simulating Python, implement x.__ceil__.`); + } + function math_fabs(args) { + if (args.length !== 1) { + throw new Error(`fabs expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type === 'bigint') { + const bigVal = BigInt(x.value); + const absVal = bigVal < 0 ? -Number(bigVal) : Number(bigVal); + return { type: 'number', value: absVal }; + } + if (x.type === 'number') { + const numVal = x.value; + if (typeof numVal !== 'number') { + throw new Error(`fabs: expected a JavaScript number, got ${typeof numVal}`); + } + const absVal = Math.abs(numVal); + return { type: 'number', value: absVal }; + } + throw new Error(`fabs: unsupported type '${x.type}'. Implement x.__abs__ if needed.`); + } + function math_floor(args) { + if (args.length !== 1) { + throw new Error(`floor expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type === 'bigint') { + return x; + } + if (x.type === 'number') { + const numVal = x.value; + if (typeof numVal !== 'number') { + throw new Error(`floor: expected a JavaScript number, got ${typeof numVal}`); + } + const floored = BigInt(Math.floor(numVal)); + return { type: 'bigint', value: floored }; + } + throw new Error(`floor: unsupported type '${x.type}'. Implement x.__floor__ if needed.`); + } + // Computes the product of a and b along with the rounding error using Dekker's algorithm. + function twoProd(a, b) { + const prod = a * b; + const c = 134217729; // 2^27 + 1 + const a_hi = (a * c) - ((a * c) - a); + const a_lo = a - a_hi; + const b_hi = (b * c) - ((b * c) - b); + const b_lo = b - b_hi; + const err = a_lo * b_lo - (((prod - a_hi * b_hi) - a_lo * b_hi) - a_hi * b_lo); + return { prod, err }; + } + // Computes the sum of a and b along with the rounding error using Fast TwoSum. + function twoSum(a, b) { + const sum = a + b; + const v = sum - a; + const err = (a - (sum - v)) + (b - v); + return { sum, err }; + } + // Performs a fused multiply-add operation: computes (x * y) + z with a single rounding. + function fusedMultiplyAdd(x, y, z) { + const { prod, err: prodErr } = twoProd(x, y); + const { sum, err: sumErr } = twoSum(prod, z); + const result = sum + (prodErr + sumErr); + return result; + } + function toNumber(val) { + if (val.type === 'bigint') { + return Number(val.value); + } + else if (val.type === 'number') { + return val.value; + } + else { + throw new Error(`unsupported type '${val.type}'`); + } + } + function math_fma(args) { + if (args.length !== 3) { + throw new Error(`fma expects exactly 3 arguments, but got ${args.length}`); + } + const xVal = toNumber(args[0]); + const yVal = toNumber(args[1]); + const zVal = toNumber(args[2]); + // Special-case handling: According to the IEEE 754 standard, fma(0, inf, nan) + // and fma(inf, 0, nan) should return NaN. + if (isNaN(xVal) || isNaN(yVal) || isNaN(zVal)) { + return { type: 'number', value: NaN }; + } + if (xVal === 0 && !isFinite(yVal) && isNaN(zVal)) { + return { type: 'number', value: NaN }; + } + if (yVal === 0 && !isFinite(xVal) && isNaN(zVal)) { + return { type: 'number', value: NaN }; + } + const result = fusedMultiplyAdd(xVal, yVal, zVal); + return { type: 'number', value: result }; + } + function math_fmod(args) { + if (args.length !== 2) { + throw new Error(`fmod expects exactly 2 arguments, but got ${args.length}`); + } + // Convert inputs to numbers + const xVal = toNumber(args[0]); + const yVal = toNumber(args[1]); + // Divisor cannot be zero + if (yVal === 0) { + throw new Error("fmod: divisor (y) must not be zero"); + } + // JavaScript's % operator behaves similarly to C's fmod + // in that the sign of the result is the same as the sign of x. + // For corner cases (NaN, Infinity), JavaScript remainder + // yields results consistent with typical C library fmod behavior. + const remainder = xVal % yVal; + return { type: 'number', value: remainder }; + } + function roundToEven(num) { + const floorVal = Math.floor(num); + const ceilVal = Math.ceil(num); + const diffFloor = num - floorVal; + const diffCeil = ceilVal - num; + if (diffFloor < diffCeil) { + return floorVal; + } + else if (diffCeil < diffFloor) { + return ceilVal; + } + else { + return (floorVal % 2 === 0) ? floorVal : ceilVal; + } + } + function math_remainder(args) { + if (args.length !== 2) { + throw new Error(`remainder expects exactly 2 arguments, but got ${args.length}`); + } + const x = args[0]; + const y = args[1]; + let xValue; + if (x.type === 'bigint') { + xValue = Number(x.value); + } + else if (x.type === 'number') { + xValue = x.value; + } + else { + throw new Error(`remainder: unsupported type '${x.type}' for first argument`); + } + let yValue; + if (y.type === 'bigint') { + yValue = Number(y.value); + } + else if (y.type === 'number') { + yValue = y.value; + } + else { + throw new Error(`remainder: unsupported type '${y.type}' for second argument`); + } + if (yValue === 0) { + throw new Error(`remainder: divisor y must not be zero`); + } + const quotient = xValue / yValue; + const n = roundToEven(quotient); + const remainder = xValue - n * yValue; + return { type: 'number', value: remainder }; + } + function math_trunc(args) { + if (args.length !== 1) { + throw new Error(`trunc expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type === 'bigint') { + return x; + } + if (x.type === 'number') { + const numVal = x.value; + if (typeof numVal !== 'number') { + throw new Error(`trunc: argument must be a number, got ${typeof numVal}`); + } + let truncated; + if (numVal === 0) { + truncated = 0; + } + else if (numVal < 0) { + truncated = Math.ceil(numVal); + } + else { + truncated = Math.floor(numVal); + } + return { type: 'bigint', value: BigInt(truncated) }; + } + throw new Error(`trunc: unsupported type '${x.type}'. Implement x.__trunc__ if needed.`); + } + function math_copysign(args) { + if (args.length !== 2) { + throw new Error(`copysign expects exactly 2 arguments, but got ${args.length}`); + } + const [x, y] = args; + if ((x.type !== 'number' && x.type !== 'bigint') || + (y.type !== 'number' && y.type !== 'bigint')) { + throw new Error(`copysign: both x and y must be of type 'number'`); + } + const xVal = Number(x.value); + const yVal = Number(y.value); + const absVal = Math.abs(xVal); + const isNegative = yVal < 0 || (Object.is(yVal, -0)); + const result = isNegative ? -absVal : absVal; + return { type: 'number', value: Number(result) }; + } + function math_isfinite(args) { + if (args.length !== 1) { + throw new Error(`isfinite expects exactly 1 argument, but got ${args.length}`); + } + const xValObj = args[0]; + if (xValObj.type !== 'number') { + throw new Error(`isfinite: argument must be 'number', got '${xValObj.type}'`); + } + const x = xValObj.value; + const result = Number.isFinite(x); + return { type: 'bool', value: result }; + } + function math_isinf(args) { + if (args.length !== 1) { + throw new Error(`isinf expects exactly 1 argument, but got ${args.length}`); + } + const xValObj = args[0]; + if (xValObj.type !== 'number') { + throw new Error(`isinf: argument must be 'number', got '${xValObj.type}'`); + } + const x = xValObj.value; + const result = (x === Infinity || x === -Infinity); + return { type: 'bool', value: result }; + } + function math_isnan(args) { + if (args.length !== 1) { + throw new Error(`isnan expects exactly 1 argument, but got ${args.length}`); + } + const xValObj = args[0]; + if (xValObj.type !== 'number') { + throw new Error(`isnan: argument must be 'number', got '${xValObj.type}'`); + } + const x = xValObj.value; + const result = Number.isNaN(x); + return { type: 'bool', value: result }; + } + function math_ldexp(args) { + if (args.length !== 2) { + throw new Error(`ldexp expects exactly 2 arguments, but got ${args.length}`); + } + const xVal = toNumber(args[0]); + if (args[1].type !== 'bigint') { + throw new Error(`ldexp: argument must be 'int', got '${args[1].type}'`); + } + const expVal = args[1].value; + // Perform x * 2^expVal + // In JavaScript, 2**expVal may overflow or underflow, yielding Infinity or 0 respectively. + // That behavior parallels typical C library rules for ldexp. + const result = xVal * Math.pow(2, Number(expVal)); + return { type: 'number', value: result }; + } + function math_nextafter(args) { + // TODO: Implement math_nextafter using proper bit-level manipulation and handling special cases (NaN, Infinity, steps, etc.) + throw new Error("math_nextafter not implemented"); + } + function math_ulp(args) { + // TODO: Implement math_ulp to return the unit in the last place (ULP) of the given floating-point number. + throw new Error("math_ulp not implemented"); + } + function math_cbrt(args) { + if (args.length !== 1) { + throw new Error(`math_cbrt expects exactly 1 argument, but got ${args.length}`); + } + const xVal = args[0]; + let x; + if (xVal.type !== 'number') { + if (xVal.type === 'bigint') { + x = Number(xVal.value); + } + else { + throw new Error(`math_cbrt: argument must be a number, got ${xVal.type}`); + } + } + else { + x = xVal.value; + } + const result = Math.cbrt(x); + return { type: 'number', value: result }; + } + function math_exp(args) { + if (args.length !== 1) { + throw new Error(`math_exp expects exactly 1 argument, but got ${args.length}`); + } + const xVal = args[0]; + let x; + if (xVal.type !== 'number') { + if (xVal.type === 'bigint') { + x = Number(xVal.value); + } + else { + throw new Error(`math_cbrt: argument must be a number, got ${xVal.type}`); + } + } + else { + x = xVal.value; + } + const result = Math.exp(x); + return { type: 'number', value: result }; + } + function math_exp2(args) { + if (args.length !== 1) { + throw new Error(`math_exp2 expects exactly 1 argument, but got ${args.length}`); + } + const xVal = args[0]; + let x; + if (xVal.type !== 'number') { + if (xVal.type === 'bigint') { + x = Number(xVal.value); + } + else { + throw new Error(`math_cbrt: argument must be a number, got ${xVal.type}`); + } + } + else { + x = xVal.value; + } + const result = Math.pow(2, x); + return { type: 'number', value: result }; + } + function math_expm1(args) { + if (args.length !== 1) { + throw new Error(`math_expm1 expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_expm1: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = Math.expm1(num); + return { type: 'number', value: result }; + } + function math_gamma(args) { + if (args.length !== 1) { + throw new Error(`gamma expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`gamma: argument must be a number, int, or bigint, but got ${x.type}`); + } + const z = toNumber(x); + const result = gamma(z); + return { type: 'number', value: result }; + } + function math_lgamma(args) { + if (args.length !== 1) { + throw new Error(`gamma expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`gamma: argument must be a number, int, or bigint, but got ${x.type}`); + } + const z = toNumber(x); + const result = lgamma(z); + return { type: 'number', value: result }; + } + function math_log(args) { + if (args.length < 1 || args.length > 2) { + throw new Error(`math_log expects 1 or 2 arguments, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_log: first argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + if (num <= 0) { + throw new Error(`math_log: argument must be positive, but got ${num}`); + } + if (args.length === 1) { + return { type: 'number', value: Math.log(num) }; + } + const baseArg = args[1]; + if (baseArg.type !== 'number' && baseArg.type !== 'int' && baseArg.type !== 'bigint') { + throw new Error(`math_log: base argument must be a number, int, or bigint, but got ${baseArg.type}`); + } + let baseNum; + if (baseArg.type === 'number') { + baseNum = baseArg.value; + } + else { + baseNum = Number(baseArg.value); + } + if (baseNum <= 0) { + throw new Error(`math_log: base must be positive, but got ${baseNum}`); + } + const result = Math.log(num) / Math.log(baseNum); + return { type: 'number', value: result }; + } + function math_log10(args) { + if (args.length !== 1) { + throw new Error(`math_log10 expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_log10: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + if (num <= 0) { + throw new Error(`math_log10: argument must be positive, but got ${num}`); + } + const result = Math.log10(num); + return { type: 'number', value: result }; + } + function math_log1p(args) { + if (args.length !== 1) { + throw new Error(`math_log1p expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_log1p: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + if (1 + num <= 0) { + throw new Error(`math_log1p: 1 + argument must be positive, but got 1 + ${num} = ${1 + num}`); + } + const result = Math.log1p(num); + return { type: 'number', value: result }; + } + function math_log2(args) { + if (args.length !== 1) { + throw new Error(`math_log2 expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_log2: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + if (num <= 0) { + throw new Error(`math_log2: argument must be positive, but got ${num}`); + } + const result = Math.log2(num); + return { type: 'number', value: result }; + } + function math_pow(args) { + if (args.length !== 2) { + throw new Error(`math_pow expects exactly 2 arguments, but got ${args.length}`); + } + const base = args[0]; + const exp = args[1]; + if ((base.type !== 'number' && base.type !== 'bigint') || + (exp.type !== 'number' && exp.type !== 'bigint')) { + throw new Error(`math_pow: both arguments must be a number or bigint`); + } + let baseNum; + if (base.type === 'number') { + baseNum = base.value; + } + else { // 'bigint' + baseNum = Number(base.value); + } + let expNum; + if (exp.type === 'number') { + expNum = exp.value; + } + else { + expNum = Number(exp.value); + } + const result = Math.pow(baseNum, expNum); + return { type: 'number', value: result }; + } + function math_radians(args) { + if (args.length !== 1) { + throw new Error(`math_radians expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_radians: argument must be a number, int, or bigint, but got ${x.type}`); + } + let deg; + if (x.type === 'number') { + deg = x.value; + } + else { + deg = Number(x.value); + } + const radians = deg * Math.PI / 180; + return { type: 'number', value: radians }; + } + function math_sin(args) { + if (args.length !== 1) { + throw new Error(`math_sin expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_sin: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = Math.sin(num); + return { type: 'number', value: result }; + } + function math_sinh(args) { + if (args.length !== 1) { + throw new Error(`math_sinh expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_sinh: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = Math.sinh(num); + return { type: 'number', value: result }; + } + function math_tan(args) { + if (args.length !== 1) { + throw new Error(`math_tan expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_tan: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = Math.tan(num); + return { type: 'number', value: result }; + } + function math_tanh(args) { + if (args.length !== 1) { + throw new Error(`math_tanh expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_tanh: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + const result = Math.tanh(num); + return { type: 'number', value: result }; + } + function math_sqrt(args) { + if (args.length !== 1) { + throw new Error(`math_sqrt expects exactly 1 argument, but got ${args.length}`); + } + const x = args[0]; + if (x.type !== 'number' && x.type !== 'int' && x.type !== 'bigint') { + throw new Error(`math_sqrt: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num; + if (x.type === 'number') { + num = x.value; + } + else { + num = Number(x.value); + } + if (num < 0) { + throw new Error(`math_sqrt: argument must be non-negative, but got ${num}`); + } + const result = Math.sqrt(num); + return { type: 'number', value: result }; + } + function max(args) { + if (args.length < 2) { + throw new Error(`max expects at least 2 arguments, but got ${args.length}`); + } + const numericTypes = ['bigint', 'number']; + const firstType = args[0].type; + let isNumeric = numericTypes.includes(firstType); + let isString = firstType === 'string'; + for (let i = 1; i < args.length; i++) { + const t = args[i].type; + if (isNumeric && !numericTypes.includes(t)) { + throw new Error(`max: all arguments must be mutually comparable (all numeric or all string)`); + } + if (isString && t !== 'string') { + throw new Error(`max: all arguments must be mutually comparable (all numeric or all string)`); + } + } + let useFloat = false; + if (isNumeric) { + for (const arg of args) { + if (arg.type === 'number') { + useFloat = true; + break; + } + } + } + let maxIndex = 0; + if (isNumeric) { + if (useFloat) { + let maxVal = Number(args[0].value); + for (let i = 1; i < args.length; i++) { + const curr = Number(args[i].value); + if (curr > maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } + else { + let maxVal = args[0].value; + for (let i = 1; i < args.length; i++) { + const curr = args[i].value; + if (curr > maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } + } + else if (isString) { + let maxVal = args[0].value; + for (let i = 1; i < args.length; i++) { + const curr = args[i].value; + if (curr > maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } + else { + throw new Error(`max: unsupported type ${firstType}`); + } + return args[maxIndex]; + } + function min(args) { + if (args.length < 2) { + throw new Error(`min expects at least 2 arguments, but got ${args.length}`); + } + const numericTypes = ['bigint', 'number']; + const firstType = args[0].type; + let isNumeric = numericTypes.includes(firstType); + let isString = firstType === 'string'; + for (let i = 1; i < args.length; i++) { + const t = args[i].type; + if (isNumeric && !numericTypes.includes(t)) { + throw new Error(`min: all arguments must be mutually comparable (all numeric or all string)`); + } + if (isString && t !== 'string') { + throw new Error(`min: all arguments must be mutually comparable (all numeric or all string)`); + } + } + let useFloat = false; + if (isNumeric) { + for (const arg of args) { + if (arg.type === 'number') { + useFloat = true; + break; + } + } + } + let maxIndex = 0; + if (isNumeric) { + if (useFloat) { + let maxVal = Number(args[0].value); + for (let i = 1; i < args.length; i++) { + const curr = Number(args[i].value); + if (curr < maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } + else { + let maxVal = args[0].value; + for (let i = 1; i < args.length; i++) { + const curr = args[i].value; + if (curr < maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } + } + else if (isString) { + let maxVal = args[0].value; + for (let i = 1; i < args.length; i++) { + const curr = args[i].value; + if (curr < maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } + else { + throw new Error(`min: unsupported type ${firstType}`); + } + return args[maxIndex]; + } + function random_random(args) { + if (args.length !== 0) { + throw new Error(`random_random expects exactly 0 arguments, but got ${args.length}`); + } + const result = Math.random(); + return { type: 'number', value: result }; + } + function round(args) { + if (args.length < 1 || args.length > 2) { + throw new Error(`round expects 1 or 2 arguments, but got ${args.length}`); + } + const numArg = args[0]; + if (numArg.type !== 'number' && numArg.type !== 'bigint') { + throw new Error(`round: first argument must be a number, int, or bigint, but got ${numArg.type}`); + } + let ndigitsArg = { value: BigInt(0) }; + if (args.length === 2 && args[1].type !== 'NoneType') { + ndigitsArg = args[1]; + } + if (numArg.type === 'number') { + let numberValue = numArg.value; + if (ndigitsArg.value > 0) { + const shifted = Number(numberValue.toFixed(Number(ndigitsArg.value))); + return { type: 'number', value: shifted }; + } + else if (ndigitsArg.value === BigInt(0)) { + const shifted = Math.round(numArg.value); + return { type: 'bigint', value: BigInt(shifted) }; + } + else { + const shifted = Math.round(numArg.value / (10 ** (-Number(ndigitsArg.value)))) * (10 ** (-Number(ndigitsArg.value))); + return { type: 'number', value: shifted }; + } + } + else { + if (ndigitsArg.value >= 0) { + return numArg; + } + else { + const shifted = numArg.value / (BigInt(10) ** (-ndigitsArg.value)) * (BigInt(10) ** (-ndigitsArg.value)); + return { type: 'bigint', value: shifted }; + } + } + } + function time_time(args) { + if (args.length !== 0) { + throw new Error(`time_time expects 0 arguments, but got ${args.length}`); + } + const currentTime = Date.now(); + return { type: 'number', value: currentTime }; + } + function toPythonFloat(num) { + //num = Number(num); + //console.info(typeof(num)); + if (Object.is(num, -0)) { + return "-0.0"; + } + if (num === 0) { + return "0.0"; + } + if (num === Infinity) { + return "inf"; + } + if (num === -Infinity) { + return "-inf"; + } + if (Number.isNaN(num)) { + return "nan"; + } + if (Math.abs(num) >= 1e16 || (num !== 0 && Math.abs(num) < 1e-4)) { + return num.toExponential().replace(/e([+-])(\d)$/, 'e$10$2'); + } + if (Number.isInteger(num)) { + return num.toFixed(1).toString(); + } + return num.toString(); + } + function toPythonString(obj) { + let ret; + if (obj.type === 'bigint' || obj.type === 'complex') { + ret = obj.value.toString(); + } + else if (obj.type === 'number') { + ret = toPythonFloat(obj.value); + } + else if (obj.type === 'bool') { + if (obj.value === true) { + return "True"; + } + else { + return "False"; + } + } + else if (obj.type === 'error') { + return obj.message; + } + else if (obj.node) { + for (let name in obj.environment.head) { + if (obj.environment.head[name] === obj) { + return ''; + } + } + } + else if (obj === undefined || obj.value === undefined) { + ret = 'None'; + } + else { + ret = obj.value.toString(); + } + return ret; + } + function str(args) { + if (args.length === 0) { + return { type: 'string', value: "" }; + } + const obj = args[0]; + const result = toPythonString(obj); + return { type: 'string', value: result }; + } + function input(args) { + // TODO: + // nodejs + // readline + // distinguish between browser and commandline + } + function print(args) { + // Convert each argument using toPythonString (an assumed helper function). + const pieces = args.map(arg => toPythonString(arg)); + // Join them with spaces. + const output = pieces.join(' '); + // Actually print to console (you can replace this with any desired output). + // console.info(output); + addPrint(output); + //return { type: 'string', value: output }; + } + + class CSEBreak { + } + // export class CseError { + // constructor(public readonly error: any) {} + // } + var ErrorType; + (function (ErrorType) { + ErrorType["IMPORT"] = "Import"; + ErrorType["RUNTIME"] = "Runtime"; + ErrorType["SYNTAX"] = "Syntax"; + ErrorType["TYPE"] = "Type"; + })(ErrorType || (ErrorType = {})); + var ErrorSeverity; + (function (ErrorSeverity) { + ErrorSeverity["WARNING"] = "Warning"; + ErrorSeverity["ERROR"] = "Error"; + })(ErrorSeverity || (ErrorSeverity = {})); + class PyComplexNumber { + constructor(real, imag) { + this.real = real; + this.imag = imag; + } + static fromNumber(value) { + return new PyComplexNumber(value, 0); + } + static fromBigInt(value) { + return new PyComplexNumber(Number(value), 0); + } + static fromString(str) { + if (!/[jJ]/.test(str)) { + const realVal = Number(str); + if (isNaN(realVal)) { + throw new Error(`Invalid complex string: ${str}`); + } + return new PyComplexNumber(realVal, 0); + } + const lower = str.toLowerCase(); + if (lower.endsWith('j')) { + const numericPart = str.substring(0, str.length - 1); + if (numericPart === '' || numericPart === '+' || numericPart === '-') { + const sign = (numericPart === '-') ? -1 : 1; + return new PyComplexNumber(0, sign * 1); + } + const imagVal = Number(numericPart); + if (isNaN(imagVal)) { + throw new Error(`Invalid complex string: ${str}`); + } + return new PyComplexNumber(0, imagVal); + } + const match = str.match(/^([\+\-]?\d+(\.\d+)?([eE][+\-]?\d+)?)([\+\-]\d+(\.\d+)?([eE][+\-]?\d+)?)?[jJ]?$/); + if (!match) { + throw new Error(`Invalid complex string: ${str}`); + } + const realPart = Number(match[1]); + let imagPart = 0; + if (match[4]) { + imagPart = Number(match[4]); + } + return new PyComplexNumber(realPart, imagPart); + } + static fromValue(value) { + if (value instanceof PyComplexNumber) { + return new PyComplexNumber(value.real, value.imag); + } + if (typeof value === "number") { + return PyComplexNumber.fromNumber(value); + } + if (typeof value === "bigint") { + return PyComplexNumber.fromBigInt(value); + } + return PyComplexNumber.fromString(value); + } + /** + * operations + */ + add(other) { + return new PyComplexNumber(this.real + other.real, this.imag + other.imag); + } + sub(other) { + return new PyComplexNumber(this.real - other.real, this.imag - other.imag); + } + mul(other) { + // (a+bi)*(c+di) = (ac - bd) + (bc + ad)i + const realPart = this.real * other.real - this.imag * other.imag; + const imagPart = this.real * other.imag + this.imag * other.real; + return new PyComplexNumber(realPart, imagPart); + } + // https://github.com/python/cpython/blob/main/Objects/complexobject.c#L986 + // In the CPython source code, a branch algorithm is used for complex division. + // It first compares the magnitudes of the dividend and divisor, and if some components are too large or too small, + // appropriate scaling is applied before performing the operation. + // This approach can significantly reduce overflow or underflow, thereby ensuring that the results remain more consistent with Python. + div(other) { + // (a+bi)/(c+di) = ((a+bi)*(c-di)) / (c^2 + d^2) + const denominator = other.real * other.real + other.imag * other.imag; + if (denominator === 0) { + throw new Error(`Division by zero in complex number.`); + } + const a = this.real; + const b = this.imag; + const c = other.real; + const d = other.imag; + const absC = Math.abs(c); + const absD = Math.abs(d); + let real; + let imag; + if (absD < absC) { + const ratio = d / c; + const denom = c + d * ratio; // c + d*(d/c) = c + d^2/c + real = (a + b * ratio) / denom; + imag = (b - a * ratio) / denom; + } + else { + const ratio = c / d; + const denom = d + c * ratio; // d + c*(c/d) = d + c^2/d + real = (a * ratio + b) / denom; + imag = (b * ratio - a) / denom; + } + return new PyComplexNumber(real, imag); + //const numerator = this.mul(new PyComplexNumber(other.real, -other.imag)); + //return new PyComplexNumber(numerator.real / denominator, numerator.imag / denominator); + } + pow(other) { + // z = this (a+bi), w = other (A+Bi) + const a = this.real; + const b = this.imag; + const A = other.real; + const B = other.imag; + const r = Math.sqrt(a * a + b * b); + const theta = Math.atan2(b, a); + if (r === 0) { + // In Python, raising 0 to a negative or complex power raises an error. + // For example, 0**(1j) in CPython directly raises ValueError: complex power. + if (A < 0 || B !== 0) { + throw new Error('0 cannot be raised to a negative or complex power'); + } + // Otherwise, 0**(positive number) = 0. + return new PyComplexNumber(0, 0); + } + const logR = Math.log(r); + // realExpPart = A*ln(r) - B*theta + // imagExpPart = B*ln(r) + A*theta + const realExpPart = A * logR - B * theta; + const imagExpPart = B * logR + A * theta; + // e^(x + i y) = e^x [cos(y) + i sin(y)] + const expOfReal = Math.exp(realExpPart); + const c = expOfReal * Math.cos(imagExpPart); + const d = expOfReal * Math.sin(imagExpPart); + return new PyComplexNumber(c, d); + } + toString() { + if (this.real === 0) { + return `${this.imag}j`; + } + // if (this.imag === 0) { + // return `${this.real}`; + // } + const sign = (this.imag >= 0) ? "+" : ""; + // return `(${this.real}${sign}${this.imag}j)`; + return `(${this.toPythonComplexFloat(this.real)}${sign}${this.toPythonComplexFloat(this.imag)}j)`; + } + toPythonComplexFloat(num) { + if (num === Infinity) { + return "inf"; + } + if (num === -Infinity) { + return "-inf"; + } + if (Math.abs(num) >= 1e16 || (num !== 0 && Math.abs(num) < 1e-4)) { + return num.toExponential().replace(/e([+-])(\d)$/, 'e$10$2'); + } + return num.toString(); + } + equals(other) { + return (Number(this.real) === Number(other.real) && Number(this.imag) === Number(other.imag)); + } + } + // export class Representation { + // constructor(public representation: string) {} + // toString() { + // return this.representation + // } + // } + class Representation { + constructor(representation) { + this.representation = representation; + } + toString(value) { + // call str(value) in stdlib + // TODO: mapping + const result = toPythonString(value); + return result; + } + } + + var ExprNS; + (function (ExprNS) { + class Expr { + constructor(startToken, endToken) { + this.startToken = startToken; + this.endToken = endToken; + } + } + ExprNS.Expr = Expr; + class None extends Expr { + constructor(startToken, endToken, value = "None") { + super(startToken, endToken); + } + accept(visitor) { + return visitor.visitNoneExpr(this); + } + } + ExprNS.None = None; + class BigIntLiteral extends Expr { + constructor(startToken, endToken, value) { + super(startToken, endToken); + this.value = value; + } + accept(visitor) { + return visitor.visitBigIntLiteralExpr(this); + } + } + ExprNS.BigIntLiteral = BigIntLiteral; + class Complex extends Expr { + constructor(startToken, endToken, value) { + super(startToken, endToken); + this.value = PyComplexNumber.fromString(value); + } + accept(visitor) { + return visitor.visitComplexExpr(this); + } + } + ExprNS.Complex = Complex; + class Binary extends Expr { + constructor(startToken, endToken, left, operator, right) { + super(startToken, endToken); + this.left = left; + this.operator = operator; + this.right = right; + } + accept(visitor) { + return visitor.visitBinaryExpr(this); + } + } + ExprNS.Binary = Binary; + class Compare extends Expr { + constructor(startToken, endToken, left, operator, right) { + super(startToken, endToken); + this.left = left; + this.operator = operator; + this.right = right; + } + accept(visitor) { + return visitor.visitCompareExpr(this); + } + } + ExprNS.Compare = Compare; + class BoolOp extends Expr { + constructor(startToken, endToken, left, operator, right) { + super(startToken, endToken); + this.left = left; + this.operator = operator; + this.right = right; + } + accept(visitor) { + return visitor.visitBoolOpExpr(this); + } + } + ExprNS.BoolOp = BoolOp; + class Grouping extends Expr { + constructor(startToken, endToken, expression) { + super(startToken, endToken); + this.expression = expression; + } + accept(visitor) { + return visitor.visitGroupingExpr(this); + } + } + ExprNS.Grouping = Grouping; + class Literal extends Expr { + constructor(startToken, endToken, value) { + super(startToken, endToken); + this.value = value; + } + accept(visitor) { + return visitor.visitLiteralExpr(this); + } + } + ExprNS.Literal = Literal; + class Unary extends Expr { + constructor(startToken, endToken, operator, right) { + super(startToken, endToken); + this.operator = operator; + this.right = right; + } + accept(visitor) { + return visitor.visitUnaryExpr(this); + } + } + ExprNS.Unary = Unary; + class Ternary extends Expr { + constructor(startToken, endToken, predicate, consequent, alternative) { + super(startToken, endToken); + this.predicate = predicate; + this.consequent = consequent; + this.alternative = alternative; + } + accept(visitor) { + return visitor.visitTernaryExpr(this); + } + } + ExprNS.Ternary = Ternary; + class Lambda extends Expr { + constructor(startToken, endToken, parameters, body) { + super(startToken, endToken); + this.parameters = parameters; + this.body = body; + } + accept(visitor) { + return visitor.visitLambdaExpr(this); + } + } + ExprNS.Lambda = Lambda; + class MultiLambda extends Expr { + constructor(startToken, endToken, parameters, body, varDecls) { + super(startToken, endToken); + this.parameters = parameters; + this.body = body; + this.varDecls = varDecls; + } + accept(visitor) { + return visitor.visitMultiLambdaExpr(this); + } + } + ExprNS.MultiLambda = MultiLambda; + class Variable extends Expr { + constructor(startToken, endToken, name) { + super(startToken, endToken); + this.name = name; + } + accept(visitor) { + return visitor.visitVariableExpr(this); + } + } + ExprNS.Variable = Variable; + class Call extends Expr { + constructor(startToken, endToken, callee, args) { + super(startToken, endToken); + this.callee = callee; + this.args = args; + } + accept(visitor) { + return visitor.visitCallExpr(this); + } + } + ExprNS.Call = Call; + })(ExprNS || (ExprNS = {})); + var StmtNS; + (function (StmtNS) { + class Stmt { + constructor(startToken, endToken) { + this.startToken = startToken; + this.endToken = endToken; + } + } + StmtNS.Stmt = Stmt; + class Indent extends Stmt { + constructor(startToken, endToken) { + super(startToken, endToken); + } + accept(visitor) { + return visitor.visitIndentCreation(this); + } + } + StmtNS.Indent = Indent; + class Dedent extends Stmt { + constructor(startToken, endToken) { + super(startToken, endToken); + } + accept(visitor) { + return visitor.visitDedentCreation(this); + } + } + StmtNS.Dedent = Dedent; + class Pass extends Stmt { + constructor(startToken, endToken) { + super(startToken, endToken); + } + accept(visitor) { + return visitor.visitPassStmt(this); + } + } + StmtNS.Pass = Pass; + class Assign extends Stmt { + constructor(startToken, endToken, name, value) { + super(startToken, endToken); + this.name = name; + this.value = value; + } + accept(visitor) { + return visitor.visitAssignStmt(this); + } + } + StmtNS.Assign = Assign; + class AnnAssign extends Stmt { + constructor(startToken, endToken, name, value, ann) { + super(startToken, endToken); + this.name = name; + this.value = value; + this.ann = ann; + } + accept(visitor) { + return visitor.visitAnnAssignStmt(this); + } + } + StmtNS.AnnAssign = AnnAssign; + class Break extends Stmt { + constructor(startToken, endToken) { + super(startToken, endToken); + } + accept(visitor) { + return visitor.visitBreakStmt(this); + } + } + StmtNS.Break = Break; + class Continue extends Stmt { + constructor(startToken, endToken) { + super(startToken, endToken); + } + accept(visitor) { + return visitor.visitContinueStmt(this); + } + } + StmtNS.Continue = Continue; + class Return extends Stmt { + constructor(startToken, endToken, value) { + super(startToken, endToken); + this.value = value; + } + accept(visitor) { + return visitor.visitReturnStmt(this); + } + } + StmtNS.Return = Return; + class FromImport extends Stmt { + constructor(startToken, endToken, module, names) { + super(startToken, endToken); + this.module = module; + this.names = names; + } + accept(visitor) { + return visitor.visitFromImportStmt(this); + } + } + StmtNS.FromImport = FromImport; + class Global extends Stmt { + constructor(startToken, endToken, name) { + super(startToken, endToken); + this.name = name; + } + accept(visitor) { + return visitor.visitGlobalStmt(this); + } + } + StmtNS.Global = Global; + class NonLocal extends Stmt { + constructor(startToken, endToken, name) { + super(startToken, endToken); + this.name = name; + } + accept(visitor) { + return visitor.visitNonLocalStmt(this); + } + } + StmtNS.NonLocal = NonLocal; + class Assert extends Stmt { + constructor(startToken, endToken, value) { + super(startToken, endToken); + this.value = value; + } + accept(visitor) { + return visitor.visitAssertStmt(this); + } + } + StmtNS.Assert = Assert; + class If extends Stmt { + constructor(startToken, endToken, condition, body, elseBlock) { + super(startToken, endToken); + this.condition = condition; + this.body = body; + this.elseBlock = elseBlock; + } + accept(visitor) { + return visitor.visitIfStmt(this); + } + } + StmtNS.If = If; + class While extends Stmt { + constructor(startToken, endToken, condition, body) { + super(startToken, endToken); + this.condition = condition; + this.body = body; + } + accept(visitor) { + return visitor.visitWhileStmt(this); + } + } + StmtNS.While = While; + class For extends Stmt { + constructor(startToken, endToken, target, iter, body) { + super(startToken, endToken); + this.target = target; + this.iter = iter; + this.body = body; + } + accept(visitor) { + return visitor.visitForStmt(this); + } + } + StmtNS.For = For; + class FunctionDef extends Stmt { + constructor(startToken, endToken, name, parameters, body, varDecls) { + super(startToken, endToken); + this.name = name; + this.parameters = parameters; + this.body = body; + this.varDecls = varDecls; + } + accept(visitor) { + return visitor.visitFunctionDefStmt(this); + } + } + StmtNS.FunctionDef = FunctionDef; + class SimpleExpr extends Stmt { + constructor(startToken, endToken, expression) { + super(startToken, endToken); + this.expression = expression; + } + accept(visitor) { + return visitor.visitSimpleExprStmt(this); + } + } + StmtNS.SimpleExpr = SimpleExpr; + class FileInput extends Stmt { + constructor(startToken, endToken, statements, varDecls) { + super(startToken, endToken); + this.statements = statements; + this.varDecls = varDecls; + } + accept(visitor) { + return visitor.visitFileInputStmt(this); + } + } + StmtNS.FileInput = FileInput; + })(StmtNS || (StmtNS = {})); + + /* + * Full disclosure: some of the functions and general layout of the file is + * from my own implementation of a parser + * in Rust. + * https://github.com/Fidget-Spinner/crafting_interpreters/blob/main/rust/src/parser.rs + * + * That is in turn an implementation of the book "Crafting Interpreters" by + * Robert Nystrom, which implements an interpreter in Java. + * https://craftinginterpreters.com/parsing-expressions.html. + * I've included the MIT license that code snippets from + * the book is licensed under down below. See + * https://github.com/munificent/craftinginterpreters/blob/master/LICENSE + * + * + * My changes: + * - The book was written in Java. I have written this in TypeScript. + * - My Rust implementation uses pattern matching, but the visitor pattern is + * used here. + * - Additionally, the production rules are completely different + * from the book as a whole different language is being parsed. + * + * + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + **/ + const PSEUD_NAMES = [ + TokenType.TRUE, + TokenType.FALSE, + TokenType.NONE, + ]; + class Parser { + constructor(source, tokens) { + this.source = source; + this.tokens = tokens; + this.current = 0; + } + // Consumes tokens while tokenTypes matches. + match(...tokenTypes) { + for (const tokenType of tokenTypes) { + if (this.check(tokenType)) { + this.advance(); + return true; + } + } + return false; + } + check(...type) { + if (this.isAtEnd()) { + return false; + } + for (const tokenType of type) { + if (this.peek().type === tokenType) { + return true; + } + } + return false; + } + advance() { + if (!this.isAtEnd()) { + this.current += 1; + } + return this.previous(); + } + isAtEnd() { + return this.peek().type === TokenType.ENDMARKER; + } + peek() { + return this.tokens[this.current]; + } + previous() { + return this.tokens[this.current - 1]; + } + consume(type, message) { + if (this.check(type)) + return this.advance(); + const token = this.tokens[this.current]; + throw new exports.ParserErrors.ExpectedTokenError(this.source, token, message); + } + synchronize() { + this.advance(); + while (!this.isAtEnd()) { + if (this.match(TokenType.NEWLINE)) { + return false; + } + if (this.match(TokenType.FOR, TokenType.WHILE, TokenType.DEF, TokenType.IF, TokenType.ELIF, TokenType.ELSE, TokenType.RETURN)) { + return true; + } + this.advance(); + } + return false; + } + parse() { + return this.file_input(); + // return this.expression(); + } + //// THE NAMES OF THE FOLLOWING FUNCTIONS FOLLOW THE PRODUCTION RULES IN THE GRAMMAR. + //// HENCE THEIR NAMES MIGHT NOT BE COMPLIANT WITH CAMELCASE + file_input() { + const startToken = this.peek(); + const statements = []; + while (!this.isAtEnd()) { + if (this.match(TokenType.NEWLINE) || this.match(TokenType.DEDENT)) { + continue; + } + statements.push(this.stmt()); + } + const endToken = this.peek(); + return new StmtNS.FileInput(startToken, endToken, statements, []); + } + stmt() { + if (this.check(TokenType.DEF, TokenType.FOR, TokenType.IF, TokenType.WHILE)) { + return this.compound_stmt(); + } + else if (this.check(TokenType.NAME, ...PSEUD_NAMES, TokenType.NUMBER, TokenType.PASS, TokenType.BREAK, TokenType.CONTINUE, TokenType.MINUS, TokenType.PLUS, TokenType.INDENT, TokenType.DEDENT, TokenType.RETURN, TokenType.FROM, TokenType.GLOBAL, TokenType.NONLOCAL, TokenType.ASSERT, TokenType.LPAR, TokenType.STRING, TokenType.BIGINT, ...SPECIAL_IDENTIFIER_TOKENS)) { + return this.simple_stmt(); + } + const startToken = this.peek(); + const endToken = this.synchronize() ? this.previous() : this.peek(); + try { + this.parse_invalid(startToken, endToken); + } + catch (e) { + if (e instanceof exports.ParserErrors.BaseParserError) { + throw (e); + } + } + throw new exports.ParserErrors.GenericUnexpectedSyntaxError(startToken.line, startToken.col, this.source, startToken.indexInSource, endToken.indexInSource); + } + compound_stmt() { + if (this.match(TokenType.IF)) { + return this.if_stmt(); + } + else if (this.match(TokenType.WHILE)) { + return this.while_stmt(); + } + else if (this.match(TokenType.FOR)) { + return this.for_stmt(); + } + else if (this.match(TokenType.DEF)) { + return this.funcdef(); + } + throw new Error("Unreachable code path"); + } + if_stmt() { + const startToken = this.previous(); + let start = this.previous(); + let cond = this.test(); + this.consume(TokenType.COLON, "Expected ':' after if"); + let block = this.suite(); + let elseStmt = null; + if (this.match(TokenType.ELIF)) { + elseStmt = [this.if_stmt()]; + } + else if (this.match(TokenType.ELSE)) { + this.consume(TokenType.COLON, "Expect ':' after else"); + elseStmt = this.suite(); + } + else { + throw new exports.ParserErrors.NoElseBlockError(this.source, start); + } + const endToken = this.previous(); + return new StmtNS.If(startToken, endToken, cond, block, elseStmt); + } + while_stmt() { + const startToken = this.peek(); + let cond = this.test(); + this.consume(TokenType.COLON, "Expected ':' after while"); + let block = this.suite(); + const endToken = this.previous(); + return new StmtNS.While(startToken, endToken, cond, block); + } + for_stmt() { + const startToken = this.peek(); + let target = this.advance(); + this.consume(TokenType.IN, "Expected in after for"); + let iter = this.test(); + this.consume(TokenType.COLON, "Expected ':' after for"); + let block = this.suite(); + const endToken = this.previous(); + return new StmtNS.For(startToken, endToken, target, iter, block); + } + funcdef() { + const startToken = this.peek(); + let name = this.advance(); + let args = this.parameters(); + this.consume(TokenType.COLON, "Expected ':' after def"); + let block = this.suite(); + const endToken = this.previous(); + return new StmtNS.FunctionDef(startToken, endToken, name, args, block, []); + } + simple_stmt() { + const startToken = this.peek(); + let res = null; + if (this.match(TokenType.NAME)) { + res = this.assign_stmt(); + } + else if (this.match(TokenType.INDENT)) { + res = new StmtNS.Indent(startToken, startToken); + } + else if (this.match(TokenType.DEDENT)) { + res = new StmtNS.Dedent(startToken, startToken); + } + else if (this.match(TokenType.PASS)) { + res = new StmtNS.Pass(startToken, startToken); + } + else if (this.match(TokenType.BREAK)) { + res = new StmtNS.Break(startToken, startToken); + } + else if (this.match(TokenType.CONTINUE)) { + res = new StmtNS.Continue(startToken, startToken); + } + else if (this.match(TokenType.RETURN)) { + res = new StmtNS.Return(startToken, startToken, this.check(TokenType.NEWLINE) ? null : this.test()); + } + else if (this.match(TokenType.FROM)) { + res = this.import_from(); + } + else if (this.match(TokenType.GLOBAL)) { + res = new StmtNS.Global(startToken, startToken, this.advance()); + } + else if (this.match(TokenType.NONLOCAL)) { + res = new StmtNS.NonLocal(startToken, startToken, this.advance()); + } + else if (this.match(TokenType.ASSERT)) { + res = new StmtNS.Assert(startToken, startToken, this.test()); + } + else if (this.check(TokenType.LPAR, TokenType.NUMBER, TokenType.STRING, TokenType.BIGINT, TokenType.MINUS, TokenType.PLUS, ...SPECIAL_IDENTIFIER_TOKENS)) { + res = new StmtNS.SimpleExpr(startToken, startToken, this.test()); + } + else { + throw new Error("Unreachable code path"); + } + this.consume(TokenType.NEWLINE, "Expected newline"); + return res; + } + assign_stmt() { + const startToken = this.previous(); + const name = this.previous(); + if (this.check(TokenType.COLON)) { + const ann = this.test(); + this.consume(TokenType.EQUAL, "Expect equal in assignment"); + const expr = this.test(); + return new StmtNS.AnnAssign(startToken, this.previous(), name, expr, ann); + } + else if (this.check(TokenType.EQUAL)) { + this.advance(); + const expr = this.test(); + return new StmtNS.Assign(startToken, this.previous(), name, expr); + } + else { + this.current--; + const expr = this.test(); + return new StmtNS.SimpleExpr(startToken, this.previous(), expr); + } + } + import_from() { + const startToken = this.previous(); + const module = this.advance(); + this.consume(TokenType.IMPORT, "Expected import keyword"); + let params; + if (this.check(TokenType.NAME)) { + params = [this.advance()]; + } + else { + params = this.parameters(); + } + return new StmtNS.FromImport(startToken, this.previous(), module, params); + } + parameters() { + this.consume(TokenType.LPAR, "Expected opening parentheses"); + let res = this.varparamslist(); + this.consume(TokenType.RPAR, "Expected closing parentheses"); + return res; + } + test() { + if (this.match(TokenType.LAMBDA)) { + return this.lambdef(); + } + else { + const startToken = this.peek(); + let consequent = this.or_test(); + if (this.match(TokenType.IF)) { + const predicate = this.or_test(); + this.consume(TokenType.ELSE, "Expected else"); + const alternative = this.test(); + return new ExprNS.Ternary(startToken, this.previous(), predicate, consequent, alternative); + } + return consequent; + } + } + lambdef() { + const startToken = this.previous(); + let args = this.varparamslist(); + if (this.match(TokenType.COLON)) { + let test = this.test(); + return new ExprNS.Lambda(startToken, this.previous(), args, test); + } + else if (this.match(TokenType.DOUBLECOLON)) { + let block = this.suite(); + return new ExprNS.MultiLambda(startToken, this.previous(), args, block, []); + } + this.consume(TokenType.COLON, "Expected ':' after lambda"); + throw new Error("unreachable code path"); + } + suite() { + let stmts = []; + if (this.match(TokenType.NEWLINE)) { + this.consume(TokenType.INDENT, "Expected indent"); + while (!this.match(TokenType.DEDENT)) { + stmts.push(this.stmt()); + } + } + return stmts; + } + varparamslist() { + let params = []; + while (!this.check(TokenType.COLON) && !this.check(TokenType.RPAR)) { + let name = this.consume(TokenType.NAME, "Expected a proper identifier in parameter"); + params.push(name); + if (!this.match(TokenType.COMMA)) { + break; + } + } + return params; + } + or_test() { + const startToken = this.peek(); + let expr = this.and_test(); + while (this.match(TokenType.OR)) { + const operator = this.previous(); + const right = this.and_test(); + expr = new ExprNS.BoolOp(startToken, this.previous(), expr, operator, right); + } + return expr; + } + and_test() { + const startToken = this.peek(); + let expr = this.not_test(); + while (this.match(TokenType.AND)) { + const operator = this.previous(); + const right = this.not_test(); + expr = new ExprNS.BoolOp(startToken, this.previous(), expr, operator, right); + } + return expr; + } + not_test() { + const startToken = this.peek(); + if (this.match(TokenType.NOT, TokenType.BANG)) { + const operator = this.previous(); + return new ExprNS.Unary(startToken, this.previous(), operator, this.not_test()); + } + return this.comparison(); + } + comparison() { + const startToken = this.peek(); + let expr = this.arith_expr(); + // @TODO: Add the rest of the comparisons + while (this.match(TokenType.LESS, TokenType.GREATER, TokenType.DOUBLEEQUAL, TokenType.GREATEREQUAL, TokenType.LESSEQUAL, TokenType.NOTEQUAL, TokenType.IS, TokenType.ISNOT, TokenType.IN, TokenType.NOTIN)) { + const operator = this.previous(); + const right = this.arith_expr(); + expr = new ExprNS.Compare(startToken, this.previous(), expr, operator, right); + } + return expr; + } + arith_expr() { + const startToken = this.peek(); + let expr = this.term(); + while (this.match(TokenType.PLUS, TokenType.MINUS)) { + const token = this.previous(); + const right = this.term(); + expr = new ExprNS.Binary(startToken, this.previous(), expr, token, right); + } + return expr; + } + term() { + const startToken = this.peek(); + let expr = this.factor(); + while (this.match(TokenType.STAR, TokenType.SLASH, TokenType.PERCENT, TokenType.DOUBLESLASH)) { + const token = this.previous(); + const right = this.factor(); + expr = new ExprNS.Binary(startToken, this.previous(), expr, token, right); + } + return expr; + } + factor() { + const startToken = this.peek(); + if (this.match(TokenType.PLUS, TokenType.MINUS)) { + const op = this.previous(); + const factor = this.factor(); + const endToken = this.previous(); + return new ExprNS.Unary(startToken, endToken, op, factor); + } + return this.power(); + } + power() { + const startToken = this.peek(); + let expr = this.atom_expr(); + if (this.match(TokenType.DOUBLESTAR)) { + const token = this.previous(); + const right = this.factor(); + const endToken = this.previous(); + return new ExprNS.Binary(startToken, endToken, expr, token, right); + } + return expr; + } + atom_expr() { + let startToken = this.peek(); + let ato = this.atom(); + let res; + if (this.match(TokenType.LPAR)) { + let args = this.arglist(); + const endToken = this.previous(); + res = new ExprNS.Call(startToken, endToken, ato, args); + } + else { + return ato; + } + // To handle things like x()()() + startToken = this.peek(); + while (this.match(TokenType.LPAR)) { + let args = this.arglist(); + res = new ExprNS.Call(startToken, this.previous(), res, args); + startToken = this.peek(); + } + return res; + } + arglist() { + let args = []; + while (!this.check(TokenType.RPAR)) { + let arg = this.test(); + args.push(arg); + if (!this.match(TokenType.COMMA)) { + break; + } + } + this.consume(TokenType.RPAR, "Expected closing ')' after function application"); + return args; + } + atom() { + const startToken = this.peek(); + if (this.match(TokenType.TRUE)) + return new ExprNS.Literal(startToken, this.previous(), true); + if (this.match(TokenType.FALSE)) + return new ExprNS.Literal(startToken, this.previous(), false); + if (this.match(TokenType.NONE)) + return new ExprNS.None(startToken, this.previous()); + if (this.match(TokenType.STRING)) { + return new ExprNS.Literal(startToken, this.previous(), this.previous().lexeme); + } + if (this.match(TokenType.NUMBER)) { + return new ExprNS.Literal(startToken, this.previous(), Number(this.previous().lexeme.replace(/_/g, ""))); + } + if (this.match(TokenType.BIGINT)) { + return new ExprNS.BigIntLiteral(startToken, this.previous(), this.previous().lexeme); + } + if (this.match(TokenType.COMPLEX)) { + return new ExprNS.Complex(startToken, this.previous(), this.previous().lexeme); + } + if (this.match(TokenType.NAME, ...PSEUD_NAMES)) { + return new ExprNS.Variable(startToken, this.previous(), this.previous()); + } + if (this.match(TokenType.LPAR)) { + let expr = this.test(); + this.consume(TokenType.RPAR, "Expected closing ')'"); + return new ExprNS.Grouping(startToken, this.previous(), expr); + } + const startTokenInvalid = this.peek(); + this.synchronize(); + const endTokenInvalid = this.peek(); + throw new exports.ParserErrors.GenericUnexpectedSyntaxError(startToken.line, startToken.col, this.source, startTokenInvalid.indexInSource, endTokenInvalid.indexInSource); + } + //// INVALID RULES + parse_invalid(startToken, endToken) { + // @TODO invalid rules + } + } + + /* + * Translate our AST to estree AST (Source's AST) + * */ + class Translator { + constructor(source) { + this.source = source; + } + tokenToEstreeLocation(token) { + // Convert zero-based to one-based. + const line = token.line + 1; + const start = { + line, + column: token.col - token.lexeme.length + }; + const end = { + line, + column: token.col + }; + const source = token.lexeme; + return { source, start, end }; + } + toEstreeLocation(stmt) { + const start = { + // Convert zero-based to one-based. + line: stmt.startToken.line + 1, + column: stmt.startToken.col - stmt.startToken.lexeme.length + }; + const end = { + // Convert zero-based to one-based. + line: stmt.endToken.line + 1, + column: stmt.endToken.col + }; + const source = this.source.slice(stmt.startToken.indexInSource, stmt.endToken.indexInSource + stmt.endToken.lexeme.length); + return { source, start, end }; + } + resolve(stmt) { + return stmt.accept(this); + } + // Ugly, but just to support proper typing + resolveStmt(stmt) { + return stmt.accept(this); + } + resolveManyStmt(stmts) { + const res = []; + for (const stmt of stmts) { + res.push(this.resolveStmt(stmt)); + } + return res; + } + resolveExpr(expr) { + return expr.accept(this); + } + resolveManyExpr(exprs) { + const res = []; + for (const expr of exprs) { + res.push(this.resolveExpr(expr)); + } + return res; + } + // Converts our internal identifier to estree identifier. + rawStringToIdentifier(name, stmtOrExpr) { + const keywords = new Set(['abstract', 'arguments', 'await', 'boolean', 'byte', + 'case', 'catch', 'char', 'const', 'debugger', 'default', 'delete', 'do', 'double', 'enum', + 'eval', 'export', 'extends', 'false', 'final', 'float', 'function', 'goto', 'implements', + 'instanceof', 'int', 'interface', 'let', 'long', 'native', 'new', 'null', 'package', + 'private', 'protected', 'public', 'short', 'static', 'super', 'switch', 'synchronized', 'this', + 'throw', 'throws', 'transient', 'true', 'typeof', 'var', 'void', 'volatile']); + return { + type: 'Identifier', + name: keywords.has(name) ? '$' + name : name, + loc: this.toEstreeLocation(stmtOrExpr), + }; + } + // Token to estree identifier. + convertToIdentifier(name) { + const keywords = new Set(['abstract', 'arguments', 'await', 'boolean', 'byte', + 'case', 'catch', 'char', 'const', 'debugger', 'default', 'delete', 'do', 'double', 'enum', + 'eval', 'export', 'extends', 'false', 'final', 'float', 'function', 'goto', 'implements', + 'instanceof', 'int', 'interface', 'let', 'long', 'native', 'new', 'null', 'package', + 'private', 'protected', 'public', 'short', 'static', 'super', 'switch', 'synchronized', 'this', + 'throw', 'throws', 'transient', 'true', 'typeof', 'var', 'void', 'volatile']); + return { + type: 'Identifier', + name: keywords.has(name.lexeme) ? '$' + name.lexeme : name.lexeme, + loc: this.tokenToEstreeLocation(name), + }; + } + convertToIdentifiers(names) { + return names.map(name => this.convertToIdentifier(name)); + } + // private convertToExpressionStatement(expr: Expression): ExpressionStatement { + // return { + // type: 'ExpressionStatement', + // expression: expr, + // // loc: this.toEstreeLocation(), + // } + // } + // private converTokenstoDecls(varDecls: Token[]): VariableDeclaration { + // return { + // type: 'VariableDeclaration', + // declarations: varDecls?.map((token): VariableDeclarator => { + // return { + // type: 'VariableDeclarator', + // id: this.convertToIdentifier(token), + // loc: this.tokenToEstreeLocation(token), + // } + // }), + // kind: 'var', + // loc: this.toEstreeLocation(), + // }; + // } + // Wraps an array of statements to a block. + // WARNING: THIS CREATES A NEW BLOCK IN + // JS AST. THIS ALSO MEANS A NEW NAMESPACE. BE CAREFUL! + wrapInBlock(stmt, stmts) { + return { + type: 'BlockStatement', + body: this.resolveManyStmt(stmts), + loc: this.toEstreeLocation(stmt), + }; + } + //// STATEMENTS + visitFileInputStmt(stmt) { + const newBody = this.resolveManyStmt(stmt.statements); + // if (stmt.varDecls !== null && stmt.varDecls.length > 0) { + // const decls = this.converTokenstoDecls(stmt.varDecls); + // newBody.unshift(decls); + // } + return { + type: 'Program', + sourceType: 'module', + body: newBody, + loc: this.toEstreeLocation(stmt), + }; + } + visitIndentCreation(stmt) { + return { + type: 'EmptyStatement', + loc: this.toEstreeLocation(stmt), + }; + } + visitDedentCreation(stmt) { + return { + type: 'EmptyStatement', + loc: this.toEstreeLocation(stmt), + }; + } + visitFunctionDefStmt(stmt) { + const newBody = this.resolveManyStmt(stmt.body); + // if (stmt.varDecls !== null && stmt.varDecls.length > 0) { + // const decls = this.converTokenstoDecls(stmt.varDecls); + // newBody.unshift(decls); + // } + return { + type: 'FunctionDeclaration', + id: this.convertToIdentifier(stmt.name), + params: this.convertToIdentifiers(stmt.parameters), + body: { + type: 'BlockStatement', + body: newBody, + }, + loc: this.toEstreeLocation(stmt), + }; + } + visitAnnAssignStmt(stmt) { + return { + type: 'AssignmentExpression', + // We only have one type of assignment in restricted Python. + operator: '=', + left: this.convertToIdentifier(stmt.name), + right: this.resolveExpr(stmt.value), + loc: this.toEstreeLocation(stmt), + }; + } + // Note: assignments are expressions in JS. + visitAssignStmt(stmt) { + // return this.convertToExpressionStatement({ + // type: 'AssignmentExpression', + // // We only have one type of assignment in restricted Python. + // operator: '=', + // left: this.convertToIdentifier(stmt.name), + // right: this.resolveExpr(stmt.value), + // loc: this.toEstreeLocation(stmt), + // }) + const declaration = { + type: 'VariableDeclarator', + id: this.convertToIdentifier(stmt.name), + loc: this.tokenToEstreeLocation(stmt.name), + init: this.resolveExpr(stmt.value), + }; + return { + type: 'VariableDeclaration', + declarations: [declaration], + // Note: we abuse the fact that var is function and module scoped + // which is exactly the same as how Python assignments are scoped! + kind: 'var', + loc: this.toEstreeLocation(stmt), + }; + } + // Convert to source's built-in assert function. + visitAssertStmt(stmt) { + return { + type: 'CallExpression', + optional: false, + callee: this.rawStringToIdentifier('assert', stmt), + arguments: [this.resolveExpr(stmt.value)], + // @TODO, this needs to come after callee + loc: this.toEstreeLocation(stmt), + }; + } + // @TODO decide how to do for loops + // For now, empty block + visitForStmt(stmt) { + return { + type: 'EmptyStatement', + loc: this.toEstreeLocation(stmt), + }; + } + visitIfStmt(stmt) { + return { + type: 'IfStatement', + test: this.resolveExpr(stmt.condition), + consequent: this.wrapInBlock(stmt, stmt.body), + alternate: stmt.elseBlock !== null ? this.wrapInBlock(stmt, stmt.elseBlock) : null, + loc: this.toEstreeLocation(stmt), + }; + } + visitGlobalStmt(stmt) { + return { + type: 'EmptyStatement', + loc: this.toEstreeLocation(stmt), + }; + } + visitNonLocalStmt(stmt) { + return { + type: 'EmptyStatement', + loc: this.toEstreeLocation(stmt), + }; + } + visitReturnStmt(stmt) { + return { + type: 'ReturnStatement', + argument: stmt.value == null ? null : this.resolveExpr(stmt.value), + loc: this.toEstreeLocation(stmt), + }; + } + visitWhileStmt(stmt) { + return { + type: 'WhileStatement', + test: this.resolveExpr(stmt.condition), + body: this.wrapInBlock(stmt, stmt.body), + loc: this.toEstreeLocation(stmt), + }; + } + visitSimpleExprStmt(stmt) { + return { + type: 'ExpressionStatement', + expression: this.resolveExpr(stmt.expression), + loc: this.toEstreeLocation(stmt), + }; + } + // @TODO + visitFromImportStmt(stmt) { + const specifiers = stmt.names.map(name => { + const ident = this.convertToIdentifier(name); + return { + type: 'ImportSpecifier', + imported: ident, + local: ident, + }; + }); + return { + type: 'ImportDeclaration', + specifiers: specifiers, + source: { + type: 'Literal', + value: stmt.module.lexeme, + loc: this.tokenToEstreeLocation(stmt.module) + }, + attributes: [] + }; + } + visitContinueStmt(stmt) { + return { + type: 'ContinueStatement', + loc: this.toEstreeLocation(stmt), + }; + } + visitBreakStmt(stmt) { + return { + type: 'BreakStatement', + loc: this.toEstreeLocation(stmt), + }; + } + visitPassStmt(stmt) { + return { + type: 'EmptyStatement', + loc: this.toEstreeLocation(stmt), + }; + } + //// EXPRESSIONS + visitVariableExpr(expr) { + return this.convertToIdentifier(expr.name); + } + visitLambdaExpr(expr) { + return { + type: 'ArrowFunctionExpression', + expression: true, + params: this.convertToIdentifiers(expr.parameters), + body: this.resolveExpr(expr.body), + loc: this.toEstreeLocation(expr), + }; + } + // disabled for now + visitMultiLambdaExpr(expr) { + return { + type: 'EmptyStatement', + loc: this.toEstreeLocation(expr), + }; + } + visitUnaryExpr(expr) { + const op = expr.operator.type; + let res = '-'; + let plus = false; + switch (op) { + case TokenType.NOT: + res = '!'; + break; + case TokenType.PLUS: + res = '+'; + plus = true; + break; + case TokenType.MINUS: + res = '-'; + break; + default: + throw new Error("Unreachable code path in translator"); + } + if (plus) { + return { + type: 'CallExpression', + optional: false, + callee: { + type: 'Identifier', + name: '__py_unary_plus', + loc: this.toEstreeLocation(expr), + }, + arguments: [this.resolveExpr(expr.right)], + loc: this.toEstreeLocation(expr), + }; + } + return { + type: 'UnaryExpression', + // To satisfy the type checker. + operator: res, + prefix: true, + argument: this.resolveExpr(expr.right), + loc: this.toEstreeLocation(expr), + }; + } + visitGroupingExpr(expr) { + return this.resolveExpr(expr.expression); + } + visitBinaryExpr(expr) { + const op = expr.operator.type; + let res = ''; + // To make the type checker happy. + switch (op) { + case TokenType.PLUS: + res = '__py_adder'; + break; + case TokenType.MINUS: + res = '__py_minuser'; + break; + case TokenType.STAR: + res = '__py_multiplier'; + break; + case TokenType.SLASH: + res = '__py_divider'; + break; + case TokenType.PERCENT: + res = '__py_modder'; + break; + // @TODO double slash and power needs to convert to math exponent/floor divide + case TokenType.DOUBLESLASH: + res = '__py_floorer'; + break; + case TokenType.DOUBLESTAR: + res = '__py_powerer'; + break; + default: + throw new Error("Unreachable binary code path in translator"); + } + return { + type: 'CallExpression', + optional: false, + callee: { + type: 'Identifier', + name: res, + loc: this.toEstreeLocation(expr), + }, + arguments: [this.resolveExpr(expr.left), this.resolveExpr(expr.right)], + loc: this.toEstreeLocation(expr), + }; + } + visitCompareExpr(expr) { + const op = expr.operator.type; + let res = '+'; + // To make the type checker happy. + switch (op) { + case TokenType.LESS: + res = '<'; + break; + case TokenType.GREATER: + res = '>'; + break; + case TokenType.DOUBLEEQUAL: + res = '==='; + break; + case TokenType.GREATEREQUAL: + res = '>='; + break; + case TokenType.LESSEQUAL: + res = '<='; + break; + case TokenType.NOTEQUAL: + res = '!=='; + break; + // @TODO we need to convert these to builtin function applications. + case TokenType.IS: + case TokenType.ISNOT: + case TokenType.IN: + case TokenType.NOTIN: + throw new exports.TranslatorErrors.UnsupportedOperator(expr.operator.line, expr.operator.col, this.source, expr.operator.indexInSource); + default: + throw new Error("Unreachable binary code path in translator"); + } + return { + type: 'BinaryExpression', + operator: res, + left: this.resolveExpr(expr.left), + right: this.resolveExpr(expr.right), + loc: this.toEstreeLocation(expr), + }; + } + visitBoolOpExpr(expr) { + const op = expr.operator.type; + let res = '||'; + // To make the type checker happy. + switch (op) { + case TokenType.AND: + res = '&&'; + break; + case TokenType.OR: + res = '||'; + break; + default: + throw new Error("Unreachable binary code path in translator"); + } + return { + type: 'LogicalExpression', + operator: res, + left: this.resolveExpr(expr.left), + right: this.resolveExpr(expr.right), + loc: this.toEstreeLocation(expr), + }; + } + visitCallExpr(expr) { + return { + type: 'CallExpression', + optional: false, + callee: this.resolveExpr(expr.callee), + arguments: this.resolveManyExpr(expr.args), + loc: this.toEstreeLocation(expr), + }; + } + visitTernaryExpr(expr) { + return { + type: 'ConditionalExpression', + test: this.resolveExpr(expr.predicate), + alternate: this.resolveExpr(expr.alternative), + consequent: this.resolveExpr(expr.consequent), + loc: this.toEstreeLocation(expr), + }; + } + visitLiteralExpr(expr) { + return { + type: 'Literal', + value: expr.value, + loc: this.toEstreeLocation(expr), + }; + } + visitBigIntLiteralExpr(expr) { + return { + type: 'Literal', + bigint: expr.value, + loc: this.toEstreeLocation(expr), + }; + } + visitNoneExpr(expr) { + return { + type: 'NoneType', + loc: this.toEstreeLocation(expr) + }; + } + visitComplexExpr(expr) { + return { + type: 'Literal', + complex: { + real: expr.value.real, + imag: expr.value.imag + }, + loc: this.toEstreeLocation(expr), + }; + } + } + + var levenshtein$1 = {exports: {}}; + + const peq = new Uint32Array(0x10000); + const myers_32 = (a, b) => { + const n = a.length; + const m = b.length; + const lst = 1 << (n - 1); + let pv = -1; + let mv = 0; + let sc = n; + let i = n; + while (i--) { + peq[a.charCodeAt(i)] |= 1 << i; + } + for (i = 0; i < m; i++) { + let eq = peq[b.charCodeAt(i)]; + const xv = eq | mv; + eq |= ((eq & pv) + pv) ^ pv; + mv |= ~(eq | pv); + pv &= eq; + if (mv & lst) { + sc++; + } + if (pv & lst) { + sc--; + } + mv = (mv << 1) | 1; + pv = (pv << 1) | ~(xv | mv); + mv &= xv; + } + i = n; + while (i--) { + peq[a.charCodeAt(i)] = 0; + } + return sc; + }; + const myers_x = (b, a) => { + const n = a.length; + const m = b.length; + const mhc = []; + const phc = []; + const hsize = Math.ceil(n / 32); + const vsize = Math.ceil(m / 32); + for (let i = 0; i < hsize; i++) { + phc[i] = -1; + mhc[i] = 0; + } + let j = 0; + for (; j < vsize - 1; j++) { + let mv = 0; + let pv = -1; + const start = j * 32; + const vlen = Math.min(32, m) + start; + for (let k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] |= 1 << k; + } + for (let i = 0; i < n; i++) { + const eq = peq[a.charCodeAt(i)]; + const pb = (phc[(i / 32) | 0] >>> i) & 1; + const mb = (mhc[(i / 32) | 0] >>> i) & 1; + const xv = eq | mv; + const xh = ((((eq | mb) & pv) + pv) ^ pv) | eq | mb; + let ph = mv | ~(xh | pv); + let mh = pv & xh; + if ((ph >>> 31) ^ pb) { + phc[(i / 32) | 0] ^= 1 << i; + } + if ((mh >>> 31) ^ mb) { + mhc[(i / 32) | 0] ^= 1 << i; + } + ph = (ph << 1) | pb; + mh = (mh << 1) | mb; + pv = mh | ~(xv | ph); + mv = ph & xv; + } + for (let k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] = 0; + } + } + let mv = 0; + let pv = -1; + const start = j * 32; + const vlen = Math.min(32, m - start) + start; + for (let k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] |= 1 << k; + } + let score = m; + for (let i = 0; i < n; i++) { + const eq = peq[a.charCodeAt(i)]; + const pb = (phc[(i / 32) | 0] >>> i) & 1; + const mb = (mhc[(i / 32) | 0] >>> i) & 1; + const xv = eq | mv; + const xh = ((((eq | mb) & pv) + pv) ^ pv) | eq | mb; + let ph = mv | ~(xh | pv); + let mh = pv & xh; + score += (ph >>> (m - 1)) & 1; + score -= (mh >>> (m - 1)) & 1; + if ((ph >>> 31) ^ pb) { + phc[(i / 32) | 0] ^= 1 << i; + } + if ((mh >>> 31) ^ mb) { + mhc[(i / 32) | 0] ^= 1 << i; + } + ph = (ph << 1) | pb; + mh = (mh << 1) | mb; + pv = mh | ~(xv | ph); + mv = ph & xv; + } + for (let k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] = 0; + } + return score; + }; + const distance = (a, b) => { + if (a.length < b.length) { + const tmp = b; + b = a; + a = tmp; + } + if (b.length === 0) { + return a.length; + } + if (a.length <= 32) { + return myers_32(a, b); + } + return myers_x(a, b); + }; + const closest = (str, arr) => { + let min_distance = Infinity; + let min_index = 0; + for (let i = 0; i < arr.length; i++) { + const dist = distance(str, arr[i]); + if (dist < min_distance) { + min_distance = dist; + min_index = i; + } + } + return arr[min_index]; + }; + + var mod = /*#__PURE__*/Object.freeze({ + __proto__: null, + closest: closest, + distance: distance + }); + + var require$$0 = /*@__PURE__*/getAugmentedNamespace(mod); + + var hasRequiredLevenshtein; + + function requireLevenshtein () { + if (hasRequiredLevenshtein) return levenshtein$1.exports; + hasRequiredLevenshtein = 1; + (function (module, exports) { + (function() { + + var collator; + try { + collator = (typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined") ? Intl.Collator("generic", { sensitivity: "base" }) : null; + } catch (err){ + console.log("Collator could not be initialized and wouldn't be used"); + } + + var levenshtein = require$$0; + + // arrays to re-use + var prevRow = [], + str2Char = []; + + /** + * Based on the algorithm at http://en.wikipedia.org/wiki/Levenshtein_distance. + */ + var Levenshtein = { + /** + * Calculate levenshtein distance of the two strings. + * + * @param str1 String the first string. + * @param str2 String the second string. + * @param [options] Additional options. + * @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison. + * @return Integer the levenshtein distance (0 and above). + */ + get: function(str1, str2, options) { + var useCollator = (options && collator && options.useCollator); + + if (useCollator) { + var str1Len = str1.length, + str2Len = str2.length; + + // base cases + if (str1Len === 0) return str2Len; + if (str2Len === 0) return str1Len; + + // two rows + var curCol, nextCol, i, j, tmp; + + // initialise previous row + for (i=0; i tmp) { + nextCol = tmp; + } + // deletion + tmp = prevRow[j + 1] + 1; + if (nextCol > tmp) { + nextCol = tmp; + } + + // copy current col value into previous (in preparation for next iteration) + prevRow[j] = curCol; + } + + // copy last col value into previous (in preparation for next iteration) + prevRow[j] = nextCol; + } + return nextCol; + } + return levenshtein.distance(str1, str2); + } + + }; + + // amd + if (module !== null && 'object' !== "undefined" && module.exports === exports) { + module.exports = Levenshtein; + } + // web worker + else if (typeof self !== "undefined" && typeof self.postMessage === 'function' && typeof self.importScripts === 'function') { + self.Levenshtein = Levenshtein; + } + // browser main thread + else if (typeof window !== "undefined" && window !== null) { + window.Levenshtein = Levenshtein; + } + }()); + } (levenshtein$1, levenshtein$1.exports)); + return levenshtein$1.exports; + } + + var levenshteinExports = requireLevenshtein(); + var levenshtein = /*@__PURE__*/getDefaultExportFromCjs(levenshteinExports); + + // const levenshtein = require('fast-levenshtein'); + const RedefineableTokenSentinel = new Token(TokenType.AT, "", 0, 0, 0); + class Environment { + constructor(source, enclosing, names) { + this.source = source; + this.enclosing = enclosing; + this.names = names; + this.functions = new Set(); + this.moduleBindings = new Set(); + } + /* + * Does a full lookup up the environment chain for a name. + * Returns the distance of the name from the current environment. + * If name isn't found, return -1. + * */ + lookupName(identifier) { + const name = identifier.lexeme; + let distance = 0; + let curr = this; + while (curr !== null) { + if (curr.names.has(name)) { + break; + } + distance += 1; + curr = curr.enclosing; + } + return (curr === null) ? -1 : distance; + } + /* Looks up the name but only for the current environment. */ + lookupNameCurrentEnv(identifier) { + return this.names.get(identifier.lexeme); + } + lookupNameCurrentEnvWithError(identifier) { + if (this.lookupName(identifier) < 0) { + throw new exports.ResolverErrors.NameNotFoundError(identifier.line, identifier.col, this.source, identifier.indexInSource, identifier.indexInSource + identifier.lexeme.length, this.suggestName(identifier)); + } + } + lookupNameParentEnvWithError(identifier) { + const name = identifier.lexeme; + let parent = this.enclosing; + if (parent === null || !parent.names.has(name)) { + throw new exports.ResolverErrors.NameNotFoundError(identifier.line, identifier.col, this.source, identifier.indexInSource, identifier.indexInSource + name.length, this.suggestName(identifier)); + } + } + declareName(identifier) { + const lookup = this.lookupNameCurrentEnv(identifier); + if (lookup !== undefined && lookup !== RedefineableTokenSentinel) { + throw new exports.ResolverErrors.NameReassignmentError(identifier.line, identifier.col, this.source, identifier.indexInSource, identifier.indexInSource + identifier.lexeme.length, lookup); + } + this.names.set(identifier.lexeme, identifier); + } + // Same as declareName but allowed to re-declare later. + declarePlaceholderName(identifier) { + const lookup = this.lookupNameCurrentEnv(identifier); + if (lookup !== undefined) { + throw new exports.ResolverErrors.NameReassignmentError(identifier.line, identifier.col, this.source, identifier.indexInSource, identifier.indexInSource + identifier.lexeme.length, lookup); + } + this.names.set(identifier.lexeme, RedefineableTokenSentinel); + } + suggestNameCurrentEnv(identifier) { + const name = identifier.lexeme; + let minDistance = Infinity; + let minName = null; + for (const declName of this.names.keys()) { + const dist = levenshtein.get(name, declName); + if (dist < minDistance) { + minDistance = dist; + minName = declName; + } + } + return minName; + } + /* + * Finds name closest to name in all environments up to builtin environment. + * Calculated using min levenshtein distance. + * */ + suggestName(identifier) { + const name = identifier.lexeme; + let minDistance = Infinity; + let minName = null; + let curr = this; + while (curr !== null) { + for (const declName of curr.names.keys()) { + const dist = levenshtein.get(name, declName); + if (dist < minDistance) { + minDistance = dist; + minName = declName; + } + } + curr = curr.enclosing; + } + if (minDistance >= 4) { + // This is pretty far, so just return null + return null; + } + return minName; + } + } + class Resolver { + constructor(source, ast) { + this.source = source; + this.ast = ast; + // The global environment + this.environment = new Environment(source, null, new Map([ + // misc library + ["_int", new Token(TokenType.NAME, "_int", 0, 0, 0)], + ["_int_from_string", new Token(TokenType.NAME, "_int_from_string", 0, 0, 0)], + ["abs", new Token(TokenType.NAME, "abs", 0, 0, 0)], + ["char_at", new Token(TokenType.NAME, "char_at", 0, 0, 0)], + ["error", new Token(TokenType.NAME, "error", 0, 0, 0)], + ["input", new Token(TokenType.NAME, "input", 0, 0, 0)], + ["isinstance", new Token(TokenType.NAME, "isinstance", 0, 0, 0)], + ["max", new Token(TokenType.NAME, "max", 0, 0, 0)], + ["min", new Token(TokenType.NAME, "min", 0, 0, 0)], + ["print", new Token(TokenType.NAME, "print", 0, 0, 0)], + ["random_random", new Token(TokenType.NAME, "random_random", 0, 0, 0)], + ["round", new Token(TokenType.NAME, "round", 0, 0, 0)], + ["str", new Token(TokenType.NAME, "str", 0, 0, 0)], + ["time_time", new Token(TokenType.NAME, "time_time", 0, 0, 0)], + // math constants + ["math_pi", new Token(TokenType.NAME, "math_pi", 0, 0, 0)], + ["math_e", new Token(TokenType.NAME, "math_e", 0, 0, 0)], + ["math_inf", new Token(TokenType.NAME, "math_inf", 0, 0, 0)], + ["math_nan", new Token(TokenType.NAME, "math_nan", 0, 0, 0)], + ["math_tau", new Token(TokenType.NAME, "math_tau", 0, 0, 0)], + // math library + ["math_acos", new Token(TokenType.NAME, "math_acos", 0, 0, 0)], + ["math_acosh", new Token(TokenType.NAME, "math_acosh", 0, 0, 0)], + ["math_asin", new Token(TokenType.NAME, "math_asin", 0, 0, 0)], + ["math_asinh", new Token(TokenType.NAME, "math_asinh", 0, 0, 0)], + ["math_atan", new Token(TokenType.NAME, "math_atan", 0, 0, 0)], + ["math_atan2", new Token(TokenType.NAME, "math_atan2", 0, 0, 0)], + ["math_atanh", new Token(TokenType.NAME, "math_atanh", 0, 0, 0)], + ["math_cbrt", new Token(TokenType.NAME, "math_cbrt", 0, 0, 0)], + ["math_ceil", new Token(TokenType.NAME, "math_ceil", 0, 0, 0)], + ["math_comb", new Token(TokenType.NAME, "math_comb", 0, 0, 0)], + ["math_copysign", new Token(TokenType.NAME, "math_copysign", 0, 0, 0)], + ["math_cos", new Token(TokenType.NAME, "math_cos", 0, 0, 0)], + ["math_cosh", new Token(TokenType.NAME, "math_cosh", 0, 0, 0)], + ["math_degrees", new Token(TokenType.NAME, "math_degrees", 0, 0, 0)], + ["math_erf", new Token(TokenType.NAME, "math_erf", 0, 0, 0)], + ["math_erfc", new Token(TokenType.NAME, "math_erfc", 0, 0, 0)], + ["math_exp", new Token(TokenType.NAME, "math_exp", 0, 0, 0)], + ["math_exp2", new Token(TokenType.NAME, "math_exp2", 0, 0, 0)], + ["math_expm1", new Token(TokenType.NAME, "math_expm1", 0, 0, 0)], + ["math_fabs", new Token(TokenType.NAME, "math_fabs", 0, 0, 0)], + ["math_factorial", new Token(TokenType.NAME, "math_factorial", 0, 0, 0)], + ["math_floor", new Token(TokenType.NAME, "math_floor", 0, 0, 0)], + ["math_fma", new Token(TokenType.NAME, "math_fma", 0, 0, 0)], + ["math_fmod", new Token(TokenType.NAME, "math_fmod", 0, 0, 0)], + ["math_gamma", new Token(TokenType.NAME, "math_gamma", 0, 0, 0)], + ["math_gcd", new Token(TokenType.NAME, "math_gcd", 0, 0, 0)], + ["math_isfinite", new Token(TokenType.NAME, "math_isfinite", 0, 0, 0)], + ["math_isinf", new Token(TokenType.NAME, "math_isinf", 0, 0, 0)], + ["math_isnan", new Token(TokenType.NAME, "math_isnan", 0, 0, 0)], + ["math_isqrt", new Token(TokenType.NAME, "math_isqrt", 0, 0, 0)], + ["math_lcm", new Token(TokenType.NAME, "math_lcm", 0, 0, 0)], + ["math_ldexp", new Token(TokenType.NAME, "math_ldexp", 0, 0, 0)], + ["math_lgamma", new Token(TokenType.NAME, "math_lgamma", 0, 0, 0)], + ["math_log", new Token(TokenType.NAME, "math_log", 0, 0, 0)], + ["math_log10", new Token(TokenType.NAME, "math_log10", 0, 0, 0)], + ["math_log1p", new Token(TokenType.NAME, "math_log1p", 0, 0, 0)], + ["math_log2", new Token(TokenType.NAME, "math_log2", 0, 0, 0)], + ["math_nextafter", new Token(TokenType.NAME, "math_nextafter", 0, 0, 0)], + ["math_perm", new Token(TokenType.NAME, "math_perm", 0, 0, 0)], + ["math_pow", new Token(TokenType.NAME, "math_pow", 0, 0, 0)], + ["math_radians", new Token(TokenType.NAME, "math_radians", 0, 0, 0)], + ["math_remainder", new Token(TokenType.NAME, "math_remainder", 0, 0, 0)], + ["math_sin", new Token(TokenType.NAME, "math_sin", 0, 0, 0)], + ["math_sinh", new Token(TokenType.NAME, "math_sinh", 0, 0, 0)], + ["math_sqrt", new Token(TokenType.NAME, "math_sqrt", 0, 0, 0)], + ["math_tan", new Token(TokenType.NAME, "math_tan", 0, 0, 0)], + ["math_tanh", new Token(TokenType.NAME, "math_tanh", 0, 0, 0)], + ["math_trunc", new Token(TokenType.NAME, "math_trunc", 0, 0, 0)], + ["math_ulp", new Token(TokenType.NAME, "math_ulp", 0, 0, 0)] + ])); + this.functionScope = null; + } + resolve(stmt) { + var _a; + if (stmt === null) { + return; + } + if (stmt instanceof Array) { + // Resolve all top-level functions first. Python allows functions declared after + // another function to be used in that function. + for (const st of stmt) { + if (st instanceof StmtNS.FunctionDef) { + (_a = this.environment) === null || _a === void 0 ? void 0 : _a.declarePlaceholderName(st.name); + } + } + for (const st of stmt) { + st.accept(this); + } + } + else { + stmt.accept(this); + } + } + varDeclNames(names) { + const res = Array.from(names.values()) + .filter(name => { + var _a, _b; + return ( + // Filter out functions and module bindings. + // Those will be handled separately, so they don't + // need to be hoisted. + !((_a = this.environment) === null || _a === void 0 ? void 0 : _a.functions.has(name.lexeme)) + && !((_b = this.environment) === null || _b === void 0 ? void 0 : _b.moduleBindings.has(name.lexeme))); + }); + return res.length === 0 ? null : res; + } + functionVarConstraint(identifier) { + var _a; + if (this.functionScope == null) { + return; + } + let curr = this.environment; + while (curr !== this.functionScope) { + if (curr !== null && curr.names.has(identifier.lexeme)) { + const token = curr.names.get(identifier.lexeme); + if (token === undefined) { + throw new Error("placeholder error"); + } + throw new exports.ResolverErrors.NameReassignmentError(identifier.line, identifier.col, this.source, identifier.indexInSource, identifier.indexInSource + identifier.lexeme.length, token); + } + curr = (_a = curr === null || curr === void 0 ? void 0 : curr.enclosing) !== null && _a !== void 0 ? _a : null; + } + } + //// STATEMENTS + visitFileInputStmt(stmt) { + // Create a new environment. + const oldEnv = this.environment; + this.environment = new Environment(this.source, this.environment, new Map()); + this.resolve(stmt.statements); + // Grab identifiers from that new environment. That are NOT functions. + // stmt.varDecls = this.varDeclNames(this.environment.names) + this.environment = oldEnv; + } + visitIndentCreation(stmt) { + // Create a new environment + this.environment = new Environment(this.source, this.environment, new Map()); + } + visitDedentCreation(stmt) { + var _a; + // Switch to the previous environment. + if (((_a = this.environment) === null || _a === void 0 ? void 0 : _a.enclosing) !== undefined) { + this.environment = this.environment.enclosing; + } + } + visitFunctionDefStmt(stmt) { + var _a, _b; + (_a = this.environment) === null || _a === void 0 ? void 0 : _a.declareName(stmt.name); + (_b = this.environment) === null || _b === void 0 ? void 0 : _b.functions.add(stmt.name.lexeme); + // Create a new environment. + // const oldEnv = this.environment; + // Assign the parameters to the new environment. + const newEnv = new Map(stmt.parameters.map(param => [param.lexeme, param])); + this.environment = new Environment(this.source, this.environment, newEnv); + // const params = new Map( + // stmt.parameters.map(param => [param.lexeme, param]) + // ); + // if (this.environment !== null) { + // this.environment.names = params; + // } + this.functionScope = this.environment; + this.resolve(stmt.body); + // Grab identifiers from that new environment. That are NOT functions. + // stmt.varDecls = this.varDeclNames(this.environment.names) + // Restore old environment + // this.environment = oldEnv; + } + visitAnnAssignStmt(stmt) { + var _a; + this.resolve(stmt.ann); + this.resolve(stmt.value); + this.functionVarConstraint(stmt.name); + (_a = this.environment) === null || _a === void 0 ? void 0 : _a.declareName(stmt.name); + } + visitAssignStmt(stmt) { + var _a; + this.resolve(stmt.value); + this.functionVarConstraint(stmt.name); + (_a = this.environment) === null || _a === void 0 ? void 0 : _a.declareName(stmt.name); + } + visitAssertStmt(stmt) { + this.resolve(stmt.value); + } + visitForStmt(stmt) { + var _a; + (_a = this.environment) === null || _a === void 0 ? void 0 : _a.declareName(stmt.target); + this.resolve(stmt.iter); + this.resolve(stmt.body); + } + visitIfStmt(stmt) { + this.resolve(stmt.condition); + this.resolve(stmt.body); + this.resolve(stmt.elseBlock); + } + // @TODO we need to treat all global statements as variable declarations in the global + // scope. + visitGlobalStmt(stmt) { + // Do nothing because global can also be declared in our + // own scope. + } + // @TODO nonlocals mean that any variable following that name in the current env + // should not create a variable declaration, but instead point to an outer variable. + visitNonLocalStmt(stmt) { + var _a; + (_a = this.environment) === null || _a === void 0 ? void 0 : _a.lookupNameParentEnvWithError(stmt.name); + } + visitReturnStmt(stmt) { + if (stmt.value !== null) { + this.resolve(stmt.value); + } + } + visitWhileStmt(stmt) { + this.resolve(stmt.condition); + this.resolve(stmt.body); + } + visitSimpleExprStmt(stmt) { + this.resolve(stmt.expression); + } + visitFromImportStmt(stmt) { + var _a, _b; + for (const name of stmt.names) { + (_a = this.environment) === null || _a === void 0 ? void 0 : _a.declareName(name); + (_b = this.environment) === null || _b === void 0 ? void 0 : _b.moduleBindings.add(name.lexeme); + } + } + visitContinueStmt(stmt) { + } + visitBreakStmt(stmt) { + } + visitPassStmt(stmt) { + } + //// EXPRESSIONS + visitVariableExpr(expr) { + var _a; + (_a = this.environment) === null || _a === void 0 ? void 0 : _a.lookupNameCurrentEnvWithError(expr.name); + } + visitLambdaExpr(expr) { + // Create a new environment. + const oldEnv = this.environment; + // Assign the parameters to the new environment. + const newEnv = new Map(expr.parameters.map(param => [param.lexeme, param])); + this.environment = new Environment(this.source, this.environment, newEnv); + this.resolve(expr.body); + // Restore old environment + this.environment = oldEnv; + } + visitMultiLambdaExpr(expr) { + // Create a new environment. + const oldEnv = this.environment; + // Assign the parameters to the new environment. + const newEnv = new Map(expr.parameters.map(param => [param.lexeme, param])); + this.environment = new Environment(this.source, this.environment, newEnv); + this.resolve(expr.body); + // Grab identifiers from that new environment. + expr.varDecls = Array.from(this.environment.names.values()); + // Restore old environment + this.environment = oldEnv; + } + visitUnaryExpr(expr) { + this.resolve(expr.right); + } + visitGroupingExpr(expr) { + this.resolve(expr.expression); + } + visitBinaryExpr(expr) { + this.resolve(expr.left); + this.resolve(expr.right); + } + visitBoolOpExpr(expr) { + this.resolve(expr.left); + this.resolve(expr.right); + } + visitCompareExpr(expr) { + this.resolve(expr.left); + this.resolve(expr.right); + } + visitCallExpr(expr) { + this.resolve(expr.callee); + this.resolve(expr.args); + } + visitTernaryExpr(expr) { + this.resolve(expr.predicate); + this.resolve(expr.consequent); + this.resolve(expr.alternative); + } + visitNoneExpr(expr) { + } + visitLiteralExpr(expr) { + } + visitBigIntLiteralExpr(expr) { + } + visitComplexExpr(expr) { + } + } + + function runCSEMachine(program, context, options = {}) { + const result = evaluate(program, context, options); + return CSEResultPromise(context, result); + } + + /** + * Generic Conductor Error. + */ + class ConductorError extends Error { + constructor(message) { + super(message); + this.name = "ConductorError"; + this.errorType = "__unknown" /* ErrorType.UNKNOWN */; + } + } + + /** + * Conductor internal error, probably caused by developer oversight. + */ + class ConductorInternalError extends ConductorError { + constructor(message) { + super(message); + this.name = "ConductorInternalError"; + this.errorType = "__internal" /* ErrorType.INTERNAL */; + } + } + + class BasicEvaluator { + startEvaluator(entryPoint) { + return __awaiter(this, void 0, void 0, function* () { + const initialChunk = yield this.conductor.requestFile(entryPoint); + if (!initialChunk) + throw new ConductorInternalError("Cannot load entrypoint file"); + yield this.evaluateFile(entryPoint, initialChunk); + while (true) { + const chunk = yield this.conductor.requestChunk(); + yield this.evaluateChunk(chunk); + } + }); + } + /** + * Evaluates a file. + * @param fileName The name of the file to be evaluated. + * @param fileContent The content of the file to be evaluated. + * @returns A promise that resolves when the evaluation is complete. + */ + evaluateFile(fileName, fileContent) { + return __awaiter(this, void 0, void 0, function* () { + return this.evaluateChunk(fileContent); + }); + } + constructor(conductor) { + this.conductor = conductor; + } + } + + /** + * Imports an external plugin from a given location. + * @param location Where to find the external plugin. + * @returns A promise resolving to the imported plugin. + */ + function importExternalPlugin(location) { + return __awaiter(this, void 0, void 0, function* () { + const plugin = (yield import(/* webpackIgnore: true */ location)).plugin; + // TODO: verify it is actually a plugin + return plugin; + }); + } + + /** + * Imports an external module from a given location. + * @param location Where to find the external module. + * @returns A promise resolving to the imported module. + */ + function importExternalModule(location) { + return __awaiter(this, void 0, void 0, function* () { + const plugin = yield importExternalPlugin(location); + // TODO: additional verification it is a module + return plugin; + }); + } + + class Channel { + send(message, transfer) { + this.__verifyAlive(); + this.__port.postMessage(message, transfer !== null && transfer !== void 0 ? transfer : []); + } + subscribe(subscriber) { + this.__verifyAlive(); + this.__subscribers.add(subscriber); + if (this.__waitingMessages) { + for (const data of this.__waitingMessages) { + subscriber(data); + } + delete this.__waitingMessages; + } + } + unsubscribe(subscriber) { + this.__verifyAlive(); + this.__subscribers.delete(subscriber); + } + close() { + var _a; + this.__verifyAlive(); + this.__isAlive = false; + (_a = this.__port) === null || _a === void 0 ? void 0 : _a.close(); + } + /** + * Check if this Channel is allowed to be used. + * @throws Throws an error if the Channel has been closed. + */ + __verifyAlive() { + if (!this.__isAlive) + throw new ConductorInternalError(`Channel ${this.name} has been closed`); + } + /** + * Dispatch some data to subscribers. + * @param data The data to be dispatched to subscribers. + */ + __dispatch(data) { + this.__verifyAlive(); + if (this.__waitingMessages) { + this.__waitingMessages.push(data); + } + else { + for (const subscriber of this.__subscribers) { + subscriber(data); + } + } + } + /** + * Listens to the port's message event, and starts the port. + * Messages will be buffered until the first subscriber listens to the Channel. + * @param port The MessagePort to listen to. + */ + listenToPort(port) { + port.addEventListener("message", e => this.__dispatch(e.data)); + port.start(); + } + /** + * Replaces the underlying MessagePort of this Channel and closes it, and starts the new port. + * @param port The new port to use. + */ + replacePort(port) { + var _a; + this.__verifyAlive(); + (_a = this.__port) === null || _a === void 0 ? void 0 : _a.close(); + this.__port = port; + this.listenToPort(port); + } + constructor(name, port) { + /** The callbacks subscribed to this Channel. */ + this.__subscribers = new Set(); // TODO: use WeakRef? but callbacks tend to be thrown away and leaking is better than incorrect behaviour + /** Is the Channel allowed to be used? */ + this.__isAlive = true; + this.__waitingMessages = []; + this.name = name; + this.replacePort(port); + } + } + + /** + * A stack-based queue implementation. + * `push` and `pop` run in amortized constant time. + */ + class Queue { + constructor() { + /** The output stack. */ + this.__s1 = []; + /** The input stack. */ + this.__s2 = []; + } + /** + * Adds an item to the queue. + * @param item The item to be added to the queue. + */ + push(item) { + this.__s2.push(item); + } + /** + * Removes an item from the queue. + * @returns The item removed from the queue. + * @throws If the queue is empty. + */ + pop() { + if (this.__s1.length === 0) { + if (this.__s2.length === 0) + throw new Error("queue is empty"); + let temp = this.__s1; + this.__s1 = this.__s2.reverse(); + this.__s2 = temp; + } + return this.__s1.pop(); // as the length is nonzero + } + /** + * The length of the queue. + */ + get length() { + return this.__s1.length + this.__s2.length; + } + /** + * Makes a copy of the queue. + * @returns A copy of the queue. + */ + clone() { + const newQueue = new Queue(); + newQueue.__s1 = [...this.__s1]; + newQueue.__s2 = [...this.__s2]; + return newQueue; + } + } + + class MessageQueue { + push(item) { + if (this.__promiseQueue.length !== 0) + this.__promiseQueue.pop()(item); + else + this.__inputQueue.push(item); + } + pop() { + return __awaiter(this, void 0, void 0, function* () { + if (this.__inputQueue.length !== 0) + return this.__inputQueue.pop(); + return new Promise((resolve, _reject) => { + this.__promiseQueue.push(resolve); + }); + }); + } + tryPop() { + if (this.__inputQueue.length !== 0) + return this.__inputQueue.pop(); + return undefined; + } + constructor() { + this.__inputQueue = new Queue(); + this.__promiseQueue = new Queue(); + this.push = this.push.bind(this); + } + } + + class ChannelQueue { + receive() { + return __awaiter(this, void 0, void 0, function* () { + return this.__messageQueue.pop(); + }); + } + tryReceive() { + return this.__messageQueue.tryPop(); + } + send(message, transfer) { + this.__channel.send(message, transfer); + } + close() { + this.__channel.unsubscribe(this.__messageQueue.push); + } + constructor(channel) { + this.__messageQueue = new MessageQueue(); + this.name = channel.name; + this.__channel = channel; + this.__channel.subscribe(this.__messageQueue.push); + } + } + + class Conduit { + __negotiateChannel(channelName) { + const { port1, port2 } = new MessageChannel(); + const channel = new Channel(channelName, port1); + this.__link.postMessage([channelName, port2], [port2]); // TODO: update communication protocol? + this.__channels.set(channelName, channel); + } + __verifyAlive() { + if (!this.__alive) + throw new ConductorInternalError("Conduit already terminated"); + } + registerPlugin(pluginClass, ...arg) { + this.__verifyAlive(); + const attachedChannels = []; + for (const channelName of pluginClass.channelAttach) { + if (!this.__channels.has(channelName)) + this.__negotiateChannel(channelName); + attachedChannels.push(this.__channels.get(channelName)); // as the Channel has been negotiated + } + const plugin = new pluginClass(this, attachedChannels, ...arg); + if (plugin.name !== undefined) { + if (this.__pluginMap.has(plugin.name)) + throw new ConductorInternalError(`Plugin ${plugin.name} already registered`); + this.__pluginMap.set(plugin.name, plugin); + } + this.__plugins.push(plugin); + return plugin; + } + unregisterPlugin(plugin) { + var _a; + this.__verifyAlive(); + let p = 0; + for (let i = 0; i < this.__plugins.length; ++i) { + if (this.__plugins[p] === plugin) + ++p; + this.__plugins[i] = this.__plugins[i + p]; + } + for (let i = this.__plugins.length - 1, e = this.__plugins.length - p; i >= e; --i) { + delete this.__plugins[i]; + } + if (plugin.name) { + this.__pluginMap.delete(plugin.name); + } + (_a = plugin.destroy) === null || _a === void 0 ? void 0 : _a.call(plugin); + } + lookupPlugin(pluginName) { + this.__verifyAlive(); + if (!this.__pluginMap.has(pluginName)) + throw new ConductorInternalError(`Plugin ${pluginName} not registered`); + return this.__pluginMap.get(pluginName); // as the map has been checked + } + terminate() { + var _a, _b, _c; + this.__verifyAlive(); + for (const plugin of this.__plugins) { + //this.unregisterPlugin(plugin); + (_a = plugin.destroy) === null || _a === void 0 ? void 0 : _a.call(plugin); + } + (_c = (_b = this.__link).terminate) === null || _c === void 0 ? void 0 : _c.call(_b); + this.__alive = false; + } + __handlePort(data) { + const [channelName, port] = data; + if (this.__channels.has(channelName)) { // uh-oh, we already have a port for this channel + const channel = this.__channels.get(channelName); // as the map has been checked + if (this.__parent) { // extract the data and discard the messageport; child's Channel will close it + channel.listenToPort(port); + } + else { // replace our messageport; Channel will close it + channel.replacePort(port); + } + } + else { // register the new channel + const channel = new Channel(channelName, port); + this.__channels.set(channelName, channel); + } + } + constructor(link, parent = false) { + this.__alive = true; + this.__channels = new Map(); + this.__pluginMap = new Map(); + this.__plugins = []; + this.__link = link; + link.addEventListener("message", e => this.__handlePort(e.data)); + this.__parent = parent; + } + } + + class RpcCallMessage { + constructor(fn, args, invokeId) { + this.type = 0 /* RpcMessageType.CALL */; + this.data = { fn, args, invokeId }; + } + } + + class RpcErrorMessage { + constructor(invokeId, err) { + this.type = 2 /* RpcMessageType.RETURN_ERR */; + this.data = { invokeId, err }; + } + } + + class RpcReturnMessage { + constructor(invokeId, res) { + this.type = 1 /* RpcMessageType.RETURN */; + this.data = { invokeId, res }; + } + } + + function makeRpc(channel, self) { + const waiting = []; + let invocations = 0; + const otherCallbacks = {}; + channel.subscribe((rpcMessage) => __awaiter(this, void 0, void 0, function* () { + var _a, _b, _c, _d; + switch (rpcMessage.type) { + case 0 /* RpcMessageType.CALL */: + { + const { fn, args, invokeId } = rpcMessage.data; + try { + // @ts-expect-error + const res = yield self[fn](...args); + if (invokeId > 0) + channel.send(new RpcReturnMessage(invokeId, res)); + } + catch (err) { + if (invokeId > 0) + channel.send(new RpcErrorMessage(invokeId, err)); + } + break; + } + case 1 /* RpcMessageType.RETURN */: + { + const { invokeId, res } = rpcMessage.data; + (_b = (_a = waiting[invokeId]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.call(_a, res); + delete waiting[invokeId]; + break; + } + case 2 /* RpcMessageType.RETURN_ERR */: + { + const { invokeId, err } = rpcMessage.data; + (_d = (_c = waiting[invokeId]) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d.call(_c, err); + delete waiting[invokeId]; + break; + } + } + })); + return new Proxy(otherCallbacks, { + get(target, p, receiver) { + const cb = Reflect.get(target, p, receiver); + if (cb) + return cb; + const newCallback = typeof p === "string" && p.charAt(0) === "$" + ? (...args) => { + channel.send(new RpcCallMessage(p, args, 0)); + } + : (...args) => { + const invokeId = ++invocations; + channel.send(new RpcCallMessage(p, args, invokeId)); + return new Promise((resolve, reject) => { + waiting[invokeId] = [resolve, reject]; + }); + }; + Reflect.set(target, p, newCallback, receiver); + return newCallback; + }, + }); + } + + /** + * Typechecking utility decorator. + * It is recommended that usage of this decorator is removed + * before or during the build process, as some tools + * (e.g. terser) do not have good support for class decorators. + * @param _pluginClass The Class to be typechecked. + */ + function checkIsPluginClass(_pluginClass) { + } + + var DataType; + (function (DataType) { + /** The return type of functions with no returned value. As a convention, the associated JS value is undefined. */ + DataType[DataType["VOID"] = 0] = "VOID"; + /** A Boolean value. */ + DataType[DataType["BOOLEAN"] = 1] = "BOOLEAN"; + /** A numerical value. */ + DataType[DataType["NUMBER"] = 2] = "NUMBER"; + /** An immutable string of characters. */ + DataType[DataType["CONST_STRING"] = 3] = "CONST_STRING"; + /** The empty list. As a convention, the associated JS value is null. */ + DataType[DataType["EMPTY_LIST"] = 4] = "EMPTY_LIST"; + /** A pair of values. Reference type. */ + DataType[DataType["PAIR"] = 5] = "PAIR"; + /** An array of values of a single type. Reference type. */ + DataType[DataType["ARRAY"] = 6] = "ARRAY"; + /** A value that can be called with fixed arity. Reference type. */ + DataType[DataType["CLOSURE"] = 7] = "CLOSURE"; + /** An opaque value that cannot be manipulated from user code. */ + DataType[DataType["OPAQUE"] = 8] = "OPAQUE"; + /** A list (either a pair or the empty list). */ + DataType[DataType["LIST"] = 9] = "LIST"; + })(DataType || (DataType = {})); + + class AbortServiceMessage { + constructor(minVersion) { + this.type = 1 /* ServiceMessageType.ABORT */; + this.data = { minVersion: minVersion }; + } + } + + class HelloServiceMessage { + constructor() { + this.type = 0 /* ServiceMessageType.HELLO */; + this.data = { version: 0 /* Constant.PROTOCOL_VERSION */ }; + } + } + + class PluginServiceMessage { + constructor(pluginName) { + this.type = 3 /* ServiceMessageType.PLUGIN */; + this.data = pluginName; + } + } + + let RunnerPlugin = (() => { + let _classDecorators = [checkIsPluginClass]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + _classThis = class { + requestFile(fileName) { + return this.__fileRpc.requestFile(fileName); + } + requestChunk() { + return __awaiter(this, void 0, void 0, function* () { + return (yield this.__chunkQueue.receive()).chunk; + }); + } + requestInput() { + return __awaiter(this, void 0, void 0, function* () { + const { message } = yield this.__ioQueue.receive(); + return message; + }); + } + tryRequestInput() { + const out = this.__ioQueue.tryReceive(); + return out === null || out === void 0 ? void 0 : out.message; + } + sendOutput(message) { + this.__ioQueue.send({ message }); + } + sendError(error) { + this.__errorChannel.send({ error }); + } + updateStatus(status, isActive) { + this.__statusChannel.send({ status, isActive }); + } + hostLoadPlugin(pluginName) { + this.__serviceChannel.send(new PluginServiceMessage(pluginName)); + } + registerPlugin(pluginClass, ...arg) { + return this.__conduit.registerPlugin(pluginClass, ...arg); + } + unregisterPlugin(plugin) { + this.__conduit.unregisterPlugin(plugin); + } + registerModule(moduleClass) { + if (!this.__isCompatibleWithModules) + throw new ConductorInternalError("Evaluator has no data interface"); + return this.registerPlugin(moduleClass, this.__evaluator); + } + unregisterModule(module) { + this.unregisterPlugin(module); + } + importAndRegisterExternalPlugin(location, ...arg) { + return __awaiter(this, void 0, void 0, function* () { + const pluginClass = yield importExternalPlugin(location); + return this.registerPlugin(pluginClass, ...arg); + }); + } + importAndRegisterExternalModule(location) { + return __awaiter(this, void 0, void 0, function* () { + const moduleClass = yield importExternalModule(location); + return this.registerModule(moduleClass); + }); + } + constructor(conduit, [fileChannel, chunkChannel, serviceChannel, ioChannel, errorChannel, statusChannel], evaluatorClass) { + var _a; + this.name = "__runner_main" /* InternalPluginName.RUNNER_MAIN */; + // @ts-expect-error TODO: figure proper way to typecheck this + this.__serviceHandlers = new Map([ + [0 /* ServiceMessageType.HELLO */, function helloServiceHandler(message) { + if (message.data.version < 0 /* Constant.PROTOCOL_MIN_VERSION */) { + this.__serviceChannel.send(new AbortServiceMessage(0 /* Constant.PROTOCOL_MIN_VERSION */)); + console.error(`Host's protocol version (${message.data.version}) must be at least ${0 /* Constant.PROTOCOL_MIN_VERSION */}`); + } + else { + console.log(`Host is using protocol version ${message.data.version}`); + } + }], + [1 /* ServiceMessageType.ABORT */, function abortServiceHandler(message) { + console.error(`Host expects at least protocol version ${message.data.minVersion}, but we are on version ${0 /* Constant.PROTOCOL_VERSION */}`); + this.__conduit.terminate(); + }], + [2 /* ServiceMessageType.ENTRY */, function entryServiceHandler(message) { + this.__evaluator.startEvaluator(message.data); + }] + ]); + this.__conduit = conduit; + this.__fileRpc = makeRpc(fileChannel, {}); + this.__chunkQueue = new ChannelQueue(chunkChannel); + this.__serviceChannel = serviceChannel; + this.__ioQueue = new ChannelQueue(ioChannel); + this.__errorChannel = errorChannel; + this.__statusChannel = statusChannel; + this.__serviceChannel.send(new HelloServiceMessage()); + this.__serviceChannel.subscribe(message => { + var _a; + (_a = this.__serviceHandlers.get(message.type)) === null || _a === void 0 ? void 0 : _a.call(this, message); + }); + this.__evaluator = new evaluatorClass(this); + this.__isCompatibleWithModules = (_a = this.__evaluator.hasDataInterface) !== null && _a !== void 0 ? _a : false; + } + }; + __setFunctionName(_classThis, "RunnerPlugin"); + (() => { + const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); + _classThis = _classDescriptor.value; + if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); + })(); + _classThis.channelAttach = ["__file_rpc" /* InternalChannelName.FILE */, "__chunk" /* InternalChannelName.CHUNK */, "__service" /* InternalChannelName.SERVICE */, "__stdio" /* InternalChannelName.STANDARD_IO */, "__error" /* InternalChannelName.ERROR */, "__status" /* InternalChannelName.STATUS */]; + (() => { + __runInitializers(_classThis, _classExtraInitializers); + })(); + return _classThis; + })(); + + /** + * Initialise this runner with the evaluator to be used. + * @param evaluatorClass The Evaluator to be used on this runner. + * @param link The underlying communication link. + * @returns The initialised `runnerPlugin` and `conduit`. + */ + function initialise(evaluatorClass, link = self) { + const conduit = new Conduit(link, false); + const runnerPlugin = conduit.registerPlugin(RunnerPlugin, evaluatorClass); + return { runnerPlugin, conduit }; + } + + class Context { + constructor(program, context) { + //public environment: Environment; + this.errors = []; + this.createGlobalEnvironment = () => ({ + tail: null, + name: 'global', + head: {}, + heap: new Heap(), + id: '-1' + }); + this.createEmptyRuntime = () => ({ + break: false, + debuggerOn: true, + isRunning: false, + environmentTree: new EnvTree(), + environments: [], + value: undefined, + nodes: [], + control: null, + stash: null, + objectCount: 0, + envSteps: -1, + envStepsTotal: 0, + breakpointSteps: [], + changepointSteps: [] + }); + this.control = new Control(program); + this.stash = new Stash(); + this.runtime = this.createEmptyRuntime(); + //this.environment = createProgramEnvironment(context || this, false); + if (this.runtime.environments.length === 0) { + const globalEnvironment = this.createGlobalEnvironment(); + this.runtime.environments.push(globalEnvironment); + this.runtime.environmentTree.insert(globalEnvironment); + } + this.nativeStorage = { + builtins: new Map(), + previousProgramsIdentifiers: new Set(), + operators: new Map(), + maxExecTime: 1000, + evaller: null, + loadedModules: {}, + loadedModuleTypes: {} + }; + } + reset(program) { + this.control = new Control(program); + this.stash = new Stash(); + //this.environment = createProgramEnvironment(this, false); + this.errors = []; + } + copy() { + const newContext = new Context(); + newContext.control = this.control.copy(); + newContext.stash = this.stash.copy(); + //newContext.environments = this.copyEnvironment(this.environments); + return newContext; + } + copyEnvironment(env) { + const newTail = env.tail ? this.copyEnvironment(env.tail) : null; + const newEnv = { + id: env.id, + name: env.name, + tail: newTail, + head: Object.assign({}, env.head), + heap: new Heap(), + callExpression: env.callExpression, + thisContext: env.thisContext + }; + return newEnv; + } + } + class EnvTree { + constructor() { + this._root = null; + this.map = new Map(); + } + get root() { + return this._root; + } + insert(environment) { + const tailEnvironment = environment.tail; + if (tailEnvironment === null) { + if (this._root === null) { + this._root = new EnvTreeNode(environment, null); + this.map.set(environment, this._root); + } + } + else { + const parentNode = this.map.get(tailEnvironment); + if (parentNode) { + const childNode = new EnvTreeNode(environment, parentNode); + parentNode.addChild(childNode); + this.map.set(environment, childNode); + } + } + } + getTreeNode(environment) { + return this.map.get(environment); + } + } + class EnvTreeNode { + constructor(environment, parent) { + this.environment = environment; + this.parent = parent; + this._children = []; + } + get children() { + return this._children; + } + resetChildren(newChildren) { + this.clearChildren(); + this.addChildren(newChildren); + newChildren.forEach(c => (c.parent = this)); + } + clearChildren() { + this._children = []; + } + addChildren(newChildren) { + this._children.push(...newChildren); + } + addChild(newChild) { + this._children.push(newChild); + return newChild; + } + } + + const defaultContext = new Context(); + const defaultOptions = { + isPrelude: false, + envSteps: 100000, + stepLimit: 100000 + }; + class PyEvaluator extends BasicEvaluator { + constructor(conductor) { + super(conductor); + this.context = defaultContext; + this.options = defaultOptions; + } + evaluateChunk(chunk) { + return __awaiter(this, void 0, void 0, function* () { + try { + const result = yield runInContext(chunk, // Code + this.context, this.options); + this.conductor.sendOutput(`${result.representation.toString(result.value)}`); + } + catch (error) { + this.conductor.sendOutput(`Error: ${error instanceof Error ? error.message : error}`); + } + }); + } + } + // runInContext + // IOptions + // Context + // BasicEvaluator; + // IRunnerPlugin + + /* Use as a command line script */ + /* npm run start:dev -- test.py */ + /* npm run start:dev -- test.py tsc --maxErrors 1 */ + function parsePythonToEstreeAst(code, variant = 1, doValidate = false) { + const script = code + '\n'; + const tokenizer = new Tokenizer(script); + const tokens = tokenizer.scanEverything(); + const pyParser = new Parser(script, tokens); + const ast = pyParser.parse(); + if (doValidate) { + new Resolver(script, ast).resolve(ast); + } + const translator = new Translator(script); + return translator.resolve(ast); + } + function runInContext(code_1, context_1) { + return __awaiter(this, arguments, void 0, function* (code, context, options = {}) { + const estreeAst = parsePythonToEstreeAst(code, 1, true); + const result = runCSEMachine(estreeAst, context, options); + return result; + }); + } + //local test only + // const context = new Context(); + // const options: IOptions = { + // isPrelude: false, + // envSteps: 100000, + // stepLimit: 100000 + // }; + // import { promises as fs1 } from 'fs'; + // import * as os from 'os'; + // async function loadModulesFromServer(context: Context, baseURL: string): Promise { + // // 先获取 modules.json 文件 + // const modulesJsonUrl = `${baseURL}/modules.json`; + // const response = await fetch(modulesJsonUrl); + // if (!response.ok) { + // throw new Error(`Failed to load modules.json from ${modulesJsonUrl}`); + // } + // const modulesData: Record = await response.json(); + // // modulesData 假定格式为 { moduleName1: {...}, moduleName2: {...}, ... } + // // 遍历每个模块名,加载对应模块 + // for (const moduleName in modulesData) { + // // 构造模块文件的 URL,假设文件名与模块名相同,并以 .js 结尾 + // const moduleUrl = `${baseURL}/bundles/${moduleName}.js`; + // const moduleResponse = await fetch(moduleUrl); + // if (!moduleResponse.ok) { + // console.warn(`Failed to load module ${moduleName} from ${moduleUrl}`); + // continue; + // } + // const moduleSource = await moduleResponse.text(); + // // 评估模块文件,获取其导出对象 + // // 注意:这里使用 eval 仅作为示例,实际项目中应考虑安全和沙箱策略 + // // let moduleExports; + // // try { + // // moduleExports = eval(moduleSource); + // // } catch (e) { + // // console.error(`Error evaluating module ${moduleName}:`, e); + // // continue; + // // } + // const tmpFile = path.join(os.tmpdir(), path.basename(moduleUrl)); + // fs1.writeFile(tmpFile, moduleSource); + // // 动态 import 使用 file:// 协议 + // const moduleExports = await import('file://' + tmpFile); + // // 将模块导出对象存入 nativeStorage.loadedModules + // context.nativeStorage.loadedModules[moduleName] = moduleExports; + // } + // console.info(context.nativeStorage); + // } + // const BaseParserError = ParserErrors.BaseParserError; + // const BaseTokenizerError = TokenizerErrors.BaseTokenizerError; + // const BaseResolverError = ResolverErrors.BaseResolverError; + // async function getResult(code: string, + // context: Context, + // options: RecursivePartial = {}): Promise { + // const result = ; + // return result; + // } + // if (require.main === module) { + // if (process.argv.length < 3) { + // console.error("Usage: npm run start:dev -- "); + // process.exit(1); + // } + // const filePath = process.argv[2]; + // try { + // const code = fs.readFileSync(filePath, "utf8") + "\n"; + // console.log(`Parsing Python file: ${filePath}`); + // const result = await runInContext(code, context, options); + // console.info(result); + // } catch (e) { + // } + // //console.log(process.versions.v8); + // } + // if (require.main === module) { + // (async () => { + // if (process.argv.length < 3) { + // console.error("Usage: npm run start:dev -- "); + // process.exit(1); + // } + // const filePath = process.argv[2]; + // try { + // //await loadModulesFromServer(context, "http://localhost:8022"); + // const code = fs.readFileSync(filePath, "utf8") + "\n"; + // console.log(`Parsing Python file: ${filePath}`); + // const result = await runInContext(code, context, options); + // console.info(result); + // console.info((result as Finished).value); + // console.info((result as Finished).representation.toString((result as Finished).value)); + // } catch (e) { + // console.error("Error:", e); + // } + // })(); + // } + initialise(PyEvaluator); + + exports.parsePythonToEstreeAst = parsePythonToEstreeAst; + exports.runInContext = runInContext; + +})); +//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..3efefbe --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../node_modules/tslib/tslib.es6.js","../src/tokens.ts","../src/errors.ts","../src/tokenizer.ts","../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/mathjs/lib/esm/core/config.js","../node_modules/mathjs/lib/esm/utils/customs.js","../node_modules/mathjs/lib/esm/utils/map.js","../node_modules/mathjs/lib/esm/utils/is.js","../node_modules/mathjs/lib/esm/utils/object.js","../node_modules/mathjs/lib/esm/core/function/config.js","../node_modules/mathjs/lib/esm/entry/configReadonly.js","../node_modules/typed-function/lib/esm/typed-function.mjs","../node_modules/mathjs/lib/esm/utils/factory.js","../node_modules/mathjs/lib/esm/utils/number.js","../node_modules/mathjs/lib/esm/core/function/typed.js","../node_modules/decimal.js/decimal.mjs","../node_modules/mathjs/lib/esm/type/bignumber/BigNumber.js","../node_modules/complex.js/dist/complex.mjs","../node_modules/mathjs/lib/esm/type/complex/Complex.js","../node_modules/fraction.js/dist/fraction.mjs","../node_modules/mathjs/lib/esm/type/fraction/Fraction.js","../node_modules/mathjs/lib/esm/type/matrix/Matrix.js","../node_modules/mathjs/lib/esm/utils/bignumber/formatter.js","../node_modules/mathjs/lib/esm/utils/string.js","../node_modules/mathjs/lib/esm/error/DimensionError.js","../node_modules/mathjs/lib/esm/error/IndexError.js","../node_modules/mathjs/lib/esm/utils/array.js","../node_modules/mathjs/lib/esm/utils/optimizeCallback.js","../node_modules/mathjs/lib/esm/type/matrix/DenseMatrix.js","../node_modules/mathjs/lib/esm/utils/collection.js","../node_modules/mathjs/lib/esm/plain/number/arithmetic.js","../node_modules/mathjs/lib/esm/utils/product.js","../node_modules/mathjs/lib/esm/plain/number/probability.js","../node_modules/mathjs/lib/esm/utils/bignumber/nearlyEqual.js","../node_modules/mathjs/lib/esm/function/utils/isZero.js","../node_modules/mathjs/lib/esm/utils/complex.js","../node_modules/mathjs/lib/esm/function/relational/compareUnits.js","../node_modules/mathjs/lib/esm/function/relational/equalScalar.js","../node_modules/mathjs/lib/esm/type/matrix/SparseMatrix.js","../node_modules/mathjs/lib/esm/type/number.js","../node_modules/mathjs/lib/esm/type/bignumber/function/bignumber.js","../node_modules/mathjs/lib/esm/type/fraction/function/fraction.js","../node_modules/mathjs/lib/esm/type/matrix/function/matrix.js","../node_modules/mathjs/lib/esm/function/arithmetic/unaryMinus.js","../node_modules/mathjs/lib/esm/function/arithmetic/abs.js","../node_modules/mathjs/lib/esm/function/arithmetic/addScalar.js","../node_modules/mathjs/lib/esm/function/arithmetic/subtractScalar.js","../node_modules/mathjs/lib/esm/type/matrix/utils/matAlgo11xS0s.js","../node_modules/mathjs/lib/esm/type/matrix/utils/matAlgo14xDs.js","../node_modules/mathjs/lib/esm/function/arithmetic/multiplyScalar.js","../node_modules/mathjs/lib/esm/function/arithmetic/multiply.js","../node_modules/mathjs/lib/esm/function/complex/conj.js","../node_modules/mathjs/lib/esm/function/matrix/identity.js","../node_modules/mathjs/lib/esm/utils/noop.js","../node_modules/mathjs/lib/esm/function/matrix/size.js","../node_modules/mathjs/lib/esm/function/special/erf.js","../node_modules/mathjs/lib/esm/function/utils/numeric.js","../node_modules/mathjs/lib/esm/function/arithmetic/divideScalar.js","../node_modules/mathjs/lib/esm/function/arithmetic/pow.js","../node_modules/mathjs/lib/esm/function/matrix/dot.js","../node_modules/mathjs/lib/esm/function/matrix/det.js","../node_modules/mathjs/lib/esm/function/matrix/inv.js","../node_modules/mathjs/lib/esm/function/probability/gamma.js","../node_modules/mathjs/lib/esm/function/probability/lgamma.js","../node_modules/mathjs/lib/esm/entry/pureFunctionsAny.generated.js","../src/cse-machine/stack.ts","../src/cse-machine/ast-helper.ts","../src/cse-machine/heap.ts","../src/cse-machine/environment.ts","../src/cse-machine/types.ts","../src/cse-machine/instrCreator.ts","../src/cse-machine/closure.ts","../src/errors/runtimeSourceError.ts","../src/errors/errors.ts","../src/cse-machine/utils.ts","../src/cse-machine/control.ts","../src/cse-machine/stash.ts","../src/cse-machine/operators.ts","../src/cse-machine/error.ts","../src/cse-machine/dict.ts","../src/cse-machine/interpreter.ts","../src/stdlib.ts","../src/types.ts","../src/ast-types.ts","../src/parser.ts","../src/translator.ts","../node_modules/fastest-levenshtein/esm/mod.js","../node_modules/fast-levenshtein/levenshtein.js","../src/resolver.ts","../src/runner/pyRunner.ts","../src/common/errors/ConductorError.ts","../src/common/errors/ConductorInternalError.ts","../src/conductor/runner/BasicEvaluator.ts","../src/common/util/importExternalPlugin.ts","../src/common/util/importExternalModule.ts","../src/conduit/Channel.ts","../src/common/ds/Queue.ts","../src/common/ds/MessageQueue.ts","../src/conduit/ChannelQueue.ts","../src/conduit/Conduit.ts","../src/conduit/rpc/types/RpcCallMessage.ts","../src/conduit/rpc/types/RpcErrorMessage.ts","../src/conduit/rpc/types/RpcReturnMessage.ts","../src/conduit/rpc/makeRpc.ts","../src/conduit/util/checkIsPluginClass.ts","../src/conductor/types/moduleInterface/DataType.ts","../src/conductor/types/serviceMessages/AbortServiceMessage.ts","../src/conductor/types/serviceMessages/HelloServiceMessage.ts","../src/conductor/types/serviceMessages/PluginServiceMessage.ts","../src/conductor/runner/RunnerPlugin.ts","../src/conductor/runner/util/initialise.ts","../src/cse-machine/context.ts","../src/conductor/runner/types/PyEvaluator.ts","../src/index.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","// Token names mostly identical to CPython https://github.com/python/cpython/blob/main/Lib/token.py.\n// Main difference is that keywords are also a token type while in CPython they are generic name.\n// We could also resolve special names at AST parse time.\n// Also renamed some token names to make more sense.\nexport enum TokenType {\n //// Source S1\n ENDMARKER,\n NAME,\n NUMBER,\n BIGINT,\n STRING,\n NEWLINE,\n INDENT,\n DEDENT,\n LPAR,\n RPAR,\n COLON,\n DOUBLECOLON,\n COMMA,\n PLUS,\n MINUS,\n BANG,\n STAR,\n SLASH,\n VBAR,\n AMPER,\n LESS,\n GREATER,\n EQUAL,\n PERCENT,\n DOUBLEEQUAL,\n NOTEQUAL,\n LESSEQUAL,\n GREATEREQUAL,\n DOUBLESTAR,\n COMPLEX, \n // Special identifiers\n AND,\n OR,\n FOR,\n WHILE,\n NONE,\n TRUE,\n FALSE,\n IS,\n NOT,\n ISNOT,\n PASS,\n DEF,\n LAMBDA,\n FROM,\n DOUBLESLASH,\n BREAK,\n CONTINUE,\n RETURN,\n ASSERT,\n IMPORT,\n GLOBAL,\n NONLOCAL,\n IF,\n ELSE,\n ELIF,\n IN,\n NOTIN,\n\n //// Source s3\n RSQB,\n LSQB,\n ELLIPSIS,\n\n //// Unusued - Found in normal Python\n SEMI,\n DOT,\n LBRACE,\n RBRACE,\n TILDE,\n CIRCUMFLEX,\n LEFTSHIFT,\n RIGHTSHIFT,\n PLUSEQUAL,\n MINEQUAL,\n STAREQUAL,\n SLASHEQUAL,\n PERCENTEQUAL,\n AMPEREQUAL,\n VBAREQUAL,\n CIRCUMFLEXEQUAL,\n LEFTSHIFTEQUAL,\n RIGHTSHIFTEQUAL,\n DOUBLESTAREQUAL,\n DOUBLESLASHEQUAL,\n AT,\n ATEQUAL,\n RARROW,\n COLONEQUAL,\n OP,\n AWAIT,\n ASYNC,\n TYPE_IGNORE,\n TYPE_COMMENT,\n YIELD,\n WITH,\n DEL,\n TRY,\n EXCEPT,\n FINALLY,\n RAISE,\n}","import {Token} from \"./tokenizer\";\nimport {Position} from \"estree\";\n\n/*\n The offset is calculated as follows: \n Current position is one after real position of end of token: 1\n*/\nconst MAGIC_OFFSET = 1;\n\nconst SPECIAL_CHARS = new RegExp(\"[\\\\\\\\$'\\\"]\", \"g\");\n\nfunction escape(unsafe: string): string {\n // @TODO escape newlines\n return unsafe.replace(SPECIAL_CHARS, \"\\\\$&\");\n}\n\n/* Searches backwards and forwards till it hits a newline */\nfunction getFullLine(source: string, current: number): string {\n let back: number = current;\n let forward: number = current;\n\n while (back > 0 && source[back] != '\\n') {\n back--;\n }\n if (source[back] === '\\n') {\n back++;\n }\n while (forward < source.length && source[forward] != '\\n') {\n forward++;\n }\n return '\\n' + source.slice(back, forward);\n}\n\nfunction toEstreeLocation(line: number, column: number, offset: number) {\n return {line, column, offset}\n}\n\nexport namespace TokenizerErrors {\n export class BaseTokenizerError extends SyntaxError {\n line: number;\n col: number;\n loc: Position;\n\n constructor(message: string, line: number, col: number) {\n super(`SyntaxError at line ${line} column ${col-1}\n ${message}`);\n this.line = line;\n this.col = col;\n this.name = \"BaseTokenizerError\";\n this.loc = toEstreeLocation(line, col, 0);\n }\n }\n\n export class UnknownTokenError extends BaseTokenizerError {\n constructor(token: string, line: number, col: number, source: string, current: number) {\n let msg = getFullLine(source, current-1) + \"\\n\";\n let hint = `${col > 1 ? '~' : ''}^~ Unknown token '${escape(token)}'`;\n // The extra `~` character takes up some space.\n hint = hint.padStart(hint.length + col - MAGIC_OFFSET - (col > 1 ? 1 : 0), \" \");\n super(msg + hint, line, col);\n this.name = \"UnknownTokenError\";\n }\n }\n\n export class UnterminatedStringError extends BaseTokenizerError {\n constructor(line: number, col: number, source: string, start: number, current: number) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = `^ Unterminated string`;\n const diff = (current - start);\n // +1 because we want the arrow to point after the string (where we expect the closing \")\n hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, \"~\");\n hint = hint.padStart(hint.length + col - diff, \" \");\n super(msg + hint, line, col);\n this.name = \"UnterminatedStringError\";\n }\n }\n\n export class NonFourIndentError extends BaseTokenizerError {\n constructor(line: number, col: number, source: string, start: number) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = `^ This indent should be a multiple of 4 spaces. It's currently ${col} spaces.`;\n hint = hint.padStart(hint.length + col - MAGIC_OFFSET, \"-\");\n super(msg + hint, line, col);\n this.name = \"NonFourIndentError\";\n }\n }\n\t\n export class InvalidNumberError extends BaseTokenizerError {\n constructor(line: number, col: number, source: string, start: number, current: number) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = `^ Invalid Number input.`;\n const diff = (current - start);\n // +1 because we want the arrow to point after the string (where we expect the closing \")\n hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, \"~\");\n hint = hint.padStart(hint.length + col - diff, \" \");\n super(msg + hint, line, col);\n this.name = \"InvalidNumberError\";\n }\n }\n\n export class InconsistentIndentError extends BaseTokenizerError {\n constructor(line: number, col: number, source: string, start: number) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = `^ This indent/dedent is inconsistent with other indents/dedents. It's currently ${col} spaces.`;\n hint = hint.padStart(hint.length + col - MAGIC_OFFSET, \"-\");\n super(msg + hint, line, col);\n this.name = \"InconsistentIndentError\";\n }\n }\n export class ForbiddenIdentifierError extends BaseTokenizerError {\n constructor(line: number, col: number, source: string, start: number) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = `^ This identifier is reserved for use in Python. Consider using another identifier.`;\n hint = hint.padStart(hint.length + col - MAGIC_OFFSET, \"^\");\n super(msg + hint, line, col);\n this.name = \"ForbiddenIdentifierError\";\n }\n }\n export class ForbiddenOperatorError extends BaseTokenizerError {\n constructor(line: number, col: number, source: string, start: number, current: number) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = ` This operator is reserved for use in Python. It's not allowed to be used.`;\n const diff = (current - start);\n hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, \"^\");\n hint = hint.padStart(hint.length + col - diff, \" \");\n super(msg + hint, line, col);\n this.name = \"ForbiddenOperatorError\";\n }\n }\n\n export class NonMatchingParenthesesError extends BaseTokenizerError {\n constructor(line: number, col: number, source: string, current: number) {\n let msg = getFullLine(source, current-1) + \"\\n\";\n let hint = `${col > 1 ? '~' : ''}^~ Non-matching closing parentheses.`;\n // The extra `~` character takes up some space.\n hint = hint.padStart(hint.length + col - MAGIC_OFFSET - (col > 1 ? 1 : 0), \" \");\n super(msg + hint, line, col);\n this.name = \"NonMatchingParenthesesError\";\n }\n }\n}\n\nexport namespace ParserErrors {\n export class BaseParserError extends SyntaxError {\n line: number;\n col: number;\n loc: Position;\n\n constructor(message: string, line: number, col: number) {\n super(`SyntaxError at line ${line} column ${col-1}\n ${message}`);\n this.line = line;\n this.col = col;\n this.name = \"BaseParserError\";\n this.loc = toEstreeLocation(line, col, 0);\n }\n }\n export class ExpectedTokenError extends BaseParserError {\n constructor(source: string, current: Token, expected: string) {\n let msg = getFullLine(source, current.indexInSource - current.lexeme.length) + \"\\n\";\n let hint = `^ ${expected}. Found '${escape(current.lexeme)}'.`;\n hint = hint.padStart(hint.length + current.col - MAGIC_OFFSET, \" \");\n super(msg + hint, current.line, current.col);\n this.name = \"ExpectedTokenError\";\n }\n }\n export class NoElseBlockError extends BaseParserError {\n constructor(source: string, current: Token) {\n let msg = getFullLine(source, current.indexInSource) + \"\\n\";\n let hint = `^ Expected else block after this if block.`;\n hint = hint.padStart(hint.length + current.col - MAGIC_OFFSET, \" \");\n super(msg + hint, current.line, current.col);\n this.name = \"ExpectedTokenError\";\n }\n }\n export class GenericUnexpectedSyntaxError extends BaseParserError {\n constructor(line: number, col: number, source: string, start: number, current: number) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = ` Detected invalid syntax.`;\n const diff = (current - start);\n hint = hint.padStart(hint.length + diff - MAGIC_OFFSET, \"^\");\n hint = hint.padStart(hint.length + col - diff, \" \");\n super(msg + hint, line, col);\n this.name = \"GenericUnexpectedSyntaxError\";\n }\n }\n}\n\nexport namespace ResolverErrors {\n export class BaseResolverError extends SyntaxError {\n line: number;\n col: number;\n loc: Position;\n\n constructor(message: string, line: number, col: number) {\n super(`ResolverError at line ${line} column ${col-1}\n ${message}`);\n this.line = line;\n this.col = col;\n this.name = \"BaseResolverError\";\n this.loc = toEstreeLocation(line, col, 0);\n }\n }\n export class NameNotFoundError extends BaseResolverError {\n constructor(line: number, col: number, source: string, start: number,\n current: number, suggestion: string | null) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = ` This name is not found in the current or enclosing environment(s).`;\n const diff = (current - start);\n hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, \"^\");\n hint = hint.padStart(hint.length + col - diff, \" \");\n if (suggestion !== null) {\n let sugg = ` Perhaps you meant to type '${suggestion}'?`\n sugg = sugg.padStart(sugg.length + col - MAGIC_OFFSET + 1, \" \");\n sugg = '\\n' + sugg;\n hint += sugg;\n }\n super(msg + hint, line, col);\n this.name = \"NameNotFoundError\";\n }\n }\n\n export class NameReassignmentError extends BaseResolverError {\n constructor(line: number, col: number, source: string, start: number,\n current: number, oldName: Token) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = ` A name has been declared here.`;\n const diff = (current - start);\n hint = hint.padStart(hint.length + diff - MAGIC_OFFSET + 1, \"^\");\n hint = hint.padStart(hint.length + col - diff, \" \");\n let sugg = ` However, it has already been declared in the same environment at line ${oldName.line}, here:`\n sugg = sugg.padStart(sugg.length + col - MAGIC_OFFSET + 1, \" \");\n sugg = '\\n' + sugg;\n hint += sugg;\n let oldNameLine = getFullLine(source, oldName.indexInSource);\n oldNameLine.padStart(oldNameLine.length + col - MAGIC_OFFSET + 1, \" \");\n hint += oldNameLine;\n super(msg + hint, line, col);\n this.name = \"NameReassignmentError\";\n }\n }\n}\n\nexport namespace TranslatorErrors {\n export class BaseTranslatorError extends SyntaxError {\n line: number;\n col: number;\n loc: Position;\n\n constructor(message: string, line: number, col: number) {\n super(`BaseTranslatorError at line ${line} column ${col-1}\n ${message}`);\n this.line = line;\n this.col = col;\n this.name = \"BaseTranslatorError\";\n this.loc = toEstreeLocation(line, col, 0);\n }\n }\n export class UnsupportedOperator extends BaseTranslatorError {\n constructor(line: number, col: number, source: string, start: number) {\n let msg = getFullLine(source, start) + \"\\n\";\n let hint = `^ This operator is not yet supported by us.`;\n hint = hint.padStart(hint.length + col - MAGIC_OFFSET, \" \");\n super(msg + hint, line, col);\n this.name = \"UnsupportedOperator\";\n }\n }\n}","/*\n* Full disclosure: The general structure of this file is adapted from my own\n* Rust implementation of a scanner\n* https://github.com/Fidget-Spinner/crafting_interpreters/blob/main/rust/src/scanner.rs.\n* That is in turn is adapted from the Java code written by the excellent book,\n* \"Crafting Interpreters\" https://craftinginterpreters.com/scanning.html.\n* Said book's copyright is under Robert Nystrom.\n* I've included the MIT license that code snippets from\n* the book is licensed under down below. See\n* https://github.com/munificent/craftinginterpreters/blob/master/LICENSE\n*\n* The changes I've made: I have rewritten basically everything from scratch.\n* Only the method names and overall method APIs\n* are the same. Their internal behaviors are quite different as the scanner\n* in the book parses a JS-like language, not Python.\n*\n* - The book was written in Java. I have written this in TypeScript.\n* - The scanner supports a whitespace significant language now.\n* - Also added support for column numbers for better error messages in the future.\n* - Also added better errors.\n* - Also added forbidden identifiers.\n*\n*\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to\n deal in the Software without restriction, including without limitation the\n rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n sell copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n IN THE SOFTWARE.\n* */\n\nimport { TokenType } from \"./tokens\";\nimport { TokenizerErrors } from \"./errors\";\n\nexport class Token {\n type: TokenType;\n lexeme: string;\n line: number;\n col: number;\n indexInSource: number;\n\n constructor(type: TokenType, lexeme: string, line: number, col: number, indexInSource: number) {\n this.type = type;\n this.lexeme = lexeme;\n this.line = line;\n this.col = col;\n this.indexInSource = indexInSource\n }\n}\n\nconst specialIdentifiers = new Map([\n [\"and\", TokenType.AND],\n [\"or\", TokenType.OR],\n [\"while\", TokenType.WHILE],\n [\"for\", TokenType.FOR],\n [\"None\", TokenType.NONE],\n [\"is\", TokenType.IS],\n [\"not\", TokenType.NOT],\n [\"pass\", TokenType.PASS],\n [\"def\", TokenType.DEF],\n [\"lambda\", TokenType.LAMBDA],\n [\"from\", TokenType.FROM],\n [\"True\", TokenType.TRUE],\n [\"False\", TokenType.FALSE],\n [\"break\", TokenType.BREAK],\n [\"continue\", TokenType.CONTINUE],\n [\"return\", TokenType.RETURN],\n [\"assert\", TokenType.ASSERT],\n [\"import\", TokenType.IMPORT],\n [\"global\", TokenType.GLOBAL],\n [\"nonlocal\", TokenType.NONLOCAL],\n [\"if\", TokenType.IF],\n [\"elif\", TokenType.ELIF],\n [\"else\", TokenType.ELSE],\n [\"in\", TokenType.IN],\n]);\n\nexport const SPECIAL_IDENTIFIER_TOKENS = Array.from(specialIdentifiers.values());\n\n\nexport class Tokenizer {\n private readonly source: string;\n private readonly tokens: Token[];\n private start: number;\n private current: number;\n private line: number;\n private col: number;\n private readonly indentStack: number[];\n private specialIdentifiers: Map;\n private forbiddenIdentifiers: Map;\n private parenthesesLevel: number;\n\n // forbiddenOperators: Set;\n constructor(source: string) {\n this.source = source;\n this.tokens = [];\n this.start = 0;\n this.current = 0;\n this.line = 0;\n this.col = 0;\n this.indentStack = [0];\n this.specialIdentifiers = specialIdentifiers;\n // Not used by us, but should be kept reserved as per Python spec\n this.forbiddenIdentifiers = new Map([\n [\"async\", TokenType.ASYNC],\n [\"await\", TokenType.AWAIT],\n [\"yield\", TokenType.YIELD],\n [\"with\", TokenType.WITH],\n [\"del\", TokenType.DEL],\n [\"try\", TokenType.TRY],\n [\"except\", TokenType.EXCEPT],\n [\"finally\", TokenType.FINALLY],\n [\"raise\", TokenType.RAISE],\n ]);\n // Operators that are valid in Python, but invalid for our use case.\n // this.forbiddenOperators = new Set([\n // TokenType.AT,\n // // Augmented assign e.g. *=\n // TokenType.ATEQUAL,\n // TokenType.PLUSEQUAL,\n // TokenType.MINEQUAL,\n // TokenType.STAREQUAL,\n // TokenType.SLASHEQUAL,\n // TokenType.PERCENTEQUAL,\n // TokenType.AMPEREQUAL,\n // TokenType.VBAREQUAL,\n // TokenType.CIRCUMFLEXEQUAL,\n // TokenType.LEFTSHIFTEQUAL,\n // TokenType.RIGHTSHIFTEQUAL,\n // TokenType.DOUBLESTAREQUAL,\n // TokenType.DOUBLESLASHEQUAL,\n // ])\n this.parenthesesLevel = 0;\n }\n\n private isAtEnd() {\n return this.current >= this.source.length;\n }\n\n private advance() {\n const res = this.source[this.current];\n if (this.peek() == '\\n') {\n this.line += 1;\n }\n this.current += 1;\n this.col += 1;\n return res;\n }\n\n private lexemeBuffer: string = \"\";\n\n private advanceString(record: boolean) {\n const res = this.source[this.current];\n if (this.peek() == '\\n') {\n this.line += 1;\n }\n this.current += 1;\n this.col += 1;\n if (record) {\n this.lexemeBuffer += res;\n }\n return res;\n }\n\n private getBuffer() {\n console.info(this.lexemeBuffer);\n }\n\n private addBuffer(c: string) {\n this.lexemeBuffer += c;\n }\n\n private subtractBufferForThreeQuoteString(): boolean {\n if (this.lexemeBuffer.length >= 3) {\n this.lexemeBuffer = this.lexemeBuffer.slice(0, -3);\n return true;\n } else {\n return false;\n }\n }\n\n /* Single character lookahead. */\n private peek(): string {\n return this.isAtEnd() ? '\\0' : this.source[this.current];\n }\n\n /* Double character lookahead. */\n\n private overwriteToken(type: TokenType) {\n const previousToken = this.tokens[this.tokens.length - 1];\n const lexeme = this.source.slice(previousToken.indexInSource, this.current);\n this.tokens[this.tokens.length - 1] = new Token(type, lexeme, previousToken.line, previousToken.col, previousToken.indexInSource);\n }\n\n private addToken(type: TokenType) {\n const line = this.line\n const col = this.col;\n const lexeme = this.source.slice(this.start, this.current);\n this.tokens.push(new Token(type, lexeme, line, col, this.current - lexeme.length))\n }\n\n private addStringToken(type: TokenType) {\n const line = this.line\n const col = this.col;\n // Remove starting and ending quotes when slicing\n // Ensures that string is parsed properly\n const lexeme = this.source.slice(this.start + 1, this.current - 1);\n this.tokens.push(new Token(type, this.lexemeBuffer, line, col, this.current - lexeme.length))\n this.lexemeBuffer = \"\";\n }\n\n private addMultiLineStringToken(type: TokenType) {\n const line = this.line\n const col = this.col;\n // Remove three starting and ending quotes when slicing\n const lexeme = this.source.slice(this.start + 3, this.current - 3);\n this.tokens.push(new Token(type, this.lexemeBuffer, line, col, this.current - lexeme.length))\n this.lexemeBuffer = \"\";\n }\n // Checks that the current character matches a pattern. If so the character is consumed, else nothing is consumed.\n private matches(pattern: string): boolean {\n if (this.isAtEnd()) {\n return false;\n } else {\n if (this.source[this.current] === pattern) {\n this.col += 1;\n this.current += 1;\n return true;\n }\n return false;\n }\n }\n\n private isLegalUnicode(c: string): boolean {\n if (this.isDelimiter(c)) {\n return false;\n }\n return c.length === 1 && !/^\\p{Nd}$/u.test(c);\n }\n\n private isAlpha(c: string): boolean {\n return /^[A-Za-z]$/i.test(c);\n }\n\n private isDigit(c: string): boolean {\n return /^[0-9]/.test(c);\n }\n\n private isHexa(c: string): boolean {\n return /^[0-9A-F]$/i.test(c);\n }\n\n private isOcta(c: string): boolean {\n return /^[0-7]/.test(c);\n }\n\n private isBinary(c: string): boolean {\n return /^[0-1]/.test(c);\n }\n\n // TODO: unicode\n private isIdentifier(c: string): boolean {\n if (/\\s/.test(c)) {\n return false;\n }\n return c === '_' || this.isAlpha(c) || this.isDigit(c) || this.isLegalUnicode(c);\n }\n\n private isDelimiter(c: string): boolean {\n return /[\\p{P}\\p{S}]/u.test(c);\n }\n\n private baseNumber() {\n switch (this.peek()) {\n case 'x':\n this.advance();\n if (!this.isHexa(this.peek())) {\n throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);\n }\n while (this.isHexa(this.peek())) {\n this.advance();\n }\n this.addToken(TokenType.BIGINT);\n break;\n case 'o':\n this.advance();\n if (!this.isOcta(this.peek())) {\n throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);\n }\n while (this.isOcta(this.peek())) {\n this.advance();\n }\n this.addToken(TokenType.BIGINT);\n break;\n case 'b':\n this.advance();\n if (!this.isBinary(this.peek())) {\n throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);\n }\n while (this.isBinary(this.peek())) {\n this.advance();\n }\n this.addToken(TokenType.BIGINT);\n break;\n default:\n while (this.isDigit(this.peek())) {\n this.advance();\n }\n \n if (this.peek() !== '.' && this.peek() !== 'e') {\n // if ends with j and J then complex number\n if (this.peek() === 'j' || this.peek() === 'J') {\n this.advance();\n this.addToken(TokenType.COMPLEX);\n return;\n }\n \n this.addToken(TokenType.BIGINT);\n return;\n }\n \n if (this.peek() === '.') {\n this.advance();\n if (this.peek() === '_') {\n // TODO:\n // throw new error\n throw new Error('_ after .');\n }\n while (this.isDigit(this.peek())) {\n this.advance();\n }\n }\n\n if (this.peek() === '_') {\n this.advance();\n }\n \n if (this.peek() === 'e') {\n this.advance();\n if (this.peek() === '-') {\n this.advance();\n }\n if (this.peek() === '+') {\n this.advance();\n }\n if (!this.isDigit(this.peek())) {\n throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);\n }\n while (this.isDigit(this.peek())) {\n this.advance();\n }\n }\n \n // if ends with j and J then complex number\n if (this.peek() === 'j' || this.peek() === 'J') {\n this.advance();\n this.addToken(TokenType.COMPLEX);\n } else {\n this.addToken(TokenType.NUMBER);\n }\n }\n }\n\n private number(c: string) {\n while ((this.isDigit(this.peek()) || this.peek() === '_') && c !== '.') {\n if (this.peek() === '_') {\n this.advance();\n if (!this.isDigit(this.peek())) {\n throw new Error(\"Invalid use of underscore in number\");\n }\n } else {\n this.advance();\n }\n }\n\n if (this.peek() !== '.' && this.peek() !== 'e' && c !== '.') {\n // if ends with j and J then complex number\n if (this.peek() === 'j' || this.peek() === 'J') {\n this.advance();\n this.addToken(TokenType.COMPLEX);\n return;\n }\n\n this.addToken(TokenType.BIGINT);\n return;\n }\n\n // Fractional part\n if ((this.peek() === '.' && c !== '.') || (this.peek() !== '.' && c === '.')) {\n this.advance();\n if (this.peek() === '_') {\n // TODO:\n // throw new error\n throw new Error('_ after .');\n }\n while (this.isDigit(this.peek()) || this.peek() === '_') {\n if (this.peek() === '_') {\n this.advance();\n if (!this.isDigit(this.peek())) {\n throw new Error(\"Invalid use of underscore in number\");\n }\n } else {\n this.advance();\n }\n }\n }\n\n // Exponent part\n if (this.peek() === 'e') {\n this.advance();\n if (this.peek() === '-') {\n this.advance();\n }\n if (this.peek() === '+') {\n this.advance();\n }\n if (!this.isDigit(this.peek())) {\n throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);\n }\n while (this.isDigit(this.peek()) || this.peek() === '_') {\n if (this.peek() === '_') {\n this.advance();\n if (!this.isDigit(this.peek())) {\n throw new Error(\"Invalid use of underscore in number\");\n }\n } else {\n this.advance();\n }\n }\n }\n\n // if ends with j and J then complex number\n if (this.peek() === 'j' || this.peek() === 'J') {\n this.advance();\n this.addToken(TokenType.COMPLEX);\n } else {\n this.addToken(TokenType.NUMBER);\n }\n //this.addToken(TokenType.NUMBER);\n }\n\n private name() {\n while (this.isIdentifier(this.peek())) {\n this.advance();\n }\n const identifier = this.source.slice(this.start, this.current);\n if (!!this.forbiddenIdentifiers.get(identifier)) {\n throw new TokenizerErrors.ForbiddenIdentifierError(this.line, this.col,\n this.source, this.start);\n }\n const specialIdent = this.specialIdentifiers.get(identifier);\n if (specialIdent !== undefined) {\n /* Merge multi-token operators, like 'is not', 'not in' */\n const previousToken = this.tokens[this.tokens.length - 1];\n switch (specialIdent) {\n case TokenType.NOT:\n if (previousToken.type === TokenType.IS) {\n this.overwriteToken(TokenType.ISNOT);\n } else {\n this.addToken(specialIdent);\n }\n return;\n case TokenType.IN:\n if (previousToken.type === TokenType.NOT) {\n this.overwriteToken(TokenType.NOTIN);\n } else {\n this.addToken(specialIdent);\n }\n return;\n default:\n this.addToken(specialIdent);\n }\n } else {\n this.addToken(TokenType.NAME);\n }\n }\n\n private scanToken() {\n const c = this.advance();\n // KJ: I really hope the JS runtime optimizes this to a jump table...\n switch (c) {\n //// SPECIAL MARKERS\n // Comment -- advance to end of line.\n case '#':\n while ((this.peek() !== '\\n' && this.peek() !== '\\r') && !this.isAtEnd()) {\n this.advance();\n }\n break;\n case ':':\n this.addToken(this.matches(':') ? TokenType.DOUBLECOLON : TokenType.COLON);\n break;\n // All non-significant whitespace\n case ' ':\n break;\n // CR LF on Windows\n case '\\r':\n if (this.matches('\\n')) {\n // fall through\n } else {\n break;\n }\n case '\\n':\n if (this.parenthesesLevel > 0) {\n this.line += 1;\n this.col = 0;\n break;\n }\n this.addToken(TokenType.NEWLINE);\n this.line += 1;\n this.col = 0;\n let accLeadingWhiteSpace = 0;\n // Detect significant whitespace\n while (this.peek() === \" \" && !this.isAtEnd()) {\n accLeadingWhiteSpace += 1;\n // Consume the rest of the line's leading whitespace.\n this.advance();\n }\n // Handles comments\n if (this.peek() === \"#\") {\n while ((this.peek() !== '\\n' && this.peek() !== '\\r') && !this.isAtEnd()) {\n this.advance();\n }\n }\n // The following block handles things like\n /*\n def foo():\n pass\n <---- this newline should be zapped\n pass <---- this should be part of the block\n */\n while ((this.peek() === \"\\n\" || this.peek() === \"\\r\") && !this.isAtEnd()) {\n // Handle \\r\\n on Windows\n if (this.peek() === \"\\r\") {\n this.advance();\n if (this.peek() === \"\\n\") {\n this.advance();\n }\n } else {\n this.advance();\n }\n this.line += 1;\n this.col = 0;\n accLeadingWhiteSpace = 0;\n // Detect significant whitespace\n while (this.peek() === \" \" && !this.isAtEnd()) {\n accLeadingWhiteSpace += 1;\n // Consume the rest of the line's leading whitespace.\n this.advance();\n }\n }\n if (accLeadingWhiteSpace % 4 !== 0) {\n throw new TokenizerErrors.NonFourIndentError(this.line, this.col, this.source, this.current);\n }\n const tos = this.indentStack[this.indentStack.length - 1];\n if (accLeadingWhiteSpace > tos) {\n this.indentStack.push(accLeadingWhiteSpace);\n const indents = Math.floor((accLeadingWhiteSpace - tos) / 4);\n for (let i = 0; i < indents; ++i) {\n this.addToken(TokenType.INDENT);\n }\n } else if (accLeadingWhiteSpace < tos) {\n if (this.indentStack.length == 0) {\n throw new TokenizerErrors.InconsistentIndentError(this.line, this.col, this.source, this.current);\n }\n const prev = this.indentStack[this.indentStack.length - 1];\n if (prev === undefined || prev === null) {\n throw new TokenizerErrors.InconsistentIndentError(this.line, this.col, this.source, this.current);\n }\n const indents = Math.floor((prev - accLeadingWhiteSpace) / 4);\n for (let i = 0; i < indents; ++i) {\n this.indentStack.pop();\n this.addToken(TokenType.DEDENT);\n }\n }\n break;\n // String\n case '\"':\n case \"'\":\n let quote = c;\n if (this.peek() == quote) { // handle multi-line string\n this.advance(); // second quote found and consumed\n if (this.peek() != quote) { // empty string \"\"\n this.addStringToken(TokenType.STRING);\n break;\n }\n this.advance(); // third quote consumed\n let quote_sum = 0;\n while (true) {\n while (this.peek() != quote && !this.isAtEnd()) {\n quote_sum = 0;\n if (this.peek() === '\\\\') {\n this.advanceString(false);\n switch(this.peek()) {\n case '\\n':\n break;\n case '\\\\':\n this.addBuffer('\\\\');\n break;\n case '\\'':\n this.addBuffer('\\'');\n break;\n case '\\\"':\n this.addBuffer('\\\"');\n break;\n case 'a':\n this.addBuffer('\\a');\n break;\n case 'b':\n this.addBuffer('\\b');\n break;\n case 'f':\n this.addBuffer('\\f');\n break;\n case 'n':\n this.addBuffer('\\n');\n break;\n case 'r':\n this.addBuffer('\\r');\n break;\n case 't':\n this.addBuffer('\\t');\n break;\n case 'v':\n this.addBuffer('\\v');\n break;\n default:\n throw new Error(\"SyntaxWarning: invalid escape sequence\");\n }\n this.advanceString(false);\n } else {\n this.advanceString(true);\n }\n //this.advance(); // advance until ending quote found\n }\n if (this.isAtEnd()) {\n throw new TokenizerErrors.UnterminatedStringError(this.line,\n this.col, this.source, this.start, this.current);\n }\n if (this.peek() == quote) {\n this.advanceString(true);\n quote_sum++;\n }\n //this.advance(); // consume first ending quote\n // if (this.peek() != quote) {\n // throw new TokenizerErrors.UnterminatedStringError(this.line,\n // this.col, this.source, this.start, this.current);\n // }\n // this.advance();\n if (quote_sum === 3) {\n this.subtractBufferForThreeQuoteString();\n // console.info('endof3quote');\n // this.getBuffer();\n break;\n }\n }\n \n // // consume second ending quote\n // if (this.peek() != quote) {\n // throw new TokenizerErrors.UnterminatedStringError(this.line,\n // this.col, this.source, this.start, this.current);\n // }\n // this.advance(); // consume third ending quote\n this.addMultiLineStringToken(TokenType.STRING);\n } else { // other case, single-line string\n while (this.peek() !== quote && this.peek() !== '\\n' && !this.isAtEnd()) {\n if (this.peek() === '\\\\') {\n this.advanceString(false);\n switch(this.peek()) {\n case '\\n':\n break;\n case '\\\\':\n this.addBuffer('\\\\');\n break;\n case '\\'':\n this.addBuffer('\\'');\n break;\n case '\\\"':\n this.addBuffer('\\\"');\n break;\n case 'a':\n this.addBuffer('\\a');\n break;\n case 'b':\n this.addBuffer('\\b');\n break;\n case 'f':\n this.addBuffer('\\f');\n break;\n case 'n':\n this.addBuffer('\\n');\n break;\n case 'r':\n this.addBuffer('\\r');\n break;\n case 't':\n this.addBuffer('\\t');\n break;\n case 'v':\n this.addBuffer('\\v');\n break;\n default:\n throw new Error(\"SyntaxWarning: invalid escape sequence\");\n }\n this.advanceString(false);\n } else {\n this.advanceString(true);\n }\n }\n // should look for \\\\\n if (this.peek() === '\\n' || this.isAtEnd()) {\n throw new TokenizerErrors.UnterminatedStringError(this.line, this.col, this.source, this.start, this.current);\n }\n // Consume Closing \"\n this.advance();\n this.addStringToken(TokenType.STRING);\n }\n break;\n // Number... I wish JS had match statements :(\n case '0':\n this.baseNumber();\n break;\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n case '.':\n this.number(c);\n break;\n //// Everything else\n case '(':\n this.addToken(TokenType.LPAR);\n this.parenthesesLevel++;\n break;\n case ')':\n this.addToken(TokenType.RPAR);\n if (this.parenthesesLevel === 0) {\n throw new TokenizerErrors.NonMatchingParenthesesError(this.line, this.col, this.source, this.current);\n }\n this.parenthesesLevel--;\n break;\n case ',':\n this.addToken(TokenType.COMMA);\n break;\n //// OPERATORS\n case '-':\n if (this.matches('=')) {\n this.raiseForbiddenOperator();\n }\n this.addToken(TokenType.MINUS);\n break;\n case '+':\n if (this.matches('=')) {\n this.raiseForbiddenOperator();\n }\n this.addToken(TokenType.PLUS);\n break;\n case '*':\n if (this.matches('=')) {\n this.raiseForbiddenOperator();\n }\n this.addToken(this.matches('*') ? TokenType.DOUBLESTAR : TokenType.STAR);\n break;\n case '/':\n if (this.matches('=')) {\n this.raiseForbiddenOperator();\n }\n this.addToken(this.matches('/') ? TokenType.DOUBLESLASH : TokenType.SLASH);\n break;\n case '%':\n if (this.matches('=')) {\n this.raiseForbiddenOperator();\n }\n this.addToken(TokenType.PERCENT);\n break;\n case '!':\n this.addToken(this.matches('=') ? TokenType.NOTEQUAL : TokenType.BANG);\n break;\n case '=':\n this.addToken(this.matches('=') ? TokenType.DOUBLEEQUAL : TokenType.EQUAL);\n break;\n case '<':\n this.addToken(this.matches('=') ? TokenType.LESSEQUAL : TokenType.LESS);\n break;\n case '>':\n this.addToken(this.matches('=') ? TokenType.GREATEREQUAL : TokenType.GREATER);\n break;\n default:\n // Identifier start\n // TODO: unicode\n if (c === '_' || this.isAlpha(c) || this.isLegalUnicode(c)) {\n this.name();\n break;\n }\n this.matchForbiddenOperator(c);\n throw new TokenizerErrors.UnknownTokenError(c, this.line, this.col, this.source, this.current);\n }\n }\n\n private matchForbiddenOperator(ch: string) {\n switch (ch) {\n case '@':\n case '|':\n case '&':\n case '~':\n case '^':\n this.matches('=');\n this.raiseForbiddenOperator();\n break;\n default:\n break;\n }\n }\n\n scanEverything(): Token[] {\n while (!this.isAtEnd()) {\n this.start = this.current;\n this.scanToken();\n }\n // Unravel the indent stack\n while (this.indentStack[this.indentStack.length - 1] !== 0) {\n this.indentStack.pop();\n this.addToken(TokenType.DEDENT);\n }\n this.tokens.push(new Token(TokenType.ENDMARKER, \"\", this.line, this.col, this.current));\n return this.tokens\n }\n\n printTokens() {\n for (const token of this.tokens) {\n console.log(`${token.indexInSource}:${token.line}-${token.line},${token.indexInSource + token.lexeme.length}\\t\\t\\t\\\n ${TokenType[token.type]}\\t\\t\\t'${token.lexeme}'`);\n }\n }\n\n private raiseForbiddenOperator() {\n throw new TokenizerErrors.ForbiddenOperatorError(this.line, this.col, this.source, this.start, this.current);\n }\n}\n\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","export var DEFAULT_CONFIG = {\n // minimum relative difference between two compared values,\n // used by all comparison functions\n relTol: 1e-12,\n // minimum absolute difference between two compared values,\n // used by all comparison functions\n absTol: 1e-15,\n // type of default matrix output. Choose 'matrix' (default) or 'array'\n matrix: 'Matrix',\n // type of default number output. Choose 'number' (default) 'BigNumber', 'bigint', or 'Fraction'\n number: 'number',\n // type of fallback used for config { number: 'bigint' } when a value cannot be represented\n // in the configured numeric type. Choose 'number' (default) or 'BigNumber'.\n numberFallback: 'number',\n // number of significant digits in BigNumbers\n precision: 64,\n // predictable output type of functions. When true, output type depends only\n // on the input types. When false (default), output type can vary depending\n // on input values. For example `math.sqrt(-4)` returns `complex('2i')` when\n // predictable is false, and returns `NaN` when true.\n predictable: false,\n // random seed for seeded pseudo random number generation\n // null = randomly seed\n randomSeed: null\n};","import { hasOwnProperty } from './object.js';\n\n/**\n * Get a property of a plain object\n * Throws an error in case the object is not a plain object or the\n * property is not defined on the object itself\n * @param {Object} object\n * @param {string} prop\n * @return {*} Returns the property value when safe\n */\nfunction getSafeProperty(object, prop) {\n // only allow getting safe properties of a plain object\n if (isSafeProperty(object, prop)) {\n return object[prop];\n }\n if (typeof object[prop] === 'function' && isSafeMethod(object, prop)) {\n throw new Error('Cannot access method \"' + prop + '\" as a property');\n }\n throw new Error('No access to property \"' + prop + '\"');\n}\n\n/**\n * Set a property on a plain object.\n * Throws an error in case the object is not a plain object or the\n * property would override an inherited property like .constructor or .toString\n * @param {Object} object\n * @param {string} prop\n * @param {*} value\n * @return {*} Returns the value\n */\n// TODO: merge this function into access.js?\nfunction setSafeProperty(object, prop, value) {\n // only allow setting safe properties of a plain object\n if (isSafeProperty(object, prop)) {\n object[prop] = value;\n return value;\n }\n throw new Error('No access to property \"' + prop + '\"');\n}\n\n/**\n * Test whether a property is safe to use on an object or Array.\n * For example .toString and .constructor are not safe\n * @param {Object | Array} object\n * @param {string} prop\n * @return {boolean} Returns true when safe\n */\nfunction isSafeProperty(object, prop) {\n if (!isPlainObject(object) && !Array.isArray(object)) {\n return false;\n }\n // SAFE: whitelisted\n // e.g length\n if (hasOwnProperty(safeNativeProperties, prop)) {\n return true;\n }\n // UNSAFE: inherited from Object prototype\n // e.g constructor\n if (prop in Object.prototype) {\n // 'in' is used instead of hasOwnProperty for nodejs v0.10\n // which is inconsistent on root prototypes. It is safe\n // here because Object.prototype is a root object\n return false;\n }\n // UNSAFE: inherited from Function prototype\n // e.g call, apply\n if (prop in Function.prototype) {\n // 'in' is used instead of hasOwnProperty for nodejs v0.10\n // which is inconsistent on root prototypes. It is safe\n // here because Function.prototype is a root object\n return false;\n }\n return true;\n}\n\n/**\n * Validate whether a method is safe.\n * Throws an error when that's not the case.\n * @param {Object} object\n * @param {string} method\n * @return {function} Returns the method when valid\n */\nfunction getSafeMethod(object, method) {\n if (!isSafeMethod(object, method)) {\n throw new Error('No access to method \"' + method + '\"');\n }\n return object[method];\n}\n\n/**\n * Check whether a method is safe.\n * Throws an error when that's not the case (for example for `constructor`).\n * @param {Object} object\n * @param {string} method\n * @return {boolean} Returns true when safe, false otherwise\n */\nfunction isSafeMethod(object, method) {\n if (object === null || object === undefined || typeof object[method] !== 'function') {\n return false;\n }\n // UNSAFE: ghosted\n // e.g overridden toString\n // Note that IE10 doesn't support __proto__ and we can't do this check there.\n if (hasOwnProperty(object, method) && Object.getPrototypeOf && method in Object.getPrototypeOf(object)) {\n return false;\n }\n // SAFE: whitelisted\n // e.g toString\n if (hasOwnProperty(safeNativeMethods, method)) {\n return true;\n }\n // UNSAFE: inherited from Object prototype\n // e.g constructor\n if (method in Object.prototype) {\n // 'in' is used instead of hasOwnProperty for nodejs v0.10\n // which is inconsistent on root prototypes. It is safe\n // here because Object.prototype is a root object\n return false;\n }\n // UNSAFE: inherited from Function prototype\n // e.g call, apply\n if (method in Function.prototype) {\n // 'in' is used instead of hasOwnProperty for nodejs v0.10\n // which is inconsistent on root prototypes. It is safe\n // here because Function.prototype is a root object\n return false;\n }\n return true;\n}\nfunction isPlainObject(object) {\n return typeof object === 'object' && object && object.constructor === Object;\n}\nvar safeNativeProperties = {\n length: true,\n name: true\n};\nvar safeNativeMethods = {\n toString: true,\n valueOf: true,\n toLocaleString: true\n};\nexport { getSafeProperty };\nexport { setSafeProperty };\nexport { isSafeProperty };\nexport { getSafeMethod };\nexport { isSafeMethod };\nexport { isPlainObject };","import { getSafeProperty, isSafeProperty, setSafeProperty } from './customs.js';\nimport { isMap, isObject } from './is.js';\n\n/**\n * A map facade on a bare object.\n *\n * The small number of methods needed to implement a scope,\n * forwarding on to the SafeProperty functions. Over time, the codebase\n * will stop using this method, as all objects will be Maps, rather than\n * more security prone objects.\n */\nexport class ObjectWrappingMap {\n constructor(object) {\n this.wrappedObject = object;\n this[Symbol.iterator] = this.entries;\n }\n keys() {\n return Object.keys(this.wrappedObject).filter(key => this.has(key)).values();\n }\n get(key) {\n return getSafeProperty(this.wrappedObject, key);\n }\n set(key, value) {\n setSafeProperty(this.wrappedObject, key, value);\n return this;\n }\n has(key) {\n return isSafeProperty(this.wrappedObject, key) && key in this.wrappedObject;\n }\n entries() {\n return mapIterator(this.keys(), key => [key, this.get(key)]);\n }\n forEach(callback) {\n for (var key of this.keys()) {\n callback(this.get(key), key, this);\n }\n }\n delete(key) {\n if (isSafeProperty(this.wrappedObject, key)) {\n delete this.wrappedObject[key];\n }\n }\n clear() {\n for (var key of this.keys()) {\n this.delete(key);\n }\n }\n get size() {\n return Object.keys(this.wrappedObject).length;\n }\n}\n\n/**\n * Create a map with two partitions: a and b.\n * The set with bKeys determines which keys/values are read/written to map b,\n * all other values are read/written to map a\n *\n * For example:\n *\n * const a = new Map()\n * const b = new Map()\n * const p = new PartitionedMap(a, b, new Set(['x', 'y']))\n *\n * In this case, values `x` and `y` are read/written to map `b`,\n * all other values are read/written to map `a`.\n */\nexport class PartitionedMap {\n /**\n * @param {Map} a\n * @param {Map} b\n * @param {Set} bKeys\n */\n constructor(a, b, bKeys) {\n this.a = a;\n this.b = b;\n this.bKeys = bKeys;\n this[Symbol.iterator] = this.entries;\n }\n get(key) {\n return this.bKeys.has(key) ? this.b.get(key) : this.a.get(key);\n }\n set(key, value) {\n if (this.bKeys.has(key)) {\n this.b.set(key, value);\n } else {\n this.a.set(key, value);\n }\n return this;\n }\n has(key) {\n return this.b.has(key) || this.a.has(key);\n }\n keys() {\n return new Set([...this.a.keys(), ...this.b.keys()])[Symbol.iterator]();\n }\n entries() {\n return mapIterator(this.keys(), key => [key, this.get(key)]);\n }\n forEach(callback) {\n for (var key of this.keys()) {\n callback(this.get(key), key, this);\n }\n }\n delete(key) {\n return this.bKeys.has(key) ? this.b.delete(key) : this.a.delete(key);\n }\n clear() {\n this.a.clear();\n this.b.clear();\n }\n get size() {\n return [...this.keys()].length;\n }\n}\n\n/**\n * Create a new iterator that maps over the provided iterator, applying a mapping function to each item\n */\nfunction mapIterator(it, callback) {\n return {\n next: () => {\n var n = it.next();\n return n.done ? n : {\n value: callback(n.value),\n done: false\n };\n }\n };\n}\n\n/**\n * Creates an empty map, or whatever your platform's polyfill is.\n *\n * @returns an empty Map or Map like object.\n */\nexport function createEmptyMap() {\n return new Map();\n}\n\n/**\n * Creates a Map from the given object.\n *\n * @param { Map | { [key: string]: unknown } | undefined } mapOrObject\n * @returns\n */\nexport function createMap(mapOrObject) {\n if (!mapOrObject) {\n return createEmptyMap();\n }\n if (isMap(mapOrObject)) {\n return mapOrObject;\n }\n if (isObject(mapOrObject)) {\n return new ObjectWrappingMap(mapOrObject);\n }\n throw new Error('createMap can create maps from objects or Maps');\n}\n\n/**\n * Unwraps a map into an object.\n *\n * @param {Map} map\n * @returns { [key: string]: unknown }\n */\nexport function toObject(map) {\n if (map instanceof ObjectWrappingMap) {\n return map.wrappedObject;\n }\n var object = {};\n for (var key of map.keys()) {\n var value = map.get(key);\n setSafeProperty(object, key, value);\n }\n return object;\n}\n\n/**\n * Copies the contents of key-value pairs from each `objects` in to `map`.\n *\n * Object is `objects` can be a `Map` or object.\n *\n * This is the `Map` analog to `Object.assign`.\n */\nexport function assign(map) {\n for (var _len = arguments.length, objects = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n objects[_key - 1] = arguments[_key];\n }\n for (var args of objects) {\n if (!args) {\n continue;\n }\n if (isMap(args)) {\n for (var key of args.keys()) {\n map.set(key, args.get(key));\n }\n } else if (isObject(args)) {\n for (var _key2 of Object.keys(args)) {\n map.set(_key2, args[_key2]);\n }\n }\n }\n return map;\n}","// type checks for all known types\n//\n// note that:\n//\n// - check by duck-typing on a property like `isUnit`, instead of checking instanceof.\n// instanceof cannot be used because that would not allow to pass data from\n// one instance of math.js to another since each has it's own instance of Unit.\n// - check the `isUnit` property via the constructor, so there will be no\n// matches for \"fake\" instances like plain objects with a property `isUnit`.\n// That is important for security reasons.\n// - It must not be possible to override the type checks used internally,\n// for security reasons, so these functions are not exposed in the expression\n// parser.\n\nimport { ObjectWrappingMap } from './map.js';\nexport function isNumber(x) {\n return typeof x === 'number';\n}\nexport function isBigNumber(x) {\n if (!x || typeof x !== 'object' || typeof x.constructor !== 'function') {\n return false;\n }\n if (x.isBigNumber === true && typeof x.constructor.prototype === 'object' && x.constructor.prototype.isBigNumber === true) {\n return true;\n }\n if (typeof x.constructor.isDecimal === 'function' && x.constructor.isDecimal(x) === true) {\n return true;\n }\n return false;\n}\nexport function isBigInt(x) {\n return typeof x === 'bigint';\n}\nexport function isComplex(x) {\n return x && typeof x === 'object' && Object.getPrototypeOf(x).isComplex === true || false;\n}\nexport function isFraction(x) {\n return x && typeof x === 'object' && Object.getPrototypeOf(x).isFraction === true || false;\n}\nexport function isUnit(x) {\n return x && x.constructor.prototype.isUnit === true || false;\n}\nexport function isString(x) {\n return typeof x === 'string';\n}\nexport var isArray = Array.isArray;\nexport function isMatrix(x) {\n return x && x.constructor.prototype.isMatrix === true || false;\n}\n\n/**\n * Test whether a value is a collection: an Array or Matrix\n * @param {*} x\n * @returns {boolean} isCollection\n */\nexport function isCollection(x) {\n return Array.isArray(x) || isMatrix(x);\n}\nexport function isDenseMatrix(x) {\n return x && x.isDenseMatrix && x.constructor.prototype.isMatrix === true || false;\n}\nexport function isSparseMatrix(x) {\n return x && x.isSparseMatrix && x.constructor.prototype.isMatrix === true || false;\n}\nexport function isRange(x) {\n return x && x.constructor.prototype.isRange === true || false;\n}\nexport function isIndex(x) {\n return x && x.constructor.prototype.isIndex === true || false;\n}\nexport function isBoolean(x) {\n return typeof x === 'boolean';\n}\nexport function isResultSet(x) {\n return x && x.constructor.prototype.isResultSet === true || false;\n}\nexport function isHelp(x) {\n return x && x.constructor.prototype.isHelp === true || false;\n}\nexport function isFunction(x) {\n return typeof x === 'function';\n}\nexport function isDate(x) {\n return x instanceof Date;\n}\nexport function isRegExp(x) {\n return x instanceof RegExp;\n}\nexport function isObject(x) {\n return !!(x && typeof x === 'object' && x.constructor === Object && !isComplex(x) && !isFraction(x));\n}\n\n/**\n * Returns `true` if the passed object appears to be a Map (i.e. duck typing).\n *\n * Methods looked for are `get`, `set`, `keys` and `has`.\n *\n * @param {Map | object} object\n * @returns\n */\nexport function isMap(object) {\n // We can use the fast instanceof, or a slower duck typing check.\n // The duck typing method needs to cover enough methods to not be confused with DenseMatrix.\n if (!object) {\n return false;\n }\n return object instanceof Map || object instanceof ObjectWrappingMap || typeof object.set === 'function' && typeof object.get === 'function' && typeof object.keys === 'function' && typeof object.has === 'function';\n}\nexport function isPartitionedMap(object) {\n return isMap(object) && isMap(object.a) && isMap(object.b);\n}\nexport function isObjectWrappingMap(object) {\n return isMap(object) && isObject(object.wrappedObject);\n}\nexport function isNull(x) {\n return x === null;\n}\nexport function isUndefined(x) {\n return x === undefined;\n}\nexport function isAccessorNode(x) {\n return x && x.isAccessorNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isArrayNode(x) {\n return x && x.isArrayNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isAssignmentNode(x) {\n return x && x.isAssignmentNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isBlockNode(x) {\n return x && x.isBlockNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isConditionalNode(x) {\n return x && x.isConditionalNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isConstantNode(x) {\n return x && x.isConstantNode === true && x.constructor.prototype.isNode === true || false;\n}\n\n/* Very specialized: returns true for those nodes which in the numerator of\n a fraction means that the division in that fraction has precedence over implicit\n multiplication, e.g. -2/3 x parses as (-2/3) x and 3/4 x parses as (3/4) x but\n 6!/8 x parses as 6! / (8x). It is located here because it is shared between\n parse.js and OperatorNode.js (for parsing and printing, respectively).\n\n This should *not* be exported from mathjs, unlike most of the tests here.\n Its name does not start with 'is' to prevent utils/snapshot.js from thinking\n it should be exported.\n*/\nexport function rule2Node(node) {\n return isConstantNode(node) || isOperatorNode(node) && node.args.length === 1 && isConstantNode(node.args[0]) && '-+~'.includes(node.op);\n}\nexport function isFunctionAssignmentNode(x) {\n return x && x.isFunctionAssignmentNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isFunctionNode(x) {\n return x && x.isFunctionNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isIndexNode(x) {\n return x && x.isIndexNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isNode(x) {\n return x && x.isNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isObjectNode(x) {\n return x && x.isObjectNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isOperatorNode(x) {\n return x && x.isOperatorNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isParenthesisNode(x) {\n return x && x.isParenthesisNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isRangeNode(x) {\n return x && x.isRangeNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isRelationalNode(x) {\n return x && x.isRelationalNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isSymbolNode(x) {\n return x && x.isSymbolNode === true && x.constructor.prototype.isNode === true || false;\n}\nexport function isChain(x) {\n return x && x.constructor.prototype.isChain === true || false;\n}\nexport function typeOf(x) {\n var t = typeof x;\n if (t === 'object') {\n if (x === null) return 'null';\n if (isBigNumber(x)) return 'BigNumber'; // Special: weird mashup with Decimal\n if (x.constructor && x.constructor.name) return x.constructor.name;\n return 'Object'; // just in case\n }\n return t; // can be 'string', 'number', 'boolean', 'function', 'bigint', ...\n}","import { isBigNumber, isObject } from './is.js';\n\n/**\n * Clone an object\n *\n * clone(x)\n *\n * Can clone any primitive type, array, and object.\n * If x has a function clone, this function will be invoked to clone the object.\n *\n * @param {*} x\n * @return {*} clone\n */\nexport function clone(x) {\n var type = typeof x;\n\n // immutable primitive types\n if (type === 'number' || type === 'bigint' || type === 'string' || type === 'boolean' || x === null || x === undefined) {\n return x;\n }\n\n // use clone function of the object when available\n if (typeof x.clone === 'function') {\n return x.clone();\n }\n\n // array\n if (Array.isArray(x)) {\n return x.map(function (value) {\n return clone(value);\n });\n }\n if (x instanceof Date) return new Date(x.valueOf());\n if (isBigNumber(x)) return x; // bignumbers are immutable\n\n // object\n if (isObject(x)) {\n return mapObject(x, clone);\n }\n if (type === 'function') {\n // we assume that the function is immutable\n return x;\n }\n throw new TypeError(\"Cannot clone: unknown type of value (value: \".concat(x, \")\"));\n}\n\n/**\n * Apply map to all properties of an object\n * @param {Object} object\n * @param {function} callback\n * @return {Object} Returns a copy of the object with mapped properties\n */\nexport function mapObject(object, callback) {\n var clone = {};\n for (var key in object) {\n if (hasOwnProperty(object, key)) {\n clone[key] = callback(object[key]);\n }\n }\n return clone;\n}\n\n/**\n * Extend object a with the properties of object b\n * @param {Object} a\n * @param {Object} b\n * @return {Object} a\n */\nexport function extend(a, b) {\n for (var prop in b) {\n if (hasOwnProperty(b, prop)) {\n a[prop] = b[prop];\n }\n }\n return a;\n}\n\n/**\n * Deep extend an object a with the properties of object b\n * @param {Object} a\n * @param {Object} b\n * @returns {Object}\n */\nexport function deepExtend(a, b) {\n // TODO: add support for Arrays to deepExtend\n if (Array.isArray(b)) {\n throw new TypeError('Arrays are not supported by deepExtend');\n }\n for (var prop in b) {\n // We check against prop not being in Object.prototype or Function.prototype\n // to prevent polluting for example Object.__proto__.\n if (hasOwnProperty(b, prop) && !(prop in Object.prototype) && !(prop in Function.prototype)) {\n if (b[prop] && b[prop].constructor === Object) {\n if (a[prop] === undefined) {\n a[prop] = {};\n }\n if (a[prop] && a[prop].constructor === Object) {\n deepExtend(a[prop], b[prop]);\n } else {\n a[prop] = b[prop];\n }\n } else if (Array.isArray(b[prop])) {\n throw new TypeError('Arrays are not supported by deepExtend');\n } else {\n a[prop] = b[prop];\n }\n }\n }\n return a;\n}\n\n/**\n * Deep test equality of all fields in two pairs of arrays or objects.\n * Compares values and functions strictly (ie. 2 is not the same as '2').\n * @param {Array | Object} a\n * @param {Array | Object} b\n * @returns {boolean}\n */\nexport function deepStrictEqual(a, b) {\n var prop, i, len;\n if (Array.isArray(a)) {\n if (!Array.isArray(b)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (i = 0, len = a.length; i < len; i++) {\n if (!deepStrictEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n } else if (typeof a === 'function') {\n return a === b;\n } else if (a instanceof Object) {\n if (Array.isArray(b) || !(b instanceof Object)) {\n return false;\n }\n for (prop in a) {\n // noinspection JSUnfilteredForInLoop\n if (!(prop in b) || !deepStrictEqual(a[prop], b[prop])) {\n return false;\n }\n }\n for (prop in b) {\n // noinspection JSUnfilteredForInLoop\n if (!(prop in a)) {\n return false;\n }\n }\n return true;\n } else {\n return a === b;\n }\n}\n\n/**\n * Recursively flatten a nested object.\n * @param {Object} nestedObject\n * @return {Object} Returns the flattened object\n */\nexport function deepFlatten(nestedObject) {\n var flattenedObject = {};\n _deepFlatten(nestedObject, flattenedObject);\n return flattenedObject;\n}\n\n// helper function used by deepFlatten\nfunction _deepFlatten(nestedObject, flattenedObject) {\n for (var prop in nestedObject) {\n if (hasOwnProperty(nestedObject, prop)) {\n var value = nestedObject[prop];\n if (typeof value === 'object' && value !== null) {\n _deepFlatten(value, flattenedObject);\n } else {\n flattenedObject[prop] = value;\n }\n }\n }\n}\n\n/**\n * Test whether the current JavaScript engine supports Object.defineProperty\n * @returns {boolean} returns true if supported\n */\nexport function canDefineProperty() {\n // test needed for broken IE8 implementation\n try {\n if (Object.defineProperty) {\n Object.defineProperty({}, 'x', {\n get: function get() {\n return null;\n }\n });\n return true;\n }\n } catch (e) {}\n return false;\n}\n\n/**\n * Attach a lazy loading property to a constant.\n * The given function `fn` is called once when the property is first requested.\n *\n * @param {Object} object Object where to add the property\n * @param {string} prop Property name\n * @param {Function} valueResolver Function returning the property value. Called\n * without arguments.\n */\nexport function lazy(object, prop, valueResolver) {\n var _uninitialized = true;\n var _value;\n Object.defineProperty(object, prop, {\n get: function get() {\n if (_uninitialized) {\n _value = valueResolver();\n _uninitialized = false;\n }\n return _value;\n },\n set: function set(value) {\n _value = value;\n _uninitialized = false;\n },\n configurable: true,\n enumerable: true\n });\n}\n\n/**\n * Traverse a path into an object.\n * When a namespace is missing, it will be created\n * @param {Object} object\n * @param {string | string[]} path A dot separated string like 'name.space'\n * @return {Object} Returns the object at the end of the path\n */\nexport function traverse(object, path) {\n if (path && typeof path === 'string') {\n return traverse(object, path.split('.'));\n }\n var obj = object;\n if (path) {\n for (var i = 0; i < path.length; i++) {\n var key = path[i];\n if (!(key in obj)) {\n obj[key] = {};\n }\n obj = obj[key];\n }\n }\n return obj;\n}\n\n/**\n * A safe hasOwnProperty\n * @param {Object} object\n * @param {string} property\n */\nexport function hasOwnProperty(object, property) {\n return object && Object.hasOwnProperty.call(object, property);\n}\n\n/**\n * Test whether an object is a factory. a factory has fields:\n *\n * - factory: function (type: Object, config: Object, load: function, typed: function [, math: Object]) (required)\n * - name: string (optional)\n * - path: string A dot separated path (optional)\n * - math: boolean If true (false by default), the math namespace is passed\n * as fifth argument of the factory function\n *\n * @param {*} object\n * @returns {boolean}\n */\nexport function isLegacyFactory(object) {\n return object && typeof object.factory === 'function';\n}\n\n/**\n * Get a nested property from an object\n * @param {Object} object\n * @param {string | string[]} path\n * @returns {Object}\n */\nexport function get(object, path) {\n if (typeof path === 'string') {\n if (isPath(path)) {\n return get(object, path.split('.'));\n } else {\n return object[path];\n }\n }\n var child = object;\n for (var i = 0; i < path.length; i++) {\n var key = path[i];\n child = child ? child[key] : undefined;\n }\n return child;\n}\n\n/**\n * Set a nested property in an object\n * Mutates the object itself\n * If the path doesn't exist, it will be created\n * @param {Object} object\n * @param {string | string[]} path\n * @param {*} value\n * @returns {Object}\n */\nexport function set(object, path, value) {\n if (typeof path === 'string') {\n if (isPath(path)) {\n return set(object, path.split('.'), value);\n } else {\n object[path] = value;\n return object;\n }\n }\n var child = object;\n for (var i = 0; i < path.length - 1; i++) {\n var key = path[i];\n if (child[key] === undefined) {\n child[key] = {};\n }\n child = child[key];\n }\n if (path.length > 0) {\n var lastKey = path[path.length - 1];\n child[lastKey] = value;\n }\n return object;\n}\n\n/**\n * Create an object composed of the picked object properties\n * @param {Object} object\n * @param {string[]} properties\n * @param {function} [transform] Optional value to transform a value when picking it\n * @return {Object}\n */\nexport function pick(object, properties, transform) {\n var copy = {};\n for (var i = 0; i < properties.length; i++) {\n var key = properties[i];\n var value = get(object, key);\n if (value !== undefined) {\n set(copy, key, transform ? transform(value, key) : value);\n }\n }\n return copy;\n}\n\n/**\n * Shallow version of pick, creating an object composed of the picked object properties\n * but not for nested properties\n * @param {Object} object\n * @param {string[]} properties\n * @return {Object}\n */\nexport function pickShallow(object, properties) {\n var copy = {};\n for (var i = 0; i < properties.length; i++) {\n var key = properties[i];\n var value = object[key];\n if (value !== undefined) {\n copy[key] = value;\n }\n }\n return copy;\n}\n\n// helper function to test whether a string contains a path like 'user.name'\nfunction isPath(str) {\n return str.includes('.');\n}","import { clone, deepExtend } from '../../utils/object.js';\nimport { DEFAULT_CONFIG } from '../config.js';\nexport var MATRIX_OPTIONS = ['Matrix', 'Array']; // valid values for option matrix\nexport var NUMBER_OPTIONS = ['number', 'BigNumber', 'Fraction']; // valid values for option number\n\nexport function configFactory(config, emit) {\n /**\n * Set configuration options for math.js, and get current options.\n * Will emit a 'config' event, with arguments (curr, prev, changes).\n *\n * This function is only available on a mathjs instance created using `create`.\n *\n * Syntax:\n *\n * math.config(config: Object): Object\n *\n * Examples:\n *\n *\n * import { create, all } from 'mathjs'\n *\n * // create a mathjs instance\n * const math = create(all)\n *\n * math.config().number // outputs 'number'\n * math.evaluate('0.4') // outputs number 0.4\n * math.config({number: 'Fraction'})\n * math.evaluate('0.4') // outputs Fraction 2/5\n *\n * @param {Object} [options] Available options:\n * {number} relTol\n * Minimum relative difference between two\n * compared values, used by all comparison functions.\n * {number} absTol\n * Minimum absolute difference between two\n * compared values, used by all comparison functions.\n * {string} matrix\n * A string 'Matrix' (default) or 'Array'.\n * {string} number\n * A string 'number' (default), 'BigNumber', 'bigint', or 'Fraction'\n * {number} precision\n * The number of significant digits for BigNumbers.\n * Not applicable for Numbers.\n * {string} parenthesis\n * How to display parentheses in LaTeX and string\n * output.\n * {string} randomSeed\n * Random seed for seeded pseudo random number generator.\n * Set to null to randomly seed.\n * @return {Object} Returns the current configuration\n */\n function _config(options) {\n if (options) {\n if (options.epsilon !== undefined) {\n // this if is only for backwards compatibility, it can be removed in the future.\n console.warn('Warning: The configuration option \"epsilon\" is deprecated. Use \"relTol\" and \"absTol\" instead.');\n var optionsFix = clone(options);\n optionsFix.relTol = options.epsilon;\n optionsFix.absTol = options.epsilon * 1e-3;\n delete optionsFix.epsilon;\n return _config(optionsFix);\n }\n var prev = clone(config);\n\n // validate some of the options\n validateOption(options, 'matrix', MATRIX_OPTIONS);\n validateOption(options, 'number', NUMBER_OPTIONS);\n\n // merge options\n deepExtend(config, options);\n var curr = clone(config);\n var changes = clone(options);\n\n // emit 'config' event\n emit('config', curr, prev, changes);\n return curr;\n } else {\n return clone(config);\n }\n }\n\n // attach the valid options to the function so they can be extended\n _config.MATRIX_OPTIONS = MATRIX_OPTIONS;\n _config.NUMBER_OPTIONS = NUMBER_OPTIONS;\n\n // attach the config properties as readonly properties to the config function\n Object.keys(DEFAULT_CONFIG).forEach(key => {\n Object.defineProperty(_config, key, {\n get: () => config[key],\n enumerable: true,\n configurable: true\n });\n });\n return _config;\n}\n\n/**\n * Validate an option\n * @param {Object} options Object with options\n * @param {string} name Name of the option to validate\n * @param {Array.} values Array with valid values for this option\n */\nfunction validateOption(options, name, values) {\n if (options[name] !== undefined && !values.includes(options[name])) {\n // unknown value\n console.warn('Warning: Unknown value \"' + options[name] + '\" for configuration option \"' + name + '\". ' + 'Available options: ' + values.map(value => JSON.stringify(value)).join(', ') + '.');\n }\n}","import _extends from \"@babel/runtime/helpers/extends\";\nimport { DEFAULT_CONFIG } from '../core/config.js';\nimport { MATRIX_OPTIONS, NUMBER_OPTIONS } from '../core/function/config.js';\n\n// create a read-only version of config\nexport var config = function config(options) {\n if (options) {\n throw new Error('The global config is readonly. \\n' + 'Please create a mathjs instance if you want to change the default configuration. \\n' + 'Example:\\n' + '\\n' + ' import { create, all } from \\'mathjs\\';\\n' + ' const mathjs = create(all);\\n' + ' mathjs.config({ number: \\'BigNumber\\' });\\n');\n }\n return Object.freeze(DEFAULT_CONFIG);\n};\n_extends(config, DEFAULT_CONFIG, {\n MATRIX_OPTIONS,\n NUMBER_OPTIONS\n});","function ok() {\n return true;\n}\nfunction notOk() {\n return false;\n}\nfunction undef() {\n return undefined;\n}\nconst NOT_TYPED_FUNCTION = 'Argument is not a typed-function.';\n\n/**\n * @typedef {{\n * params: Param[],\n * fn: function,\n * test: function,\n * implementation: function\n * }} Signature\n *\n * @typedef {{\n * types: Type[],\n * hasAny: boolean,\n * hasConversion: boolean,\n * restParam: boolean\n * }} Param\n *\n * @typedef {{\n * name: string,\n * typeIndex: number,\n * test: function,\n * isAny: boolean,\n * conversion?: ConversionDef,\n * conversionIndex: number,\n * }} Type\n *\n * @typedef {{\n * from: string,\n * to: string,\n * convert: function (*) : *\n * }} ConversionDef\n *\n * @typedef {{\n * name: string,\n * test: function(*) : boolean,\n * isAny?: boolean\n * }} TypeDef\n */\n\n/**\n * @returns {() => function}\n */\nfunction create() {\n // data type tests\n\n /**\n * Returns true if the argument is a non-null \"plain\" object\n */\n function isPlainObject(x) {\n return typeof x === 'object' && x !== null && x.constructor === Object;\n }\n const _types = [{\n name: 'number',\n test: function (x) {\n return typeof x === 'number';\n }\n }, {\n name: 'string',\n test: function (x) {\n return typeof x === 'string';\n }\n }, {\n name: 'boolean',\n test: function (x) {\n return typeof x === 'boolean';\n }\n }, {\n name: 'Function',\n test: function (x) {\n return typeof x === 'function';\n }\n }, {\n name: 'Array',\n test: Array.isArray\n }, {\n name: 'Date',\n test: function (x) {\n return x instanceof Date;\n }\n }, {\n name: 'RegExp',\n test: function (x) {\n return x instanceof RegExp;\n }\n }, {\n name: 'Object',\n test: isPlainObject\n }, {\n name: 'null',\n test: function (x) {\n return x === null;\n }\n }, {\n name: 'undefined',\n test: function (x) {\n return x === undefined;\n }\n }];\n const anyType = {\n name: 'any',\n test: ok,\n isAny: true\n };\n\n // Data structures to track the types. As these are local variables in\n // create(), each typed universe will get its own copy, but the variables\n // will only be accessible through the (closures of the) functions supplied\n // as properties of the typed object, not directly.\n // These will be initialized in clear() below\n let typeMap; // primary store of all types\n let typeList; // Array of just type names, for the sake of ordering\n\n // And similar data structures for the type conversions:\n let nConversions = 0;\n // the actual conversions are stored on a property of the destination types\n\n // This is a temporary object, will be replaced with a function at the end\n let typed = {\n createCount: 0\n };\n\n /**\n * Takes a type name and returns the corresponding official type object\n * for that type.\n *\n * @param {string} typeName\n * @returns {TypeDef} type\n */\n function findType(typeName) {\n const type = typeMap.get(typeName);\n if (type) {\n return type;\n }\n // Remainder is error handling\n let message = 'Unknown type \"' + typeName + '\"';\n const name = typeName.toLowerCase();\n let otherName;\n for (otherName of typeList) {\n if (otherName.toLowerCase() === name) {\n message += '. Did you mean \"' + otherName + '\" ?';\n break;\n }\n }\n throw new TypeError(message);\n }\n\n /**\n * Adds an array `types` of type definitions to this typed instance.\n * Each type definition should be an object with properties:\n * 'name' - a string giving the name of the type; 'test' - function\n * returning a boolean that tests membership in the type; and optionally\n * 'isAny' - true only for the 'any' type.\n *\n * The second optional argument, `before`, gives the name of a type that\n * these types should be added before. The new types are added in the\n * order specified.\n * @param {TypeDef[]} types\n * @param {string | boolean} [beforeSpec='any'] before\n */\n function addTypes(types) {\n let beforeSpec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'any';\n const beforeIndex = beforeSpec ? findType(beforeSpec).index : typeList.length;\n const newTypes = [];\n for (let i = 0; i < types.length; ++i) {\n if (!types[i] || typeof types[i].name !== 'string' || typeof types[i].test !== 'function') {\n throw new TypeError('Object with properties {name: string, test: function} expected');\n }\n const typeName = types[i].name;\n if (typeMap.has(typeName)) {\n throw new TypeError('Duplicate type name \"' + typeName + '\"');\n }\n newTypes.push(typeName);\n typeMap.set(typeName, {\n name: typeName,\n test: types[i].test,\n isAny: types[i].isAny,\n index: beforeIndex + i,\n conversionsTo: [] // Newly added type can't have any conversions to it\n });\n }\n // update the typeList\n const affectedTypes = typeList.slice(beforeIndex);\n typeList = typeList.slice(0, beforeIndex).concat(newTypes).concat(affectedTypes);\n // Fix the indices\n for (let i = beforeIndex + newTypes.length; i < typeList.length; ++i) {\n typeMap.get(typeList[i]).index = i;\n }\n }\n\n /**\n * Removes all types and conversions from this typed instance.\n * May cause previously constructed typed-functions to throw\n * strange errors when they are called with types that do not\n * match any of their signatures.\n */\n function clear() {\n typeMap = new Map();\n typeList = [];\n nConversions = 0;\n addTypes([anyType], false);\n }\n\n // initialize the types to the default list\n clear();\n addTypes(_types);\n\n /**\n * Removes all conversions, leaving the types alone.\n */\n function clearConversions() {\n let typeName;\n for (typeName of typeList) {\n typeMap.get(typeName).conversionsTo = [];\n }\n nConversions = 0;\n }\n\n /**\n * Find the type names that match a value.\n * @param {*} value\n * @return {string[]} Array of names of types for which\n * the type test matches the value.\n */\n function findTypeNames(value) {\n const matches = typeList.filter(name => {\n const type = typeMap.get(name);\n return !type.isAny && type.test(value);\n });\n if (matches.length) {\n return matches;\n }\n return ['any'];\n }\n\n /**\n * Check if an entity is a typed function created by any instance\n * @param {any} entity\n * @returns {boolean}\n */\n function isTypedFunction(entity) {\n return entity && typeof entity === 'function' && '_typedFunctionData' in entity;\n }\n\n /**\n * Find a specific signature from a (composed) typed function, for example:\n *\n * typed.findSignature(fn, ['number', 'string'])\n * typed.findSignature(fn, 'number, string')\n * typed.findSignature(fn, 'number,string', {exact: true})\n *\n * This function findSignature will by default return the best match to\n * the given signature, possibly employing type conversions.\n *\n * The (optional) third argument is a plain object giving options\n * controlling the signature search. Currently the only implemented\n * option is `exact`: if specified as true (default is false), only\n * exact matches will be returned (i.e. signatures for which `fn` was\n * directly defined). Note that a (possibly different) type matching\n * `any`, or one or more instances of TYPE matching `...TYPE` are\n * considered exact matches in this regard, as no conversions are used.\n *\n * This function returns a \"signature\" object, as does `typed.resolve()`,\n * which is a plain object with four keys: `params` (the array of parameters\n * for this signature), `fn` (the originally supplied function for this\n * signature), `test` (a generated function that determines if an argument\n * list matches this signature, and `implementation` (the function to call\n * on a matching argument list, that performs conversions if necessary and\n * then calls the originally supplied function).\n *\n * @param {Function} fn A typed-function\n * @param {string | string[]} signature\n * Signature to be found, can be an array or a comma separated string.\n * @param {object} options Controls the signature search as documented\n * @return {{ params: Param[], fn: function, test: function, implementation: function }}\n * Returns the matching signature, or throws an error when no signature\n * is found.\n */\n function findSignature(fn, signature, options) {\n if (!isTypedFunction(fn)) {\n throw new TypeError(NOT_TYPED_FUNCTION);\n }\n\n // Canonicalize input\n const exact = options && options.exact;\n const stringSignature = Array.isArray(signature) ? signature.join(',') : signature;\n const params = parseSignature(stringSignature);\n const canonicalSignature = stringifyParams(params);\n\n // First hope we get lucky and exactly match a signature\n if (!exact || canonicalSignature in fn.signatures) {\n // OK, we can check the internal signatures\n const match = fn._typedFunctionData.signatureMap.get(canonicalSignature);\n if (match) {\n return match;\n }\n }\n\n // Oh well, we did not; so we have to go back and check the parameters\n // one by one, in order to catch things like `any` and rest params.\n // Note here we can assume there is at least one parameter, because\n // the empty signature would have matched successfully above.\n const nParams = params.length;\n let remainingSignatures;\n if (exact) {\n remainingSignatures = [];\n let name;\n for (name in fn.signatures) {\n remainingSignatures.push(fn._typedFunctionData.signatureMap.get(name));\n }\n } else {\n remainingSignatures = fn._typedFunctionData.signatures;\n }\n for (let i = 0; i < nParams; ++i) {\n const want = params[i];\n const filteredSignatures = [];\n let possibility;\n for (possibility of remainingSignatures) {\n const have = getParamAtIndex(possibility.params, i);\n if (!have || want.restParam && !have.restParam) {\n continue;\n }\n if (!have.hasAny) {\n // have to check all of the wanted types are available\n const haveTypes = paramTypeSet(have);\n if (want.types.some(wtype => !haveTypes.has(wtype.name))) {\n continue;\n }\n }\n // OK, this looks good\n filteredSignatures.push(possibility);\n }\n remainingSignatures = filteredSignatures;\n if (remainingSignatures.length === 0) break;\n }\n // Return the first remaining signature that was totally matched:\n let candidate;\n for (candidate of remainingSignatures) {\n if (candidate.params.length <= nParams) {\n return candidate;\n }\n }\n throw new TypeError('Signature not found (signature: ' + (fn.name || 'unnamed') + '(' + stringifyParams(params, ', ') + '))');\n }\n\n /**\n * Find the proper function to call for a specific signature from\n * a (composed) typed function, for example:\n *\n * typed.find(fn, ['number', 'string'])\n * typed.find(fn, 'number, string')\n * typed.find(fn, 'number,string', {exact: true})\n *\n * This function find will by default return the best match to\n * the given signature, possibly employing type conversions (and returning\n * a function that will perform those conversions as needed). The\n * (optional) third argument is a plain object giving options contolling\n * the signature search. Currently only the option `exact` is implemented,\n * which defaults to \"false\". If `exact` is specified as true, then only\n * exact matches will be returned (i.e. signatures for which `fn` was\n * directly defined). Uses of `any` and `...TYPE` are considered exact if\n * no conversions are necessary to apply the corresponding function.\n *\n * @param {Function} fn A typed-function\n * @param {string | string[]} signature\n * Signature to be found, can be an array or a comma separated string.\n * @param {object} options Controls the signature match as documented\n * @return {function}\n * Returns the function to call for the given signature, or throws an\n * error if no match is found.\n */\n function find(fn, signature, options) {\n return findSignature(fn, signature, options).implementation;\n }\n\n /**\n * Convert a given value to another data type, specified by type name.\n *\n * @param {*} value\n * @param {string} typeName\n */\n function convert(value, typeName) {\n // check conversion is needed\n const type = findType(typeName);\n if (type.test(value)) {\n return value;\n }\n const conversions = type.conversionsTo;\n if (conversions.length === 0) {\n throw new Error('There are no conversions to ' + typeName + ' defined.');\n }\n for (let i = 0; i < conversions.length; i++) {\n const fromType = findType(conversions[i].from);\n if (fromType.test(value)) {\n return conversions[i].convert(value);\n }\n }\n throw new Error('Cannot convert ' + value + ' to ' + typeName);\n }\n\n /**\n * Stringify parameters in a normalized way\n * @param {Param[]} params\n * @param {string} [','] separator\n * @return {string}\n */\n function stringifyParams(params) {\n let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';\n return params.map(p => p.name).join(separator);\n }\n\n /**\n * Parse a parameter, like \"...number | boolean\"\n * @param {string} param\n * @return {Param} param\n */\n function parseParam(param) {\n const restParam = param.indexOf('...') === 0;\n const types = !restParam ? param : param.length > 3 ? param.slice(3) : 'any';\n const typeDefs = types.split('|').map(s => findType(s.trim()));\n let hasAny = false;\n let paramName = restParam ? '...' : '';\n const exactTypes = typeDefs.map(function (type) {\n hasAny = type.isAny || hasAny;\n paramName += type.name + '|';\n return {\n name: type.name,\n typeIndex: type.index,\n test: type.test,\n isAny: type.isAny,\n conversion: null,\n conversionIndex: -1\n };\n });\n return {\n types: exactTypes,\n name: paramName.slice(0, -1),\n // remove trailing '|' from above\n hasAny,\n hasConversion: false,\n restParam\n };\n }\n\n /**\n * Expands a parsed parameter with the types available from currently\n * defined conversions.\n * @param {Param} param\n * @return {Param} param\n */\n function expandParam(param) {\n const typeNames = param.types.map(t => t.name);\n const matchingConversions = availableConversions(typeNames);\n let hasAny = param.hasAny;\n let newName = param.name;\n const convertibleTypes = matchingConversions.map(function (conversion) {\n const type = findType(conversion.from);\n hasAny = type.isAny || hasAny;\n newName += '|' + conversion.from;\n return {\n name: conversion.from,\n typeIndex: type.index,\n test: type.test,\n isAny: type.isAny,\n conversion,\n conversionIndex: conversion.index\n };\n });\n return {\n types: param.types.concat(convertibleTypes),\n name: newName,\n hasAny,\n hasConversion: convertibleTypes.length > 0,\n restParam: param.restParam\n };\n }\n\n /**\n * Return the set of type names in a parameter.\n * Caches the result for efficiency\n *\n * @param {Param} param\n * @return {Set} typenames\n */\n function paramTypeSet(param) {\n if (!param.typeSet) {\n param.typeSet = new Set();\n param.types.forEach(type => param.typeSet.add(type.name));\n }\n return param.typeSet;\n }\n\n /**\n * Parse a signature with comma separated parameters,\n * like \"number | boolean, ...string\"\n *\n * @param {string} signature\n * @return {Param[]} params\n */\n function parseSignature(rawSignature) {\n const params = [];\n if (typeof rawSignature !== 'string') {\n throw new TypeError('Signatures must be strings');\n }\n const signature = rawSignature.trim();\n if (signature === '') {\n return params;\n }\n const rawParams = signature.split(',');\n for (let i = 0; i < rawParams.length; ++i) {\n const parsedParam = parseParam(rawParams[i].trim());\n if (parsedParam.restParam && i !== rawParams.length - 1) {\n throw new SyntaxError('Unexpected rest parameter \"' + rawParams[i] + '\": ' + 'only allowed for the last parameter');\n }\n // if invalid, short-circuit (all the types may have been filtered)\n if (parsedParam.types.length === 0) {\n return null;\n }\n params.push(parsedParam);\n }\n return params;\n }\n\n /**\n * Test whether a set of params contains a restParam\n * @param {Param[]} params\n * @return {boolean} Returns true when the last parameter is a restParam\n */\n function hasRestParam(params) {\n const param = last(params);\n return param ? param.restParam : false;\n }\n\n /**\n * Create a type test for a single parameter, which can have one or multiple\n * types.\n * @param {Param} param\n * @return {function(x: *) : boolean} Returns a test function\n */\n function compileTest(param) {\n if (!param || param.types.length === 0) {\n // nothing to do\n return ok;\n } else if (param.types.length === 1) {\n return findType(param.types[0].name).test;\n } else if (param.types.length === 2) {\n const test0 = findType(param.types[0].name).test;\n const test1 = findType(param.types[1].name).test;\n return function or(x) {\n return test0(x) || test1(x);\n };\n } else {\n // param.types.length > 2\n const tests = param.types.map(function (type) {\n return findType(type.name).test;\n });\n return function or(x) {\n for (let i = 0; i < tests.length; i++) {\n if (tests[i](x)) {\n return true;\n }\n }\n return false;\n };\n }\n }\n\n /**\n * Create a test for all parameters of a signature\n * @param {Param[]} params\n * @return {function(args: Array<*>) : boolean}\n */\n function compileTests(params) {\n let tests, test0, test1;\n if (hasRestParam(params)) {\n // variable arguments like '...number'\n tests = initial(params).map(compileTest);\n const varIndex = tests.length;\n const lastTest = compileTest(last(params));\n const testRestParam = function (args) {\n for (let i = varIndex; i < args.length; i++) {\n if (!lastTest(args[i])) {\n return false;\n }\n }\n return true;\n };\n return function testArgs(args) {\n for (let i = 0; i < tests.length; i++) {\n if (!tests[i](args[i])) {\n return false;\n }\n }\n return testRestParam(args) && args.length >= varIndex + 1;\n };\n } else {\n // no variable arguments\n if (params.length === 0) {\n return function testArgs(args) {\n return args.length === 0;\n };\n } else if (params.length === 1) {\n test0 = compileTest(params[0]);\n return function testArgs(args) {\n return test0(args[0]) && args.length === 1;\n };\n } else if (params.length === 2) {\n test0 = compileTest(params[0]);\n test1 = compileTest(params[1]);\n return function testArgs(args) {\n return test0(args[0]) && test1(args[1]) && args.length === 2;\n };\n } else {\n // arguments.length > 2\n tests = params.map(compileTest);\n return function testArgs(args) {\n for (let i = 0; i < tests.length; i++) {\n if (!tests[i](args[i])) {\n return false;\n }\n }\n return args.length === tests.length;\n };\n }\n }\n }\n\n /**\n * Find the parameter at a specific index of a Params list.\n * Handles rest parameters.\n * @param {Param[]} params\n * @param {number} index\n * @return {Param | null} Returns the matching parameter when found,\n * null otherwise.\n */\n function getParamAtIndex(params, index) {\n return index < params.length ? params[index] : hasRestParam(params) ? last(params) : null;\n }\n\n /**\n * Get all type names of a parameter\n * @param {Params[]} params\n * @param {number} index\n * @return {string[]} Returns an array with type names\n */\n function getTypeSetAtIndex(params, index) {\n const param = getParamAtIndex(params, index);\n if (!param) {\n return new Set();\n }\n return paramTypeSet(param);\n }\n\n /**\n * Test whether a type is an exact type or conversion\n * @param {Type} type\n * @return {boolean} Returns true when\n */\n function isExactType(type) {\n return type.conversion === null || type.conversion === undefined;\n }\n\n /**\n * Helper function for creating error messages: create an array with\n * all available types on a specific argument index.\n * @param {Signature[]} signatures\n * @param {number} index\n * @return {string[]} Returns an array with available types\n */\n function mergeExpectedParams(signatures, index) {\n const typeSet = new Set();\n signatures.forEach(signature => {\n const paramSet = getTypeSetAtIndex(signature.params, index);\n let name;\n for (name of paramSet) {\n typeSet.add(name);\n }\n });\n return typeSet.has('any') ? ['any'] : Array.from(typeSet);\n }\n\n /**\n * Create\n * @param {string} name The name of the function\n * @param {array.<*>} args The actual arguments passed to the function\n * @param {Signature[]} signatures A list with available signatures\n * @return {TypeError} Returns a type error with additional data\n * attached to it in the property `data`\n */\n function createError(name, args, signatures) {\n let err, expected;\n const _name = name || 'unnamed';\n\n // test for wrong type at some index\n let matchingSignatures = signatures;\n let index;\n for (index = 0; index < args.length; index++) {\n const nextMatchingDefs = [];\n matchingSignatures.forEach(signature => {\n const param = getParamAtIndex(signature.params, index);\n const test = compileTest(param);\n if ((index < signature.params.length || hasRestParam(signature.params)) && test(args[index])) {\n nextMatchingDefs.push(signature);\n }\n });\n if (nextMatchingDefs.length === 0) {\n // no matching signatures anymore, throw error \"wrong type\"\n expected = mergeExpectedParams(matchingSignatures, index);\n if (expected.length > 0) {\n const actualTypes = findTypeNames(args[index]);\n err = new TypeError('Unexpected type of argument in function ' + _name + ' (expected: ' + expected.join(' or ') + ', actual: ' + actualTypes.join(' | ') + ', index: ' + index + ')');\n err.data = {\n category: 'wrongType',\n fn: _name,\n index,\n actual: actualTypes,\n expected\n };\n return err;\n }\n } else {\n matchingSignatures = nextMatchingDefs;\n }\n }\n\n // test for too few arguments\n const lengths = matchingSignatures.map(function (signature) {\n return hasRestParam(signature.params) ? Infinity : signature.params.length;\n });\n if (args.length < Math.min.apply(null, lengths)) {\n expected = mergeExpectedParams(matchingSignatures, index);\n err = new TypeError('Too few arguments in function ' + _name + ' (expected: ' + expected.join(' or ') + ', index: ' + args.length + ')');\n err.data = {\n category: 'tooFewArgs',\n fn: _name,\n index: args.length,\n expected\n };\n return err;\n }\n\n // test for too many arguments\n const maxLength = Math.max.apply(null, lengths);\n if (args.length > maxLength) {\n err = new TypeError('Too many arguments in function ' + _name + ' (expected: ' + maxLength + ', actual: ' + args.length + ')');\n err.data = {\n category: 'tooManyArgs',\n fn: _name,\n index: args.length,\n expectedLength: maxLength\n };\n return err;\n }\n\n // Generic error\n const argTypes = [];\n for (let i = 0; i < args.length; ++i) {\n argTypes.push(findTypeNames(args[i]).join('|'));\n }\n err = new TypeError('Arguments of type \"' + argTypes.join(', ') + '\" do not match any of the defined signatures of function ' + _name + '.');\n err.data = {\n category: 'mismatch',\n actual: argTypes\n };\n return err;\n }\n\n /**\n * Find the lowest index of all exact types of a parameter (no conversions)\n * @param {Param} param\n * @return {number} Returns the index of the lowest type in typed.types\n */\n function getLowestTypeIndex(param) {\n let min = typeList.length + 1;\n for (let i = 0; i < param.types.length; i++) {\n if (isExactType(param.types[i])) {\n min = Math.min(min, param.types[i].typeIndex);\n }\n }\n return min;\n }\n\n /**\n * Find the lowest index of the conversion of all types of the parameter\n * having a conversion\n * @param {Param} param\n * @return {number} Returns the lowest index of the conversions of this type\n */\n function getLowestConversionIndex(param) {\n let min = nConversions + 1;\n for (let i = 0; i < param.types.length; i++) {\n if (!isExactType(param.types[i])) {\n min = Math.min(min, param.types[i].conversionIndex);\n }\n }\n return min;\n }\n\n /**\n * Compare two params\n * @param {Param} param1\n * @param {Param} param2\n * @return {number} returns -1 when param1 must get a lower\n * index than param2, 1 when the opposite,\n * or zero when both are equal\n */\n function compareParams(param1, param2) {\n // We compare a number of metrics on a param in turn:\n // 1) 'any' parameters are the least preferred\n if (param1.hasAny) {\n if (!param2.hasAny) {\n return 1;\n }\n } else if (param2.hasAny) {\n return -1;\n }\n\n // 2) Prefer non-rest to rest parameters\n if (param1.restParam) {\n if (!param2.restParam) {\n return 1;\n }\n } else if (param2.restParam) {\n return -1;\n }\n\n // 3) Prefer exact type match to conversions\n if (param1.hasConversion) {\n if (!param2.hasConversion) {\n return 1;\n }\n } else if (param2.hasConversion) {\n return -1;\n }\n\n // 4) Prefer lower type index:\n const typeDiff = getLowestTypeIndex(param1) - getLowestTypeIndex(param2);\n if (typeDiff < 0) {\n return -1;\n }\n if (typeDiff > 0) {\n return 1;\n }\n\n // 5) Prefer lower conversion index\n const convDiff = getLowestConversionIndex(param1) - getLowestConversionIndex(param2);\n if (convDiff < 0) {\n return -1;\n }\n if (convDiff > 0) {\n return 1;\n }\n\n // Don't have a basis for preference\n return 0;\n }\n\n /**\n * Compare two signatures\n * @param {Signature} signature1\n * @param {Signature} signature2\n * @return {number} returns a negative number when param1 must get a lower\n * index than param2, a positive number when the opposite,\n * or zero when both are equal\n */\n function compareSignatures(signature1, signature2) {\n const pars1 = signature1.params;\n const pars2 = signature2.params;\n const last1 = last(pars1);\n const last2 = last(pars2);\n const hasRest1 = hasRestParam(pars1);\n const hasRest2 = hasRestParam(pars2);\n // We compare a number of metrics on signatures in turn:\n // 1) An \"any rest param\" is least preferred\n if (hasRest1 && last1.hasAny) {\n if (!hasRest2 || !last2.hasAny) {\n return 1;\n }\n } else if (hasRest2 && last2.hasAny) {\n return -1;\n }\n\n // 2) Minimize the number of 'any' parameters\n let any1 = 0;\n let conv1 = 0;\n let par;\n for (par of pars1) {\n if (par.hasAny) ++any1;\n if (par.hasConversion) ++conv1;\n }\n let any2 = 0;\n let conv2 = 0;\n for (par of pars2) {\n if (par.hasAny) ++any2;\n if (par.hasConversion) ++conv2;\n }\n if (any1 !== any2) {\n return any1 - any2;\n }\n\n // 3) A conversion rest param is less preferred\n if (hasRest1 && last1.hasConversion) {\n if (!hasRest2 || !last2.hasConversion) {\n return 1;\n }\n } else if (hasRest2 && last2.hasConversion) {\n return -1;\n }\n\n // 4) Minimize the number of conversions\n if (conv1 !== conv2) {\n return conv1 - conv2;\n }\n\n // 5) Prefer no rest param\n if (hasRest1) {\n if (!hasRest2) {\n return 1;\n }\n } else if (hasRest2) {\n return -1;\n }\n\n // 6) Prefer shorter with rest param, longer without\n const lengthCriterion = (pars1.length - pars2.length) * (hasRest1 ? -1 : 1);\n if (lengthCriterion !== 0) {\n return lengthCriterion;\n }\n\n // Signatures are identical in each of the above metrics.\n // In particular, they are the same length.\n // We can therefore compare the parameters one by one.\n // First we count which signature has more preferred parameters.\n const comparisons = [];\n let tc = 0;\n for (let i = 0; i < pars1.length; ++i) {\n const thisComparison = compareParams(pars1[i], pars2[i]);\n comparisons.push(thisComparison);\n tc += thisComparison;\n }\n if (tc !== 0) {\n return tc;\n }\n\n // They have the same number of preferred parameters, so go by the\n // earliest parameter in which we have a preference.\n // In other words, dispatch is driven somewhat more by earlier\n // parameters than later ones.\n let c;\n for (c of comparisons) {\n if (c !== 0) {\n return c;\n }\n }\n\n // It's a tossup:\n return 0;\n }\n\n /**\n * Produce a list of all conversions from distinct types to one of\n * the given types.\n *\n * @param {string[]} typeNames\n * @return {ConversionDef[]} Returns the conversions that are available\n * resulting in any given type (if any)\n */\n function availableConversions(typeNames) {\n if (typeNames.length === 0) {\n return [];\n }\n const types = typeNames.map(findType);\n if (typeNames.length > 1) {\n types.sort((t1, t2) => t1.index - t2.index);\n }\n let matches = types[0].conversionsTo;\n if (typeNames.length === 1) {\n return matches;\n }\n matches = matches.concat([]); // shallow copy the matches\n // Since the types are now in index order, we just want the first\n // occurrence of any from type:\n const knownTypes = new Set(typeNames);\n for (let i = 1; i < types.length; ++i) {\n let newMatch;\n for (newMatch of types[i].conversionsTo) {\n if (!knownTypes.has(newMatch.from)) {\n matches.push(newMatch);\n knownTypes.add(newMatch.from);\n }\n }\n }\n return matches;\n }\n\n /**\n * Preprocess arguments before calling the original function:\n * - if needed convert the parameters\n * - in case of rest parameters, move the rest parameters into an Array\n * @param {Param[]} params\n * @param {function} fn\n * @return {function} Returns a wrapped function\n */\n function compileArgsPreprocessing(params, fn) {\n let fnConvert = fn;\n\n // TODO: can we make this wrapper function smarter/simpler?\n\n if (params.some(p => p.hasConversion)) {\n const restParam = hasRestParam(params);\n const compiledConversions = params.map(compileArgConversion);\n fnConvert = function convertArgs() {\n const args = [];\n const last = restParam ? arguments.length - 1 : arguments.length;\n for (let i = 0; i < last; i++) {\n args[i] = compiledConversions[i](arguments[i]);\n }\n if (restParam) {\n args[last] = arguments[last].map(compiledConversions[last]);\n }\n return fn.apply(this, args);\n };\n }\n let fnPreprocess = fnConvert;\n if (hasRestParam(params)) {\n const offset = params.length - 1;\n fnPreprocess = function preprocessRestParams() {\n return fnConvert.apply(this, slice(arguments, 0, offset).concat([slice(arguments, offset)]));\n };\n }\n return fnPreprocess;\n }\n\n /**\n * Compile conversion for a parameter to the right type\n * @param {Param} param\n * @return {function} Returns the wrapped function that will convert arguments\n *\n */\n function compileArgConversion(param) {\n let test0, test1, conversion0, conversion1;\n const tests = [];\n const conversions = [];\n param.types.forEach(function (type) {\n if (type.conversion) {\n tests.push(findType(type.conversion.from).test);\n conversions.push(type.conversion.convert);\n }\n });\n\n // create optimized conversion functions depending on the number of conversions\n switch (conversions.length) {\n case 0:\n return function convertArg(arg) {\n return arg;\n };\n case 1:\n test0 = tests[0];\n conversion0 = conversions[0];\n return function convertArg(arg) {\n if (test0(arg)) {\n return conversion0(arg);\n }\n return arg;\n };\n case 2:\n test0 = tests[0];\n test1 = tests[1];\n conversion0 = conversions[0];\n conversion1 = conversions[1];\n return function convertArg(arg) {\n if (test0(arg)) {\n return conversion0(arg);\n }\n if (test1(arg)) {\n return conversion1(arg);\n }\n return arg;\n };\n default:\n return function convertArg(arg) {\n for (let i = 0; i < conversions.length; i++) {\n if (tests[i](arg)) {\n return conversions[i](arg);\n }\n }\n return arg;\n };\n }\n }\n\n /**\n * Split params with union types in to separate params.\n *\n * For example:\n *\n * splitParams([['Array', 'Object'], ['string', 'RegExp'])\n * // returns:\n * // [\n * // ['Array', 'string'],\n * // ['Array', 'RegExp'],\n * // ['Object', 'string'],\n * // ['Object', 'RegExp']\n * // ]\n *\n * @param {Param[]} params\n * @return {Param[]}\n */\n function splitParams(params) {\n function _splitParams(params, index, paramsSoFar) {\n if (index < params.length) {\n const param = params[index];\n let resultingParams = [];\n if (param.restParam) {\n // split the types of a rest parameter in two:\n // one with only exact types, and one with exact types and conversions\n const exactTypes = param.types.filter(isExactType);\n if (exactTypes.length < param.types.length) {\n resultingParams.push({\n types: exactTypes,\n name: '...' + exactTypes.map(t => t.name).join('|'),\n hasAny: exactTypes.some(t => t.isAny),\n hasConversion: false,\n restParam: true\n });\n }\n resultingParams.push(param);\n } else {\n // split all the types of a regular parameter into one type per param\n resultingParams = param.types.map(function (type) {\n return {\n types: [type],\n name: type.name,\n hasAny: type.isAny,\n hasConversion: type.conversion,\n restParam: false\n };\n });\n }\n\n // recurse over the groups with types\n return flatMap(resultingParams, function (nextParam) {\n return _splitParams(params, index + 1, paramsSoFar.concat([nextParam]));\n });\n } else {\n // we've reached the end of the parameters.\n return [paramsSoFar];\n }\n }\n return _splitParams(params, 0, []);\n }\n\n /**\n * Test whether two param lists represent conflicting signatures\n * @param {Param[]} params1\n * @param {Param[]} params2\n * @return {boolean} Returns true when the signatures conflict, false otherwise.\n */\n function conflicting(params1, params2) {\n const ii = Math.max(params1.length, params2.length);\n for (let i = 0; i < ii; i++) {\n const typeSet1 = getTypeSetAtIndex(params1, i);\n const typeSet2 = getTypeSetAtIndex(params2, i);\n let overlap = false;\n let name;\n for (name of typeSet2) {\n if (typeSet1.has(name)) {\n overlap = true;\n break;\n }\n }\n if (!overlap) {\n return false;\n }\n }\n const len1 = params1.length;\n const len2 = params2.length;\n const restParam1 = hasRestParam(params1);\n const restParam2 = hasRestParam(params2);\n return restParam1 ? restParam2 ? len1 === len2 : len2 >= len1 : restParam2 ? len1 >= len2 : len1 === len2;\n }\n\n /**\n * Helper function for `resolveReferences` that returns a copy of\n * functionList wihe any prior resolutions cleared out, in case we are\n * recycling signatures from a prior typed function construction.\n *\n * @param {Array.} functionList\n * @return {Array.}\n */\n function clearResolutions(functionList) {\n return functionList.map(fn => {\n if (isReferToSelf(fn)) {\n return referToSelf(fn.referToSelf.callback);\n }\n if (isReferTo(fn)) {\n return makeReferTo(fn.referTo.references, fn.referTo.callback);\n }\n return fn;\n });\n }\n\n /**\n * Take a list of references, a list of functions functionList, and a\n * signatureMap indexing signatures into functionList, and return\n * the list of resolutions, or a false-y value if they don't all\n * resolve in a valid way (yet).\n *\n * @param {string[]} references\n * @param {Array} signatureMap\n * @return {function[] | false} resolutions\n */\n function collectResolutions(references, functionList, signatureMap) {\n const resolvedReferences = [];\n let reference;\n for (reference of references) {\n let resolution = signatureMap[reference];\n if (typeof resolution !== 'number') {\n throw new TypeError('No definition for referenced signature \"' + reference + '\"');\n }\n resolution = functionList[resolution];\n if (typeof resolution !== 'function') {\n return false;\n }\n resolvedReferences.push(resolution);\n }\n return resolvedReferences;\n }\n\n /**\n * Resolve any references in the functionList for the typed function\n * itself. The signatureMap tells which index in the functionList a\n * given signature should be mapped to (for use in resolving typed.referTo)\n * and self provides the destions of a typed.referToSelf.\n *\n * @param {Array} functionList\n * @param {Object.} signatureMap\n * @param {function} self The typed-function itself\n * @return {Array} The list of resolved functions\n */\n function resolveReferences(functionList, signatureMap, self) {\n const resolvedFunctions = clearResolutions(functionList);\n const isResolved = new Array(resolvedFunctions.length).fill(false);\n let leftUnresolved = true;\n while (leftUnresolved) {\n leftUnresolved = false;\n let nothingResolved = true;\n for (let i = 0; i < resolvedFunctions.length; ++i) {\n if (isResolved[i]) continue;\n const fn = resolvedFunctions[i];\n if (isReferToSelf(fn)) {\n resolvedFunctions[i] = fn.referToSelf.callback(self);\n // Preserve reference in case signature is reused someday:\n resolvedFunctions[i].referToSelf = fn.referToSelf;\n isResolved[i] = true;\n nothingResolved = false;\n } else if (isReferTo(fn)) {\n const resolvedReferences = collectResolutions(fn.referTo.references, resolvedFunctions, signatureMap);\n if (resolvedReferences) {\n resolvedFunctions[i] = fn.referTo.callback.apply(this, resolvedReferences);\n // Preserve reference in case signature is reused someday:\n resolvedFunctions[i].referTo = fn.referTo;\n isResolved[i] = true;\n nothingResolved = false;\n } else {\n leftUnresolved = true;\n }\n }\n }\n if (nothingResolved && leftUnresolved) {\n throw new SyntaxError('Circular reference detected in resolving typed.referTo');\n }\n }\n return resolvedFunctions;\n }\n\n /**\n * Validate whether any of the function bodies contains a self-reference\n * usage like `this(...)` or `this.signatures`. This self-referencing is\n * deprecated since typed-function v3. It has been replaced with\n * the functions typed.referTo and typed.referToSelf.\n * @param {Object.} signaturesMap\n */\n function validateDeprecatedThis(signaturesMap) {\n // TODO: remove this deprecation warning logic some day (it's introduced in v3)\n\n // match occurrences like 'this(' and 'this.signatures'\n const deprecatedThisRegex = /\\bthis(\\(|\\.signatures\\b)/;\n Object.keys(signaturesMap).forEach(signature => {\n const fn = signaturesMap[signature];\n if (deprecatedThisRegex.test(fn.toString())) {\n throw new SyntaxError('Using `this` to self-reference a function ' + 'is deprecated since typed-function@3. ' + 'Use typed.referTo and typed.referToSelf instead.');\n }\n });\n }\n\n /**\n * Create a typed function\n * @param {String} name The name for the typed function\n * @param {Object.} rawSignaturesMap\n * An object with one or\n * multiple signatures as key, and the\n * function corresponding to the\n * signature as value.\n * @return {function} Returns the created typed function.\n */\n function createTypedFunction(name, rawSignaturesMap) {\n typed.createCount++;\n if (Object.keys(rawSignaturesMap).length === 0) {\n throw new SyntaxError('No signatures provided');\n }\n if (typed.warnAgainstDeprecatedThis) {\n validateDeprecatedThis(rawSignaturesMap);\n }\n\n // Main processing loop for signatures\n const parsedParams = [];\n const originalFunctions = [];\n const signaturesMap = {};\n const preliminarySignatures = []; // may have duplicates from conversions\n let signature;\n for (signature in rawSignaturesMap) {\n // A) Protect against polluted Object prototype:\n if (!Object.prototype.hasOwnProperty.call(rawSignaturesMap, signature)) {\n continue;\n }\n // B) Parse the signature\n const params = parseSignature(signature);\n if (!params) continue;\n // C) Check for conflicts\n parsedParams.forEach(function (pp) {\n if (conflicting(pp, params)) {\n throw new TypeError('Conflicting signatures \"' + stringifyParams(pp) + '\" and \"' + stringifyParams(params) + '\".');\n }\n });\n parsedParams.push(params);\n // D) Store the provided function and add conversions\n const functionIndex = originalFunctions.length;\n originalFunctions.push(rawSignaturesMap[signature]);\n const conversionParams = params.map(expandParam);\n // E) Split the signatures and collect them up\n let sp;\n for (sp of splitParams(conversionParams)) {\n const spName = stringifyParams(sp);\n preliminarySignatures.push({\n params: sp,\n name: spName,\n fn: functionIndex\n });\n if (sp.every(p => !p.hasConversion)) {\n signaturesMap[spName] = functionIndex;\n }\n }\n }\n preliminarySignatures.sort(compareSignatures);\n\n // Note the forward reference to theTypedFn\n const resolvedFunctions = resolveReferences(originalFunctions, signaturesMap, theTypedFn);\n\n // Fill in the proper function for each signature\n let s;\n for (s in signaturesMap) {\n if (Object.prototype.hasOwnProperty.call(signaturesMap, s)) {\n signaturesMap[s] = resolvedFunctions[signaturesMap[s]];\n }\n }\n const signatures = [];\n const internalSignatureMap = new Map(); // benchmarks faster than object\n for (s of preliminarySignatures) {\n // Note it's only safe to eliminate duplicates like this\n // _after_ the signature sorting step above; otherwise we might\n // remove the wrong one.\n if (!internalSignatureMap.has(s.name)) {\n s.fn = resolvedFunctions[s.fn];\n signatures.push(s);\n internalSignatureMap.set(s.name, s);\n }\n }\n\n // we create a highly optimized checks for the first couple of signatures with max 2 arguments\n const ok0 = signatures[0] && signatures[0].params.length <= 2 && !hasRestParam(signatures[0].params);\n const ok1 = signatures[1] && signatures[1].params.length <= 2 && !hasRestParam(signatures[1].params);\n const ok2 = signatures[2] && signatures[2].params.length <= 2 && !hasRestParam(signatures[2].params);\n const ok3 = signatures[3] && signatures[3].params.length <= 2 && !hasRestParam(signatures[3].params);\n const ok4 = signatures[4] && signatures[4].params.length <= 2 && !hasRestParam(signatures[4].params);\n const ok5 = signatures[5] && signatures[5].params.length <= 2 && !hasRestParam(signatures[5].params);\n const allOk = ok0 && ok1 && ok2 && ok3 && ok4 && ok5;\n\n // compile the tests\n for (let i = 0; i < signatures.length; ++i) {\n signatures[i].test = compileTests(signatures[i].params);\n }\n const test00 = ok0 ? compileTest(signatures[0].params[0]) : notOk;\n const test10 = ok1 ? compileTest(signatures[1].params[0]) : notOk;\n const test20 = ok2 ? compileTest(signatures[2].params[0]) : notOk;\n const test30 = ok3 ? compileTest(signatures[3].params[0]) : notOk;\n const test40 = ok4 ? compileTest(signatures[4].params[0]) : notOk;\n const test50 = ok5 ? compileTest(signatures[5].params[0]) : notOk;\n const test01 = ok0 ? compileTest(signatures[0].params[1]) : notOk;\n const test11 = ok1 ? compileTest(signatures[1].params[1]) : notOk;\n const test21 = ok2 ? compileTest(signatures[2].params[1]) : notOk;\n const test31 = ok3 ? compileTest(signatures[3].params[1]) : notOk;\n const test41 = ok4 ? compileTest(signatures[4].params[1]) : notOk;\n const test51 = ok5 ? compileTest(signatures[5].params[1]) : notOk;\n\n // compile the functions\n for (let i = 0; i < signatures.length; ++i) {\n signatures[i].implementation = compileArgsPreprocessing(signatures[i].params, signatures[i].fn);\n }\n const fn0 = ok0 ? signatures[0].implementation : undef;\n const fn1 = ok1 ? signatures[1].implementation : undef;\n const fn2 = ok2 ? signatures[2].implementation : undef;\n const fn3 = ok3 ? signatures[3].implementation : undef;\n const fn4 = ok4 ? signatures[4].implementation : undef;\n const fn5 = ok5 ? signatures[5].implementation : undef;\n const len0 = ok0 ? signatures[0].params.length : -1;\n const len1 = ok1 ? signatures[1].params.length : -1;\n const len2 = ok2 ? signatures[2].params.length : -1;\n const len3 = ok3 ? signatures[3].params.length : -1;\n const len4 = ok4 ? signatures[4].params.length : -1;\n const len5 = ok5 ? signatures[5].params.length : -1;\n\n // simple and generic, but also slow\n const iStart = allOk ? 6 : 0;\n const iEnd = signatures.length;\n // de-reference ahead for execution speed:\n const tests = signatures.map(s => s.test);\n const fns = signatures.map(s => s.implementation);\n const generic = function generic() {\n 'use strict';\n\n for (let i = iStart; i < iEnd; i++) {\n if (tests[i](arguments)) {\n return fns[i].apply(this, arguments);\n }\n }\n return typed.onMismatch(name, arguments, signatures);\n };\n\n // create the typed function\n // fast, specialized version. Falls back to the slower, generic one if needed\n function theTypedFn(arg0, arg1) {\n 'use strict';\n\n if (arguments.length === len0 && test00(arg0) && test01(arg1)) {\n return fn0.apply(this, arguments);\n }\n if (arguments.length === len1 && test10(arg0) && test11(arg1)) {\n return fn1.apply(this, arguments);\n }\n if (arguments.length === len2 && test20(arg0) && test21(arg1)) {\n return fn2.apply(this, arguments);\n }\n if (arguments.length === len3 && test30(arg0) && test31(arg1)) {\n return fn3.apply(this, arguments);\n }\n if (arguments.length === len4 && test40(arg0) && test41(arg1)) {\n return fn4.apply(this, arguments);\n }\n if (arguments.length === len5 && test50(arg0) && test51(arg1)) {\n return fn5.apply(this, arguments);\n }\n return generic.apply(this, arguments);\n }\n\n // attach name the typed function\n try {\n Object.defineProperty(theTypedFn, 'name', {\n value: name\n });\n } catch (err) {\n // old browsers do not support Object.defineProperty and some don't support setting the name property\n // the function name is not essential for the functioning, it's mostly useful for debugging,\n // so it's fine to have unnamed functions.\n }\n\n // attach signatures to the function.\n // This property is close to the original collection of signatures\n // used to create the typed-function, just with unions split:\n theTypedFn.signatures = signaturesMap;\n\n // Store internal data for functions like resolve, find, etc.\n // Also serves as the flag that this is a typed-function\n theTypedFn._typedFunctionData = {\n signatures,\n signatureMap: internalSignatureMap\n };\n return theTypedFn;\n }\n\n /**\n * Action to take on mismatch\n * @param {string} name Name of function that was attempted to be called\n * @param {Array} args Actual arguments to the call\n * @param {Array} signatures Known signatures of the named typed-function\n */\n function _onMismatch(name, args, signatures) {\n throw createError(name, args, signatures);\n }\n\n /**\n * Return all but the last items of an array or function Arguments\n * @param {Array | Arguments} arr\n * @return {Array}\n */\n function initial(arr) {\n return slice(arr, 0, arr.length - 1);\n }\n\n /**\n * return the last item of an array or function Arguments\n * @param {Array | Arguments} arr\n * @return {*}\n */\n function last(arr) {\n return arr[arr.length - 1];\n }\n\n /**\n * Slice an array or function Arguments\n * @param {Array | Arguments | IArguments} arr\n * @param {number} start\n * @param {number} [end]\n * @return {Array}\n */\n function slice(arr, start, end) {\n return Array.prototype.slice.call(arr, start, end);\n }\n\n /**\n * Return the first item from an array for which test(arr[i]) returns true\n * @param {Array} arr\n * @param {function} test\n * @return {* | undefined} Returns the first matching item\n * or undefined when there is no match\n */\n function findInArray(arr, test) {\n for (let i = 0; i < arr.length; i++) {\n if (test(arr[i])) {\n return arr[i];\n }\n }\n return undefined;\n }\n\n /**\n * Flat map the result invoking a callback for every item in an array.\n * https://gist.github.com/samgiles/762ee337dff48623e729\n * @param {Array} arr\n * @param {function} callback\n * @return {Array}\n */\n function flatMap(arr, callback) {\n return Array.prototype.concat.apply([], arr.map(callback));\n }\n\n /**\n * Create a reference callback to one or multiple signatures\n *\n * Syntax:\n *\n * typed.referTo(signature1, signature2, ..., function callback(fn1, fn2, ...) {\n * // ...\n * })\n *\n * @returns {{referTo: {references: string[], callback}}}\n */\n function referTo() {\n const references = initial(arguments).map(s => stringifyParams(parseSignature(s)));\n const callback = last(arguments);\n if (typeof callback !== 'function') {\n throw new TypeError('Callback function expected as last argument');\n }\n return makeReferTo(references, callback);\n }\n function makeReferTo(references, callback) {\n return {\n referTo: {\n references,\n callback\n }\n };\n }\n\n /**\n * Create a reference callback to the typed-function itself\n *\n * @param {(self: function) => function} callback\n * @returns {{referToSelf: { callback: function }}}\n */\n function referToSelf(callback) {\n if (typeof callback !== 'function') {\n throw new TypeError('Callback function expected as first argument');\n }\n return {\n referToSelf: {\n callback\n }\n };\n }\n\n /**\n * Test whether something is a referTo object, holding a list with reference\n * signatures and a callback.\n *\n * @param {Object | function} objectOrFn\n * @returns {boolean}\n */\n function isReferTo(objectOrFn) {\n return objectOrFn && typeof objectOrFn.referTo === 'object' && Array.isArray(objectOrFn.referTo.references) && typeof objectOrFn.referTo.callback === 'function';\n }\n\n /**\n * Test whether something is a referToSelf object, holding a callback where\n * to pass `self`.\n *\n * @param {Object | function} objectOrFn\n * @returns {boolean}\n */\n function isReferToSelf(objectOrFn) {\n return objectOrFn && typeof objectOrFn.referToSelf === 'object' && typeof objectOrFn.referToSelf.callback === 'function';\n }\n\n /**\n * Check if name is (A) new, (B) a match, or (C) a mismatch; and throw\n * an error in case (C).\n *\n * @param { string | undefined } nameSoFar\n * @param { string | undefined } newName\n * @returns { string } updated name\n */\n function checkName(nameSoFar, newName) {\n if (!nameSoFar) {\n return newName;\n }\n if (newName && newName !== nameSoFar) {\n const err = new Error('Function names do not match (expected: ' + nameSoFar + ', actual: ' + newName + ')');\n err.data = {\n actual: newName,\n expected: nameSoFar\n };\n throw err;\n }\n return nameSoFar;\n }\n\n /**\n * Retrieve the implied name from an object with signature keys\n * and function values, checking whether all value names match\n *\n * @param { {string: function} } obj\n */\n function getObjectName(obj) {\n let name;\n for (const key in obj) {\n // Only pay attention to own properties, and only if their values\n // are typed functions or functions with a signature property\n if (Object.prototype.hasOwnProperty.call(obj, key) && (isTypedFunction(obj[key]) || typeof obj[key].signature === 'string')) {\n name = checkName(name, obj[key].name);\n }\n }\n return name;\n }\n\n /**\n * Copy all of the signatures from the second argument into the first,\n * which is modified by side effect, checking for conflicts\n *\n * @param {Object.} dest\n * @param {Object.} source\n */\n function mergeSignatures(dest, source) {\n let key;\n for (key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n if (key in dest) {\n if (source[key] !== dest[key]) {\n const err = new Error('Signature \"' + key + '\" is defined twice');\n err.data = {\n signature: key,\n sourceFunction: source[key],\n destFunction: dest[key]\n };\n throw err;\n }\n // else: both signatures point to the same function, that's fine\n }\n dest[key] = source[key];\n }\n }\n }\n const saveTyped = typed;\n\n /**\n * Originally the main function was a typed function itself, but then\n * it might not be able to generate error messages if the client\n * replaced the type system with different names.\n *\n * Main entry: typed([name], functions/objects with signatures...)\n *\n * Assembles and returns a new typed-function from the given items\n * that provide signatures and implementations, each of which may be\n * * a plain object mapping (string) signatures to implementing functions,\n * * a previously constructed typed function, or\n * * any other single function with a string-valued property `signature`.\n * The name of the resulting typed-function will be given by the\n * string-valued name argument if present, or if not, by the name\n * of any of the arguments that have one, as long as any that do are\n * consistent with each other. If no name is specified, the name will be\n * an empty string.\n *\n * @param {string} maybeName [optional]\n * @param {(function|object)[]} signature providers\n * @returns {typed-function}\n */\n typed = function (maybeName) {\n const named = typeof maybeName === 'string';\n const start = named ? 1 : 0;\n let name = named ? maybeName : '';\n const allSignatures = {};\n for (let i = start; i < arguments.length; ++i) {\n const item = arguments[i];\n let theseSignatures = {};\n let thisName;\n if (typeof item === 'function') {\n thisName = item.name;\n if (typeof item.signature === 'string') {\n // Case 1: Ordinary function with a string 'signature' property\n theseSignatures[item.signature] = item;\n } else if (isTypedFunction(item)) {\n // Case 2: Existing typed function\n theseSignatures = item.signatures;\n }\n } else if (isPlainObject(item)) {\n // Case 3: Plain object, assume keys = signatures, values = functions\n theseSignatures = item;\n if (!named) {\n thisName = getObjectName(item);\n }\n }\n if (Object.keys(theseSignatures).length === 0) {\n const err = new TypeError('Argument to \\'typed\\' at index ' + i + ' is not a (typed) function, ' + 'nor an object with signatures as keys and functions as values.');\n err.data = {\n index: i,\n argument: item\n };\n throw err;\n }\n if (!named) {\n name = checkName(name, thisName);\n }\n mergeSignatures(allSignatures, theseSignatures);\n }\n return createTypedFunction(name || '', allSignatures);\n };\n typed.create = create;\n typed.createCount = saveTyped.createCount;\n typed.onMismatch = _onMismatch;\n typed.throwMismatchError = _onMismatch;\n typed.createError = createError;\n typed.clear = clear;\n typed.clearConversions = clearConversions;\n typed.addTypes = addTypes;\n typed._findType = findType; // For unit testing only\n typed.referTo = referTo;\n typed.referToSelf = referToSelf;\n typed.convert = convert;\n typed.findSignature = findSignature;\n typed.find = find;\n typed.isTypedFunction = isTypedFunction;\n typed.warnAgainstDeprecatedThis = true;\n\n /**\n * add a type (convenience wrapper for typed.addTypes)\n * @param {{name: string, test: function}} type\n * @param {boolean} [beforeObjectTest=true]\n * If true, the new test will be inserted before\n * the test with name 'Object' (if any), since\n * tests for Object match Array and classes too.\n */\n typed.addType = function (type, beforeObjectTest) {\n let before = 'any';\n if (beforeObjectTest !== false && typeMap.has('Object')) {\n before = 'Object';\n }\n typed.addTypes([type], before);\n };\n\n /**\n * Verify that the ConversionDef conversion has a valid format.\n *\n * @param {conversionDef} conversion\n * @return {void}\n * @throws {TypeError|SyntaxError}\n */\n function _validateConversion(conversion) {\n if (!conversion || typeof conversion.from !== 'string' || typeof conversion.to !== 'string' || typeof conversion.convert !== 'function') {\n throw new TypeError('Object with properties {from: string, to: string, convert: function} expected');\n }\n if (conversion.to === conversion.from) {\n throw new SyntaxError('Illegal to define conversion from \"' + conversion.from + '\" to itself.');\n }\n }\n\n /**\n * Add a conversion\n *\n * @param {ConversionDef} conversion\n * @param {{override: boolean}} [options]\n * @returns {void}\n * @throws {TypeError}\n */\n typed.addConversion = function (conversion) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n override: false\n };\n _validateConversion(conversion);\n const to = findType(conversion.to);\n const existing = to.conversionsTo.find(other => other.from === conversion.from);\n if (existing) {\n if (options && options.override) {\n typed.removeConversion({\n from: existing.from,\n to: conversion.to,\n convert: existing.convert\n });\n } else {\n throw new Error('There is already a conversion from \"' + conversion.from + '\" to \"' + to.name + '\"');\n }\n }\n to.conversionsTo.push({\n from: conversion.from,\n convert: conversion.convert,\n index: nConversions++\n });\n };\n\n /**\n * Convenience wrapper to call addConversion on each conversion in a list.\n *\n * @param {ConversionDef[]} conversions\n * @param {{override: boolean}} [options]\n * @returns {void}\n * @throws {TypeError}\n */\n typed.addConversions = function (conversions, options) {\n conversions.forEach(conversion => typed.addConversion(conversion, options));\n };\n\n /**\n * Remove the specified conversion. The format is the same as for\n * addConversion, and the convert function must match or an error\n * is thrown.\n *\n * @param {{from: string, to: string, convert: function}} conversion\n * @returns {void}\n * @throws {TypeError|SyntaxError|Error}\n */\n typed.removeConversion = function (conversion) {\n _validateConversion(conversion);\n const to = findType(conversion.to);\n const existingConversion = findInArray(to.conversionsTo, c => c.from === conversion.from);\n if (!existingConversion) {\n throw new Error('Attempt to remove nonexistent conversion from ' + conversion.from + ' to ' + conversion.to);\n }\n if (existingConversion.convert !== conversion.convert) {\n throw new Error('Conversion to remove does not match existing conversion');\n }\n const index = to.conversionsTo.indexOf(existingConversion);\n to.conversionsTo.splice(index, 1);\n };\n\n /**\n * Produce the specific signature that a typed function\n * will execute on the given arguments. Here, a \"signature\" is an\n * object with properties 'params', 'test', 'fn', and 'implementation'.\n * This last property is a function that converts params as necessary\n * and then calls 'fn'. Returns null if there is no matching signature.\n * @param {typed-function} tf\n * @param {any[]} argList\n * @returns {{params: string, test: function, fn: function, implementation: function}}\n */\n typed.resolve = function (tf, argList) {\n if (!isTypedFunction(tf)) {\n throw new TypeError(NOT_TYPED_FUNCTION);\n }\n const sigs = tf._typedFunctionData.signatures;\n for (let i = 0; i < sigs.length; ++i) {\n if (sigs[i].test(argList)) {\n return sigs[i];\n }\n }\n return null;\n };\n return typed;\n}\nexport default create();\n//# sourceMappingURL=typed-function.mjs.map","import { pickShallow } from './object.js';\n\n/**\n * Create a factory function, which can be used to inject dependencies.\n *\n * The created functions are memoized, a consecutive call of the factory\n * with the exact same inputs will return the same function instance.\n * The memoized cache is exposed on `factory.cache` and can be cleared\n * if needed.\n *\n * Example:\n *\n * const name = 'log'\n * const dependencies = ['config', 'typed', 'divideScalar', 'Complex']\n *\n * export const createLog = factory(name, dependencies, ({ typed, config, divideScalar, Complex }) => {\n * // ... create the function log here and return it\n * }\n *\n * @param {string} name Name of the function to be created\n * @param {string[]} dependencies The names of all required dependencies\n * @param {function} create Callback function called with an object with all dependencies\n * @param {Object} [meta]\n * Optional object with meta information that will be attached\n * to the created factory function as property `meta`. For explanation\n * of what meta properties can be specified and what they mean, see\n * docs/core/extension.md.\n * @returns {function}\n */\nexport function factory(name, dependencies, create, meta) {\n function assertAndCreate(scope) {\n // we only pass the requested dependencies to the factory function\n // to prevent functions to rely on dependencies that are not explicitly\n // requested.\n var deps = pickShallow(scope, dependencies.map(stripOptionalNotation));\n assertDependencies(name, dependencies, scope);\n return create(deps);\n }\n assertAndCreate.isFactory = true;\n assertAndCreate.fn = name;\n assertAndCreate.dependencies = dependencies.slice().sort();\n if (meta) {\n assertAndCreate.meta = meta;\n }\n return assertAndCreate;\n}\n\n/**\n * Sort all factories such that when loading in order, the dependencies are resolved.\n *\n * @param {Array} factories\n * @returns {Array} Returns a new array with the sorted factories.\n */\nexport function sortFactories(factories) {\n var factoriesByName = {};\n factories.forEach(factory => {\n factoriesByName[factory.fn] = factory;\n });\n function containsDependency(factory, dependency) {\n // TODO: detect circular references\n if (isFactory(factory)) {\n if (factory.dependencies.includes(dependency.fn || dependency.name)) {\n return true;\n }\n if (factory.dependencies.some(d => containsDependency(factoriesByName[d], dependency))) {\n return true;\n }\n }\n return false;\n }\n var sorted = [];\n function addFactory(factory) {\n var index = 0;\n while (index < sorted.length && !containsDependency(sorted[index], factory)) {\n index++;\n }\n sorted.splice(index, 0, factory);\n }\n\n // sort regular factory functions\n factories.filter(isFactory).forEach(addFactory);\n\n // sort legacy factory functions AFTER the regular factory functions\n factories.filter(factory => !isFactory(factory)).forEach(addFactory);\n return sorted;\n}\n\n// TODO: comment or cleanup if unused in the end\nexport function create(factories) {\n var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n sortFactories(factories).forEach(factory => factory(scope));\n return scope;\n}\n\n/**\n * Test whether an object is a factory. This is the case when it has\n * properties name, dependencies, and a function create.\n * @param {*} obj\n * @returns {boolean}\n */\nexport function isFactory(obj) {\n return typeof obj === 'function' && typeof obj.fn === 'string' && Array.isArray(obj.dependencies);\n}\n\n/**\n * Assert that all dependencies of a list with dependencies are available in the provided scope.\n *\n * Will throw an exception when there are dependencies missing.\n *\n * @param {string} name Name for the function to be created. Used to generate a useful error message\n * @param {string[]} dependencies\n * @param {Object} scope\n */\nexport function assertDependencies(name, dependencies, scope) {\n var allDefined = dependencies.filter(dependency => !isOptionalDependency(dependency)) // filter optionals\n .every(dependency => scope[dependency] !== undefined);\n if (!allDefined) {\n var missingDependencies = dependencies.filter(dependency => scope[dependency] === undefined);\n\n // TODO: create a custom error class for this, a MathjsError or something like that\n throw new Error(\"Cannot create function \\\"\".concat(name, \"\\\", \") + \"some dependencies are missing: \".concat(missingDependencies.map(d => \"\\\"\".concat(d, \"\\\"\")).join(', '), \".\"));\n }\n}\nexport function isOptionalDependency(dependency) {\n return dependency && dependency[0] === '?';\n}\nexport function stripOptionalNotation(dependency) {\n return dependency && dependency[0] === '?' ? dependency.slice(1) : dependency;\n}","import { isBigNumber, isNumber, isObject } from './is.js';\n\n/**\n * @typedef {{sign: '+' | '-' | '', coefficients: number[], exponent: number}} SplitValue\n */\n\n/**\n * Check if a number is integer\n * @param {number | boolean} value\n * @return {boolean} isInteger\n */\nexport function isInteger(value) {\n if (typeof value === 'boolean') {\n return true;\n }\n return isFinite(value) ? value === Math.round(value) : false;\n}\n\n/**\n * Ensure the number type is compatible with the provided value.\n * If not, return 'number' instead.\n *\n * For example:\n *\n * safeNumberType('2.3', { number: 'bigint', numberFallback: 'number' })\n *\n * will return 'number' and not 'bigint' because trying to create a bigint with\n * value 2.3 would throw an exception.\n *\n * @param {string} numberStr\n * @param {{\n * number: 'number' | 'BigNumber' | 'bigint' | 'Fraction'\n * numberFallback: 'number' | 'BigNumber'\n * }} config\n * @returns {'number' | 'BigNumber' | 'bigint' | 'Fraction'}\n */\nexport function safeNumberType(numberStr, config) {\n if (config.number === 'bigint') {\n try {\n BigInt(numberStr);\n } catch (_unused) {\n return config.numberFallback;\n }\n }\n return config.number;\n}\n\n/**\n * Calculate the sign of a number\n * @param {number} x\n * @returns {number}\n */\nexport var sign = Math.sign || function (x) {\n if (x > 0) {\n return 1;\n } else if (x < 0) {\n return -1;\n } else {\n return 0;\n }\n};\n\n/**\n * Calculate the base-2 logarithm of a number\n * @param {number} x\n * @returns {number}\n */\nexport var log2 = Math.log2 || function log2(x) {\n return Math.log(x) / Math.LN2;\n};\n\n/**\n * Calculate the base-10 logarithm of a number\n * @param {number} x\n * @returns {number}\n */\nexport var log10 = Math.log10 || function log10(x) {\n return Math.log(x) / Math.LN10;\n};\n\n/**\n * Calculate the natural logarithm of a number + 1\n * @param {number} x\n * @returns {number}\n */\nexport var log1p = Math.log1p || function (x) {\n return Math.log(x + 1);\n};\n\n/**\n * Calculate cubic root for a number\n *\n * Code from es6-shim.js:\n * https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L1564-L1577\n *\n * @param {number} x\n * @returns {number} Returns the cubic root of x\n */\nexport var cbrt = Math.cbrt || function cbrt(x) {\n if (x === 0) {\n return x;\n }\n var negate = x < 0;\n var result;\n if (negate) {\n x = -x;\n }\n if (isFinite(x)) {\n result = Math.exp(Math.log(x) / 3);\n // from https://en.wikipedia.org/wiki/Cube_root#Numerical_methods\n result = (x / (result * result) + 2 * result) / 3;\n } else {\n result = x;\n }\n return negate ? -result : result;\n};\n\n/**\n * Calculates exponentiation minus 1\n * @param {number} x\n * @return {number} res\n */\nexport var expm1 = Math.expm1 || function expm1(x) {\n return x >= 2e-4 || x <= -2e-4 ? Math.exp(x) - 1 : x + x * x / 2 + x * x * x / 6;\n};\n\n/**\n * Formats a number in a given base\n * @param {number} n\n * @param {number} base\n * @param {number} size\n * @returns {string}\n */\nfunction formatNumberToBase(n, base, size) {\n var prefixes = {\n 2: '0b',\n 8: '0o',\n 16: '0x'\n };\n var prefix = prefixes[base];\n var suffix = '';\n if (size) {\n if (size < 1) {\n throw new Error('size must be in greater than 0');\n }\n if (!isInteger(size)) {\n throw new Error('size must be an integer');\n }\n if (n > 2 ** (size - 1) - 1 || n < -(2 ** (size - 1))) {\n throw new Error(\"Value must be in range [-2^\".concat(size - 1, \", 2^\").concat(size - 1, \"-1]\"));\n }\n if (!isInteger(n)) {\n throw new Error('Value must be an integer');\n }\n if (n < 0) {\n n = n + 2 ** size;\n }\n suffix = \"i\".concat(size);\n }\n var sign = '';\n if (n < 0) {\n n = -n;\n sign = '-';\n }\n return \"\".concat(sign).concat(prefix).concat(n.toString(base)).concat(suffix);\n}\n\n/**\n * Convert a number to a formatted string representation.\n *\n * Syntax:\n *\n * format(value)\n * format(value, options)\n * format(value, precision)\n * format(value, fn)\n *\n * Where:\n *\n * {number} value The value to be formatted\n * {Object} options An object with formatting options. Available options:\n * {string} notation\n * Number notation. Choose from:\n * 'fixed' Always use regular number notation.\n * For example '123.40' and '14000000'\n * 'exponential' Always use exponential notation.\n * For example '1.234e+2' and '1.4e+7'\n * 'engineering' Always use engineering notation.\n * For example '123.4e+0' and '14.0e+6'\n * 'auto' (default) Regular number notation for numbers\n * having an absolute value between\n * `lowerExp` and `upperExp` bounds, and\n * uses exponential notation elsewhere.\n * Lower bound is included, upper bound\n * is excluded.\n * For example '123.4' and '1.4e7'.\n * 'bin', 'oct, or\n * 'hex' Format the number using binary, octal,\n * or hexadecimal notation.\n * For example '0b1101' and '0x10fe'.\n * {number} wordSize The word size in bits to use for formatting\n * in binary, octal, or hexadecimal notation.\n * To be used only with 'bin', 'oct', or 'hex'\n * values for 'notation' option. When this option\n * is defined the value is formatted as a signed\n * twos complement integer of the given word size\n * and the size suffix is appended to the output.\n * For example\n * format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'.\n * Default value is undefined.\n * {number} precision A number between 0 and 16 to round\n * the digits of the number.\n * In case of notations 'exponential',\n * 'engineering', and 'auto',\n * `precision` defines the total\n * number of significant digits returned.\n * In case of notation 'fixed',\n * `precision` defines the number of\n * significant digits after the decimal\n * point.\n * `precision` is undefined by default,\n * not rounding any digits.\n * {number} lowerExp Exponent determining the lower boundary\n * for formatting a value with an exponent\n * when `notation='auto`.\n * Default value is `-3`.\n * {number} upperExp Exponent determining the upper boundary\n * for formatting a value with an exponent\n * when `notation='auto`.\n * Default value is `5`.\n * {Function} fn A custom formatting function. Can be used to override the\n * built-in notations. Function `fn` is called with `value` as\n * parameter and must return a string. Is useful for example to\n * format all values inside a matrix in a particular way.\n *\n * Examples:\n *\n * format(6.4) // '6.4'\n * format(1240000) // '1.24e6'\n * format(1/3) // '0.3333333333333333'\n * format(1/3, 3) // '0.333'\n * format(21385, 2) // '21000'\n * format(12.071, {notation: 'fixed'}) // '12'\n * format(2.3, {notation: 'fixed', precision: 2}) // '2.30'\n * format(52.8, {notation: 'exponential'}) // '5.28e+1'\n * format(12345678, {notation: 'engineering'}) // '12.345678e+6'\n *\n * @param {number} value\n * @param {Object | Function | number} [options]\n * @return {string} str The formatted value\n */\nexport function format(value, options) {\n if (typeof options === 'function') {\n // handle format(value, fn)\n return options(value);\n }\n\n // handle special cases\n if (value === Infinity) {\n return 'Infinity';\n } else if (value === -Infinity) {\n return '-Infinity';\n } else if (isNaN(value)) {\n return 'NaN';\n }\n var {\n notation,\n precision,\n wordSize\n } = normalizeFormatOptions(options);\n\n // handle the various notations\n switch (notation) {\n case 'fixed':\n return toFixed(value, precision);\n case 'exponential':\n return toExponential(value, precision);\n case 'engineering':\n return toEngineering(value, precision);\n case 'bin':\n return formatNumberToBase(value, 2, wordSize);\n case 'oct':\n return formatNumberToBase(value, 8, wordSize);\n case 'hex':\n return formatNumberToBase(value, 16, wordSize);\n case 'auto':\n // remove trailing zeros after the decimal point\n return toPrecision(value, precision, options).replace(/((\\.\\d*?)(0+))($|e)/, function () {\n var digits = arguments[2];\n var e = arguments[4];\n return digits !== '.' ? digits + e : e;\n });\n default:\n throw new Error('Unknown notation \"' + notation + '\". ' + 'Choose \"auto\", \"exponential\", \"fixed\", \"bin\", \"oct\", or \"hex.');\n }\n}\n\n/**\n * Normalize format options into an object:\n * {\n * notation: string,\n * precision: number | undefined,\n * wordSize: number | undefined\n * }\n */\nexport function normalizeFormatOptions(options) {\n // default values for options\n var notation = 'auto';\n var precision;\n var wordSize;\n if (options !== undefined) {\n if (isNumber(options)) {\n precision = options;\n } else if (isBigNumber(options)) {\n precision = options.toNumber();\n } else if (isObject(options)) {\n if (options.precision !== undefined) {\n precision = _toNumberOrThrow(options.precision, () => {\n throw new Error('Option \"precision\" must be a number or BigNumber');\n });\n }\n if (options.wordSize !== undefined) {\n wordSize = _toNumberOrThrow(options.wordSize, () => {\n throw new Error('Option \"wordSize\" must be a number or BigNumber');\n });\n }\n if (options.notation) {\n notation = options.notation;\n }\n } else {\n throw new Error('Unsupported type of options, number, BigNumber, or object expected');\n }\n }\n return {\n notation,\n precision,\n wordSize\n };\n}\n\n/**\n * Split a number into sign, coefficients, and exponent\n * @param {number | string} value\n * @return {SplitValue}\n * Returns an object containing sign, coefficients, and exponent\n */\nexport function splitNumber(value) {\n // parse the input value\n var match = String(value).toLowerCase().match(/^(-?)(\\d+\\.?\\d*)(e([+-]?\\d+))?$/);\n if (!match) {\n throw new SyntaxError('Invalid number ' + value);\n }\n var sign = match[1];\n var digits = match[2];\n var exponent = parseFloat(match[4] || '0');\n var dot = digits.indexOf('.');\n exponent += dot !== -1 ? dot - 1 : digits.length - 1;\n var coefficients = digits.replace('.', '') // remove the dot (must be removed before removing leading zeros)\n .replace(/^0*/, function (zeros) {\n // remove leading zeros, add their count to the exponent\n exponent -= zeros.length;\n return '';\n }).replace(/0*$/, '') // remove trailing zeros\n .split('').map(function (d) {\n return parseInt(d);\n });\n if (coefficients.length === 0) {\n coefficients.push(0);\n exponent++;\n }\n return {\n sign,\n coefficients,\n exponent\n };\n}\n\n/**\n * Format a number in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3'\n * @param {number | string} value\n * @param {number} [precision] Optional number of significant figures to return.\n */\nexport function toEngineering(value, precision) {\n if (isNaN(value) || !isFinite(value)) {\n return String(value);\n }\n var split = splitNumber(value);\n var rounded = roundDigits(split, precision);\n var e = rounded.exponent;\n var c = rounded.coefficients;\n\n // find nearest lower multiple of 3 for exponent\n var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3;\n if (isNumber(precision)) {\n // add zeroes to give correct sig figs\n while (precision > c.length || e - newExp + 1 > c.length) {\n c.push(0);\n }\n } else {\n // concatenate coefficients with necessary zeros\n // add zeros if necessary (for example: 1e+8 -> 100e+6)\n var missingZeros = Math.abs(e - newExp) - (c.length - 1);\n for (var i = 0; i < missingZeros; i++) {\n c.push(0);\n }\n }\n\n // find difference in exponents\n var expDiff = Math.abs(e - newExp);\n var decimalIdx = 1;\n\n // push decimal index over by expDiff times\n while (expDiff > 0) {\n decimalIdx++;\n expDiff--;\n }\n\n // if all coefficient values are zero after the decimal point and precision is unset, don't add a decimal value.\n // otherwise concat with the rest of the coefficients\n var decimals = c.slice(decimalIdx).join('');\n var decimalVal = isNumber(precision) && decimals.length || decimals.match(/[1-9]/) ? '.' + decimals : '';\n var str = c.slice(0, decimalIdx).join('') + decimalVal + 'e' + (e >= 0 ? '+' : '') + newExp.toString();\n return rounded.sign + str;\n}\n\n/**\n * Format a number with fixed notation.\n * @param {number | string} value\n * @param {number} [precision=undefined] Optional number of decimals after the\n * decimal point. null by default.\n */\nexport function toFixed(value, precision) {\n if (isNaN(value) || !isFinite(value)) {\n return String(value);\n }\n var splitValue = splitNumber(value);\n var rounded = typeof precision === 'number' ? roundDigits(splitValue, splitValue.exponent + 1 + precision) : splitValue;\n var c = rounded.coefficients;\n var p = rounded.exponent + 1; // exponent may have changed\n\n // append zeros if needed\n var pp = p + (precision || 0);\n if (c.length < pp) {\n c = c.concat(zeros(pp - c.length));\n }\n\n // prepend zeros if needed\n if (p < 0) {\n c = zeros(-p + 1).concat(c);\n p = 1;\n }\n\n // insert a dot if needed\n if (p < c.length) {\n c.splice(p, 0, p === 0 ? '0.' : '.');\n }\n return rounded.sign + c.join('');\n}\n\n/**\n * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'\n * @param {number | string} value\n * @param {number} [precision] Number of digits in formatted output.\n * If not provided, the maximum available digits\n * is used.\n */\nexport function toExponential(value, precision) {\n if (isNaN(value) || !isFinite(value)) {\n return String(value);\n }\n\n // round if needed, else create a clone\n var split = splitNumber(value);\n var rounded = precision ? roundDigits(split, precision) : split;\n var c = rounded.coefficients;\n var e = rounded.exponent;\n\n // append zeros if needed\n if (c.length < precision) {\n c = c.concat(zeros(precision - c.length));\n }\n\n // format as `C.CCCe+EEE` or `C.CCCe-EEE`\n var first = c.shift();\n return rounded.sign + first + (c.length > 0 ? '.' + c.join('') : '') + 'e' + (e >= 0 ? '+' : '') + e;\n}\n\n/**\n * Format a number with a certain precision\n * @param {number | string} value\n * @param {number} [precision=undefined] Optional number of digits.\n * @param {{lowerExp: number | undefined, upperExp: number | undefined}} [options]\n * By default:\n * lowerExp = -3 (incl)\n * upper = +5 (excl)\n * @return {string}\n */\nexport function toPrecision(value, precision, options) {\n if (isNaN(value) || !isFinite(value)) {\n return String(value);\n }\n\n // determine lower and upper bound for exponential notation.\n var lowerExp = _toNumberOrDefault(options === null || options === void 0 ? void 0 : options.lowerExp, -3);\n var upperExp = _toNumberOrDefault(options === null || options === void 0 ? void 0 : options.upperExp, 5);\n var split = splitNumber(value);\n var rounded = precision ? roundDigits(split, precision) : split;\n if (rounded.exponent < lowerExp || rounded.exponent >= upperExp) {\n // exponential notation\n return toExponential(value, precision);\n } else {\n var c = rounded.coefficients;\n var e = rounded.exponent;\n\n // append trailing zeros\n if (c.length < precision) {\n c = c.concat(zeros(precision - c.length));\n }\n\n // append trailing zeros\n // TODO: simplify the next statement\n c = c.concat(zeros(e - c.length + 1 + (c.length < precision ? precision - c.length : 0)));\n\n // prepend zeros\n c = zeros(-e).concat(c);\n var dot = e > 0 ? e : 0;\n if (dot < c.length - 1) {\n c.splice(dot + 1, 0, '.');\n }\n return rounded.sign + c.join('');\n }\n}\n\n/**\n * Round the number of digits of a number *\n * @param {SplitValue} split A value split with .splitNumber(value)\n * @param {number} precision A positive integer\n * @return {SplitValue}\n * Returns an object containing sign, coefficients, and exponent\n * with rounded digits\n */\nexport function roundDigits(split, precision) {\n // create a clone\n var rounded = {\n sign: split.sign,\n coefficients: split.coefficients,\n exponent: split.exponent\n };\n var c = rounded.coefficients;\n\n // prepend zeros if needed\n while (precision <= 0) {\n c.unshift(0);\n rounded.exponent++;\n precision++;\n }\n if (c.length > precision) {\n var removed = c.splice(precision, c.length - precision);\n if (removed[0] >= 5) {\n var i = precision - 1;\n c[i]++;\n while (c[i] === 10) {\n c.pop();\n if (i === 0) {\n c.unshift(0);\n rounded.exponent++;\n i++;\n }\n i--;\n c[i]++;\n }\n }\n }\n return rounded;\n}\n\n/**\n * Create an array filled with zeros.\n * @param {number} length\n * @return {Array}\n */\nfunction zeros(length) {\n var arr = [];\n for (var i = 0; i < length; i++) {\n arr.push(0);\n }\n return arr;\n}\n\n/**\n * Count the number of significant digits of a number.\n *\n * For example:\n * 2.34 returns 3\n * 0.0034 returns 2\n * 120.5e+30 returns 4\n *\n * @param {number} value\n * @return {number} digits Number of significant digits\n */\nexport function digits(value) {\n return value.toExponential().replace(/e.*$/, '') // remove exponential notation\n .replace(/^0\\.?0*|\\./, '') // remove decimal point and leading zeros\n .length;\n}\n\n/**\n * Compares two floating point numbers.\n * @param {number} a - First value to compare\n * @param {number} b - Second value to compare\n * @param {number} [relTol=1e-09] - The relative tolerance, indicating the maximum allowed difference relative to the larger absolute value. Must be greater than 0.\n * @param {number} [absTol=1e-12] - The minimum absolute tolerance, useful for comparisons near zero. Must be at least 0.\n * @return {boolean} whether the two numbers are nearly equal\n *\n * @throws {Error} If `relTol` is less than or equal to 0.\n * @throws {Error} If `absTol` is less than 0.\n *\n * @example\n * nearlyEqual(1.000000001, 1.0, 1e-8); // true\n * nearlyEqual(1.000000002, 1.0, 0); // false\n * nearlyEqual(1.0, 1.009, undefined, 0.01); // true\n * nearlyEqual(0.000000001, 0.0, undefined, 1e-8); // true\n */\nexport function nearlyEqual(a, b) {\n var relTol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1e-8;\n var absTol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n if (relTol <= 0) {\n throw new Error('Relative tolerance must be greater than 0');\n }\n if (absTol < 0) {\n throw new Error('Absolute tolerance must be at least 0');\n }\n\n // NaN\n if (isNaN(a) || isNaN(b)) {\n return false;\n }\n if (!isFinite(a) || !isFinite(b)) {\n return a === b;\n }\n if (a === b) {\n return true;\n }\n\n // abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)\n return Math.abs(a - b) <= Math.max(relTol * Math.max(Math.abs(a), Math.abs(b)), absTol);\n}\n\n/**\n * Calculate the hyperbolic arccos of a number\n * @param {number} x\n * @return {number}\n */\nexport var acosh = Math.acosh || function (x) {\n return Math.log(Math.sqrt(x * x - 1) + x);\n};\nexport var asinh = Math.asinh || function (x) {\n return Math.log(Math.sqrt(x * x + 1) + x);\n};\n\n/**\n * Calculate the hyperbolic arctangent of a number\n * @param {number} x\n * @return {number}\n */\nexport var atanh = Math.atanh || function (x) {\n return Math.log((1 + x) / (1 - x)) / 2;\n};\n\n/**\n * Calculate the hyperbolic cosine of a number\n * @param {number} x\n * @returns {number}\n */\nexport var cosh = Math.cosh || function (x) {\n return (Math.exp(x) + Math.exp(-x)) / 2;\n};\n\n/**\n * Calculate the hyperbolic sine of a number\n * @param {number} x\n * @returns {number}\n */\nexport var sinh = Math.sinh || function (x) {\n return (Math.exp(x) - Math.exp(-x)) / 2;\n};\n\n/**\n * Calculate the hyperbolic tangent of a number\n * @param {number} x\n * @returns {number}\n */\nexport var tanh = Math.tanh || function (x) {\n var e = Math.exp(2 * x);\n return (e - 1) / (e + 1);\n};\n\n/**\n * Returns a value with the magnitude of x and the sign of y.\n * @param {number} x\n * @param {number} y\n * @returns {number}\n */\nexport function copysign(x, y) {\n var signx = x > 0 ? true : x < 0 ? false : 1 / x === Infinity;\n var signy = y > 0 ? true : y < 0 ? false : 1 / y === Infinity;\n return signx ^ signy ? -x : x;\n}\nfunction _toNumberOrThrow(value, onError) {\n if (isNumber(value)) {\n return value;\n } else if (isBigNumber(value)) {\n return value.toNumber();\n } else {\n onError();\n }\n}\nfunction _toNumberOrDefault(value, defaultValue) {\n if (isNumber(value)) {\n return value;\n } else if (isBigNumber(value)) {\n return value.toNumber();\n } else {\n return defaultValue;\n }\n}","/**\n * Create a typed-function which checks the types of the arguments and\n * can match them against multiple provided signatures. The typed-function\n * automatically converts inputs in order to find a matching signature.\n * Typed functions throw informative errors in case of wrong input arguments.\n *\n * See the library [typed-function](https://github.com/josdejong/typed-function)\n * for detailed documentation.\n *\n * Syntax:\n *\n * math.typed(name, signatures) : function\n * math.typed(signatures) : function\n *\n * Examples:\n *\n * // create a typed function with multiple types per argument (type union)\n * const fn2 = typed({\n * 'number | boolean': function (b) {\n * return 'b is a number or boolean'\n * },\n * 'string, number | boolean': function (a, b) {\n * return 'a is a string, b is a number or boolean'\n * }\n * })\n *\n * // create a typed function with an any type argument\n * const log = typed({\n * 'string, any': function (event, data) {\n * console.log('event: ' + event + ', data: ' + JSON.stringify(data))\n * }\n * })\n *\n * @param {string} [name] Optional name for the typed-function\n * @param {Object} signatures Object with one or multiple function signatures\n * @returns {function} The created typed-function.\n */\n\nimport typedFunction from 'typed-function';\nimport { factory } from '../../utils/factory.js';\nimport { isAccessorNode, isArray, isArrayNode, isAssignmentNode, isBigInt, isBigNumber, isBlockNode, isBoolean, isChain, isCollection, isComplex, isConditionalNode, isConstantNode, isDate, isDenseMatrix, isFraction, isFunction, isFunctionAssignmentNode, isFunctionNode, isHelp, isIndex, isIndexNode, isMap, isMatrix, isNode, isNull, isNumber, isObject, isObjectNode, isOperatorNode, isParenthesisNode, isRange, isRangeNode, isRegExp, isRelationalNode, isResultSet, isSparseMatrix, isString, isSymbolNode, isUndefined, isUnit } from '../../utils/is.js';\nimport { digits } from '../../utils/number.js';\n\n// returns a new instance of typed-function\nvar _createTyped2 = function _createTyped() {\n // initially, return the original instance of typed-function\n // consecutively, return a new instance from typed.create.\n _createTyped2 = typedFunction.create;\n return typedFunction;\n};\nvar dependencies = ['?BigNumber', '?Complex', '?DenseMatrix', '?Fraction'];\n\n/**\n * Factory function for creating a new typed instance\n * @param {Object} dependencies Object with data types like Complex and BigNumber\n * @returns {Function}\n */\nexport var createTyped = /* #__PURE__ */factory('typed', dependencies, function createTyped(_ref) {\n var {\n BigNumber,\n Complex,\n DenseMatrix,\n Fraction\n } = _ref;\n // TODO: typed-function must be able to silently ignore signatures with unknown data types\n\n // get a new instance of typed-function\n var typed = _createTyped2();\n\n // define all types. The order of the types determines in which order function\n // arguments are type-checked (so for performance it's important to put the\n // most used types first).\n typed.clear();\n typed.addTypes([{\n name: 'number',\n test: isNumber\n }, {\n name: 'Complex',\n test: isComplex\n }, {\n name: 'BigNumber',\n test: isBigNumber\n }, {\n name: 'bigint',\n test: isBigInt\n }, {\n name: 'Fraction',\n test: isFraction\n }, {\n name: 'Unit',\n test: isUnit\n },\n // The following type matches a valid variable name, i.e., an alphanumeric\n // string starting with an alphabetic character. It is used (at least)\n // in the definition of the derivative() function, as the argument telling\n // what to differentiate over must (currently) be a variable.\n // TODO: deprecate the identifier type (it's not used anymore, see https://github.com/josdejong/mathjs/issues/3253)\n {\n name: 'identifier',\n test: s => isString && /^(?:[A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088E\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\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108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7CD\\uA7D0\\uA7D1\\uA7D3\\uA7D5-\\uA7DC\\uA7F2-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\u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C61\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDEB8\\uDF00-\\uDF1A\\uDF40-\\uDF46]|\\uD806[\\uDC00-\\uDC2B\\uDCA0-\\uDCDF\\uDCFF-\\uDD06\\uDD09\\uDD0C-\\uDD13\\uDD15\\uDD16\\uDD18-\\uDD2F\\uDD3F\\uDD41\\uDDA0-\\uDDA7\\uDDAA-\\uDDD0\\uDDE1\\uDDE3\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE89\\uDE9D\\uDEB0-\\uDEF8\\uDFC0-\\uDFE0]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46\\uDD60-\\uDD65\\uDD67\\uDD68\\uDD6A-\\uDD89\\uDD98\\uDEE0-\\uDEF2\\uDF02\\uDF04-\\uDF10\\uDF12-\\uDF33\\uDFB0]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|\\uD80B[\\uDF90-\\uDFF0]|[\\uD80C\\uD80E\\uD80F\\uD81C-\\uD820\\uD822\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD887][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2F\\uDC41-\\uDC46\\uDC60-\\uDFFF]|\\uD810[\\uDC00-\\uDFFA]|\\uD811[\\uDC00-\\uDE46]|\\uD818[\\uDD00-\\uDD1D]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE70-\\uDEBE\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDD40-\\uDD6C\\uDE40-\\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\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF39\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD888[\\uDC00-\\uDFAF])(?:[0-9A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088E\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5D\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7CD\\uA7D0\\uA7D1\\uA7D3\\uA7D5-\\uA7DC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\uD80F\\uD81C-\\uD820\\uD822\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD887][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2F\\uDC41-\\uDC46\\uDC60-\\uDFFF]|\\uD810[\\uDC00-\\uDFFA]|\\uD811[\\uDC00-\\uDE46]|\\uD818[\\uDD00-\\uDD1D]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE70-\\uDEBE\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDD40-\\uDD6C\\uDE40-\\uDE7F\\uDF00-\\uDF4A\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1\\uDFE3]|\\uD821[\\uDC00-\\uDFF7]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD08]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD32\\uDD50-\\uDD52\\uDD55\\uDD64-\\uDD67\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD837[\\uDF00-\\uDF1E\\uDF25-\\uDF2A]|\\uD838[\\uDC30-\\uDC6D\\uDD00-\\uDD2C\\uDD37-\\uDD3D\\uDD4E\\uDE90-\\uDEAD\\uDEC0-\\uDEEB]|\\uD839[\\uDCD0-\\uDCEB\\uDDD0-\\uDDED\\uDDF0\\uDFE0-\\uDFE6\\uDFE8-\\uDFEB\\uDFED\\uDFEE\\uDFF0-\\uDFFE]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43\\uDD4B]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF39\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD888[\\uDC00-\\uDFAF])*$/.test(s)\n }, {\n name: 'string',\n test: isString\n }, {\n name: 'Chain',\n test: isChain\n }, {\n name: 'Array',\n test: isArray\n }, {\n name: 'Matrix',\n test: isMatrix\n }, {\n name: 'DenseMatrix',\n test: isDenseMatrix\n }, {\n name: 'SparseMatrix',\n test: isSparseMatrix\n }, {\n name: 'Range',\n test: isRange\n }, {\n name: 'Index',\n test: isIndex\n }, {\n name: 'boolean',\n test: isBoolean\n }, {\n name: 'ResultSet',\n test: isResultSet\n }, {\n name: 'Help',\n test: isHelp\n }, {\n name: 'function',\n test: isFunction\n }, {\n name: 'Date',\n test: isDate\n }, {\n name: 'RegExp',\n test: isRegExp\n }, {\n name: 'null',\n test: isNull\n }, {\n name: 'undefined',\n test: isUndefined\n }, {\n name: 'AccessorNode',\n test: isAccessorNode\n }, {\n name: 'ArrayNode',\n test: isArrayNode\n }, {\n name: 'AssignmentNode',\n test: isAssignmentNode\n }, {\n name: 'BlockNode',\n test: isBlockNode\n }, {\n name: 'ConditionalNode',\n test: isConditionalNode\n }, {\n name: 'ConstantNode',\n test: isConstantNode\n }, {\n name: 'FunctionNode',\n test: isFunctionNode\n }, {\n name: 'FunctionAssignmentNode',\n test: isFunctionAssignmentNode\n }, {\n name: 'IndexNode',\n test: isIndexNode\n }, {\n name: 'Node',\n test: isNode\n }, {\n name: 'ObjectNode',\n test: isObjectNode\n }, {\n name: 'OperatorNode',\n test: isOperatorNode\n }, {\n name: 'ParenthesisNode',\n test: isParenthesisNode\n }, {\n name: 'RangeNode',\n test: isRangeNode\n }, {\n name: 'RelationalNode',\n test: isRelationalNode\n }, {\n name: 'SymbolNode',\n test: isSymbolNode\n }, {\n name: 'Map',\n test: isMap\n }, {\n name: 'Object',\n test: isObject\n } // order 'Object' last, it matches on other classes too\n ]);\n typed.addConversions([{\n from: 'number',\n to: 'BigNumber',\n convert: function convert(x) {\n if (!BigNumber) {\n throwNoBignumber(x);\n }\n\n // note: conversion from number to BigNumber can fail if x has >15 digits\n if (digits(x) > 15) {\n throw new TypeError('Cannot implicitly convert a number with >15 significant digits to BigNumber ' + '(value: ' + x + '). ' + 'Use function bignumber(x) to convert to BigNumber.');\n }\n return new BigNumber(x);\n }\n }, {\n from: 'number',\n to: 'Complex',\n convert: function convert(x) {\n if (!Complex) {\n throwNoComplex(x);\n }\n return new Complex(x, 0);\n }\n }, {\n from: 'BigNumber',\n to: 'Complex',\n convert: function convert(x) {\n if (!Complex) {\n throwNoComplex(x);\n }\n return new Complex(x.toNumber(), 0);\n }\n }, {\n from: 'bigint',\n to: 'number',\n convert: function convert(x) {\n if (x > Number.MAX_SAFE_INTEGER) {\n throw new TypeError('Cannot implicitly convert bigint to number: ' + 'value exceeds the max safe integer value (value: ' + x + ')');\n }\n return Number(x);\n }\n }, {\n from: 'bigint',\n to: 'BigNumber',\n convert: function convert(x) {\n if (!BigNumber) {\n throwNoBignumber(x);\n }\n return new BigNumber(x.toString());\n }\n }, {\n from: 'bigint',\n to: 'Fraction',\n convert: function convert(x) {\n if (!Fraction) {\n throwNoFraction(x);\n }\n return new Fraction(x);\n }\n }, {\n from: 'Fraction',\n to: 'BigNumber',\n convert: function convert(x) {\n throw new TypeError('Cannot implicitly convert a Fraction to BigNumber or vice versa. ' + 'Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.');\n }\n }, {\n from: 'Fraction',\n to: 'Complex',\n convert: function convert(x) {\n if (!Complex) {\n throwNoComplex(x);\n }\n return new Complex(x.valueOf(), 0);\n }\n }, {\n from: 'number',\n to: 'Fraction',\n convert: function convert(x) {\n if (!Fraction) {\n throwNoFraction(x);\n }\n var f = new Fraction(x);\n if (f.valueOf() !== x) {\n throw new TypeError('Cannot implicitly convert a number to a Fraction when there will be a loss of precision ' + '(value: ' + x + '). ' + 'Use function fraction(x) to convert to Fraction.');\n }\n return f;\n }\n }, {\n // FIXME: add conversion from Fraction to number, for example for `sqrt(fraction(1,3))`\n // from: 'Fraction',\n // to: 'number',\n // convert: function (x) {\n // return x.valueOf()\n // }\n // }, {\n from: 'string',\n to: 'number',\n convert: function convert(x) {\n var n = Number(x);\n if (isNaN(n)) {\n throw new Error('Cannot convert \"' + x + '\" to a number');\n }\n return n;\n }\n }, {\n from: 'string',\n to: 'BigNumber',\n convert: function convert(x) {\n if (!BigNumber) {\n throwNoBignumber(x);\n }\n try {\n return new BigNumber(x);\n } catch (err) {\n throw new Error('Cannot convert \"' + x + '\" to BigNumber');\n }\n }\n }, {\n from: 'string',\n to: 'bigint',\n convert: function convert(x) {\n try {\n return BigInt(x);\n } catch (err) {\n throw new Error('Cannot convert \"' + x + '\" to BigInt');\n }\n }\n }, {\n from: 'string',\n to: 'Fraction',\n convert: function convert(x) {\n if (!Fraction) {\n throwNoFraction(x);\n }\n try {\n return new Fraction(x);\n } catch (err) {\n throw new Error('Cannot convert \"' + x + '\" to Fraction');\n }\n }\n }, {\n from: 'string',\n to: 'Complex',\n convert: function convert(x) {\n if (!Complex) {\n throwNoComplex(x);\n }\n try {\n return new Complex(x);\n } catch (err) {\n throw new Error('Cannot convert \"' + x + '\" to Complex');\n }\n }\n }, {\n from: 'boolean',\n to: 'number',\n convert: function convert(x) {\n return +x;\n }\n }, {\n from: 'boolean',\n to: 'BigNumber',\n convert: function convert(x) {\n if (!BigNumber) {\n throwNoBignumber(x);\n }\n return new BigNumber(+x);\n }\n }, {\n from: 'boolean',\n to: 'bigint',\n convert: function convert(x) {\n return BigInt(+x);\n }\n }, {\n from: 'boolean',\n to: 'Fraction',\n convert: function convert(x) {\n if (!Fraction) {\n throwNoFraction(x);\n }\n return new Fraction(+x);\n }\n }, {\n from: 'boolean',\n to: 'string',\n convert: function convert(x) {\n return String(x);\n }\n }, {\n from: 'Array',\n to: 'Matrix',\n convert: function convert(array) {\n if (!DenseMatrix) {\n throwNoMatrix();\n }\n return new DenseMatrix(array);\n }\n }, {\n from: 'Matrix',\n to: 'Array',\n convert: function convert(matrix) {\n return matrix.valueOf();\n }\n }]);\n\n // Provide a suggestion on how to call a function elementwise\n // This was added primarily as guidance for the v10 -> v11 transition,\n // and could potentially be removed in the future if it no longer seems\n // to be helpful.\n typed.onMismatch = (name, args, signatures) => {\n var usualError = typed.createError(name, args, signatures);\n if (['wrongType', 'mismatch'].includes(usualError.data.category) && args.length === 1 && isCollection(args[0]) &&\n // check if the function can be unary:\n signatures.some(sig => !sig.params.includes(','))) {\n var err = new TypeError(\"Function '\".concat(name, \"' doesn't apply to matrices. To call it \") + \"elementwise on a matrix 'M', try 'map(M, \".concat(name, \")'.\"));\n err.data = usualError.data;\n throw err;\n }\n throw usualError;\n };\n\n // Provide a suggestion on how to call a function elementwise\n // This was added primarily as guidance for the v10 -> v11 transition,\n // and could potentially be removed in the future if it no longer seems\n // to be helpful.\n typed.onMismatch = (name, args, signatures) => {\n var usualError = typed.createError(name, args, signatures);\n if (['wrongType', 'mismatch'].includes(usualError.data.category) && args.length === 1 && isCollection(args[0]) &&\n // check if the function can be unary:\n signatures.some(sig => !sig.params.includes(','))) {\n var err = new TypeError(\"Function '\".concat(name, \"' doesn't apply to matrices. To call it \") + \"elementwise on a matrix 'M', try 'map(M, \".concat(name, \")'.\"));\n err.data = usualError.data;\n throw err;\n }\n throw usualError;\n };\n return typed;\n});\nfunction throwNoBignumber(x) {\n throw new Error(\"Cannot convert value \".concat(x, \" into a BigNumber: no class 'BigNumber' provided\"));\n}\nfunction throwNoComplex(x) {\n throw new Error(\"Cannot convert value \".concat(x, \" into a Complex number: no class 'Complex' provided\"));\n}\nfunction throwNoMatrix() {\n throw new Error('Cannot convert array into a Matrix: no class \\'DenseMatrix\\' provided');\n}\nfunction throwNoFraction(x) {\n throw new Error(\"Cannot convert value \".concat(x, \" into a Fraction, no class 'Fraction' provided.\"));\n}","/*!\r\n * decimal.js v10.5.0\r\n * An arbitrary-precision Decimal type for JavaScript.\r\n * https://github.com/MikeMcl/decimal.js\r\n * Copyright (c) 2025 Michael Mclaughlin \r\n * MIT Licence\r\n */\r\n\r\n\r\n// ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //\r\n\r\n\r\n // The maximum exponent magnitude.\r\n // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.\r\nvar EXP_LIMIT = 9e15, // 0 to 9e15\r\n\r\n // The limit on the value of `precision`, and on the value of the first argument to\r\n // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.\r\n MAX_DIGITS = 1e9, // 0 to 1e9\r\n\r\n // Base conversion alphabet.\r\n NUMERALS = '0123456789abcdef',\r\n\r\n // The natural logarithm of 10 (1025 digits).\r\n LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',\r\n\r\n // Pi (1025 digits).\r\n PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',\r\n\r\n\r\n // The initial configuration properties of the Decimal constructor.\r\n DEFAULTS = {\r\n\r\n // These values must be integers within the stated ranges (inclusive).\r\n // Most of these values can be changed at run-time using the `Decimal.config` method.\r\n\r\n // The maximum number of significant digits of the result of a calculation or base conversion.\r\n // E.g. `Decimal.config({ precision: 20 });`\r\n precision: 20, // 1 to MAX_DIGITS\r\n\r\n // The rounding mode used when rounding to `precision`.\r\n //\r\n // ROUND_UP 0 Away from zero.\r\n // ROUND_DOWN 1 Towards zero.\r\n // ROUND_CEIL 2 Towards +Infinity.\r\n // ROUND_FLOOR 3 Towards -Infinity.\r\n // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n //\r\n // E.g.\r\n // `Decimal.rounding = 4;`\r\n // `Decimal.rounding = Decimal.ROUND_HALF_UP;`\r\n rounding: 4, // 0 to 8\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 The IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.\r\n //\r\n // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian\r\n // division (9) are commonly used for the modulus operation. The other rounding modes can also\r\n // be used, but they may not give useful results.\r\n modulo: 1, // 0 to 9\r\n\r\n // The exponent value at and beneath which `toString` returns exponential notation.\r\n // JavaScript numbers: -7\r\n toExpNeg: -7, // 0 to -EXP_LIMIT\r\n\r\n // The exponent value at and above which `toString` returns exponential notation.\r\n // JavaScript numbers: 21\r\n toExpPos: 21, // 0 to EXP_LIMIT\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // JavaScript numbers: -324 (5e-324)\r\n minE: -EXP_LIMIT, // -1 to -EXP_LIMIT\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // JavaScript numbers: 308 (1.7976931348623157e+308)\r\n maxE: EXP_LIMIT, // 1 to EXP_LIMIT\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n crypto: false // true/false\r\n },\r\n\r\n\r\n// ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //\r\n\r\n\r\n inexact, quadrant,\r\n external = true,\r\n\r\n decimalError = '[DecimalError] ',\r\n invalidArgument = decimalError + 'Invalid argument: ',\r\n precisionLimitExceeded = decimalError + 'Precision limit exceeded',\r\n cryptoUnavailable = decimalError + 'crypto unavailable',\r\n tag = '[object Decimal]',\r\n\r\n mathfloor = Math.floor,\r\n mathpow = Math.pow,\r\n\r\n isBinary = /^0b([01]+(\\.[01]*)?|\\.[01]+)(p[+-]?\\d+)?$/i,\r\n isHex = /^0x([0-9a-f]+(\\.[0-9a-f]*)?|\\.[0-9a-f]+)(p[+-]?\\d+)?$/i,\r\n isOctal = /^0o([0-7]+(\\.[0-7]*)?|\\.[0-7]+)(p[+-]?\\d+)?$/i,\r\n isDecimal = /^(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,\r\n\r\n BASE = 1e7,\r\n LOG_BASE = 7,\r\n MAX_SAFE_INTEGER = 9007199254740991,\r\n\r\n LN10_PRECISION = LN10.length - 1,\r\n PI_PRECISION = PI.length - 1,\r\n\r\n // Decimal.prototype object\r\n P = { toStringTag: tag };\r\n\r\n\r\n// Decimal prototype methods\r\n\r\n\r\n/*\r\n * absoluteValue abs\r\n * ceil\r\n * clampedTo clamp\r\n * comparedTo cmp\r\n * cosine cos\r\n * cubeRoot cbrt\r\n * decimalPlaces dp\r\n * dividedBy div\r\n * dividedToIntegerBy divToInt\r\n * equals eq\r\n * floor\r\n * greaterThan gt\r\n * greaterThanOrEqualTo gte\r\n * hyperbolicCosine cosh\r\n * hyperbolicSine sinh\r\n * hyperbolicTangent tanh\r\n * inverseCosine acos\r\n * inverseHyperbolicCosine acosh\r\n * inverseHyperbolicSine asinh\r\n * inverseHyperbolicTangent atanh\r\n * inverseSine asin\r\n * inverseTangent atan\r\n * isFinite\r\n * isInteger isInt\r\n * isNaN\r\n * isNegative isNeg\r\n * isPositive isPos\r\n * isZero\r\n * lessThan lt\r\n * lessThanOrEqualTo lte\r\n * logarithm log\r\n * [maximum] [max]\r\n * [minimum] [min]\r\n * minus sub\r\n * modulo mod\r\n * naturalExponential exp\r\n * naturalLogarithm ln\r\n * negated neg\r\n * plus add\r\n * precision sd\r\n * round\r\n * sine sin\r\n * squareRoot sqrt\r\n * tangent tan\r\n * times mul\r\n * toBinary\r\n * toDecimalPlaces toDP\r\n * toExponential\r\n * toFixed\r\n * toFraction\r\n * toHexadecimal toHex\r\n * toNearest\r\n * toNumber\r\n * toOctal\r\n * toPower pow\r\n * toPrecision\r\n * toSignificantDigits toSD\r\n * toString\r\n * truncated trunc\r\n * valueOf toJSON\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the absolute value of this Decimal.\r\n *\r\n */\r\nP.absoluteValue = P.abs = function () {\r\n var x = new this.constructor(this);\r\n if (x.s < 0) x.s = 1;\r\n return finalise(x);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the\r\n * direction of positive Infinity.\r\n *\r\n */\r\nP.ceil = function () {\r\n return finalise(new this.constructor(this), this.e + 1, 2);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal clamped to the range\r\n * delineated by `min` and `max`.\r\n *\r\n * min {number|string|bigint|Decimal}\r\n * max {number|string|bigint|Decimal}\r\n *\r\n */\r\nP.clampedTo = P.clamp = function (min, max) {\r\n var k,\r\n x = this,\r\n Ctor = x.constructor;\r\n min = new Ctor(min);\r\n max = new Ctor(max);\r\n if (!min.s || !max.s) return new Ctor(NaN);\r\n if (min.gt(max)) throw Error(invalidArgument + max);\r\n k = x.cmp(min);\r\n return k < 0 ? min : x.cmp(max) > 0 ? max : new Ctor(x);\r\n};\r\n\r\n\r\n/*\r\n * Return\r\n * 1 if the value of this Decimal is greater than the value of `y`,\r\n * -1 if the value of this Decimal is less than the value of `y`,\r\n * 0 if they have the same value,\r\n * NaN if the value of either Decimal is NaN.\r\n *\r\n */\r\nP.comparedTo = P.cmp = function (y) {\r\n var i, j, xdL, ydL,\r\n x = this,\r\n xd = x.d,\r\n yd = (y = new x.constructor(y)).d,\r\n xs = x.s,\r\n ys = y.s;\r\n\r\n // Either NaN or ±Infinity?\r\n if (!xd || !yd) {\r\n return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;\r\n }\r\n\r\n // Either zero?\r\n if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;\r\n\r\n // Signs differ?\r\n if (xs !== ys) return xs;\r\n\r\n // Compare exponents.\r\n if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;\r\n\r\n xdL = xd.length;\r\n ydL = yd.length;\r\n\r\n // Compare digit by digit.\r\n for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {\r\n if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;\r\n }\r\n\r\n // Compare lengths.\r\n return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-1, 1]\r\n *\r\n * cos(0) = 1\r\n * cos(-0) = 1\r\n * cos(Infinity) = NaN\r\n * cos(-Infinity) = NaN\r\n * cos(NaN) = NaN\r\n *\r\n */\r\nP.cosine = P.cos = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.d) return new Ctor(NaN);\r\n\r\n // cos(0) = cos(-0) = 1\r\n if (!x.d[0]) return new Ctor(1);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;\r\n Ctor.rounding = 1;\r\n\r\n x = cosine(Ctor, toLessThanHalfPi(Ctor, x));\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n *\r\n * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * cbrt(0) = 0\r\n * cbrt(-0) = -0\r\n * cbrt(1) = 1\r\n * cbrt(-1) = -1\r\n * cbrt(N) = N\r\n * cbrt(-I) = -I\r\n * cbrt(I) = I\r\n *\r\n * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))\r\n *\r\n */\r\nP.cubeRoot = P.cbrt = function () {\r\n var e, m, n, r, rep, s, sd, t, t3, t3plusx,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite() || x.isZero()) return new Ctor(x);\r\n external = false;\r\n\r\n // Initial estimate.\r\n s = x.s * mathpow(x.s * x, 1 / 3);\r\n\r\n // Math.cbrt underflow/overflow?\r\n // Pass x to Math.pow as integer, then adjust the exponent of the result.\r\n if (!s || Math.abs(s) == 1 / 0) {\r\n n = digitsToString(x.d);\r\n e = x.e;\r\n\r\n // Adjust n exponent so it is a multiple of 3 away from x exponent.\r\n if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');\r\n s = mathpow(n, 1 / 3);\r\n\r\n // Rarely, e may be one less than the result exponent value.\r\n e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new Ctor(n);\r\n r.s = x.s;\r\n } else {\r\n r = new Ctor(s.toString());\r\n }\r\n\r\n sd = (e = Ctor.precision) + 3;\r\n\r\n // Halley's method.\r\n // TODO? Compare Newton's method.\r\n for (;;) {\r\n t = r;\r\n t3 = t.times(t).times(t);\r\n t3plusx = t3.plus(x);\r\n r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);\r\n\r\n // TODO? Replace with for-loop and checkRoundingDigits.\r\n if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {\r\n n = n.slice(sd - 3, sd + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999\r\n // , i.e. approaching a rounding boundary, continue the iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the exact result as the\r\n // nines may infinitely repeat.\r\n if (!rep) {\r\n finalise(t, e + 1, 0);\r\n\r\n if (t.times(t).times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n sd += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.\r\n // If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n finalise(r, e + 1, 1);\r\n m = !r.times(r).times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return finalise(r, e, Ctor.rounding, m);\r\n};\r\n\r\n\r\n/*\r\n * Return the number of decimal places of the value of this Decimal.\r\n *\r\n */\r\nP.decimalPlaces = P.dp = function () {\r\n var w,\r\n d = this.d,\r\n n = NaN;\r\n\r\n if (d) {\r\n w = d.length - 1;\r\n n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last word.\r\n w = d[w];\r\n if (w) for (; w % 10 == 0; w /= 10) n--;\r\n if (n < 0) n = 0;\r\n }\r\n\r\n return n;\r\n};\r\n\r\n\r\n/*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.dividedBy = P.div = function (y) {\r\n return divide(this, new this.constructor(y));\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the integer part of dividing the value of this Decimal\r\n * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.dividedToIntegerBy = P.divToInt = function (y) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.\r\n *\r\n */\r\nP.equals = P.eq = function (y) {\r\n return this.cmp(y) === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the\r\n * direction of negative Infinity.\r\n *\r\n */\r\nP.floor = function () {\r\n return finalise(new this.constructor(this), this.e + 1, 3);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than the value of `y`, otherwise return\r\n * false.\r\n *\r\n */\r\nP.greaterThan = P.gt = function (y) {\r\n return this.cmp(y) > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than or equal to the value of `y`,\r\n * otherwise return false.\r\n *\r\n */\r\nP.greaterThanOrEqualTo = P.gte = function (y) {\r\n var k = this.cmp(y);\r\n return k == 1 || k === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [1, Infinity]\r\n *\r\n * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...\r\n *\r\n * cosh(0) = 1\r\n * cosh(-0) = 1\r\n * cosh(Infinity) = Infinity\r\n * cosh(-Infinity) = Infinity\r\n * cosh(NaN) = NaN\r\n *\r\n * x time taken (ms) result\r\n * 1000 9 9.8503555700852349694e+433\r\n * 10000 25 4.4034091128314607936e+4342\r\n * 100000 171 1.4033316802130615897e+43429\r\n * 1000000 3817 1.5166076984010437725e+434294\r\n * 10000000 abandoned after 2 minute wait\r\n *\r\n * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))\r\n *\r\n */\r\nP.hyperbolicCosine = P.cosh = function () {\r\n var k, n, pr, rm, len,\r\n x = this,\r\n Ctor = x.constructor,\r\n one = new Ctor(1);\r\n\r\n if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);\r\n if (x.isZero()) return one;\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;\r\n Ctor.rounding = 1;\r\n len = x.d.length;\r\n\r\n // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1\r\n // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n // TODO? Estimation reused from cosine() and may not be optimal here.\r\n if (len < 32) {\r\n k = Math.ceil(len / 3);\r\n n = (1 / tinyPow(4, k)).toString();\r\n } else {\r\n k = 16;\r\n n = '2.3283064365386962890625e-10';\r\n }\r\n\r\n x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);\r\n\r\n // Reverse argument reduction\r\n var cosh2_x,\r\n i = k,\r\n d8 = new Ctor(8);\r\n for (; i--;) {\r\n cosh2_x = x.times(x);\r\n x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));\r\n }\r\n\r\n return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...\r\n *\r\n * sinh(0) = 0\r\n * sinh(-0) = -0\r\n * sinh(Infinity) = Infinity\r\n * sinh(-Infinity) = -Infinity\r\n * sinh(NaN) = NaN\r\n *\r\n * x time taken (ms)\r\n * 10 2 ms\r\n * 100 5 ms\r\n * 1000 14 ms\r\n * 10000 82 ms\r\n * 100000 886 ms 1.4033316802130615897e+43429\r\n * 200000 2613 ms\r\n * 300000 5407 ms\r\n * 400000 8824 ms\r\n * 500000 13026 ms 8.7080643612718084129e+217146\r\n * 1000000 48543 ms\r\n *\r\n * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))\r\n *\r\n */\r\nP.hyperbolicSine = P.sinh = function () {\r\n var k, pr, rm, len,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite() || x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;\r\n Ctor.rounding = 1;\r\n len = x.d.length;\r\n\r\n if (len < 3) {\r\n x = taylorSeries(Ctor, 2, x, x, true);\r\n } else {\r\n\r\n // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))\r\n // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))\r\n // 3 multiplications and 1 addition\r\n\r\n // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))\r\n // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))\r\n // 4 multiplications and 2 additions\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n k = 1.4 * Math.sqrt(len);\r\n k = k > 16 ? 16 : k | 0;\r\n\r\n x = x.times(1 / tinyPow(5, k));\r\n x = taylorSeries(Ctor, 2, x, x, true);\r\n\r\n // Reverse argument reduction\r\n var sinh2_x,\r\n d5 = new Ctor(5),\r\n d16 = new Ctor(16),\r\n d20 = new Ctor(20);\r\n for (; k--;) {\r\n sinh2_x = x.times(x);\r\n x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));\r\n }\r\n }\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-1, 1]\r\n *\r\n * tanh(x) = sinh(x) / cosh(x)\r\n *\r\n * tanh(0) = 0\r\n * tanh(-0) = -0\r\n * tanh(Infinity) = 1\r\n * tanh(-Infinity) = -1\r\n * tanh(NaN) = NaN\r\n *\r\n */\r\nP.hyperbolicTangent = P.tanh = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(x.s);\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + 7;\r\n Ctor.rounding = 1;\r\n\r\n return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of\r\n * this Decimal.\r\n *\r\n * Domain: [-1, 1]\r\n * Range: [0, pi]\r\n *\r\n * acos(x) = pi/2 - asin(x)\r\n *\r\n * acos(0) = pi/2\r\n * acos(-0) = pi/2\r\n * acos(1) = 0\r\n * acos(-1) = pi\r\n * acos(1/2) = pi/3\r\n * acos(-1/2) = 2*pi/3\r\n * acos(|x| > 1) = NaN\r\n * acos(NaN) = NaN\r\n *\r\n */\r\nP.inverseCosine = P.acos = function () {\r\n var x = this,\r\n Ctor = x.constructor,\r\n k = x.abs().cmp(1),\r\n pr = Ctor.precision,\r\n rm = Ctor.rounding;\r\n\r\n if (k !== -1) {\r\n return k === 0\r\n // |x| is 1\r\n ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)\r\n // |x| > 1 or x is NaN\r\n : new Ctor(NaN);\r\n }\r\n\r\n if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);\r\n\r\n // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3\r\n\r\n Ctor.precision = pr + 6;\r\n Ctor.rounding = 1;\r\n\r\n // See https://github.com/MikeMcl/decimal.js/pull/217\r\n x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.times(2);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the\r\n * value of this Decimal.\r\n *\r\n * Domain: [1, Infinity]\r\n * Range: [0, Infinity]\r\n *\r\n * acosh(x) = ln(x + sqrt(x^2 - 1))\r\n *\r\n * acosh(x < 1) = NaN\r\n * acosh(NaN) = NaN\r\n * acosh(Infinity) = Infinity\r\n * acosh(-Infinity) = NaN\r\n * acosh(0) = NaN\r\n * acosh(-0) = NaN\r\n * acosh(1) = 0\r\n * acosh(-1) = NaN\r\n *\r\n */\r\nP.inverseHyperbolicCosine = P.acosh = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);\r\n if (!x.isFinite()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;\r\n Ctor.rounding = 1;\r\n external = false;\r\n\r\n x = x.times(x).minus(1).sqrt().plus(x);\r\n\r\n external = true;\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.ln();\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value\r\n * of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * asinh(x) = ln(x + sqrt(x^2 + 1))\r\n *\r\n * asinh(NaN) = NaN\r\n * asinh(Infinity) = Infinity\r\n * asinh(-Infinity) = -Infinity\r\n * asinh(0) = 0\r\n * asinh(-0) = -0\r\n *\r\n */\r\nP.inverseHyperbolicSine = P.asinh = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite() || x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;\r\n Ctor.rounding = 1;\r\n external = false;\r\n\r\n x = x.times(x).plus(1).sqrt().plus(x);\r\n\r\n external = true;\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.ln();\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the\r\n * value of this Decimal.\r\n *\r\n * Domain: [-1, 1]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * atanh(x) = 0.5 * ln((1 + x) / (1 - x))\r\n *\r\n * atanh(|x| > 1) = NaN\r\n * atanh(NaN) = NaN\r\n * atanh(Infinity) = NaN\r\n * atanh(-Infinity) = NaN\r\n * atanh(0) = 0\r\n * atanh(-0) = -0\r\n * atanh(1) = Infinity\r\n * atanh(-1) = -Infinity\r\n *\r\n */\r\nP.inverseHyperbolicTangent = P.atanh = function () {\r\n var pr, rm, wpr, xsd,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(NaN);\r\n if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n xsd = x.sd();\r\n\r\n if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);\r\n\r\n Ctor.precision = wpr = xsd - x.e;\r\n\r\n x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);\r\n\r\n Ctor.precision = pr + 4;\r\n Ctor.rounding = 1;\r\n\r\n x = x.ln();\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.times(0.5);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-pi/2, pi/2]\r\n *\r\n * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))\r\n *\r\n * asin(0) = 0\r\n * asin(-0) = -0\r\n * asin(1/2) = pi/6\r\n * asin(-1/2) = -pi/6\r\n * asin(1) = pi/2\r\n * asin(-1) = -pi/2\r\n * asin(|x| > 1) = NaN\r\n * asin(NaN) = NaN\r\n *\r\n * TODO? Compare performance of Taylor series.\r\n *\r\n */\r\nP.inverseSine = P.asin = function () {\r\n var halfPi, k,\r\n pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n k = x.abs().cmp(1);\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n if (k !== -1) {\r\n\r\n // |x| is 1\r\n if (k === 0) {\r\n halfPi = getPi(Ctor, pr + 4, rm).times(0.5);\r\n halfPi.s = x.s;\r\n return halfPi;\r\n }\r\n\r\n // |x| > 1 or x is NaN\r\n return new Ctor(NaN);\r\n }\r\n\r\n // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6\r\n\r\n Ctor.precision = pr + 6;\r\n Ctor.rounding = 1;\r\n\r\n x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.times(2);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value\r\n * of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-pi/2, pi/2]\r\n *\r\n * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...\r\n *\r\n * atan(0) = 0\r\n * atan(-0) = -0\r\n * atan(1) = pi/4\r\n * atan(-1) = -pi/4\r\n * atan(Infinity) = pi/2\r\n * atan(-Infinity) = -pi/2\r\n * atan(NaN) = NaN\r\n *\r\n */\r\nP.inverseTangent = P.atan = function () {\r\n var i, j, k, n, px, t, r, wpr, x2,\r\n x = this,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision,\r\n rm = Ctor.rounding;\r\n\r\n if (!x.isFinite()) {\r\n if (!x.s) return new Ctor(NaN);\r\n if (pr + 4 <= PI_PRECISION) {\r\n r = getPi(Ctor, pr + 4, rm).times(0.5);\r\n r.s = x.s;\r\n return r;\r\n }\r\n } else if (x.isZero()) {\r\n return new Ctor(x);\r\n } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {\r\n r = getPi(Ctor, pr + 4, rm).times(0.25);\r\n r.s = x.s;\r\n return r;\r\n }\r\n\r\n Ctor.precision = wpr = pr + 10;\r\n Ctor.rounding = 1;\r\n\r\n // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);\r\n\r\n // Argument reduction\r\n // Ensure |x| < 0.42\r\n // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))\r\n\r\n k = Math.min(28, wpr / LOG_BASE + 2 | 0);\r\n\r\n for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));\r\n\r\n external = false;\r\n\r\n j = Math.ceil(wpr / LOG_BASE);\r\n n = 1;\r\n x2 = x.times(x);\r\n r = new Ctor(x);\r\n px = x;\r\n\r\n // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...\r\n for (; i !== -1;) {\r\n px = px.times(x2);\r\n t = r.minus(px.div(n += 2));\r\n\r\n px = px.times(x2);\r\n r = t.plus(px.div(n += 2));\r\n\r\n if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);\r\n }\r\n\r\n if (k) r = r.times(2 << (k - 1));\r\n\r\n external = true;\r\n\r\n return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is a finite number, otherwise return false.\r\n *\r\n */\r\nP.isFinite = function () {\r\n return !!this.d;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is an integer, otherwise return false.\r\n *\r\n */\r\nP.isInteger = P.isInt = function () {\r\n return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is NaN, otherwise return false.\r\n *\r\n */\r\nP.isNaN = function () {\r\n return !this.s;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is negative, otherwise return false.\r\n *\r\n */\r\nP.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is positive, otherwise return false.\r\n *\r\n */\r\nP.isPositive = P.isPos = function () {\r\n return this.s > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is 0 or -0, otherwise return false.\r\n *\r\n */\r\nP.isZero = function () {\r\n return !!this.d && this.d[0] === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThan = P.lt = function (y) {\r\n return this.cmp(y) < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThanOrEqualTo = P.lte = function (y) {\r\n return this.cmp(y) < 1;\r\n};\r\n\r\n\r\n/*\r\n * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * If no base is specified, return log[10](arg).\r\n *\r\n * log[base](arg) = ln(arg) / ln(base)\r\n *\r\n * The result will always be correctly rounded if the base of the log is 10, and 'almost always'\r\n * otherwise:\r\n *\r\n * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen\r\n * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error\r\n * between the result and the correctly rounded result will be one ulp (unit in the last place).\r\n *\r\n * log[-b](a) = NaN\r\n * log[0](a) = NaN\r\n * log[1](a) = NaN\r\n * log[NaN](a) = NaN\r\n * log[Infinity](a) = NaN\r\n * log[b](0) = -Infinity\r\n * log[b](-0) = -Infinity\r\n * log[b](-a) = NaN\r\n * log[b](1) = 0\r\n * log[b](Infinity) = Infinity\r\n * log[b](NaN) = NaN\r\n *\r\n * [base] {number|string|bigint|Decimal} The base of the logarithm.\r\n *\r\n */\r\nP.logarithm = P.log = function (base) {\r\n var isBase10, d, denominator, k, inf, num, sd, r,\r\n arg = this,\r\n Ctor = arg.constructor,\r\n pr = Ctor.precision,\r\n rm = Ctor.rounding,\r\n guard = 5;\r\n\r\n // Default base is 10.\r\n if (base == null) {\r\n base = new Ctor(10);\r\n isBase10 = true;\r\n } else {\r\n base = new Ctor(base);\r\n d = base.d;\r\n\r\n // Return NaN if base is negative, or non-finite, or is 0 or 1.\r\n if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);\r\n\r\n isBase10 = base.eq(10);\r\n }\r\n\r\n d = arg.d;\r\n\r\n // Is arg negative, non-finite, 0 or 1?\r\n if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {\r\n return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);\r\n }\r\n\r\n // The result will have a non-terminating decimal expansion if base is 10 and arg is not an\r\n // integer power of 10.\r\n if (isBase10) {\r\n if (d.length > 1) {\r\n inf = true;\r\n } else {\r\n for (k = d[0]; k % 10 === 0;) k /= 10;\r\n inf = k !== 1;\r\n }\r\n }\r\n\r\n external = false;\r\n sd = pr + guard;\r\n num = naturalLogarithm(arg, sd);\r\n denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);\r\n\r\n // The result will have 5 rounding digits.\r\n r = divide(num, denominator, sd, 1);\r\n\r\n // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,\r\n // calculate 10 further digits.\r\n //\r\n // If the result is known to have an infinite decimal expansion, repeat this until it is clear\r\n // that the result is above or below the boundary. Otherwise, if after calculating the 10\r\n // further digits, the last 14 are nines, round up and assume the result is exact.\r\n // Also assume the result is exact if the last 14 are zero.\r\n //\r\n // Example of a result that will be incorrectly rounded:\r\n // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...\r\n // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it\r\n // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so\r\n // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal\r\n // place is still 2.6.\r\n if (checkRoundingDigits(r.d, k = pr, rm)) {\r\n\r\n do {\r\n sd += 10;\r\n num = naturalLogarithm(arg, sd);\r\n denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);\r\n r = divide(num, denominator, sd, 1);\r\n\r\n if (!inf) {\r\n\r\n // Check for 14 nines from the 2nd rounding digit, as the first may be 4.\r\n if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {\r\n r = finalise(r, pr + 1, 0);\r\n }\r\n\r\n break;\r\n }\r\n } while (checkRoundingDigits(r.d, k += 10, rm));\r\n }\r\n\r\n external = true;\r\n\r\n return finalise(r, pr, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\nP.max = function () {\r\n Array.prototype.push.call(arguments, this);\r\n return maxOrMin(this.constructor, arguments, -1);\r\n};\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\nP.min = function () {\r\n Array.prototype.push.call(arguments, this);\r\n return maxOrMin(this.constructor, arguments, 1);\r\n};\r\n */\r\n\r\n\r\n/*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.minus = P.sub = function (y) {\r\n var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n y = new Ctor(y);\r\n\r\n // If either is not finite...\r\n if (!x.d || !y.d) {\r\n\r\n // Return NaN if either is NaN.\r\n if (!x.s || !y.s) y = new Ctor(NaN);\r\n\r\n // Return y negated if x is finite and y is ±Infinity.\r\n else if (x.d) y.s = -y.s;\r\n\r\n // Return x if y is finite and x is ±Infinity.\r\n // Return x if both are ±Infinity with different signs.\r\n // Return NaN if both are ±Infinity with the same sign.\r\n else y = new Ctor(y.d || x.s !== y.s ? x : NaN);\r\n\r\n return y;\r\n }\r\n\r\n // If signs differ...\r\n if (x.s != y.s) {\r\n y.s = -y.s;\r\n return x.plus(y);\r\n }\r\n\r\n xd = x.d;\r\n yd = y.d;\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n // If either is zero...\r\n if (!xd[0] || !yd[0]) {\r\n\r\n // Return y negated if x is zero and y is non-zero.\r\n if (yd[0]) y.s = -y.s;\r\n\r\n // Return x if y is zero and x is non-zero.\r\n else if (xd[0]) y = new Ctor(x);\r\n\r\n // Return zero if both are zero.\r\n // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.\r\n else return new Ctor(rm === 3 ? -0 : 0);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n }\r\n\r\n // x and y are finite, non-zero numbers with the same sign.\r\n\r\n // Calculate base 1e7 exponents.\r\n e = mathfloor(y.e / LOG_BASE);\r\n xe = mathfloor(x.e / LOG_BASE);\r\n\r\n xd = xd.slice();\r\n k = xe - e;\r\n\r\n // If base 1e7 exponents differ...\r\n if (k) {\r\n xLTy = k < 0;\r\n\r\n if (xLTy) {\r\n d = xd;\r\n k = -k;\r\n len = yd.length;\r\n } else {\r\n d = yd;\r\n e = xe;\r\n len = xd.length;\r\n }\r\n\r\n // Numbers with massively different exponents would result in a very high number of\r\n // zeros needing to be prepended, but this can be avoided while still ensuring correct\r\n // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.\r\n i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;\r\n\r\n if (k > i) {\r\n k = i;\r\n d.length = 1;\r\n }\r\n\r\n // Prepend zeros to equalise exponents.\r\n d.reverse();\r\n for (i = k; i--;) d.push(0);\r\n d.reverse();\r\n\r\n // Base 1e7 exponents equal.\r\n } else {\r\n\r\n // Check digits to determine which is the bigger number.\r\n\r\n i = xd.length;\r\n len = yd.length;\r\n xLTy = i < len;\r\n if (xLTy) len = i;\r\n\r\n for (i = 0; i < len; i++) {\r\n if (xd[i] != yd[i]) {\r\n xLTy = xd[i] < yd[i];\r\n break;\r\n }\r\n }\r\n\r\n k = 0;\r\n }\r\n\r\n if (xLTy) {\r\n d = xd;\r\n xd = yd;\r\n yd = d;\r\n y.s = -y.s;\r\n }\r\n\r\n len = xd.length;\r\n\r\n // Append zeros to `xd` if shorter.\r\n // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.\r\n for (i = yd.length - len; i > 0; --i) xd[len++] = 0;\r\n\r\n // Subtract yd from xd.\r\n for (i = yd.length; i > k;) {\r\n\r\n if (xd[--i] < yd[i]) {\r\n for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;\r\n --xd[j];\r\n xd[i] += BASE;\r\n }\r\n\r\n xd[i] -= yd[i];\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (; xd[--len] === 0;) xd.pop();\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xd[0] === 0; xd.shift()) --e;\r\n\r\n // Zero?\r\n if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);\r\n\r\n y.d = xd;\r\n y.e = getBase10Exponent(xd, e);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n};\r\n\r\n\r\n/*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * The result depends on the modulo mode.\r\n *\r\n */\r\nP.modulo = P.mod = function (y) {\r\n var q,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n y = new Ctor(y);\r\n\r\n // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.\r\n if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);\r\n\r\n // Return x if y is ±Infinity or x is ±0.\r\n if (!y.d || x.d && !x.d[0]) {\r\n return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);\r\n }\r\n\r\n // Prevent rounding of intermediate calculations.\r\n external = false;\r\n\r\n if (Ctor.modulo == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // result = x - q * y where 0 <= result < abs(y)\r\n q = divide(x, y.abs(), 0, 3, 1);\r\n q.s *= y.s;\r\n } else {\r\n q = divide(x, y, 0, Ctor.modulo, 1);\r\n }\r\n\r\n q = q.times(y);\r\n\r\n external = true;\r\n\r\n return x.minus(q);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of the value of this Decimal,\r\n * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.naturalExponential = P.exp = function () {\r\n return naturalExponential(this);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,\r\n * rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.naturalLogarithm = P.ln = function () {\r\n return naturalLogarithm(this);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by\r\n * -1.\r\n *\r\n */\r\nP.negated = P.neg = function () {\r\n var x = new this.constructor(this);\r\n x.s = -x.s;\r\n return finalise(x);\r\n};\r\n\r\n\r\n/*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.plus = P.add = function (y) {\r\n var carry, d, e, i, k, len, pr, rm, xd, yd,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n y = new Ctor(y);\r\n\r\n // If either is not finite...\r\n if (!x.d || !y.d) {\r\n\r\n // Return NaN if either is NaN.\r\n if (!x.s || !y.s) y = new Ctor(NaN);\r\n\r\n // Return x if y is finite and x is ±Infinity.\r\n // Return x if both are ±Infinity with the same sign.\r\n // Return NaN if both are ±Infinity with different signs.\r\n // Return y if x is finite and y is ±Infinity.\r\n else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);\r\n\r\n return y;\r\n }\r\n\r\n // If signs differ...\r\n if (x.s != y.s) {\r\n y.s = -y.s;\r\n return x.minus(y);\r\n }\r\n\r\n xd = x.d;\r\n yd = y.d;\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n // If either is zero...\r\n if (!xd[0] || !yd[0]) {\r\n\r\n // Return x if y is zero.\r\n // Return y if y is non-zero.\r\n if (!yd[0]) y = new Ctor(x);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n }\r\n\r\n // x and y are finite, non-zero numbers with the same sign.\r\n\r\n // Calculate base 1e7 exponents.\r\n k = mathfloor(x.e / LOG_BASE);\r\n e = mathfloor(y.e / LOG_BASE);\r\n\r\n xd = xd.slice();\r\n i = k - e;\r\n\r\n // If base 1e7 exponents differ...\r\n if (i) {\r\n\r\n if (i < 0) {\r\n d = xd;\r\n i = -i;\r\n len = yd.length;\r\n } else {\r\n d = yd;\r\n e = k;\r\n len = xd.length;\r\n }\r\n\r\n // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.\r\n k = Math.ceil(pr / LOG_BASE);\r\n len = k > len ? k + 1 : len + 1;\r\n\r\n if (i > len) {\r\n i = len;\r\n d.length = 1;\r\n }\r\n\r\n // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.\r\n d.reverse();\r\n for (; i--;) d.push(0);\r\n d.reverse();\r\n }\r\n\r\n len = xd.length;\r\n i = yd.length;\r\n\r\n // If yd is longer than xd, swap xd and yd so xd points to the longer array.\r\n if (len - i < 0) {\r\n i = len;\r\n d = yd;\r\n yd = xd;\r\n xd = d;\r\n }\r\n\r\n // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.\r\n for (carry = 0; i;) {\r\n carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;\r\n xd[i] %= BASE;\r\n }\r\n\r\n if (carry) {\r\n xd.unshift(carry);\r\n ++e;\r\n }\r\n\r\n // Remove trailing zeros.\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n for (len = xd.length; xd[--len] == 0;) xd.pop();\r\n\r\n y.d = xd;\r\n y.e = getBase10Exponent(xd, e);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n};\r\n\r\n\r\n/*\r\n * Return the number of significant digits of the value of this Decimal.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n *\r\n */\r\nP.precision = P.sd = function (z) {\r\n var k,\r\n x = this;\r\n\r\n if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);\r\n\r\n if (x.d) {\r\n k = getPrecision(x.d);\r\n if (z && x.e + 1 > k) k = x.e + 1;\r\n } else {\r\n k = NaN;\r\n }\r\n\r\n return k;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using\r\n * rounding mode `rounding`.\r\n *\r\n */\r\nP.round = function () {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n return finalise(new Ctor(x), x.e + 1, Ctor.rounding);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sine of the value in radians of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-1, 1]\r\n *\r\n * sin(x) = x - x^3/3! + x^5/5! - ...\r\n *\r\n * sin(0) = 0\r\n * sin(-0) = -0\r\n * sin(Infinity) = NaN\r\n * sin(-Infinity) = NaN\r\n * sin(NaN) = NaN\r\n *\r\n */\r\nP.sine = P.sin = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(NaN);\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;\r\n Ctor.rounding = 1;\r\n\r\n x = sine(Ctor, toLessThanHalfPi(Ctor, x));\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n */\r\nP.squareRoot = P.sqrt = function () {\r\n var m, n, sd, r, rep, t,\r\n x = this,\r\n d = x.d,\r\n e = x.e,\r\n s = x.s,\r\n Ctor = x.constructor;\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !d || !d[0]) {\r\n return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);\r\n }\r\n\r\n external = false;\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+x);\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = digitsToString(d);\r\n\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(n);\r\n e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new Ctor(n);\r\n } else {\r\n r = new Ctor(s.toString());\r\n }\r\n\r\n sd = (e = Ctor.precision) + 3;\r\n\r\n // Newton-Raphson iteration.\r\n for (;;) {\r\n t = r;\r\n r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);\r\n\r\n // TODO? Replace with for-loop and checkRoundingDigits.\r\n if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {\r\n n = n.slice(sd - 3, sd + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or\r\n // 4999, i.e. approaching a rounding boundary, continue the iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the exact result as the\r\n // nines may infinitely repeat.\r\n if (!rep) {\r\n finalise(t, e + 1, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n sd += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.\r\n // If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n finalise(r, e + 1, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return finalise(r, e, Ctor.rounding, m);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * tan(0) = 0\r\n * tan(-0) = -0\r\n * tan(Infinity) = NaN\r\n * tan(-Infinity) = NaN\r\n * tan(NaN) = NaN\r\n *\r\n */\r\nP.tangent = P.tan = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(NaN);\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + 10;\r\n Ctor.rounding = 1;\r\n\r\n x = x.sin();\r\n x.s = 1;\r\n x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.times = P.mul = function (y) {\r\n var carry, e, i, k, r, rL, t, xdL, ydL,\r\n x = this,\r\n Ctor = x.constructor,\r\n xd = x.d,\r\n yd = (y = new Ctor(y)).d;\r\n\r\n y.s *= x.s;\r\n\r\n // If either is NaN, ±Infinity or ±0...\r\n if (!xd || !xd[0] || !yd || !yd[0]) {\r\n\r\n return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd\r\n\r\n // Return NaN if either is NaN.\r\n // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.\r\n ? NaN\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n // Return ±0 if either is ±0.\r\n : !xd || !yd ? y.s / 0 : y.s * 0);\r\n }\r\n\r\n e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);\r\n xdL = xd.length;\r\n ydL = yd.length;\r\n\r\n // Ensure xd points to the longer array.\r\n if (xdL < ydL) {\r\n r = xd;\r\n xd = yd;\r\n yd = r;\r\n rL = xdL;\r\n xdL = ydL;\r\n ydL = rL;\r\n }\r\n\r\n // Initialise the result array with zeros.\r\n r = [];\r\n rL = xdL + ydL;\r\n for (i = rL; i--;) r.push(0);\r\n\r\n // Multiply!\r\n for (i = ydL; --i >= 0;) {\r\n carry = 0;\r\n for (k = xdL + i; k > i;) {\r\n t = r[k] + yd[i] * xd[k - i - 1] + carry;\r\n r[k--] = t % BASE | 0;\r\n carry = t / BASE | 0;\r\n }\r\n\r\n r[k] = (r[k] + carry) % BASE | 0;\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (; !r[--rL];) r.pop();\r\n\r\n if (carry) ++e;\r\n else r.shift();\r\n\r\n y.d = r;\r\n y.e = getBase10Exponent(r, e);\r\n\r\n return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in base 2, round to `sd` significant\r\n * digits using rounding mode `rm`.\r\n *\r\n * If the optional `sd` argument is present then return binary exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toBinary = function (sd, rm) {\r\n return toStringBinary(this, 2, sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`\r\n * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.\r\n *\r\n * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toDecimalPlaces = P.toDP = function (dp, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n x = new Ctor(x);\r\n if (dp === void 0) return x;\r\n\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n return finalise(x, dp + x.e + 1, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in exponential notation rounded to\r\n * `dp` fixed decimal places using rounding mode `rounding`.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toExponential = function (dp, rm) {\r\n var str,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (dp === void 0) {\r\n str = finiteToString(x, true);\r\n } else {\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n x = finalise(new Ctor(x), dp + 1, rm);\r\n str = finiteToString(x, true, dp + 1);\r\n }\r\n\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in normal (fixed-point) notation to\r\n * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is\r\n * omitted.\r\n *\r\n * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.\r\n * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.\r\n * (-0).toFixed(3) is '0.000'.\r\n * (-0.5).toFixed(0) is '-0'.\r\n *\r\n */\r\nP.toFixed = function (dp, rm) {\r\n var str, y,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (dp === void 0) {\r\n str = finiteToString(x);\r\n } else {\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n y = finalise(new Ctor(x), dp + x.e + 1, rm);\r\n str = finiteToString(y, false, dp + y.e + 1);\r\n }\r\n\r\n // To determine whether to add the minus sign look at the value before it was rounded,\r\n // i.e. look at `x` rather than `y`.\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return an array representing the value of this Decimal as a simple fraction with an integer\r\n * numerator and an integer denominator.\r\n *\r\n * The denominator will be a positive non-zero value less than or equal to the specified maximum\r\n * denominator. If a maximum denominator is not specified, the denominator will be the lowest\r\n * value necessary to represent the number exactly.\r\n *\r\n * [maxD] {number|string|bigint|Decimal} Maximum denominator. Integer >= 1 and < Infinity.\r\n *\r\n */\r\nP.toFraction = function (maxD) {\r\n var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,\r\n x = this,\r\n xd = x.d,\r\n Ctor = x.constructor;\r\n\r\n if (!xd) return new Ctor(x);\r\n\r\n n1 = d0 = new Ctor(1);\r\n d1 = n0 = new Ctor(0);\r\n\r\n d = new Ctor(d1);\r\n e = d.e = getPrecision(xd) - x.e - 1;\r\n k = e % LOG_BASE;\r\n d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);\r\n\r\n if (maxD == null) {\r\n\r\n // d is 10**e, the minimum max-denominator needed.\r\n maxD = e > 0 ? d : n1;\r\n } else {\r\n n = new Ctor(maxD);\r\n if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);\r\n maxD = n.gt(d) ? (e > 0 ? d : n1) : n;\r\n }\r\n\r\n external = false;\r\n n = new Ctor(digitsToString(xd));\r\n pr = Ctor.precision;\r\n Ctor.precision = e = xd.length * LOG_BASE * 2;\r\n\r\n for (;;) {\r\n q = divide(n, d, 0, 1, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.cmp(maxD) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n d2 = n1;\r\n n1 = n0.plus(q.times(d2));\r\n n0 = d2;\r\n d2 = d;\r\n d = n.minus(q.times(d2));\r\n n = d2;\r\n }\r\n\r\n d2 = divide(maxD.minus(d0), d1, 0, 1, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1?\r\n r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1\r\n ? [n1, d1] : [n0, d0];\r\n\r\n Ctor.precision = pr;\r\n external = true;\r\n\r\n return r;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in base 16, round to `sd` significant\r\n * digits using rounding mode `rm`.\r\n *\r\n * If the optional `sd` argument is present then return binary exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toHexadecimal = P.toHex = function (sd, rm) {\r\n return toStringBinary(this, 16, sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding\r\n * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.\r\n *\r\n * The return value will always have the same sign as this Decimal, unless either this Decimal\r\n * or `y` is NaN, in which case the return value will be also be NaN.\r\n *\r\n * The return value is not affected by the value of `precision`.\r\n *\r\n * y {number|string|bigint|Decimal} The magnitude to round to a multiple of.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toNearest() rounding mode not an integer: {rm}'\r\n * 'toNearest() rounding mode out of range: {rm}'\r\n *\r\n */\r\nP.toNearest = function (y, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n x = new Ctor(x);\r\n\r\n if (y == null) {\r\n\r\n // If x is not finite, return x.\r\n if (!x.d) return x;\r\n\r\n y = new Ctor(1);\r\n rm = Ctor.rounding;\r\n } else {\r\n y = new Ctor(y);\r\n if (rm === void 0) {\r\n rm = Ctor.rounding;\r\n } else {\r\n checkInt32(rm, 0, 8);\r\n }\r\n\r\n // If x is not finite, return x if y is not NaN, else NaN.\r\n if (!x.d) return y.s ? x : y;\r\n\r\n // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.\r\n if (!y.d) {\r\n if (y.s) y.s = x.s;\r\n return y;\r\n }\r\n }\r\n\r\n // If y is not zero, calculate the nearest multiple of y to x.\r\n if (y.d[0]) {\r\n external = false;\r\n x = divide(x, y, 0, rm, 1).times(y);\r\n external = true;\r\n finalise(x);\r\n\r\n // If y is zero, return zero with the sign of x.\r\n } else {\r\n y.s = x.s;\r\n x = y;\r\n }\r\n\r\n return x;\r\n};\r\n\r\n\r\n/*\r\n * Return the value of this Decimal converted to a number primitive.\r\n * Zero keeps its sign.\r\n *\r\n */\r\nP.toNumber = function () {\r\n return +this;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in base 8, round to `sd` significant\r\n * digits using rounding mode `rm`.\r\n *\r\n * If the optional `sd` argument is present then return binary exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toOctal = function (sd, rm) {\r\n return toStringBinary(this, 8, sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded\r\n * to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * ECMAScript compliant.\r\n *\r\n * pow(x, NaN) = NaN\r\n * pow(x, ±0) = 1\r\n\r\n * pow(NaN, non-zero) = NaN\r\n * pow(abs(x) > 1, +Infinity) = +Infinity\r\n * pow(abs(x) > 1, -Infinity) = +0\r\n * pow(abs(x) == 1, ±Infinity) = NaN\r\n * pow(abs(x) < 1, +Infinity) = +0\r\n * pow(abs(x) < 1, -Infinity) = +Infinity\r\n * pow(+Infinity, y > 0) = +Infinity\r\n * pow(+Infinity, y < 0) = +0\r\n * pow(-Infinity, odd integer > 0) = -Infinity\r\n * pow(-Infinity, even integer > 0) = +Infinity\r\n * pow(-Infinity, odd integer < 0) = -0\r\n * pow(-Infinity, even integer < 0) = +0\r\n * pow(+0, y > 0) = +0\r\n * pow(+0, y < 0) = +Infinity\r\n * pow(-0, odd integer > 0) = -0\r\n * pow(-0, even integer > 0) = +0\r\n * pow(-0, odd integer < 0) = -Infinity\r\n * pow(-0, even integer < 0) = +Infinity\r\n * pow(finite x < 0, finite non-integer) = NaN\r\n *\r\n * For non-integer or very large exponents pow(x, y) is calculated using\r\n *\r\n * x^y = exp(y*ln(x))\r\n *\r\n * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the\r\n * probability of an incorrectly rounded result\r\n * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14\r\n * i.e. 1 in 250,000,000,000,000\r\n *\r\n * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).\r\n *\r\n * y {number|string|bigint|Decimal} The power to which to raise this Decimal.\r\n *\r\n */\r\nP.toPower = P.pow = function (y) {\r\n var e, k, pr, r, rm, s,\r\n x = this,\r\n Ctor = x.constructor,\r\n yn = +(y = new Ctor(y));\r\n\r\n // Either ±Infinity, NaN or ±0?\r\n if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));\r\n\r\n x = new Ctor(x);\r\n\r\n if (x.eq(1)) return x;\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n if (y.eq(1)) return finalise(x, pr, rm);\r\n\r\n // y exponent\r\n e = mathfloor(y.e / LOG_BASE);\r\n\r\n // If y is a small integer use the 'exponentiation by squaring' algorithm.\r\n if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {\r\n r = intPow(Ctor, x, k, pr);\r\n return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);\r\n }\r\n\r\n s = x.s;\r\n\r\n // if x is negative\r\n if (s < 0) {\r\n\r\n // if y is not an integer\r\n if (e < y.d.length - 1) return new Ctor(NaN);\r\n\r\n // Result is positive if x is negative and the last digit of integer y is even.\r\n if ((y.d[e] & 1) == 0) s = 1;\r\n\r\n // if x.eq(-1)\r\n if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {\r\n x.s = s;\r\n return x;\r\n }\r\n }\r\n\r\n // Estimate result exponent.\r\n // x^y = 10^e, where e = y * log10(x)\r\n // log10(x) = log10(x_significand) + x_exponent\r\n // log10(x_significand) = ln(x_significand) / ln(10)\r\n k = mathpow(+x, yn);\r\n e = k == 0 || !isFinite(k)\r\n ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))\r\n : new Ctor(k + '').e;\r\n\r\n // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.\r\n\r\n // Overflow/underflow?\r\n if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);\r\n\r\n external = false;\r\n Ctor.rounding = x.s = 1;\r\n\r\n // Estimate the extra guard digits needed to ensure five correct rounding digits from\r\n // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):\r\n // new Decimal(2.32456).pow('2087987436534566.46411')\r\n // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815\r\n k = Math.min(12, (e + '').length);\r\n\r\n // r = x^y = exp(y*ln(x))\r\n r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);\r\n\r\n // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)\r\n if (r.d) {\r\n\r\n // Truncate to the required precision plus five rounding digits.\r\n r = finalise(r, pr + 5, 1);\r\n\r\n // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate\r\n // the result.\r\n if (checkRoundingDigits(r.d, pr, rm)) {\r\n e = pr + 10;\r\n\r\n // Truncate to the increased precision plus five rounding digits.\r\n r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);\r\n\r\n // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).\r\n if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {\r\n r = finalise(r, pr + 1, 0);\r\n }\r\n }\r\n }\r\n\r\n r.s = s;\r\n external = true;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(r, pr, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal rounded to `sd` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * Return exponential notation if `sd` is less than the number of digits necessary to represent\r\n * the integer part of the value in normal notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toPrecision = function (sd, rm) {\r\n var str,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (sd === void 0) {\r\n str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);\r\n } else {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n x = finalise(new Ctor(x), sd, rm);\r\n str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);\r\n }\r\n\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`\r\n * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if\r\n * omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toSD() digits out of range: {sd}'\r\n * 'toSD() digits not an integer: {sd}'\r\n * 'toSD() rounding mode not an integer: {rm}'\r\n * 'toSD() rounding mode out of range: {rm}'\r\n *\r\n */\r\nP.toSignificantDigits = P.toSD = function (sd, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n if (sd === void 0) {\r\n sd = Ctor.precision;\r\n rm = Ctor.rounding;\r\n } else {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n }\r\n\r\n return finalise(new Ctor(x), sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal.\r\n *\r\n * Return exponential notation if this Decimal has a positive exponent equal to or greater than\r\n * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.\r\n *\r\n */\r\nP.toString = function () {\r\n var x = this,\r\n Ctor = x.constructor,\r\n str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);\r\n\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.\r\n *\r\n */\r\nP.truncated = P.trunc = function () {\r\n return finalise(new this.constructor(this), this.e + 1, 1);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal.\r\n * Unlike `toString`, negative zero will include the minus sign.\r\n *\r\n */\r\nP.valueOf = P.toJSON = function () {\r\n var x = this,\r\n Ctor = x.constructor,\r\n str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);\r\n\r\n return x.isNeg() ? '-' + str : str;\r\n};\r\n\r\n\r\n// Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.\r\n\r\n\r\n/*\r\n * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,\r\n * finiteToString, naturalExponential, naturalLogarithm\r\n * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,\r\n * P.toPrecision, P.toSignificantDigits, toStringBinary, random\r\n * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm\r\n * convertBase toStringBinary, parseOther\r\n * cos P.cos\r\n * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,\r\n * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,\r\n * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,\r\n * taylorSeries, atan2, parseOther\r\n * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,\r\n * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,\r\n * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,\r\n * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,\r\n * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,\r\n * P.truncated, divide, getLn10, getPi, naturalExponential,\r\n * naturalLogarithm, ceil, floor, round, trunc\r\n * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,\r\n * toStringBinary\r\n * getBase10Exponent P.minus, P.plus, P.times, parseOther\r\n * getLn10 P.logarithm, naturalLogarithm\r\n * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2\r\n * getPrecision P.precision, P.toFraction\r\n * getZeroString digitsToString, finiteToString\r\n * intPow P.toPower, parseOther\r\n * isOdd toLessThanHalfPi\r\n * maxOrMin max, min\r\n * naturalExponential P.naturalExponential, P.toPower\r\n * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,\r\n * P.toPower, naturalExponential\r\n * nonFiniteToString finiteToString, toStringBinary\r\n * parseDecimal Decimal\r\n * parseOther Decimal\r\n * sin P.sin\r\n * taylorSeries P.cosh, P.sinh, cos, sin\r\n * toLessThanHalfPi P.cos, P.sin\r\n * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal\r\n * truncate intPow\r\n *\r\n * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,\r\n * naturalLogarithm, config, parseOther, random, Decimal\r\n */\r\n\r\n\r\nfunction digitsToString(d) {\r\n var i, k, ws,\r\n indexOfLastWord = d.length - 1,\r\n str = '',\r\n w = d[0];\r\n\r\n if (indexOfLastWord > 0) {\r\n str += w;\r\n for (i = 1; i < indexOfLastWord; i++) {\r\n ws = d[i] + '';\r\n k = LOG_BASE - ws.length;\r\n if (k) str += getZeroString(k);\r\n str += ws;\r\n }\r\n\r\n w = d[i];\r\n ws = w + '';\r\n k = LOG_BASE - ws.length;\r\n if (k) str += getZeroString(k);\r\n } else if (w === 0) {\r\n return '0';\r\n }\r\n\r\n // Remove trailing zeros of last w.\r\n for (; w % 10 === 0;) w /= 10;\r\n\r\n return str + w;\r\n}\r\n\r\n\r\nfunction checkInt32(i, min, max) {\r\n if (i !== ~~i || i < min || i > max) {\r\n throw Error(invalidArgument + i);\r\n }\r\n}\r\n\r\n\r\n/*\r\n * Check 5 rounding digits if `repeating` is null, 4 otherwise.\r\n * `repeating == null` if caller is `log` or `pow`,\r\n * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.\r\n */\r\nfunction checkRoundingDigits(d, i, rm, repeating) {\r\n var di, k, r, rd;\r\n\r\n // Get the length of the first word of the array d.\r\n for (k = d[0]; k >= 10; k /= 10) --i;\r\n\r\n // Is the rounding digit in the first word of d?\r\n if (--i < 0) {\r\n i += LOG_BASE;\r\n di = 0;\r\n } else {\r\n di = Math.ceil((i + 1) / LOG_BASE);\r\n i %= LOG_BASE;\r\n }\r\n\r\n // i is the index (0 - 6) of the rounding digit.\r\n // E.g. if within the word 3487563 the first rounding digit is 5,\r\n // then i = 4, k = 1000, rd = 3487563 % 1000 = 563\r\n k = mathpow(10, LOG_BASE - i);\r\n rd = d[di] % k | 0;\r\n\r\n if (repeating == null) {\r\n if (i < 3) {\r\n if (i == 0) rd = rd / 100 | 0;\r\n else if (i == 1) rd = rd / 10 | 0;\r\n r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;\r\n } else {\r\n r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&\r\n (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||\r\n (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;\r\n }\r\n } else {\r\n if (i < 4) {\r\n if (i == 0) rd = rd / 1000 | 0;\r\n else if (i == 1) rd = rd / 100 | 0;\r\n else if (i == 2) rd = rd / 10 | 0;\r\n r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;\r\n } else {\r\n r = ((repeating || rm < 4) && rd + 1 == k ||\r\n (!repeating && rm > 3) && rd + 1 == k / 2) &&\r\n (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;\r\n }\r\n }\r\n\r\n return r;\r\n}\r\n\r\n\r\n// Convert string of `baseIn` to an array of numbers of `baseOut`.\r\n// Eg. convertBase('255', 10, 16) returns [15, 15].\r\n// Eg. convertBase('ff', 16, 10) returns [2, 5, 5].\r\nfunction convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n}\r\n\r\n\r\n/*\r\n * cos(x) = 1 - x^2/2! + x^4/4! - ...\r\n * |x| < pi/2\r\n *\r\n */\r\nfunction cosine(Ctor, x) {\r\n var k, len, y;\r\n\r\n if (x.isZero()) return x;\r\n\r\n // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1\r\n // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n len = x.d.length;\r\n if (len < 32) {\r\n k = Math.ceil(len / 3);\r\n y = (1 / tinyPow(4, k)).toString();\r\n } else {\r\n k = 16;\r\n y = '2.3283064365386962890625e-10';\r\n }\r\n\r\n Ctor.precision += k;\r\n\r\n x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));\r\n\r\n // Reverse argument reduction\r\n for (var i = k; i--;) {\r\n var cos2x = x.times(x);\r\n x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);\r\n }\r\n\r\n Ctor.precision -= k;\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Perform division in the specified base.\r\n */\r\nvar divide = (function () {\r\n\r\n // Assumes non-zero x and k, and hence non-zero result.\r\n function multiplyInteger(x, k, base) {\r\n var temp,\r\n carry = 0,\r\n i = x.length;\r\n\r\n for (x = x.slice(); i--;) {\r\n temp = x[i] * k + carry;\r\n x[i] = temp % base | 0;\r\n carry = temp / base | 0;\r\n }\r\n\r\n if (carry) x.unshift(carry);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, r;\r\n\r\n if (aL != bL) {\r\n r = aL > bL ? 1 : -1;\r\n } else {\r\n for (i = r = 0; i < aL; i++) {\r\n if (a[i] != b[i]) {\r\n r = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return r;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1;) a.shift();\r\n }\r\n\r\n return function (x, y, pr, rm, dp, base) {\r\n var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,\r\n yL, yz,\r\n Ctor = x.constructor,\r\n sign = x.s == y.s ? 1 : -1,\r\n xd = x.d,\r\n yd = y.d;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xd || !xd[0] || !yd || !yd[0]) {\r\n\r\n return new Ctor(// Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :\r\n\r\n // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.\r\n xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);\r\n }\r\n\r\n if (base) {\r\n logBase = 1;\r\n e = x.e - y.e;\r\n } else {\r\n base = BASE;\r\n logBase = LOG_BASE;\r\n e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);\r\n }\r\n\r\n yL = yd.length;\r\n xL = xd.length;\r\n q = new Ctor(sign);\r\n qd = q.d = [];\r\n\r\n // Result exponent may be one less than e.\r\n // The digit array of a Decimal from toStringBinary may have trailing zeros.\r\n for (i = 0; yd[i] == (xd[i] || 0); i++);\r\n\r\n if (yd[i] > (xd[i] || 0)) e--;\r\n\r\n if (pr == null) {\r\n sd = pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n } else if (dp) {\r\n sd = pr + (x.e - y.e) + 1;\r\n } else {\r\n sd = pr;\r\n }\r\n\r\n if (sd < 0) {\r\n qd.push(1);\r\n more = true;\r\n } else {\r\n\r\n // Convert precision in number of base 10 digits to base 1e7 digits.\r\n sd = sd / logBase + 2 | 0;\r\n i = 0;\r\n\r\n // divisor < 1e7\r\n if (yL == 1) {\r\n k = 0;\r\n yd = yd[0];\r\n sd++;\r\n\r\n // k is the carry.\r\n for (; (i < xL || k) && sd--; i++) {\r\n t = k * base + (xd[i] || 0);\r\n qd[i] = t / yd | 0;\r\n k = t % yd | 0;\r\n }\r\n\r\n more = k || i < xL;\r\n\r\n // divisor >= 1e7\r\n } else {\r\n\r\n // Normalise xd and yd so highest order digit of yd is >= base/2\r\n k = base / (yd[0] + 1) | 0;\r\n\r\n if (k > 1) {\r\n yd = multiplyInteger(yd, k, base);\r\n xd = multiplyInteger(xd, k, base);\r\n yL = yd.length;\r\n xL = xd.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xd.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL;) rem[remL++] = 0;\r\n\r\n yz = yd.slice();\r\n yz.unshift(0);\r\n yd0 = yd[0];\r\n\r\n if (yd[1] >= base / 2) ++yd0;\r\n\r\n do {\r\n k = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yd, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, k.\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // k will be how many times the divisor goes into the current remainder.\r\n k = rem0 / yd0 | 0;\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (k)\r\n // 2. if product > remainder: product -= divisor, k--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, k++\r\n\r\n if (k > 1) {\r\n if (k >= base) k = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiplyInteger(yd, k, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n cmp = compare(prod, rem, prodL, remL);\r\n\r\n // product > remainder.\r\n if (cmp == 1) {\r\n k--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yd, prodL, base);\r\n }\r\n } else {\r\n\r\n // cmp is -1.\r\n // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1\r\n // to avoid it. If k is 1 there is a need to compare yd and rem again below.\r\n if (k == 0) cmp = k = 1;\r\n prod = yd.slice();\r\n }\r\n\r\n prodL = prod.length;\r\n if (prodL < remL) prod.unshift(0);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n\r\n // If product was < previous remainder.\r\n if (cmp == -1) {\r\n remL = rem.length;\r\n\r\n // Compare divisor and new remainder.\r\n cmp = compare(yd, rem, yL, remL);\r\n\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n if (cmp < 1) {\r\n k++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yd, remL, base);\r\n }\r\n }\r\n\r\n remL = rem.length;\r\n } else if (cmp === 0) {\r\n k++;\r\n rem = [0];\r\n } // if cmp === 1, k will be 0\r\n\r\n // Add the next digit, k, to the result array.\r\n qd[i++] = k;\r\n\r\n // Update the remainder.\r\n if (cmp && rem[0]) {\r\n rem[remL++] = xd[xi] || 0;\r\n } else {\r\n rem = [xd[xi]];\r\n remL = 1;\r\n }\r\n\r\n } while ((xi++ < xL || rem[0] !== void 0) && sd--);\r\n\r\n more = rem[0] !== void 0;\r\n }\r\n\r\n // Leading zero?\r\n if (!qd[0]) qd.shift();\r\n }\r\n\r\n // logBase is 1 when divide is being used for base conversion.\r\n if (logBase == 1) {\r\n q.e = e;\r\n inexact = more;\r\n } else {\r\n\r\n // To calculate q.e, first get the number of digits of qd[0].\r\n for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;\r\n q.e = i + e * logBase - 1;\r\n\r\n finalise(q, dp ? pr + q.e + 1 : pr, rm, more);\r\n }\r\n\r\n return q;\r\n };\r\n})();\r\n\r\n\r\n/*\r\n * Round `x` to `sd` significant digits using rounding mode `rm`.\r\n * Check for over/under-flow.\r\n */\r\n function finalise(x, sd, rm, isTruncated) {\r\n var digits, i, j, k, rd, roundUp, w, xd, xdi,\r\n Ctor = x.constructor;\r\n\r\n // Don't round if sd is null or undefined.\r\n out: if (sd != null) {\r\n xd = x.d;\r\n\r\n // Infinity/NaN.\r\n if (!xd) return x;\r\n\r\n // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // w: the word of xd containing rd, a base 1e7 number.\r\n // xdi: the index of w within xd.\r\n // digits: the number of digits of w.\r\n // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if\r\n // they had leading zeros)\r\n // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).\r\n\r\n // Get the length of the first word of the digits array xd.\r\n for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;\r\n i = sd - digits;\r\n\r\n // Is the rounding digit in the first word of xd?\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n w = xd[xdi = 0];\r\n\r\n // Get the rounding digit at index j of w.\r\n rd = w / mathpow(10, digits - j - 1) % 10 | 0;\r\n } else {\r\n xdi = Math.ceil((i + 1) / LOG_BASE);\r\n k = xd.length;\r\n if (xdi >= k) {\r\n if (isTruncated) {\r\n\r\n // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.\r\n for (; k++ <= xdi;) xd.push(0);\r\n w = rd = 0;\r\n digits = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n w = k = xd[xdi];\r\n\r\n // Get the number of digits of w.\r\n for (digits = 1; k >= 10; k /= 10) digits++;\r\n\r\n // Get the index of rd within w.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within w, adjusted for leading zeros.\r\n // The number of leading zeros of w is given by LOG_BASE - digits.\r\n j = i - LOG_BASE + digits;\r\n\r\n // Get the rounding digit at index j of w.\r\n rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;\r\n }\r\n }\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n isTruncated = isTruncated || sd < 0 ||\r\n xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));\r\n\r\n // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right\r\n // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression\r\n // will give 714.\r\n\r\n roundUp = rm < 4\r\n ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xd[0]) {\r\n xd.length = 0;\r\n if (roundUp) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xd[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xd.length = xdi;\r\n k = 1;\r\n xdi--;\r\n } else {\r\n xd.length = xdi + 1;\r\n k = mathpow(10, LOG_BASE - i);\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of w.\r\n xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;\r\n }\r\n\r\n if (roundUp) {\r\n for (;;) {\r\n\r\n // Is the digit to be rounded up in the first word of xd?\r\n if (xdi == 0) {\r\n\r\n // i will be the length of xd[0] before k is added.\r\n for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;\r\n j = xd[0] += k;\r\n for (k = 1; j >= 10; j /= 10) k++;\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xd[0] == BASE) xd[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xd[xdi] += k;\r\n if (xd[xdi] != BASE) break;\r\n xd[xdi--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xd.length; xd[--i] === 0;) xd.pop();\r\n }\r\n\r\n if (external) {\r\n\r\n // Overflow?\r\n if (x.e > Ctor.maxE) {\r\n\r\n // Infinity.\r\n x.d = null;\r\n x.e = NaN;\r\n\r\n // Underflow?\r\n } else if (x.e < Ctor.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n // Ctor.underflow = true;\r\n } // else Ctor.underflow = false;\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\nfunction finiteToString(x, isExp, sd) {\r\n if (!x.isFinite()) return nonFiniteToString(x);\r\n var k,\r\n e = x.e,\r\n str = digitsToString(x.d),\r\n len = str.length;\r\n\r\n if (isExp) {\r\n if (sd && (k = sd - len) > 0) {\r\n str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);\r\n } else if (len > 1) {\r\n str = str.charAt(0) + '.' + str.slice(1);\r\n }\r\n\r\n str = str + (x.e < 0 ? 'e' : 'e+') + x.e;\r\n } else if (e < 0) {\r\n str = '0.' + getZeroString(-e - 1) + str;\r\n if (sd && (k = sd - len) > 0) str += getZeroString(k);\r\n } else if (e >= len) {\r\n str += getZeroString(e + 1 - len);\r\n if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);\r\n } else {\r\n if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);\r\n if (sd && (k = sd - len) > 0) {\r\n if (e + 1 === len) str += '.';\r\n str += getZeroString(k);\r\n }\r\n }\r\n\r\n return str;\r\n}\r\n\r\n\r\n// Calculate the base 10 exponent from the base 1e7 exponent.\r\nfunction getBase10Exponent(digits, e) {\r\n var w = digits[0];\r\n\r\n // Add the number of digits of the first word of the digits array.\r\n for ( e *= LOG_BASE; w >= 10; w /= 10) e++;\r\n return e;\r\n}\r\n\r\n\r\nfunction getLn10(Ctor, sd, pr) {\r\n if (sd > LN10_PRECISION) {\r\n\r\n // Reset global state in case the exception is caught.\r\n external = true;\r\n if (pr) Ctor.precision = pr;\r\n throw Error(precisionLimitExceeded);\r\n }\r\n return finalise(new Ctor(LN10), sd, 1, true);\r\n}\r\n\r\n\r\nfunction getPi(Ctor, sd, rm) {\r\n if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);\r\n return finalise(new Ctor(PI), sd, rm, true);\r\n}\r\n\r\n\r\nfunction getPrecision(digits) {\r\n var w = digits.length - 1,\r\n len = w * LOG_BASE + 1;\r\n\r\n w = digits[w];\r\n\r\n // If non-zero...\r\n if (w) {\r\n\r\n // Subtract the number of trailing zeros of the last word.\r\n for (; w % 10 == 0; w /= 10) len--;\r\n\r\n // Add the number of digits of the first word.\r\n for (w = digits[0]; w >= 10; w /= 10) len++;\r\n }\r\n\r\n return len;\r\n}\r\n\r\n\r\nfunction getZeroString(k) {\r\n var zs = '';\r\n for (; k--;) zs += '0';\r\n return zs;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an\r\n * integer of type number.\r\n *\r\n * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.\r\n *\r\n */\r\nfunction intPow(Ctor, x, n, pr) {\r\n var isTruncated,\r\n r = new Ctor(1),\r\n\r\n // Max n of 9007199254740991 takes 53 loop iterations.\r\n // Maximum digits array length; leaves [28, 34] guard digits.\r\n k = Math.ceil(pr / LOG_BASE + 4);\r\n\r\n external = false;\r\n\r\n for (;;) {\r\n if (n % 2) {\r\n r = r.times(x);\r\n if (truncate(r.d, k)) isTruncated = true;\r\n }\r\n\r\n n = mathfloor(n / 2);\r\n if (n === 0) {\r\n\r\n // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.\r\n n = r.d.length - 1;\r\n if (isTruncated && r.d[n] === 0) ++r.d[n];\r\n break;\r\n }\r\n\r\n x = x.times(x);\r\n truncate(x.d, k);\r\n }\r\n\r\n external = true;\r\n\r\n return r;\r\n}\r\n\r\n\r\nfunction isOdd(n) {\r\n return n.d[n.d.length - 1] & 1;\r\n}\r\n\r\n\r\n/*\r\n * Handle `max` (`n` is -1) and `min` (`n` is 1).\r\n */\r\nfunction maxOrMin(Ctor, args, n) {\r\n var k, y,\r\n x = new Ctor(args[0]),\r\n i = 0;\r\n\r\n for (; ++i < args.length;) {\r\n y = new Ctor(args[i]);\r\n\r\n // NaN?\r\n if (!y.s) {\r\n x = y;\r\n break;\r\n }\r\n\r\n k = x.cmp(y);\r\n\r\n if (k === n || k === 0 && x.s === n) {\r\n x = y;\r\n }\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant\r\n * digits.\r\n *\r\n * Taylor/Maclaurin series.\r\n *\r\n * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...\r\n *\r\n * Argument reduction:\r\n * Repeat x = x / 32, k += 5, until |x| < 0.1\r\n * exp(x) = exp(x / 2^k)^(2^k)\r\n *\r\n * Previously, the argument was initially reduced by\r\n * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)\r\n * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was\r\n * found to be slower than just dividing repeatedly by 32 as above.\r\n *\r\n * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000\r\n * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000\r\n * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)\r\n *\r\n * exp(Infinity) = Infinity\r\n * exp(-Infinity) = 0\r\n * exp(NaN) = NaN\r\n * exp(±0) = 1\r\n *\r\n * exp(x) is non-terminating for any finite, non-zero x.\r\n *\r\n * The result will always be correctly rounded.\r\n *\r\n */\r\nfunction naturalExponential(x, sd) {\r\n var denominator, guard, j, pow, sum, t, wpr,\r\n rep = 0,\r\n i = 0,\r\n k = 0,\r\n Ctor = x.constructor,\r\n rm = Ctor.rounding,\r\n pr = Ctor.precision;\r\n\r\n // 0/NaN/Infinity?\r\n if (!x.d || !x.d[0] || x.e > 17) {\r\n\r\n return new Ctor(x.d\r\n ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0\r\n : x.s ? x.s < 0 ? 0 : x : 0 / 0);\r\n }\r\n\r\n if (sd == null) {\r\n external = false;\r\n wpr = pr;\r\n } else {\r\n wpr = sd;\r\n }\r\n\r\n t = new Ctor(0.03125);\r\n\r\n // while abs(x) >= 0.1\r\n while (x.e > -2) {\r\n\r\n // x = x / 2^5\r\n x = x.times(t);\r\n k += 5;\r\n }\r\n\r\n // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision\r\n // necessary to ensure the first 4 rounding digits are correct.\r\n guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;\r\n wpr += guard;\r\n denominator = pow = sum = new Ctor(1);\r\n Ctor.precision = wpr;\r\n\r\n for (;;) {\r\n pow = finalise(pow.times(x), wpr, 1);\r\n denominator = denominator.times(++i);\r\n t = sum.plus(divide(pow, denominator, wpr, 1));\r\n\r\n if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {\r\n j = k;\r\n while (j--) sum = finalise(sum.times(sum), wpr, 1);\r\n\r\n // Check to see if the first 4 rounding digits are [49]999.\r\n // If so, repeat the summation with a higher precision, otherwise\r\n // e.g. with precision: 18, rounding: 1\r\n // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)\r\n // `wpr - guard` is the index of first rounding digit.\r\n if (sd == null) {\r\n\r\n if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {\r\n Ctor.precision = wpr += 10;\r\n denominator = pow = t = new Ctor(1);\r\n i = 0;\r\n rep++;\r\n } else {\r\n return finalise(sum, Ctor.precision = pr, rm, external = true);\r\n }\r\n } else {\r\n Ctor.precision = pr;\r\n return sum;\r\n }\r\n }\r\n\r\n sum = t;\r\n }\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant\r\n * digits.\r\n *\r\n * ln(-n) = NaN\r\n * ln(0) = -Infinity\r\n * ln(-0) = -Infinity\r\n * ln(1) = 0\r\n * ln(Infinity) = Infinity\r\n * ln(-Infinity) = NaN\r\n * ln(NaN) = NaN\r\n *\r\n * ln(n) (n != 1) is non-terminating.\r\n *\r\n */\r\nfunction naturalLogarithm(y, sd) {\r\n var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,\r\n n = 1,\r\n guard = 10,\r\n x = y,\r\n xd = x.d,\r\n Ctor = x.constructor,\r\n rm = Ctor.rounding,\r\n pr = Ctor.precision;\r\n\r\n // Is x negative or Infinity, NaN, 0 or 1?\r\n if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {\r\n return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);\r\n }\r\n\r\n if (sd == null) {\r\n external = false;\r\n wpr = pr;\r\n } else {\r\n wpr = sd;\r\n }\r\n\r\n Ctor.precision = wpr += guard;\r\n c = digitsToString(xd);\r\n c0 = c.charAt(0);\r\n\r\n if (Math.abs(e = x.e) < 1.5e15) {\r\n\r\n // Argument reduction.\r\n // The series converges faster the closer the argument is to 1, so using\r\n // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b\r\n // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,\r\n // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can\r\n // later be divided by this number, then separate out the power of 10 using\r\n // ln(a*10^b) = ln(a) + b*ln(10).\r\n\r\n // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).\r\n //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {\r\n // max n is 6 (gives 0.7 - 1.3)\r\n while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {\r\n x = x.times(y);\r\n c = digitsToString(x.d);\r\n c0 = c.charAt(0);\r\n n++;\r\n }\r\n\r\n e = x.e;\r\n\r\n if (c0 > 1) {\r\n x = new Ctor('0.' + c);\r\n e++;\r\n } else {\r\n x = new Ctor(c0 + '.' + c.slice(1));\r\n }\r\n } else {\r\n\r\n // The argument reduction method above may result in overflow if the argument y is a massive\r\n // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this\r\n // function using ln(x*10^e) = ln(x) + e*ln(10).\r\n t = getLn10(Ctor, wpr + 2, pr).times(e + '');\r\n x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);\r\n Ctor.precision = pr;\r\n\r\n return sd == null ? finalise(x, pr, rm, external = true) : x;\r\n }\r\n\r\n // x1 is x reduced to a value near 1.\r\n x1 = x;\r\n\r\n // Taylor series.\r\n // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)\r\n // where x = (y - 1)/(y + 1) (|x| < 1)\r\n sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);\r\n x2 = finalise(x.times(x), wpr, 1);\r\n denominator = 3;\r\n\r\n for (;;) {\r\n numerator = finalise(numerator.times(x2), wpr, 1);\r\n t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));\r\n\r\n if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {\r\n sum = sum.times(2);\r\n\r\n // Reverse the argument reduction. Check that e is not 0 because, besides preventing an\r\n // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.\r\n if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));\r\n sum = divide(sum, new Ctor(n), wpr, 1);\r\n\r\n // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has\r\n // been repeated previously) and the first 4 rounding digits 9999?\r\n // If so, restart the summation with a higher precision, otherwise\r\n // e.g. with precision: 12, rounding: 1\r\n // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.\r\n // `wpr - guard` is the index of first rounding digit.\r\n if (sd == null) {\r\n if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {\r\n Ctor.precision = wpr += guard;\r\n t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);\r\n x2 = finalise(x.times(x), wpr, 1);\r\n denominator = rep = 1;\r\n } else {\r\n return finalise(sum, Ctor.precision = pr, rm, external = true);\r\n }\r\n } else {\r\n Ctor.precision = pr;\r\n return sum;\r\n }\r\n }\r\n\r\n sum = t;\r\n denominator += 2;\r\n }\r\n}\r\n\r\n\r\n// ±Infinity, NaN.\r\nfunction nonFiniteToString(x) {\r\n // Unsigned.\r\n return String(x.s * x.s / 0);\r\n}\r\n\r\n\r\n/*\r\n * Parse the value of a new Decimal `x` from string `str`.\r\n */\r\nfunction parseDecimal(x, str) {\r\n var e, i, len;\r\n\r\n // TODO BigInt str: no need to check for decimal point, exponential form or leading zeros.\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(len - 1) === 48; --len);\r\n str = str.slice(i, len);\r\n\r\n if (str) {\r\n len -= i;\r\n x.e = e = e - i - 1;\r\n x.d = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first word of the digits array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE;\r\n\r\n if (i < len) {\r\n if (i) x.d.push(+str.slice(0, i));\r\n for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--;) str += '0';\r\n x.d.push(+str);\r\n\r\n if (external) {\r\n\r\n // Overflow?\r\n if (x.e > x.constructor.maxE) {\r\n\r\n // Infinity.\r\n x.d = null;\r\n x.e = NaN;\r\n\r\n // Underflow?\r\n } else if (x.e < x.constructor.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n // x.constructor.underflow = true;\r\n } // else x.constructor.underflow = false;\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.\r\n */\r\nfunction parseOther(x, str) {\r\n var base, Ctor, divisor, i, isFloat, len, p, xd, xe;\r\n\r\n if (str.indexOf('_') > -1) {\r\n str = str.replace(/(\\d)_(?=\\d)/g, '$1');\r\n if (isDecimal.test(str)) return parseDecimal(x, str);\r\n } else if (str === 'Infinity' || str === 'NaN') {\r\n if (!+str) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return x;\r\n }\r\n\r\n if (isHex.test(str)) {\r\n base = 16;\r\n str = str.toLowerCase();\r\n } else if (isBinary.test(str)) {\r\n base = 2;\r\n } else if (isOctal.test(str)) {\r\n base = 8;\r\n } else {\r\n throw Error(invalidArgument + str);\r\n }\r\n\r\n // Is there a binary exponent part?\r\n i = str.search(/p/i);\r\n\r\n if (i > 0) {\r\n p = +str.slice(i + 1);\r\n str = str.substring(2, i);\r\n } else {\r\n str = str.slice(2);\r\n }\r\n\r\n // Convert `str` as an integer then divide the result by `base` raised to a power such that the\r\n // fraction part will be restored.\r\n i = str.indexOf('.');\r\n isFloat = i >= 0;\r\n Ctor = x.constructor;\r\n\r\n if (isFloat) {\r\n str = str.replace('.', '');\r\n len = str.length;\r\n i = len - i;\r\n\r\n // log[10](16) = 1.2041... , log[10](88) = 1.9444....\r\n divisor = intPow(Ctor, new Ctor(base), i, i * 2);\r\n }\r\n\r\n xd = convertBase(str, base, BASE);\r\n xe = xd.length - 1;\r\n\r\n // Remove trailing zeros.\r\n for (i = xe; xd[i] === 0; --i) xd.pop();\r\n if (i < 0) return new Ctor(x.s * 0);\r\n x.e = getBase10Exponent(xd, xe);\r\n x.d = xd;\r\n external = false;\r\n\r\n // At what precision to perform the division to ensure exact conversion?\r\n // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)\r\n // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412\r\n // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.\r\n // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount\r\n // Therefore using 4 * the number of digits of str will always be enough.\r\n if (isFloat) x = divide(x, divisor, len * 4);\r\n\r\n // Multiply by the binary exponent part if present.\r\n if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p));\r\n external = true;\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * sin(x) = x - x^3/3! + x^5/5! - ...\r\n * |x| < pi/2\r\n *\r\n */\r\nfunction sine(Ctor, x) {\r\n var k,\r\n len = x.d.length;\r\n\r\n if (len < 3) {\r\n return x.isZero() ? x : taylorSeries(Ctor, 2, x, x);\r\n }\r\n\r\n // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)\r\n // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)\r\n // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n k = 1.4 * Math.sqrt(len);\r\n k = k > 16 ? 16 : k | 0;\r\n\r\n x = x.times(1 / tinyPow(5, k));\r\n x = taylorSeries(Ctor, 2, x, x);\r\n\r\n // Reverse argument reduction\r\n var sin2_x,\r\n d5 = new Ctor(5),\r\n d16 = new Ctor(16),\r\n d20 = new Ctor(20);\r\n for (; k--;) {\r\n sin2_x = x.times(x);\r\n x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n// Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.\r\nfunction taylorSeries(Ctor, n, x, y, isHyperbolic) {\r\n var j, t, u, x2,\r\n i = 1,\r\n pr = Ctor.precision,\r\n k = Math.ceil(pr / LOG_BASE);\r\n\r\n external = false;\r\n x2 = x.times(x);\r\n u = new Ctor(y);\r\n\r\n for (;;) {\r\n t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);\r\n u = isHyperbolic ? y.plus(t) : y.minus(t);\r\n y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);\r\n t = u.plus(y);\r\n\r\n if (t.d[k] !== void 0) {\r\n for (j = k; t.d[j] === u.d[j] && j--;);\r\n if (j == -1) break;\r\n }\r\n\r\n j = u;\r\n u = y;\r\n y = t;\r\n t = j;\r\n i++;\r\n }\r\n\r\n external = true;\r\n t.d.length = k + 1;\r\n\r\n return t;\r\n}\r\n\r\n\r\n// Exponent e must be positive and non-zero.\r\nfunction tinyPow(b, e) {\r\n var n = b;\r\n while (--e) n *= b;\r\n return n;\r\n}\r\n\r\n\r\n// Return the absolute value of `x` reduced to less than or equal to half pi.\r\nfunction toLessThanHalfPi(Ctor, x) {\r\n var t,\r\n isNeg = x.s < 0,\r\n pi = getPi(Ctor, Ctor.precision, 1),\r\n halfPi = pi.times(0.5);\r\n\r\n x = x.abs();\r\n\r\n if (x.lte(halfPi)) {\r\n quadrant = isNeg ? 4 : 1;\r\n return x;\r\n }\r\n\r\n t = x.divToInt(pi);\r\n\r\n if (t.isZero()) {\r\n quadrant = isNeg ? 3 : 2;\r\n } else {\r\n x = x.minus(t.times(pi));\r\n\r\n // 0 <= x < pi\r\n if (x.lte(halfPi)) {\r\n quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);\r\n return x;\r\n }\r\n\r\n quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);\r\n }\r\n\r\n return x.minus(pi).abs();\r\n}\r\n\r\n\r\n/*\r\n * Return the value of Decimal `x` as a string in base `baseOut`.\r\n *\r\n * If the optional `sd` argument is present include a binary exponent suffix.\r\n */\r\nfunction toStringBinary(x, baseOut, sd, rm) {\r\n var base, e, i, k, len, roundUp, str, xd, y,\r\n Ctor = x.constructor,\r\n isExp = sd !== void 0;\r\n\r\n if (isExp) {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n } else {\r\n sd = Ctor.precision;\r\n rm = Ctor.rounding;\r\n }\r\n\r\n if (!x.isFinite()) {\r\n str = nonFiniteToString(x);\r\n } else {\r\n str = finiteToString(x);\r\n i = str.indexOf('.');\r\n\r\n // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:\r\n // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))\r\n // minBinaryExponent = floor(decimalExponent * log[2](10))\r\n // log[2](10) = 3.321928094887362347870319429489390175864\r\n\r\n if (isExp) {\r\n base = 2;\r\n if (baseOut == 16) {\r\n sd = sd * 4 - 3;\r\n } else if (baseOut == 8) {\r\n sd = sd * 3 - 2;\r\n }\r\n } else {\r\n base = baseOut;\r\n }\r\n\r\n // Convert the number as an integer then divide the result by its base raised to a power such\r\n // that the fraction part will be restored.\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n str = str.replace('.', '');\r\n y = new Ctor(1);\r\n y.e = str.length - i;\r\n y.d = convertBase(finiteToString(y), 10, base);\r\n y.e = y.d.length;\r\n }\r\n\r\n xd = convertBase(str, 10, base);\r\n e = len = xd.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xd[--len] == 0;) xd.pop();\r\n\r\n if (!xd[0]) {\r\n str = isExp ? '0p+0' : '0';\r\n } else {\r\n if (i < 0) {\r\n e--;\r\n } else {\r\n x = new Ctor(x);\r\n x.d = xd;\r\n x.e = e;\r\n x = divide(x, y, sd, rm, 0, base);\r\n xd = x.d;\r\n e = x.e;\r\n roundUp = inexact;\r\n }\r\n\r\n // The rounding digit, i.e. the digit after the digit that may be rounded up.\r\n i = xd[sd];\r\n k = base / 2;\r\n roundUp = roundUp || xd[sd + 1] !== void 0;\r\n\r\n roundUp = rm < 4\r\n ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))\r\n : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||\r\n rm === (x.s < 0 ? 8 : 7));\r\n\r\n xd.length = sd;\r\n\r\n if (roundUp) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (; ++xd[--sd] > base - 1;) {\r\n xd[sd] = 0;\r\n if (!sd) {\r\n ++e;\r\n xd.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (len = xd.length; !xd[len - 1]; --len);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);\r\n\r\n // Add binary exponent suffix?\r\n if (isExp) {\r\n if (len > 1) {\r\n if (baseOut == 16 || baseOut == 8) {\r\n i = baseOut == 16 ? 4 : 3;\r\n for (--len; len % i; len++) str += '0';\r\n xd = convertBase(str, base, baseOut);\r\n for (len = xd.length; !xd[len - 1]; --len);\r\n\r\n // xd[0] will always be be 1\r\n for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);\r\n } else {\r\n str = str.charAt(0) + '.' + str.slice(1);\r\n }\r\n }\r\n\r\n str = str + (e < 0 ? 'p' : 'p+') + e;\r\n } else if (e < 0) {\r\n for (; ++e;) str = '0' + str;\r\n str = '0.' + str;\r\n } else {\r\n if (++e > len) for (e -= len; e-- ;) str += '0';\r\n else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);\r\n }\r\n }\r\n\r\n str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;\r\n }\r\n\r\n return x.s < 0 ? '-' + str : str;\r\n}\r\n\r\n\r\n// Does not strip trailing zeros.\r\nfunction truncate(arr, len) {\r\n if (arr.length > len) {\r\n arr.length = len;\r\n return true;\r\n }\r\n}\r\n\r\n\r\n// Decimal methods\r\n\r\n\r\n/*\r\n * abs\r\n * acos\r\n * acosh\r\n * add\r\n * asin\r\n * asinh\r\n * atan\r\n * atanh\r\n * atan2\r\n * cbrt\r\n * ceil\r\n * clamp\r\n * clone\r\n * config\r\n * cos\r\n * cosh\r\n * div\r\n * exp\r\n * floor\r\n * hypot\r\n * ln\r\n * log\r\n * log2\r\n * log10\r\n * max\r\n * min\r\n * mod\r\n * mul\r\n * pow\r\n * random\r\n * round\r\n * set\r\n * sign\r\n * sin\r\n * sinh\r\n * sqrt\r\n * sub\r\n * sum\r\n * tan\r\n * tanh\r\n * trunc\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the absolute value of `x`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction abs(x) {\r\n return new this(x).abs();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arccosine in radians of `x`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction acos(x) {\r\n return new this(x).acos();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction acosh(x) {\r\n return new this(x).acosh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction add(x, y) {\r\n return new this(x).plus(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction asin(x) {\r\n return new this(x).asin();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction asinh(x) {\r\n return new this(x).asinh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction atan(x) {\r\n return new this(x).atan();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction atanh(x) {\r\n return new this(x).atanh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi\r\n * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-pi, pi]\r\n *\r\n * y {number|string|bigint|Decimal} The y-coordinate.\r\n * x {number|string|bigint|Decimal} The x-coordinate.\r\n *\r\n * atan2(±0, -0) = ±pi\r\n * atan2(±0, +0) = ±0\r\n * atan2(±0, -x) = ±pi for x > 0\r\n * atan2(±0, x) = ±0 for x > 0\r\n * atan2(-y, ±0) = -pi/2 for y > 0\r\n * atan2(y, ±0) = pi/2 for y > 0\r\n * atan2(±y, -Infinity) = ±pi for finite y > 0\r\n * atan2(±y, +Infinity) = ±0 for finite y > 0\r\n * atan2(±Infinity, x) = ±pi/2 for finite x\r\n * atan2(±Infinity, -Infinity) = ±3*pi/4\r\n * atan2(±Infinity, +Infinity) = ±pi/4\r\n * atan2(NaN, x) = NaN\r\n * atan2(y, NaN) = NaN\r\n *\r\n */\r\nfunction atan2(y, x) {\r\n y = new this(y);\r\n x = new this(x);\r\n var r,\r\n pr = this.precision,\r\n rm = this.rounding,\r\n wpr = pr + 4;\r\n\r\n // Either NaN\r\n if (!y.s || !x.s) {\r\n r = new this(NaN);\r\n\r\n // Both ±Infinity\r\n } else if (!y.d && !x.d) {\r\n r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);\r\n r.s = y.s;\r\n\r\n // x is ±Infinity or y is ±0\r\n } else if (!x.d || y.isZero()) {\r\n r = x.s < 0 ? getPi(this, pr, rm) : new this(0);\r\n r.s = y.s;\r\n\r\n // y is ±Infinity or x is ±0\r\n } else if (!y.d || x.isZero()) {\r\n r = getPi(this, wpr, 1).times(0.5);\r\n r.s = y.s;\r\n\r\n // Both non-zero and finite\r\n } else if (x.s < 0) {\r\n this.precision = wpr;\r\n this.rounding = 1;\r\n r = this.atan(divide(y, x, wpr, 1));\r\n x = getPi(this, wpr, 1);\r\n this.precision = pr;\r\n this.rounding = rm;\r\n r = y.s < 0 ? r.minus(x) : r.plus(x);\r\n } else {\r\n r = this.atan(divide(y, x, wpr, 1));\r\n }\r\n\r\n return r;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction cbrt(x) {\r\n return new this(x).cbrt();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction ceil(x) {\r\n return finalise(x = new this(x), x.e + 1, 2);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * min {number|string|bigint|Decimal}\r\n * max {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction clamp(x, min, max) {\r\n return new this(x).clamp(min, max);\r\n}\r\n\r\n\r\n/*\r\n * Configure global settings for a Decimal constructor.\r\n *\r\n * `obj` is an object with one or more of the following properties,\r\n *\r\n * precision {number}\r\n * rounding {number}\r\n * toExpNeg {number}\r\n * toExpPos {number}\r\n * maxE {number}\r\n * minE {number}\r\n * modulo {number}\r\n * crypto {boolean|number}\r\n * defaults {true}\r\n *\r\n * E.g. Decimal.config({ precision: 20, rounding: 4 })\r\n *\r\n */\r\nfunction config(obj) {\r\n if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');\r\n var i, p, v,\r\n useDefaults = obj.defaults === true,\r\n ps = [\r\n 'precision', 1, MAX_DIGITS,\r\n 'rounding', 0, 8,\r\n 'toExpNeg', -EXP_LIMIT, 0,\r\n 'toExpPos', 0, EXP_LIMIT,\r\n 'maxE', 0, EXP_LIMIT,\r\n 'minE', -EXP_LIMIT, 0,\r\n 'modulo', 0, 9\r\n ];\r\n\r\n for (i = 0; i < ps.length; i += 3) {\r\n if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];\r\n if ((v = obj[p]) !== void 0) {\r\n if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;\r\n else throw Error(invalidArgument + p + ': ' + v);\r\n }\r\n }\r\n\r\n if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];\r\n if ((v = obj[p]) !== void 0) {\r\n if (v === true || v === false || v === 0 || v === 1) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n this[p] = true;\r\n } else {\r\n throw Error(cryptoUnavailable);\r\n }\r\n } else {\r\n this[p] = false;\r\n }\r\n } else {\r\n throw Error(invalidArgument + p + ': ' + v);\r\n }\r\n }\r\n\r\n return this;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction cos(x) {\r\n return new this(x).cos();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction cosh(x) {\r\n return new this(x).cosh();\r\n}\r\n\r\n\r\n/*\r\n * Create and return a Decimal constructor with the same configuration properties as this Decimal\r\n * constructor.\r\n *\r\n */\r\nfunction clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * v {number|string|bigint|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(v) {\r\n var e, i, t,\r\n x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n if (isDecimalInstance(v)) {\r\n x.s = v.s;\r\n\r\n if (external) {\r\n if (!v.d || v.e > Decimal.maxE) {\r\n\r\n // Infinity.\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (v.e < Decimal.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d.slice();\r\n }\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d ? v.d.slice() : v.d;\r\n }\r\n\r\n return;\r\n }\r\n\r\n t = typeof v;\r\n\r\n if (t === 'number') {\r\n if (v === 0) {\r\n x.s = 1 / v < 0 ? -1 : 1;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (v === ~~v && v < 1e7) {\r\n for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n\r\n if (external) {\r\n if (e > Decimal.maxE) {\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (e < Decimal.minE) {\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n // Infinity or NaN?\r\n if (v * 0 !== 0) {\r\n if (!v) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n }\r\n\r\n if (t === 'string') {\r\n if ((i = v.charCodeAt(0)) === 45) { // minus sign\r\n v = v.slice(1);\r\n x.s = -1;\r\n } else {\r\n if (i === 43) v = v.slice(1); // plus sign\r\n x.s = 1;\r\n }\r\n\r\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n }\r\n\r\n if (t === 'bigint') {\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n }\r\n\r\n throw Error(invalidArgument + v);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n Decimal.EUCLID = 9;\r\n\r\n Decimal.config = Decimal.set = config;\r\n Decimal.clone = clone;\r\n Decimal.isDecimal = isDecimalInstance;\r\n\r\n Decimal.abs = abs;\r\n Decimal.acos = acos;\r\n Decimal.acosh = acosh; // ES6\r\n Decimal.add = add;\r\n Decimal.asin = asin;\r\n Decimal.asinh = asinh; // ES6\r\n Decimal.atan = atan;\r\n Decimal.atanh = atanh; // ES6\r\n Decimal.atan2 = atan2;\r\n Decimal.cbrt = cbrt; // ES6\r\n Decimal.ceil = ceil;\r\n Decimal.clamp = clamp;\r\n Decimal.cos = cos;\r\n Decimal.cosh = cosh; // ES6\r\n Decimal.div = div;\r\n Decimal.exp = exp;\r\n Decimal.floor = floor;\r\n Decimal.hypot = hypot; // ES6\r\n Decimal.ln = ln;\r\n Decimal.log = log;\r\n Decimal.log10 = log10; // ES6\r\n Decimal.log2 = log2; // ES6\r\n Decimal.max = max;\r\n Decimal.min = min;\r\n Decimal.mod = mod;\r\n Decimal.mul = mul;\r\n Decimal.pow = pow;\r\n Decimal.random = random;\r\n Decimal.round = round;\r\n Decimal.sign = sign; // ES6\r\n Decimal.sin = sin;\r\n Decimal.sinh = sinh; // ES6\r\n Decimal.sqrt = sqrt;\r\n Decimal.sub = sub;\r\n Decimal.sum = sum;\r\n Decimal.tan = tan;\r\n Decimal.tanh = tanh; // ES6\r\n Decimal.trunc = trunc; // ES6\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n if (obj.defaults !== true) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction div(x, y) {\r\n return new this(x).div(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} The power to which to raise the base of the natural log.\r\n *\r\n */\r\nfunction exp(x) {\r\n return new this(x).exp();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction floor(x) {\r\n return finalise(x = new this(x), x.e + 1, 3);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,\r\n * rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction hypot() {\r\n var i, n,\r\n t = new this(0);\r\n\r\n external = false;\r\n\r\n for (i = 0; i < arguments.length;) {\r\n n = new this(arguments[i++]);\r\n if (!n.d) {\r\n if (n.s) {\r\n external = true;\r\n return new this(1 / 0);\r\n }\r\n t = n;\r\n } else if (t.d) {\r\n t = t.plus(n.times(n));\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return t.sqrt();\r\n}\r\n\r\n\r\n/*\r\n * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),\r\n * otherwise return false.\r\n *\r\n */\r\nfunction isDecimalInstance(obj) {\r\n return obj instanceof Decimal || obj && obj.toStringTag === tag || false;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction ln(x) {\r\n return new this(x).ln();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base\r\n * is specified, rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * log[y](x)\r\n *\r\n * x {number|string|bigint|Decimal} The argument of the logarithm.\r\n * y {number|string|bigint|Decimal} The base of the logarithm.\r\n *\r\n */\r\nfunction log(x, y) {\r\n return new this(x).log(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction log2(x) {\r\n return new this(x).log(2);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction log10(x) {\r\n return new this(x).log(10);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction max() {\r\n return maxOrMin(this, arguments, -1);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction min() {\r\n return maxOrMin(this, arguments, 1);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction mod(x, y) {\r\n return new this(x).mod(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction mul(x, y) {\r\n return new this(x).mul(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} The base.\r\n * y {number|string|bigint|Decimal} The exponent.\r\n *\r\n */\r\nfunction pow(x, y) {\r\n return new this(x).pow(y);\r\n}\r\n\r\n\r\n/*\r\n * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with\r\n * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros\r\n * are produced).\r\n *\r\n * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.\r\n *\r\n */\r\nfunction random(sd) {\r\n var d, e, k, n,\r\n i = 0,\r\n r = new this(1),\r\n rd = [];\r\n\r\n if (sd === void 0) sd = this.precision;\r\n else checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n k = Math.ceil(sd / LOG_BASE);\r\n\r\n if (!this.crypto) {\r\n for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n } else if (crypto.getRandomValues) {\r\n d = crypto.getRandomValues(new Uint32Array(k));\r\n\r\n for (; i < k;) {\r\n n = d[i];\r\n\r\n // 0 <= n < 4294967296\r\n // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).\r\n if (n >= 4.29e9) {\r\n d[i] = crypto.getRandomValues(new Uint32Array(1))[0];\r\n } else {\r\n\r\n // 0 <= n <= 4289999999\r\n // 0 <= (n % 1e7) <= 9999999\r\n rd[i++] = n % 1e7;\r\n }\r\n }\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n d = crypto.randomBytes(k *= 4);\r\n\r\n for (; i < k;) {\r\n\r\n // 0 <= n < 2147483648\r\n n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);\r\n\r\n // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).\r\n if (n >= 2.14e9) {\r\n crypto.randomBytes(4).copy(d, i);\r\n } else {\r\n\r\n // 0 <= n <= 2139999999\r\n // 0 <= (n % 1e7) <= 9999999\r\n rd.push(n % 1e7);\r\n i += 4;\r\n }\r\n }\r\n\r\n i = k / 4;\r\n } else {\r\n throw Error(cryptoUnavailable);\r\n }\r\n\r\n k = rd[--i];\r\n sd %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to sd.\r\n if (k && sd) {\r\n n = mathpow(10, LOG_BASE - sd);\r\n rd[i] = (k / n | 0) * n;\r\n }\r\n\r\n // Remove trailing words which are zero.\r\n for (; rd[i] === 0; i--) rd.pop();\r\n\r\n // Zero?\r\n if (i < 0) {\r\n e = 0;\r\n rd = [0];\r\n } else {\r\n e = -1;\r\n\r\n // Remove leading words which are zero and adjust exponent accordingly.\r\n for (; rd[0] === 0; e -= LOG_BASE) rd.shift();\r\n\r\n // Count the digits of the first word of rd to determine leading zeros.\r\n for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;\r\n\r\n // Adjust the exponent for leading zeros of the first word of rd.\r\n if (k < LOG_BASE) e -= LOG_BASE - k;\r\n }\r\n\r\n r.e = e;\r\n r.d = rd;\r\n\r\n return r;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.\r\n *\r\n * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction round(x) {\r\n return finalise(x = new this(x), x.e + 1, this.rounding);\r\n}\r\n\r\n\r\n/*\r\n * Return\r\n * 1 if x > 0,\r\n * -1 if x < 0,\r\n * 0 if x is 0,\r\n * -0 if x is -0,\r\n * NaN otherwise\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction sign(x) {\r\n x = new this(x);\r\n return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction sin(x) {\r\n return new this(x).sin();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction sinh(x) {\r\n return new this(x).sinh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction sqrt(x) {\r\n return new this(x).sqrt();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction sub(x, y) {\r\n return new this(x).sub(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sum of the arguments, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * Only the result is rounded, not the intermediate calculations.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction sum() {\r\n var i = 0,\r\n args = arguments,\r\n x = new this(args[i]);\r\n\r\n external = false;\r\n for (; x.s && ++i < args.length;) x = x.plus(args[i]);\r\n external = true;\r\n\r\n return finalise(x, this.precision, this.rounding);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction tan(x) {\r\n return new this(x).tan();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction tanh(x) {\r\n return new this(x).tanh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` truncated to an integer.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction trunc(x) {\r\n return finalise(x = new this(x), x.e + 1, 1);\r\n}\r\n\r\n\r\nP[Symbol.for('nodejs.util.inspect.custom')] = P.toString;\r\nP[Symbol.toStringTag] = 'Decimal';\r\n\r\n// Create and configure initial Decimal constructor.\r\nexport var Decimal = P.constructor = clone(DEFAULTS);\r\n\r\n// Create the internal constants from their string values.\r\nLN10 = new Decimal(LN10);\r\nPI = new Decimal(PI);\r\n\r\nexport default Decimal;\r\n","import Decimal from 'decimal.js';\nimport { factory } from '../../utils/factory.js';\nvar name = 'BigNumber';\nvar dependencies = ['?on', 'config'];\nexport var createBigNumberClass = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n on,\n config\n } = _ref;\n var BigNumber = Decimal.clone({\n precision: config.precision,\n modulo: Decimal.EUCLID\n });\n BigNumber.prototype = Object.create(BigNumber.prototype);\n\n /**\n * Attach type information\n */\n BigNumber.prototype.type = 'BigNumber';\n BigNumber.prototype.isBigNumber = true;\n\n /**\n * Get a JSON representation of a BigNumber containing\n * type information\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"BigNumber\", \"value\": \"0.2\"}`\n */\n BigNumber.prototype.toJSON = function () {\n return {\n mathjs: 'BigNumber',\n value: this.toString()\n };\n };\n\n /**\n * Instantiate a BigNumber from a JSON object\n * @param {Object} json a JSON object structured as:\n * `{\"mathjs\": \"BigNumber\", \"value\": \"0.2\"}`\n * @return {BigNumber}\n */\n BigNumber.fromJSON = function (json) {\n return new BigNumber(json.value);\n };\n if (on) {\n // listen for changed in the configuration, automatically apply changed precision\n on('config', function (curr, prev) {\n if (curr.precision !== prev.precision) {\n BigNumber.config({\n precision: curr.precision\n });\n }\n });\n }\n return BigNumber;\n}, {\n isClass: true\n});","'use strict';\n\n/**\n *\n * This class allows the manipulation of complex numbers.\n * You can pass a complex number in different formats. Either as object, double, string or two integer parameters.\n *\n * Object form\n * { re: , im: }\n * { arg: , abs: }\n * { phi: , r: }\n *\n * Array / Vector form\n * [ real, imaginary ]\n *\n * Double form\n * 99.3 - Single double value\n *\n * String form\n * '23.1337' - Simple real number\n * '15+3i' - a simple complex number\n * '3-i' - a simple complex number\n *\n * Example:\n *\n * const c = new Complex('99.3+8i');\n * c.mul({r: 3, i: 9}).div(4.9).sub(3, 2);\n *\n */\n\n\nconst cosh = Math.cosh || function (x) {\n return Math.abs(x) < 1e-9 ? 1 - x : (Math.exp(x) + Math.exp(-x)) * 0.5;\n};\n\nconst sinh = Math.sinh || function (x) {\n return Math.abs(x) < 1e-9 ? x : (Math.exp(x) - Math.exp(-x)) * 0.5;\n};\n\n/**\n * Calculates cos(x) - 1 using Taylor series if x is small (-¼π ≤ x ≤ ¼π).\n *\n * @param {number} x\n * @returns {number} cos(x) - 1\n */\nconst cosm1 = function (x) {\n\n const b = Math.PI / 4;\n if (-b > x || x > b) {\n return Math.cos(x) - 1.0;\n }\n\n /* Calculate horner form of polynomial of taylor series in Q\n let fac = 1, alt = 1, pol = {};\n for (let i = 0; i <= 16; i++) {\n fac*= i || 1;\n if (i % 2 == 0) {\n pol[i] = new Fraction(1, alt * fac);\n alt = -alt;\n }\n }\n console.log(new Polynomial(pol).toHorner()); // (((((((1/20922789888000x^2-1/87178291200)x^2+1/479001600)x^2-1/3628800)x^2+1/40320)x^2-1/720)x^2+1/24)x^2-1/2)x^2+1\n */\n\n const xx = x * x;\n return xx * (\n xx * (\n xx * (\n xx * (\n xx * (\n xx * (\n xx * (\n xx / 20922789888000\n - 1 / 87178291200)\n + 1 / 479001600)\n - 1 / 3628800)\n + 1 / 40320)\n - 1 / 720)\n + 1 / 24)\n - 1 / 2);\n};\n\nconst hypot = function (x, y) {\n\n x = Math.abs(x);\n y = Math.abs(y);\n\n // Ensure `x` is the larger value\n if (x < y) [x, y] = [y, x];\n\n // If both are below the threshold, use straightforward Pythagoras\n if (x < 1e8) return Math.sqrt(x * x + y * y);\n\n // For larger values, scale to avoid overflow\n y /= x;\n return x * Math.sqrt(1 + y * y);\n};\n\nconst parser_exit = function () {\n throw SyntaxError('Invalid Param');\n};\n\n/**\n * Calculates log(sqrt(a^2+b^2)) in a way to avoid overflows\n *\n * @param {number} a\n * @param {number} b\n * @returns {number}\n */\nfunction logHypot(a, b) {\n\n const _a = Math.abs(a);\n const _b = Math.abs(b);\n\n if (a === 0) {\n return Math.log(_b);\n }\n\n if (b === 0) {\n return Math.log(_a);\n }\n\n if (_a < 3000 && _b < 3000) {\n return Math.log(a * a + b * b) * 0.5;\n }\n\n /* I got 4 ideas to compute this property without overflow:\n *\n * Testing 1000000 times with random samples for a,b ∈ [1, 1000000000] against a big decimal library to get an error estimate\n *\n * 1. Only eliminate the square root: (OVERALL ERROR: 3.9122483030951116e-11)\n\n Math.log(a * a + b * b) / 2\n\n *\n *\n * 2. Try to use the non-overflowing pythagoras: (OVERALL ERROR: 8.889760039210159e-10)\n\n const fn = function(a, b) {\n a = Math.abs(a);\n b = Math.abs(b);\n let t = Math.min(a, b);\n a = Math.max(a, b);\n t = t / a;\n\n return Math.log(a) + Math.log(1 + t * t) / 2;\n };\n\n * 3. Abuse the identity cos(atan(y/x) = x / sqrt(x^2+y^2): (OVERALL ERROR: 3.4780178737037204e-10)\n\n Math.log(a / Math.cos(Math.atan2(b, a)))\n\n * 4. Use 3. and apply log rules: (OVERALL ERROR: 1.2014087502620896e-9)\n\n Math.log(a) - Math.log(Math.cos(Math.atan2(b, a)))\n\n */\n\n a = a * 0.5;\n b = b * 0.5;\n\n return 0.5 * Math.log(a * a + b * b) + Math.LN2;\n}\n\nconst P = { 're': 0, 'im': 0 };\nconst parse = function (a, b) {\n\n const z = P;\n\n if (a === undefined || a === null) {\n z['re'] =\n z['im'] = 0;\n } else if (b !== undefined) {\n z['re'] = a;\n z['im'] = b;\n } else\n switch (typeof a) {\n\n case 'object':\n\n if ('im' in a && 're' in a) {\n z['re'] = a['re'];\n z['im'] = a['im'];\n } else if ('abs' in a && 'arg' in a) {\n if (!isFinite(a['abs']) && isFinite(a['arg'])) {\n return Complex['INFINITY'];\n }\n z['re'] = a['abs'] * Math.cos(a['arg']);\n z['im'] = a['abs'] * Math.sin(a['arg']);\n } else if ('r' in a && 'phi' in a) {\n if (!isFinite(a['r']) && isFinite(a['phi'])) {\n return Complex['INFINITY'];\n }\n z['re'] = a['r'] * Math.cos(a['phi']);\n z['im'] = a['r'] * Math.sin(a['phi']);\n } else if (a.length === 2) { // Quick array check\n z['re'] = a[0];\n z['im'] = a[1];\n } else {\n parser_exit();\n }\n break;\n\n case 'string':\n\n z['im'] = /* void */\n z['re'] = 0;\n\n const tokens = a.replace(/_/g, '')\n .match(/\\d+\\.?\\d*e[+-]?\\d+|\\d+\\.?\\d*|\\.\\d+|./g);\n let plus = 1;\n let minus = 0;\n\n if (tokens === null) {\n parser_exit();\n }\n\n for (let i = 0; i < tokens.length; i++) {\n\n const c = tokens[i];\n\n if (c === ' ' || c === '\\t' || c === '\\n') {\n /* void */\n } else if (c === '+') {\n plus++;\n } else if (c === '-') {\n minus++;\n } else if (c === 'i' || c === 'I') {\n\n if (plus + minus === 0) {\n parser_exit();\n }\n\n if (tokens[i + 1] !== ' ' && !isNaN(tokens[i + 1])) {\n z['im'] += parseFloat((minus % 2 ? '-' : '') + tokens[i + 1]);\n i++;\n } else {\n z['im'] += parseFloat((minus % 2 ? '-' : '') + '1');\n }\n plus = minus = 0;\n\n } else {\n\n if (plus + minus === 0 || isNaN(c)) {\n parser_exit();\n }\n\n if (tokens[i + 1] === 'i' || tokens[i + 1] === 'I') {\n z['im'] += parseFloat((minus % 2 ? '-' : '') + c);\n i++;\n } else {\n z['re'] += parseFloat((minus % 2 ? '-' : '') + c);\n }\n plus = minus = 0;\n }\n }\n\n // Still something on the stack\n if (plus + minus > 0) {\n parser_exit();\n }\n break;\n\n case 'number':\n z['im'] = 0;\n z['re'] = a;\n break;\n\n default:\n parser_exit();\n }\n\n if (isNaN(z['re']) || isNaN(z['im'])) {\n // If a calculation is NaN, we treat it as NaN and don't throw\n //parser_exit();\n }\n\n return z;\n};\n\n/**\n * @constructor\n * @returns {Complex}\n */\nfunction Complex(a, b) {\n\n if (!(this instanceof Complex)) {\n return new Complex(a, b);\n }\n\n const z = parse(a, b);\n\n this['re'] = z['re'];\n this['im'] = z['im'];\n}\n\nComplex.prototype = {\n\n 're': 0,\n 'im': 0,\n\n /**\n * Calculates the sign of a complex number, which is a normalized complex\n *\n * @returns {Complex}\n */\n 'sign': function () {\n\n const abs = hypot(this['re'], this['im']);\n\n return new Complex(\n this['re'] / abs,\n this['im'] / abs);\n },\n\n /**\n * Adds two complex numbers\n *\n * @returns {Complex}\n */\n 'add': function (a, b) {\n\n const z = parse(a, b);\n\n const tInfin = this['isInfinite']();\n const zInfin = !(isFinite(z['re']) && isFinite(z['im']));\n\n if (tInfin || zInfin) {\n\n if (tInfin && zInfin) {\n // Infinity + Infinity = NaN\n return Complex['NAN'];\n }\n // Infinity + z = Infinity { where z != Infinity }\n return Complex['INFINITY'];\n }\n\n return new Complex(\n this['re'] + z['re'],\n this['im'] + z['im']);\n },\n\n /**\n * Subtracts two complex numbers\n *\n * @returns {Complex}\n */\n 'sub': function (a, b) {\n\n const z = parse(a, b);\n\n const tInfin = this['isInfinite']();\n const zInfin = !(isFinite(z['re']) && isFinite(z['im']));\n\n if (tInfin || zInfin) {\n\n if (tInfin && zInfin) {\n // Infinity - Infinity = NaN\n return Complex['NAN'];\n }\n // Infinity - z = Infinity { where z != Infinity }\n return Complex['INFINITY'];\n }\n\n return new Complex(\n this['re'] - z['re'],\n this['im'] - z['im']);\n },\n\n /**\n * Multiplies two complex numbers\n *\n * @returns {Complex}\n */\n 'mul': function (a, b) {\n\n const z = parse(a, b);\n\n const tInfin = this['isInfinite']();\n const zInfin = !(isFinite(z['re']) && isFinite(z['im']));\n const tIsZero = this['re'] === 0 && this['im'] === 0;\n const zIsZero = z['re'] === 0 && z['im'] === 0;\n\n // Infinity * 0 = NaN\n if (tInfin && zIsZero || zInfin && tIsZero) {\n return Complex['NAN'];\n }\n\n // Infinity * z = Infinity { where z != 0 }\n if (tInfin || zInfin) {\n return Complex['INFINITY'];\n }\n\n // Shortcut for real values\n if (z['im'] === 0 && this['im'] === 0) {\n return new Complex(this['re'] * z['re'], 0);\n }\n\n return new Complex(\n this['re'] * z['re'] - this['im'] * z['im'],\n this['re'] * z['im'] + this['im'] * z['re']);\n },\n\n /**\n * Divides two complex numbers\n *\n * @returns {Complex}\n */\n 'div': function (a, b) {\n\n const z = parse(a, b);\n\n const tInfin = this['isInfinite']();\n const zInfin = !(isFinite(z['re']) && isFinite(z['im']));\n const tIsZero = this['re'] === 0 && this['im'] === 0;\n const zIsZero = z['re'] === 0 && z['im'] === 0;\n\n // 0 / 0 = NaN and Infinity / Infinity = NaN\n if (tIsZero && zIsZero || tInfin && zInfin) {\n return Complex['NAN'];\n }\n\n // Infinity / 0 = Infinity\n if (zIsZero || tInfin) {\n return Complex['INFINITY'];\n }\n\n // 0 / Infinity = 0\n if (tIsZero || zInfin) {\n return Complex['ZERO'];\n }\n\n if (0 === z['im']) {\n // Divisor is real\n return new Complex(this['re'] / z['re'], this['im'] / z['re']);\n }\n\n if (Math.abs(z['re']) < Math.abs(z['im'])) {\n\n const x = z['re'] / z['im'];\n const t = z['re'] * x + z['im'];\n\n return new Complex(\n (this['re'] * x + this['im']) / t,\n (this['im'] * x - this['re']) / t);\n\n } else {\n\n const x = z['im'] / z['re'];\n const t = z['im'] * x + z['re'];\n\n return new Complex(\n (this['re'] + this['im'] * x) / t,\n (this['im'] - this['re'] * x) / t);\n }\n },\n\n /**\n * Calculate the power of two complex numbers\n *\n * @returns {Complex}\n */\n 'pow': function (a, b) {\n\n const z = parse(a, b);\n\n const tIsZero = this['re'] === 0 && this['im'] === 0;\n const zIsZero = z['re'] === 0 && z['im'] === 0;\n\n if (zIsZero) {\n return Complex['ONE'];\n }\n\n // If the exponent is real\n if (z['im'] === 0) {\n\n if (this['im'] === 0 && this['re'] > 0) {\n\n return new Complex(Math.pow(this['re'], z['re']), 0);\n\n } else if (this['re'] === 0) { // If base is fully imaginary\n\n switch ((z['re'] % 4 + 4) % 4) {\n case 0:\n return new Complex(Math.pow(this['im'], z['re']), 0);\n case 1:\n return new Complex(0, Math.pow(this['im'], z['re']));\n case 2:\n return new Complex(-Math.pow(this['im'], z['re']), 0);\n case 3:\n return new Complex(0, -Math.pow(this['im'], z['re']));\n }\n }\n }\n\n /* I couldn't find a good formula, so here is a derivation and optimization\n *\n * z_1^z_2 = (a + bi)^(c + di)\n * = exp((c + di) * log(a + bi)\n * = pow(a^2 + b^2, (c + di) / 2) * exp(i(c + di)atan2(b, a))\n * =>...\n * Re = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * cos(d * log(a^2 + b^2) / 2 + c * atan2(b, a))\n * Im = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * sin(d * log(a^2 + b^2) / 2 + c * atan2(b, a))\n *\n * =>...\n * Re = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * cos(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a))\n * Im = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * sin(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a))\n *\n * =>\n * Re = exp(c * logsq2 - d * arg(z_1)) * cos(d * logsq2 + c * arg(z_1))\n * Im = exp(c * logsq2 - d * arg(z_1)) * sin(d * logsq2 + c * arg(z_1))\n *\n */\n\n if (tIsZero && z['re'] > 0) { // Same behavior as Wolframalpha, Zero if real part is zero\n return Complex['ZERO'];\n }\n\n const arg = Math.atan2(this['im'], this['re']);\n const loh = logHypot(this['re'], this['im']);\n\n let re = Math.exp(z['re'] * loh - z['im'] * arg);\n let im = z['im'] * loh + z['re'] * arg;\n return new Complex(\n re * Math.cos(im),\n re * Math.sin(im));\n },\n\n /**\n * Calculate the complex square root\n *\n * @returns {Complex}\n */\n 'sqrt': function () {\n\n const a = this['re'];\n const b = this['im'];\n\n if (b === 0) {\n // Real number case\n if (a >= 0) {\n return new Complex(Math.sqrt(a), 0);\n } else {\n return new Complex(0, Math.sqrt(-a));\n }\n }\n\n const r = hypot(a, b);\n\n let re = Math.sqrt(0.5 * (r + Math.abs(a))); // sqrt(2x) / 2 = sqrt(x / 2)\n let im = Math.abs(b) / (2 * re);\n\n if (a >= 0) {\n return new Complex(re, b < 0 ? -im : im);\n } else {\n return new Complex(im, b < 0 ? -re : re);\n }\n },\n\n /**\n * Calculate the complex exponent\n *\n * @returns {Complex}\n */\n 'exp': function () {\n\n const er = Math.exp(this['re']);\n\n if (this['im'] === 0) {\n return new Complex(er, 0);\n }\n return new Complex(\n er * Math.cos(this['im']),\n er * Math.sin(this['im']));\n },\n\n /**\n * Calculate the complex exponent and subtracts one.\n *\n * This may be more accurate than `Complex(x).exp().sub(1)` if\n * `x` is small.\n *\n * @returns {Complex}\n */\n 'expm1': function () {\n\n /**\n * exp(a + i*b) - 1\n = exp(a) * (cos(b) + j*sin(b)) - 1\n = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b)\n */\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n Math.expm1(a) * Math.cos(b) + cosm1(b),\n Math.exp(a) * Math.sin(b));\n },\n\n /**\n * Calculate the natural log\n *\n * @returns {Complex}\n */\n 'log': function () {\n\n const a = this['re'];\n const b = this['im'];\n\n if (b === 0 && a > 0) {\n return new Complex(Math.log(a), 0);\n }\n\n return new Complex(\n logHypot(a, b),\n Math.atan2(b, a));\n },\n\n /**\n * Calculate the magnitude of the complex number\n *\n * @returns {number}\n */\n 'abs': function () {\n\n return hypot(this['re'], this['im']);\n },\n\n /**\n * Calculate the angle of the complex number\n *\n * @returns {number}\n */\n 'arg': function () {\n\n return Math.atan2(this['im'], this['re']);\n },\n\n /**\n * Calculate the sine of the complex number\n *\n * @returns {Complex}\n */\n 'sin': function () {\n\n // sin(z) = ( e^iz - e^-iz ) / 2i \n // = sin(a)cosh(b) + i cos(a)sinh(b)\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n Math.sin(a) * cosh(b),\n Math.cos(a) * sinh(b));\n },\n\n /**\n * Calculate the cosine\n *\n * @returns {Complex}\n */\n 'cos': function () {\n\n // cos(z) = ( e^iz + e^-iz ) / 2 \n // = cos(a)cosh(b) - i sin(a)sinh(b)\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n Math.cos(a) * cosh(b),\n -Math.sin(a) * sinh(b));\n },\n\n /**\n * Calculate the tangent\n *\n * @returns {Complex}\n */\n 'tan': function () {\n\n // tan(z) = sin(z) / cos(z) \n // = ( e^iz - e^-iz ) / ( i( e^iz + e^-iz ) )\n // = ( e^2iz - 1 ) / i( e^2iz + 1 )\n // = ( sin(2a) + i sinh(2b) ) / ( cos(2a) + cosh(2b) )\n\n const a = 2 * this['re'];\n const b = 2 * this['im'];\n const d = Math.cos(a) + cosh(b);\n\n return new Complex(\n Math.sin(a) / d,\n sinh(b) / d);\n },\n\n /**\n * Calculate the cotangent\n *\n * @returns {Complex}\n */\n 'cot': function () {\n\n // cot(c) = i(e^(ci) + e^(-ci)) / (e^(ci) - e^(-ci))\n\n const a = 2 * this['re'];\n const b = 2 * this['im'];\n const d = Math.cos(a) - cosh(b);\n\n return new Complex(\n -Math.sin(a) / d,\n sinh(b) / d);\n },\n\n /**\n * Calculate the secant\n *\n * @returns {Complex}\n */\n 'sec': function () {\n\n // sec(c) = 2 / (e^(ci) + e^(-ci))\n\n const a = this['re'];\n const b = this['im'];\n const d = 0.5 * cosh(2 * b) + 0.5 * Math.cos(2 * a);\n\n return new Complex(\n Math.cos(a) * cosh(b) / d,\n Math.sin(a) * sinh(b) / d);\n },\n\n /**\n * Calculate the cosecans\n *\n * @returns {Complex}\n */\n 'csc': function () {\n\n // csc(c) = 2i / (e^(ci) - e^(-ci))\n\n const a = this['re'];\n const b = this['im'];\n const d = 0.5 * cosh(2 * b) - 0.5 * Math.cos(2 * a);\n\n return new Complex(\n Math.sin(a) * cosh(b) / d,\n -Math.cos(a) * sinh(b) / d);\n },\n\n /**\n * Calculate the complex arcus sinus\n *\n * @returns {Complex}\n */\n 'asin': function () {\n\n // asin(c) = -i * log(ci + sqrt(1 - c^2))\n\n const a = this['re'];\n const b = this['im'];\n\n const t1 = new Complex(\n b * b - a * a + 1,\n -2 * a * b)['sqrt']();\n\n const t2 = new Complex(\n t1['re'] - b,\n t1['im'] + a)['log']();\n\n return new Complex(t2['im'], -t2['re']);\n },\n\n /**\n * Calculate the complex arcus cosinus\n *\n * @returns {Complex}\n */\n 'acos': function () {\n\n // acos(c) = i * log(c - i * sqrt(1 - c^2))\n\n const a = this['re'];\n const b = this['im'];\n\n const t1 = new Complex(\n b * b - a * a + 1,\n -2 * a * b)['sqrt']();\n\n const t2 = new Complex(\n t1['re'] - b,\n t1['im'] + a)['log']();\n\n return new Complex(Math.PI / 2 - t2['im'], t2['re']);\n },\n\n /**\n * Calculate the complex arcus tangent\n *\n * @returns {Complex}\n */\n 'atan': function () {\n\n // atan(c) = i / 2 log((i + x) / (i - x))\n\n const a = this['re'];\n const b = this['im'];\n\n if (a === 0) {\n\n if (b === 1) {\n return new Complex(0, Infinity);\n }\n\n if (b === -1) {\n return new Complex(0, -Infinity);\n }\n }\n\n const d = a * a + (1.0 - b) * (1.0 - b);\n\n const t1 = new Complex(\n (1 - b * b - a * a) / d,\n -2 * a / d).log();\n\n return new Complex(-0.5 * t1['im'], 0.5 * t1['re']);\n },\n\n /**\n * Calculate the complex arcus cotangent\n *\n * @returns {Complex}\n */\n 'acot': function () {\n\n // acot(c) = i / 2 log((c - i) / (c + i))\n\n const a = this['re'];\n const b = this['im'];\n\n if (b === 0) {\n return new Complex(Math.atan2(1, a), 0);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).atan()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).atan();\n },\n\n /**\n * Calculate the complex arcus secant\n *\n * @returns {Complex}\n */\n 'asec': function () {\n\n // asec(c) = -i * log(1 / c + sqrt(1 - i / c^2))\n\n const a = this['re'];\n const b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(0, Infinity);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).acos()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).acos();\n },\n\n /**\n * Calculate the complex arcus cosecans\n *\n * @returns {Complex}\n */\n 'acsc': function () {\n\n // acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2))\n\n const a = this['re'];\n const b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(Math.PI / 2, Infinity);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).asin()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).asin();\n },\n\n /**\n * Calculate the complex sinh\n *\n * @returns {Complex}\n */\n 'sinh': function () {\n\n // sinh(c) = (e^c - e^-c) / 2\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n sinh(a) * Math.cos(b),\n cosh(a) * Math.sin(b));\n },\n\n /**\n * Calculate the complex cosh\n *\n * @returns {Complex}\n */\n 'cosh': function () {\n\n // cosh(c) = (e^c + e^-c) / 2\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n cosh(a) * Math.cos(b),\n sinh(a) * Math.sin(b));\n },\n\n /**\n * Calculate the complex tanh\n *\n * @returns {Complex}\n */\n 'tanh': function () {\n\n // tanh(c) = (e^c - e^-c) / (e^c + e^-c)\n\n const a = 2 * this['re'];\n const b = 2 * this['im'];\n const d = cosh(a) + Math.cos(b);\n\n return new Complex(\n sinh(a) / d,\n Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex coth\n *\n * @returns {Complex}\n */\n 'coth': function () {\n\n // coth(c) = (e^c + e^-c) / (e^c - e^-c)\n\n const a = 2 * this['re'];\n const b = 2 * this['im'];\n const d = cosh(a) - Math.cos(b);\n\n return new Complex(\n sinh(a) / d,\n -Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex coth\n *\n * @returns {Complex}\n */\n 'csch': function () {\n\n // csch(c) = 2 / (e^c - e^-c)\n\n const a = this['re'];\n const b = this['im'];\n const d = Math.cos(2 * b) - cosh(2 * a);\n\n return new Complex(\n -2 * sinh(a) * Math.cos(b) / d,\n 2 * cosh(a) * Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex sech\n *\n * @returns {Complex}\n */\n 'sech': function () {\n\n // sech(c) = 2 / (e^c + e^-c)\n\n const a = this['re'];\n const b = this['im'];\n const d = Math.cos(2 * b) + cosh(2 * a);\n\n return new Complex(\n 2 * cosh(a) * Math.cos(b) / d,\n -2 * sinh(a) * Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex asinh\n *\n * @returns {Complex}\n */\n 'asinh': function () {\n\n // asinh(c) = log(c + sqrt(c^2 + 1))\n\n let tmp = this['im'];\n this['im'] = -this['re'];\n this['re'] = tmp;\n const res = this['asin']();\n\n this['re'] = -this['im'];\n this['im'] = tmp;\n tmp = res['re'];\n\n res['re'] = -res['im'];\n res['im'] = tmp;\n return res;\n },\n\n /**\n * Calculate the complex acosh\n *\n * @returns {Complex}\n */\n 'acosh': function () {\n\n // acosh(c) = log(c + sqrt(c^2 - 1))\n\n const res = this['acos']();\n if (res['im'] <= 0) {\n const tmp = res['re'];\n res['re'] = -res['im'];\n res['im'] = tmp;\n } else {\n const tmp = res['im'];\n res['im'] = -res['re'];\n res['re'] = tmp;\n }\n return res;\n },\n\n /**\n * Calculate the complex atanh\n *\n * @returns {Complex}\n */\n 'atanh': function () {\n\n // atanh(c) = log((1+c) / (1-c)) / 2\n\n const a = this['re'];\n const b = this['im'];\n\n const noIM = a > 1 && b === 0;\n const oneMinus = 1 - a;\n const onePlus = 1 + a;\n const d = oneMinus * oneMinus + b * b;\n\n const x = (d !== 0)\n ? new Complex(\n (onePlus * oneMinus - b * b) / d,\n (b * oneMinus + onePlus * b) / d)\n : new Complex(\n (a !== -1) ? (a / 0) : 0,\n (b !== 0) ? (b / 0) : 0);\n\n const temp = x['re'];\n x['re'] = logHypot(x['re'], x['im']) / 2;\n x['im'] = Math.atan2(x['im'], temp) / 2;\n if (noIM) {\n x['im'] = -x['im'];\n }\n return x;\n },\n\n /**\n * Calculate the complex acoth\n *\n * @returns {Complex}\n */\n 'acoth': function () {\n\n // acoth(c) = log((c+1) / (c-1)) / 2\n\n const a = this['re'];\n const b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(0, Math.PI / 2);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).atanh()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).atanh();\n },\n\n /**\n * Calculate the complex acsch\n *\n * @returns {Complex}\n */\n 'acsch': function () {\n\n // acsch(c) = log((1+sqrt(1+c^2))/c)\n\n const a = this['re'];\n const b = this['im'];\n\n if (b === 0) {\n\n return new Complex(\n (a !== 0)\n ? Math.log(a + Math.sqrt(a * a + 1))\n : Infinity, 0);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).asinh()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).asinh();\n },\n\n /**\n * Calculate the complex asech\n *\n * @returns {Complex}\n */\n 'asech': function () {\n\n // asech(c) = log((1+sqrt(1-c^2))/c)\n\n const a = this['re'];\n const b = this['im'];\n\n if (this['isZero']()) {\n return Complex['INFINITY'];\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).acosh()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).acosh();\n },\n\n /**\n * Calculate the complex inverse 1/z\n *\n * @returns {Complex}\n */\n 'inverse': function () {\n\n // 1 / 0 = Infinity and 1 / Infinity = 0\n if (this['isZero']()) {\n return Complex['INFINITY'];\n }\n\n if (this['isInfinite']()) {\n return Complex['ZERO'];\n }\n\n const a = this['re'];\n const b = this['im'];\n\n const d = a * a + b * b;\n\n return new Complex(a / d, -b / d);\n },\n\n /**\n * Returns the complex conjugate\n *\n * @returns {Complex}\n */\n 'conjugate': function () {\n\n return new Complex(this['re'], -this['im']);\n },\n\n /**\n * Gets the negated complex number\n *\n * @returns {Complex}\n */\n 'neg': function () {\n\n return new Complex(-this['re'], -this['im']);\n },\n\n /**\n * Ceils the actual complex number\n *\n * @returns {Complex}\n */\n 'ceil': function (places) {\n\n places = Math.pow(10, places || 0);\n\n return new Complex(\n Math.ceil(this['re'] * places) / places,\n Math.ceil(this['im'] * places) / places);\n },\n\n /**\n * Floors the actual complex number\n *\n * @returns {Complex}\n */\n 'floor': function (places) {\n\n places = Math.pow(10, places || 0);\n\n return new Complex(\n Math.floor(this['re'] * places) / places,\n Math.floor(this['im'] * places) / places);\n },\n\n /**\n * Ceils the actual complex number\n *\n * @returns {Complex}\n */\n 'round': function (places) {\n\n places = Math.pow(10, places || 0);\n\n return new Complex(\n Math.round(this['re'] * places) / places,\n Math.round(this['im'] * places) / places);\n },\n\n /**\n * Compares two complex numbers\n *\n * **Note:** new Complex(Infinity).equals(Infinity) === false\n *\n * @returns {boolean}\n */\n 'equals': function (a, b) {\n\n const z = parse(a, b);\n\n return Math.abs(z['re'] - this['re']) <= Complex['EPSILON'] &&\n Math.abs(z['im'] - this['im']) <= Complex['EPSILON'];\n },\n\n /**\n * Clones the actual object\n *\n * @returns {Complex}\n */\n 'clone': function () {\n\n return new Complex(this['re'], this['im']);\n },\n\n /**\n * Gets a string of the actual complex number\n *\n * @returns {string}\n */\n 'toString': function () {\n\n let a = this['re'];\n let b = this['im'];\n let ret = \"\";\n\n if (this['isNaN']()) {\n return 'NaN';\n }\n\n if (this['isInfinite']()) {\n return 'Infinity';\n }\n\n if (Math.abs(a) < Complex['EPSILON']) {\n a = 0;\n }\n\n if (Math.abs(b) < Complex['EPSILON']) {\n b = 0;\n }\n\n // If is real number\n if (b === 0) {\n return ret + a;\n }\n\n if (a !== 0) {\n ret += a;\n ret += \" \";\n if (b < 0) {\n b = -b;\n ret += \"-\";\n } else {\n ret += \"+\";\n }\n ret += \" \";\n } else if (b < 0) {\n b = -b;\n ret += \"-\";\n }\n\n if (1 !== b) { // b is the absolute imaginary part\n ret += b;\n }\n return ret + \"i\";\n },\n\n /**\n * Returns the actual number as a vector\n *\n * @returns {Array}\n */\n 'toVector': function () {\n\n return [this['re'], this['im']];\n },\n\n /**\n * Returns the actual real value of the current object\n *\n * @returns {number|null}\n */\n 'valueOf': function () {\n\n if (this['im'] === 0) {\n return this['re'];\n }\n return null;\n },\n\n /**\n * Determines whether a complex number is not on the Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isNaN': function () {\n return isNaN(this['re']) || isNaN(this['im']);\n },\n\n /**\n * Determines whether or not a complex number is at the zero pole of the\n * Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isZero': function () {\n return this['im'] === 0 && this['re'] === 0;\n },\n\n /**\n * Determines whether a complex number is not at the infinity pole of the\n * Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isFinite': function () {\n return isFinite(this['re']) && isFinite(this['im']);\n },\n\n /**\n * Determines whether or not a complex number is at the infinity pole of the\n * Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isInfinite': function () {\n return !this['isFinite']();\n }\n};\n\nComplex['ZERO'] = new Complex(0, 0);\nComplex['ONE'] = new Complex(1, 0);\nComplex['I'] = new Complex(0, 1);\nComplex['PI'] = new Complex(Math.PI, 0);\nComplex['E'] = new Complex(Math.E, 0);\nComplex['INFINITY'] = new Complex(Infinity, Infinity);\nComplex['NAN'] = new Complex(NaN, NaN);\nComplex['EPSILON'] = 1e-15;\nexport {\n Complex as default, Complex\n};\n","import Complex from 'complex.js';\nimport { format } from '../../utils/number.js';\nimport { isNumber, isUnit } from '../../utils/is.js';\nimport { factory } from '../../utils/factory.js';\nvar name = 'Complex';\nvar dependencies = [];\nexport var createComplexClass = /* #__PURE__ */factory(name, dependencies, () => {\n /**\n * Attach type information\n */\n Object.defineProperty(Complex, 'name', {\n value: 'Complex'\n });\n Complex.prototype.constructor = Complex;\n Complex.prototype.type = 'Complex';\n Complex.prototype.isComplex = true;\n\n /**\n * Get a JSON representation of the complex number\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"Complex\", \"re\": 2, \"im\": 3}`\n */\n Complex.prototype.toJSON = function () {\n return {\n mathjs: 'Complex',\n re: this.re,\n im: this.im\n };\n };\n\n /*\n * Return the value of the complex number in polar notation\n * The angle phi will be set in the interval of [-pi, pi].\n * @return {{r: number, phi: number}} Returns and object with properties r and phi.\n */\n Complex.prototype.toPolar = function () {\n return {\n r: this.abs(),\n phi: this.arg()\n };\n };\n\n /**\n * Get a string representation of the complex number,\n * with optional formatting options.\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @return {string} str\n */\n Complex.prototype.format = function (options) {\n var str = '';\n var im = this.im;\n var re = this.re;\n var strRe = format(this.re, options);\n var strIm = format(this.im, options);\n\n // round either re or im when smaller than the configured precision\n var precision = isNumber(options) ? options : options ? options.precision : null;\n if (precision !== null) {\n var epsilon = Math.pow(10, -precision);\n if (Math.abs(re / im) < epsilon) {\n re = 0;\n }\n if (Math.abs(im / re) < epsilon) {\n im = 0;\n }\n }\n if (im === 0) {\n // real value\n str = strRe;\n } else if (re === 0) {\n // purely complex value\n if (im === 1) {\n str = 'i';\n } else if (im === -1) {\n str = '-i';\n } else {\n str = strIm + 'i';\n }\n } else {\n // complex value\n if (im < 0) {\n if (im === -1) {\n str = strRe + ' - i';\n } else {\n str = strRe + ' - ' + strIm.substring(1) + 'i';\n }\n } else {\n if (im === 1) {\n str = strRe + ' + i';\n } else {\n str = strRe + ' + ' + strIm + 'i';\n }\n }\n }\n return str;\n };\n\n /**\n * Create a complex number from polar coordinates\n *\n * Usage:\n *\n * Complex.fromPolar(r: number, phi: number) : Complex\n * Complex.fromPolar({r: number, phi: number}) : Complex\n *\n * @param {*} args...\n * @return {Complex}\n */\n Complex.fromPolar = function (args) {\n switch (arguments.length) {\n case 1:\n {\n var arg = arguments[0];\n if (typeof arg === 'object') {\n return Complex(arg);\n } else {\n throw new TypeError('Input has to be an object with r and phi keys.');\n }\n }\n case 2:\n {\n var r = arguments[0];\n var phi = arguments[1];\n if (isNumber(r)) {\n if (isUnit(phi) && phi.hasBase('ANGLE')) {\n // convert unit to a number in radians\n phi = phi.toNumber('rad');\n }\n if (isNumber(phi)) {\n return new Complex({\n r,\n phi\n });\n }\n throw new TypeError('Phi is not a number nor an angle unit.');\n } else {\n throw new TypeError('Radius r is not a number.');\n }\n }\n default:\n throw new SyntaxError('Wrong number of arguments in function fromPolar');\n }\n };\n Complex.prototype.valueOf = Complex.prototype.toString;\n\n /**\n * Create a Complex number from a JSON object\n * @param {Object} json A JSON Object structured as\n * {\"mathjs\": \"Complex\", \"re\": 2, \"im\": 3}\n * All properties are optional, default values\n * for `re` and `im` are 0.\n * @return {Complex} Returns a new Complex number\n */\n Complex.fromJSON = function (json) {\n return new Complex(json);\n };\n\n /**\n * Compare two complex numbers, `a` and `b`:\n *\n * - Returns 1 when the real part of `a` is larger than the real part of `b`\n * - Returns -1 when the real part of `a` is smaller than the real part of `b`\n * - Returns 1 when the real parts are equal\n * and the imaginary part of `a` is larger than the imaginary part of `b`\n * - Returns -1 when the real parts are equal\n * and the imaginary part of `a` is smaller than the imaginary part of `b`\n * - Returns 0 when both real and imaginary parts are equal.\n *\n * @params {Complex} a\n * @params {Complex} b\n * @returns {number} Returns the comparison result: -1, 0, or 1\n */\n Complex.compare = function (a, b) {\n if (a.re > b.re) {\n return 1;\n }\n if (a.re < b.re) {\n return -1;\n }\n if (a.im > b.im) {\n return 1;\n }\n if (a.im < b.im) {\n return -1;\n }\n return 0;\n };\n return Complex;\n}, {\n isClass: true\n});","'use strict';\n\n/**\n *\n * This class offers the possibility to calculate fractions.\n * You can pass a fraction in different formats. Either as array, as double, as string or as an integer.\n *\n * Array/Object form\n * [ 0 => , 1 => ]\n * { n => , d => }\n *\n * Integer form\n * - Single integer value as BigInt or Number\n *\n * Double form\n * - Single double value as Number\n *\n * String form\n * 123.456 - a simple double\n * 123/456 - a string fraction\n * 123.'456' - a double with repeating decimal places\n * 123.(456) - synonym\n * 123.45'6' - a double with repeating last place\n * 123.45(6) - synonym\n *\n * Example:\n * let f = new Fraction(\"9.4'31'\");\n * f.mul([-4, 3]).div(4.9);\n *\n */\n\n// Set Identity function to downgrade BigInt to Number if needed\nif (typeof BigInt === 'undefined') BigInt = function (n) { if (isNaN(n)) throw new Error(\"\"); return n; };\n\nconst C_ZERO = BigInt(0);\nconst C_ONE = BigInt(1);\nconst C_TWO = BigInt(2);\nconst C_FIVE = BigInt(5);\nconst C_TEN = BigInt(10);\n\n// Maximum search depth for cyclic rational numbers. 2000 should be more than enough.\n// Example: 1/7 = 0.(142857) has 6 repeating decimal places.\n// If MAX_CYCLE_LEN gets reduced, long cycles will not be detected and toString() only gets the first 10 digits\nconst MAX_CYCLE_LEN = 2000;\n\n// Parsed data to avoid calling \"new\" all the time\nconst P = {\n \"s\": C_ONE,\n \"n\": C_ZERO,\n \"d\": C_ONE\n};\n\nfunction assign(n, s) {\n\n try {\n n = BigInt(n);\n } catch (e) {\n throw InvalidParameter();\n }\n return n * s;\n}\n\nfunction trunc(x) {\n return typeof x === 'bigint' ? x : Math.floor(x);\n}\n\n// Creates a new Fraction internally without the need of the bulky constructor\nfunction newFraction(n, d) {\n\n if (d === C_ZERO) {\n throw DivisionByZero();\n }\n\n const f = Object.create(Fraction.prototype);\n f[\"s\"] = n < C_ZERO ? -C_ONE : C_ONE;\n\n n = n < C_ZERO ? -n : n;\n\n const a = gcd(n, d);\n\n f[\"n\"] = n / a;\n f[\"d\"] = d / a;\n return f;\n}\n\nfunction factorize(num) {\n\n const factors = {};\n\n let n = num;\n let i = C_TWO;\n let s = C_FIVE - C_ONE;\n\n while (s <= n) {\n\n while (n % i === C_ZERO) {\n n /= i;\n factors[i] = (factors[i] || C_ZERO) + C_ONE;\n }\n s += C_ONE + C_TWO * i++;\n }\n\n if (n !== num) {\n if (n > 1)\n factors[n] = (factors[n] || C_ZERO) + C_ONE;\n } else {\n factors[num] = (factors[num] || C_ZERO) + C_ONE;\n }\n return factors;\n}\n\nconst parse = function (p1, p2) {\n\n let n = C_ZERO, d = C_ONE, s = C_ONE;\n\n if (p1 === undefined || p1 === null) { // No argument\n /* void */\n } else if (p2 !== undefined) { // Two arguments\n\n if (typeof p1 === \"bigint\") {\n n = p1;\n } else if (isNaN(p1)) {\n throw InvalidParameter();\n } else if (p1 % 1 !== 0) {\n throw NonIntegerParameter();\n } else {\n n = BigInt(p1);\n }\n\n if (typeof p2 === \"bigint\") {\n d = p2;\n } else if (isNaN(p2)) {\n throw InvalidParameter();\n } else if (p2 % 1 !== 0) {\n throw NonIntegerParameter();\n } else {\n d = BigInt(p2);\n }\n\n s = n * d;\n\n } else if (typeof p1 === \"object\") {\n if (\"d\" in p1 && \"n\" in p1) {\n n = BigInt(p1[\"n\"]);\n d = BigInt(p1[\"d\"]);\n if (\"s\" in p1)\n n *= BigInt(p1[\"s\"]);\n } else if (0 in p1) {\n n = BigInt(p1[0]);\n if (1 in p1)\n d = BigInt(p1[1]);\n } else if (typeof p1 === \"bigint\") {\n n = p1;\n } else {\n throw InvalidParameter();\n }\n s = n * d;\n } else if (typeof p1 === \"number\") {\n\n if (isNaN(p1)) {\n throw InvalidParameter();\n }\n\n if (p1 < 0) {\n s = -C_ONE;\n p1 = -p1;\n }\n\n if (p1 % 1 === 0) {\n n = BigInt(p1);\n } else {\n\n let z = 1;\n\n let A = 0, B = 1;\n let C = 1, D = 1;\n\n let N = 10000000;\n\n if (p1 >= 1) {\n z = 10 ** Math.floor(1 + Math.log10(p1));\n p1 /= z;\n }\n\n // Using Farey Sequences\n\n while (B <= N && D <= N) {\n let M = (A + C) / (B + D);\n\n if (p1 === M) {\n if (B + D <= N) {\n n = A + C;\n d = B + D;\n } else if (D > B) {\n n = C;\n d = D;\n } else {\n n = A;\n d = B;\n }\n break;\n\n } else {\n\n if (p1 > M) {\n A += C;\n B += D;\n } else {\n C += A;\n D += B;\n }\n\n if (B > N) {\n n = C;\n d = D;\n } else {\n n = A;\n d = B;\n }\n }\n }\n n = BigInt(n) * BigInt(z);\n d = BigInt(d);\n }\n\n } else if (typeof p1 === \"string\") {\n\n let ndx = 0;\n\n let v = C_ZERO, w = C_ZERO, x = C_ZERO, y = C_ONE, z = C_ONE;\n\n let match = p1.replace(/_/g, '').match(/\\d+|./g);\n\n if (match === null)\n throw InvalidParameter();\n\n if (match[ndx] === '-') {// Check for minus sign at the beginning\n s = -C_ONE;\n ndx++;\n } else if (match[ndx] === '+') {// Check for plus sign at the beginning\n ndx++;\n }\n\n if (match.length === ndx + 1) { // Check if it's just a simple number \"1234\"\n w = assign(match[ndx++], s);\n } else if (match[ndx + 1] === '.' || match[ndx] === '.') { // Check if it's a decimal number\n\n if (match[ndx] !== '.') { // Handle 0.5 and .5\n v = assign(match[ndx++], s);\n }\n ndx++;\n\n // Check for decimal places\n if (ndx + 1 === match.length || match[ndx + 1] === '(' && match[ndx + 3] === ')' || match[ndx + 1] === \"'\" && match[ndx + 3] === \"'\") {\n w = assign(match[ndx], s);\n y = C_TEN ** BigInt(match[ndx].length);\n ndx++;\n }\n\n // Check for repeating places\n if (match[ndx] === '(' && match[ndx + 2] === ')' || match[ndx] === \"'\" && match[ndx + 2] === \"'\") {\n x = assign(match[ndx + 1], s);\n z = C_TEN ** BigInt(match[ndx + 1].length) - C_ONE;\n ndx += 3;\n }\n\n } else if (match[ndx + 1] === '/' || match[ndx + 1] === ':') { // Check for a simple fraction \"123/456\" or \"123:456\"\n w = assign(match[ndx], s);\n y = assign(match[ndx + 2], C_ONE);\n ndx += 3;\n } else if (match[ndx + 3] === '/' && match[ndx + 1] === ' ') { // Check for a complex fraction \"123 1/2\"\n v = assign(match[ndx], s);\n w = assign(match[ndx + 2], s);\n y = assign(match[ndx + 4], C_ONE);\n ndx += 5;\n }\n\n if (match.length <= ndx) { // Check for more tokens on the stack\n d = y * z;\n s = /* void */\n n = x + d * v + z * w;\n } else {\n throw InvalidParameter();\n }\n\n } else if (typeof p1 === \"bigint\") {\n n = p1;\n s = p1;\n d = C_ONE;\n } else {\n throw InvalidParameter();\n }\n\n if (d === C_ZERO) {\n throw DivisionByZero();\n }\n\n P[\"s\"] = s < C_ZERO ? -C_ONE : C_ONE;\n P[\"n\"] = n < C_ZERO ? -n : n;\n P[\"d\"] = d < C_ZERO ? -d : d;\n};\n\nfunction modpow(b, e, m) {\n\n let r = C_ONE;\n for (; e > C_ZERO; b = (b * b) % m, e >>= C_ONE) {\n\n if (e & C_ONE) {\n r = (r * b) % m;\n }\n }\n return r;\n}\n\nfunction cycleLen(n, d) {\n\n for (; d % C_TWO === C_ZERO;\n d /= C_TWO) {\n }\n\n for (; d % C_FIVE === C_ZERO;\n d /= C_FIVE) {\n }\n\n if (d === C_ONE) // Catch non-cyclic numbers\n return C_ZERO;\n\n // If we would like to compute really large numbers quicker, we could make use of Fermat's little theorem:\n // 10^(d-1) % d == 1\n // However, we don't need such large numbers and MAX_CYCLE_LEN should be the capstone,\n // as we want to translate the numbers to strings.\n\n let rem = C_TEN % d;\n let t = 1;\n\n for (; rem !== C_ONE; t++) {\n rem = rem * C_TEN % d;\n\n if (t > MAX_CYCLE_LEN)\n return C_ZERO; // Returning 0 here means that we don't print it as a cyclic number. It's likely that the answer is `d-1`\n }\n return BigInt(t);\n}\n\nfunction cycleStart(n, d, len) {\n\n let rem1 = C_ONE;\n let rem2 = modpow(C_TEN, len, d);\n\n for (let t = 0; t < 300; t++) { // s < ~log10(Number.MAX_VALUE)\n // Solve 10^s == 10^(s+t) (mod d)\n\n if (rem1 === rem2)\n return BigInt(t);\n\n rem1 = rem1 * C_TEN % d;\n rem2 = rem2 * C_TEN % d;\n }\n return 0;\n}\n\nfunction gcd(a, b) {\n\n if (!a)\n return b;\n if (!b)\n return a;\n\n while (1) {\n a %= b;\n if (!a)\n return b;\n b %= a;\n if (!b)\n return a;\n }\n}\n\n/**\n * Module constructor\n *\n * @constructor\n * @param {number|Fraction=} a\n * @param {number=} b\n */\nfunction Fraction(a, b) {\n\n parse(a, b);\n\n if (this instanceof Fraction) {\n a = gcd(P[\"d\"], P[\"n\"]); // Abuse a\n this[\"s\"] = P[\"s\"];\n this[\"n\"] = P[\"n\"] / a;\n this[\"d\"] = P[\"d\"] / a;\n } else {\n return newFraction(P['s'] * P['n'], P['d']);\n }\n}\n\nvar DivisionByZero = function () { return new Error(\"Division by Zero\"); };\nvar InvalidParameter = function () { return new Error(\"Invalid argument\"); };\nvar NonIntegerParameter = function () { return new Error(\"Parameters must be integer\"); };\n\nFraction.prototype = {\n\n \"s\": C_ONE,\n \"n\": C_ZERO,\n \"d\": C_ONE,\n\n /**\n * Calculates the absolute value\n *\n * Ex: new Fraction(-4).abs() => 4\n **/\n \"abs\": function () {\n\n return newFraction(this[\"n\"], this[\"d\"]);\n },\n\n /**\n * Inverts the sign of the current fraction\n *\n * Ex: new Fraction(-4).neg() => 4\n **/\n \"neg\": function () {\n\n return newFraction(-this[\"s\"] * this[\"n\"], this[\"d\"]);\n },\n\n /**\n * Adds two rational numbers\n *\n * Ex: new Fraction({n: 2, d: 3}).add(\"14.9\") => 467 / 30\n **/\n \"add\": function (a, b) {\n\n parse(a, b);\n return newFraction(\n this[\"s\"] * this[\"n\"] * P[\"d\"] + P[\"s\"] * this[\"d\"] * P[\"n\"],\n this[\"d\"] * P[\"d\"]\n );\n },\n\n /**\n * Subtracts two rational numbers\n *\n * Ex: new Fraction({n: 2, d: 3}).add(\"14.9\") => -427 / 30\n **/\n \"sub\": function (a, b) {\n\n parse(a, b);\n return newFraction(\n this[\"s\"] * this[\"n\"] * P[\"d\"] - P[\"s\"] * this[\"d\"] * P[\"n\"],\n this[\"d\"] * P[\"d\"]\n );\n },\n\n /**\n * Multiplies two rational numbers\n *\n * Ex: new Fraction(\"-17.(345)\").mul(3) => 5776 / 111\n **/\n \"mul\": function (a, b) {\n\n parse(a, b);\n return newFraction(\n this[\"s\"] * P[\"s\"] * this[\"n\"] * P[\"n\"],\n this[\"d\"] * P[\"d\"]\n );\n },\n\n /**\n * Divides two rational numbers\n *\n * Ex: new Fraction(\"-17.(345)\").inverse().div(3)\n **/\n \"div\": function (a, b) {\n\n parse(a, b);\n return newFraction(\n this[\"s\"] * P[\"s\"] * this[\"n\"] * P[\"d\"],\n this[\"d\"] * P[\"n\"]\n );\n },\n\n /**\n * Clones the actual object\n *\n * Ex: new Fraction(\"-17.(345)\").clone()\n **/\n \"clone\": function () {\n return newFraction(this['s'] * this['n'], this['d']);\n },\n\n /**\n * Calculates the modulo of two rational numbers - a more precise fmod\n *\n * Ex: new Fraction('4.(3)').mod([7, 8]) => (13/3) % (7/8) = (5/6)\n * Ex: new Fraction(20, 10).mod().equals(0) ? \"is Integer\"\n **/\n \"mod\": function (a, b) {\n\n if (a === undefined) {\n return newFraction(this[\"s\"] * this[\"n\"] % this[\"d\"], C_ONE);\n }\n\n parse(a, b);\n if (C_ZERO === P[\"n\"] * this[\"d\"]) {\n throw DivisionByZero();\n }\n\n /**\n * I derived the rational modulo similar to the modulo for integers\n *\n * https://raw.org/book/analysis/rational-numbers/\n *\n * n1/d1 = (n2/d2) * q + r, where 0 ≤ r < n2/d2\n * => d2 * n1 = n2 * d1 * q + d1 * d2 * r\n * => r = (d2 * n1 - n2 * d1 * q) / (d1 * d2)\n * = (d2 * n1 - n2 * d1 * floor((d2 * n1) / (n2 * d1))) / (d1 * d2)\n * = ((d2 * n1) % (n2 * d1)) / (d1 * d2)\n */\n return newFraction(\n this[\"s\"] * (P[\"d\"] * this[\"n\"]) % (P[\"n\"] * this[\"d\"]),\n P[\"d\"] * this[\"d\"]);\n },\n\n /**\n * Calculates the fractional gcd of two rational numbers\n *\n * Ex: new Fraction(5,8).gcd(3,7) => 1/56\n */\n \"gcd\": function (a, b) {\n\n parse(a, b);\n\n // https://raw.org/book/analysis/rational-numbers/\n // gcd(a / b, c / d) = gcd(a, c) / lcm(b, d)\n\n return newFraction(gcd(P[\"n\"], this[\"n\"]) * gcd(P[\"d\"], this[\"d\"]), P[\"d\"] * this[\"d\"]);\n },\n\n /**\n * Calculates the fractional lcm of two rational numbers\n *\n * Ex: new Fraction(5,8).lcm(3,7) => 15\n */\n \"lcm\": function (a, b) {\n\n parse(a, b);\n\n // https://raw.org/book/analysis/rational-numbers/\n // lcm(a / b, c / d) = lcm(a, c) / gcd(b, d)\n\n if (P[\"n\"] === C_ZERO && this[\"n\"] === C_ZERO) {\n return newFraction(C_ZERO, C_ONE);\n }\n return newFraction(P[\"n\"] * this[\"n\"], gcd(P[\"n\"], this[\"n\"]) * gcd(P[\"d\"], this[\"d\"]));\n },\n\n /**\n * Gets the inverse of the fraction, means numerator and denominator are exchanged\n *\n * Ex: new Fraction([-3, 4]).inverse() => -4 / 3\n **/\n \"inverse\": function () {\n return newFraction(this[\"s\"] * this[\"d\"], this[\"n\"]);\n },\n\n /**\n * Calculates the fraction to some integer exponent\n *\n * Ex: new Fraction(-1,2).pow(-3) => -8\n */\n \"pow\": function (a, b) {\n\n parse(a, b);\n\n // Trivial case when exp is an integer\n\n if (P['d'] === C_ONE) {\n\n if (P['s'] < C_ZERO) {\n return newFraction((this['s'] * this[\"d\"]) ** P['n'], this[\"n\"] ** P['n']);\n } else {\n return newFraction((this['s'] * this[\"n\"]) ** P['n'], this[\"d\"] ** P['n']);\n }\n }\n\n // Negative roots become complex\n // (-a/b)^(c/d) = x\n // ⇔ (-1)^(c/d) * (a/b)^(c/d) = x\n // ⇔ (cos(pi) + i*sin(pi))^(c/d) * (a/b)^(c/d) = x\n // ⇔ (cos(c*pi/d) + i*sin(c*pi/d)) * (a/b)^(c/d) = x # DeMoivre's formula\n // From which follows that only for c=0 the root is non-complex\n if (this['s'] < C_ZERO) return null;\n\n // Now prime factor n and d\n let N = factorize(this['n']);\n let D = factorize(this['d']);\n\n // Exponentiate and take root for n and d individually\n let n = C_ONE;\n let d = C_ONE;\n for (let k in N) {\n if (k === '1') continue;\n if (k === '0') {\n n = C_ZERO;\n break;\n }\n N[k] *= P['n'];\n\n if (N[k] % P['d'] === C_ZERO) {\n N[k] /= P['d'];\n } else return null;\n n *= BigInt(k) ** N[k];\n }\n\n for (let k in D) {\n if (k === '1') continue;\n D[k] *= P['n'];\n\n if (D[k] % P['d'] === C_ZERO) {\n D[k] /= P['d'];\n } else return null;\n d *= BigInt(k) ** D[k];\n }\n\n if (P['s'] < C_ZERO) {\n return newFraction(d, n);\n }\n return newFraction(n, d);\n },\n\n /**\n * Calculates the logarithm of a fraction to a given rational base\n *\n * Ex: new Fraction(27, 8).log(9, 4) => 3/2\n */\n \"log\": function (a, b) {\n\n parse(a, b);\n\n if (this['s'] <= C_ZERO || P['s'] <= C_ZERO) return null;\n\n const allPrimes = {};\n\n const baseFactors = factorize(P['n']);\n const T1 = factorize(P['d']);\n\n const numberFactors = factorize(this['n']);\n const T2 = factorize(this['d']);\n\n for (const prime in T1) {\n baseFactors[prime] = (baseFactors[prime] || C_ZERO) - T1[prime];\n }\n for (const prime in T2) {\n numberFactors[prime] = (numberFactors[prime] || C_ZERO) - T2[prime];\n }\n\n for (const prime in baseFactors) {\n if (prime === '1') continue;\n allPrimes[prime] = true;\n }\n for (const prime in numberFactors) {\n if (prime === '1') continue;\n allPrimes[prime] = true;\n }\n\n let retN = null;\n let retD = null;\n\n // Iterate over all unique primes to determine if a consistent ratio exists\n for (const prime in allPrimes) {\n\n const baseExponent = baseFactors[prime] || C_ZERO;\n const numberExponent = numberFactors[prime] || C_ZERO;\n\n if (baseExponent === C_ZERO) {\n if (numberExponent !== C_ZERO) {\n return null; // Logarithm cannot be expressed as a rational number\n }\n continue; // Skip this prime since both exponents are zero\n }\n\n // Calculate the ratio of exponents for this prime\n let curN = numberExponent;\n let curD = baseExponent;\n\n // Simplify the current ratio\n const gcdValue = gcd(curN, curD);\n curN /= gcdValue;\n curD /= gcdValue;\n\n // Check if this is the first ratio; otherwise, ensure ratios are consistent\n if (retN === null && retD === null) {\n retN = curN;\n retD = curD;\n } else if (curN * retD !== retN * curD) {\n return null; // Ratios do not match, logarithm cannot be rational\n }\n }\n\n return retN !== null && retD !== null\n ? newFraction(retN, retD)\n : null;\n },\n\n /**\n * Check if two rational numbers are the same\n *\n * Ex: new Fraction(19.6).equals([98, 5]);\n **/\n \"equals\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] === P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Check if this rational number is less than another\n *\n * Ex: new Fraction(19.6).lt([98, 5]);\n **/\n \"lt\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] < P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Check if this rational number is less than or equal another\n *\n * Ex: new Fraction(19.6).lt([98, 5]);\n **/\n \"lte\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] <= P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Check if this rational number is greater than another\n *\n * Ex: new Fraction(19.6).lt([98, 5]);\n **/\n \"gt\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] > P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Check if this rational number is greater than or equal another\n *\n * Ex: new Fraction(19.6).lt([98, 5]);\n **/\n \"gte\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] >= P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Compare two rational numbers\n * < 0 iff this < that\n * > 0 iff this > that\n * = 0 iff this = that\n *\n * Ex: new Fraction(19.6).compare([98, 5]);\n **/\n \"compare\": function (a, b) {\n\n parse(a, b);\n let t = this[\"s\"] * this[\"n\"] * P[\"d\"] - P[\"s\"] * P[\"n\"] * this[\"d\"];\n\n return (C_ZERO < t) - (t < C_ZERO);\n },\n\n /**\n * Calculates the ceil of a rational number\n *\n * Ex: new Fraction('4.(3)').ceil() => (5 / 1)\n **/\n \"ceil\": function (places) {\n\n places = C_TEN ** BigInt(places || 0);\n\n return newFraction(trunc(this[\"s\"] * places * this[\"n\"] / this[\"d\"]) +\n (places * this[\"n\"] % this[\"d\"] > C_ZERO && this[\"s\"] >= C_ZERO ? C_ONE : C_ZERO),\n places);\n },\n\n /**\n * Calculates the floor of a rational number\n *\n * Ex: new Fraction('4.(3)').floor() => (4 / 1)\n **/\n \"floor\": function (places) {\n\n places = C_TEN ** BigInt(places || 0);\n\n return newFraction(trunc(this[\"s\"] * places * this[\"n\"] / this[\"d\"]) -\n (places * this[\"n\"] % this[\"d\"] > C_ZERO && this[\"s\"] < C_ZERO ? C_ONE : C_ZERO),\n places);\n },\n\n /**\n * Rounds a rational numbers\n *\n * Ex: new Fraction('4.(3)').round() => (4 / 1)\n **/\n \"round\": function (places) {\n\n places = C_TEN ** BigInt(places || 0);\n\n /* Derivation:\n\n s >= 0:\n round(n / d) = trunc(n / d) + (n % d) / d >= 0.5 ? 1 : 0\n = trunc(n / d) + 2(n % d) >= d ? 1 : 0\n s < 0:\n round(n / d) =-trunc(n / d) - (n % d) / d > 0.5 ? 1 : 0\n =-trunc(n / d) - 2(n % d) > d ? 1 : 0\n\n =>:\n\n round(s * n / d) = s * trunc(n / d) + s * (C + 2(n % d) > d ? 1 : 0)\n where C = s >= 0 ? 1 : 0, to fix the >= for the positve case.\n */\n\n return newFraction(trunc(this[\"s\"] * places * this[\"n\"] / this[\"d\"]) +\n this[\"s\"] * ((this[\"s\"] >= C_ZERO ? C_ONE : C_ZERO) + C_TWO * (places * this[\"n\"] % this[\"d\"]) > this[\"d\"] ? C_ONE : C_ZERO),\n places);\n },\n\n /**\n * Rounds a rational number to a multiple of another rational number\n *\n * Ex: new Fraction('0.9').roundTo(\"1/8\") => 7 / 8\n **/\n \"roundTo\": function (a, b) {\n\n /*\n k * x/y ≤ a/b < (k+1) * x/y\n ⇔ k ≤ a/b / (x/y) < (k+1)\n ⇔ k = floor(a/b * y/x)\n ⇔ k = floor((a * y) / (b * x))\n */\n\n parse(a, b);\n\n const n = this['n'] * P['d'];\n const d = this['d'] * P['n'];\n const r = n % d;\n\n // round(n / d) = trunc(n / d) + 2(n % d) >= d ? 1 : 0\n let k = trunc(n / d);\n if (r + r >= d) {\n k++;\n }\n return newFraction(this['s'] * k * P['n'], P['d']);\n },\n\n /**\n * Check if two rational numbers are divisible\n *\n * Ex: new Fraction(19.6).divisible(1.5);\n */\n \"divisible\": function (a, b) {\n\n parse(a, b);\n return !(!(P[\"n\"] * this[\"d\"]) || ((this[\"n\"] * P[\"d\"]) % (P[\"n\"] * this[\"d\"])));\n },\n\n /**\n * Returns a decimal representation of the fraction\n *\n * Ex: new Fraction(\"100.'91823'\").valueOf() => 100.91823918239183\n **/\n 'valueOf': function () {\n // Best we can do so far\n return Number(this[\"s\"] * this[\"n\"]) / Number(this[\"d\"]);\n },\n\n /**\n * Creates a string representation of a fraction with all digits\n *\n * Ex: new Fraction(\"100.'91823'\").toString() => \"100.(91823)\"\n **/\n 'toString': function (dec) {\n\n let N = this[\"n\"];\n let D = this[\"d\"];\n\n dec = dec || 15; // 15 = decimal places when no repetition\n\n let cycLen = cycleLen(N, D); // Cycle length\n let cycOff = cycleStart(N, D, cycLen); // Cycle start\n\n let str = this['s'] < C_ZERO ? \"-\" : \"\";\n\n // Append integer part\n str += trunc(N / D);\n\n N %= D;\n N *= C_TEN;\n\n if (N)\n str += \".\";\n\n if (cycLen) {\n\n for (let i = cycOff; i--;) {\n str += trunc(N / D);\n N %= D;\n N *= C_TEN;\n }\n str += \"(\";\n for (let i = cycLen; i--;) {\n str += trunc(N / D);\n N %= D;\n N *= C_TEN;\n }\n str += \")\";\n } else {\n for (let i = dec; N && i--;) {\n str += trunc(N / D);\n N %= D;\n N *= C_TEN;\n }\n }\n return str;\n },\n\n /**\n * Returns a string-fraction representation of a Fraction object\n *\n * Ex: new Fraction(\"1.'3'\").toFraction() => \"4 1/3\"\n **/\n 'toFraction': function (showMixed) {\n\n let n = this[\"n\"];\n let d = this[\"d\"];\n let str = this['s'] < C_ZERO ? \"-\" : \"\";\n\n if (d === C_ONE) {\n str += n;\n } else {\n let whole = trunc(n / d);\n if (showMixed && whole > C_ZERO) {\n str += whole;\n str += \" \";\n n %= d;\n }\n\n str += n;\n str += '/';\n str += d;\n }\n return str;\n },\n\n /**\n * Returns a latex representation of a Fraction object\n *\n * Ex: new Fraction(\"1.'3'\").toLatex() => \"\\frac{4}{3}\"\n **/\n 'toLatex': function (showMixed) {\n\n let n = this[\"n\"];\n let d = this[\"d\"];\n let str = this['s'] < C_ZERO ? \"-\" : \"\";\n\n if (d === C_ONE) {\n str += n;\n } else {\n let whole = trunc(n / d);\n if (showMixed && whole > C_ZERO) {\n str += whole;\n n %= d;\n }\n\n str += \"\\\\frac{\";\n str += n;\n str += '}{';\n str += d;\n str += '}';\n }\n return str;\n },\n\n /**\n * Returns an array of continued fraction elements\n *\n * Ex: new Fraction(\"7/8\").toContinued() => [0,1,7]\n */\n 'toContinued': function () {\n\n let a = this['n'];\n let b = this['d'];\n let res = [];\n\n do {\n res.push(trunc(a / b));\n let t = a % b;\n a = b;\n b = t;\n } while (a !== C_ONE);\n\n return res;\n },\n\n \"simplify\": function (eps) {\n\n const ieps = BigInt(1 / (eps || 0.001) | 0);\n\n const thisABS = this['abs']();\n const cont = thisABS['toContinued']();\n\n for (let i = 1; i < cont.length; i++) {\n\n let s = newFraction(cont[i - 1], C_ONE);\n for (let k = i - 2; k >= 0; k--) {\n s = s['inverse']()['add'](cont[k]);\n }\n\n let t = s['sub'](thisABS);\n if (t['n'] * ieps < t['d']) { // More robust than Math.abs(t.valueOf()) < eps\n return s['mul'](this['s']);\n }\n }\n return this;\n }\n};\nexport {\n Fraction as default, Fraction\n};\n","import Fraction from 'fraction.js';\nimport { factory } from '../../utils/factory.js';\nvar name = 'Fraction';\nvar dependencies = [];\nexport var createFractionClass = /* #__PURE__ */factory(name, dependencies, () => {\n /**\n * Attach type information\n */\n Object.defineProperty(Fraction, 'name', {\n value: 'Fraction'\n });\n Fraction.prototype.constructor = Fraction;\n Fraction.prototype.type = 'Fraction';\n Fraction.prototype.isFraction = true;\n\n /**\n * Get a JSON representation of a Fraction containing type information\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"Fraction\", \"n\": \"3\", \"d\": \"8\"}`\n */\n Fraction.prototype.toJSON = function () {\n return {\n mathjs: 'Fraction',\n n: String(this.s * this.n),\n d: String(this.d)\n };\n };\n\n /**\n * Instantiate a Fraction from a JSON object\n * @param {Object} json a JSON object structured as:\n * `{\"mathjs\": \"Fraction\", \"n\": \"3\", \"d\": \"8\"}`\n * @return {BigNumber}\n */\n Fraction.fromJSON = function (json) {\n return new Fraction(json);\n };\n return Fraction;\n}, {\n isClass: true\n});","import { factory } from '../../utils/factory.js';\nvar name = 'Matrix';\nvar dependencies = [];\nexport var createMatrixClass = /* #__PURE__ */factory(name, dependencies, () => {\n /**\n * @constructor Matrix\n *\n * A Matrix is a wrapper around an Array. A matrix can hold a multi dimensional\n * array. A matrix can be constructed as:\n *\n * let matrix = math.matrix(data)\n *\n * Matrix contains the functions to resize, get and set values, get the size,\n * clone the matrix and to convert the matrix to a vector, array, or scalar.\n * Furthermore, one can iterate over the matrix using map and forEach.\n * The internal Array of the Matrix can be accessed using the function valueOf.\n *\n * Example usage:\n *\n * let matrix = math.matrix([[1, 2], [3, 4]])\n * matix.size() // [2, 2]\n * matrix.resize([3, 2], 5)\n * matrix.valueOf() // [[1, 2], [3, 4], [5, 5]]\n * matrix.subset([1,2]) // 3 (indexes are zero-based)\n *\n */\n function Matrix() {\n if (!(this instanceof Matrix)) {\n throw new SyntaxError('Constructor must be called with the new operator');\n }\n }\n\n /**\n * Attach type information\n */\n Matrix.prototype.type = 'Matrix';\n Matrix.prototype.isMatrix = true;\n\n /**\n * Get the storage format used by the matrix.\n *\n * Usage:\n * const format = matrix.storage() // retrieve storage format\n *\n * @return {string} The storage format.\n */\n Matrix.prototype.storage = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke storage on a Matrix interface');\n };\n\n /**\n * Get the datatype of the data stored in the matrix.\n *\n * Usage:\n * const format = matrix.datatype() // retrieve matrix datatype\n *\n * @return {string} The datatype.\n */\n Matrix.prototype.datatype = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke datatype on a Matrix interface');\n };\n\n /**\n * Create a new Matrix With the type of the current matrix instance\n * @param {Array | Object} data\n * @param {string} [datatype]\n */\n Matrix.prototype.create = function (data, datatype) {\n throw new Error('Cannot invoke create on a Matrix interface');\n };\n\n /**\n * Get a subset of the matrix, or replace a subset of the matrix.\n *\n * Usage:\n * const subset = matrix.subset(index) // retrieve subset\n * const value = matrix.subset(index, replacement) // replace subset\n *\n * @param {Index} index\n * @param {Array | Matrix | *} [replacement]\n * @param {*} [defaultValue=0] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be filled with zeros.\n */\n Matrix.prototype.subset = function (index, replacement, defaultValue) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke subset on a Matrix interface');\n };\n\n /**\n * Get a single element from the matrix.\n * @param {number[]} index Zero-based index\n * @return {*} value\n */\n Matrix.prototype.get = function (index) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke get on a Matrix interface');\n };\n\n /**\n * Replace a single element in the matrix.\n * @param {number[]} index Zero-based index\n * @param {*} value\n * @param {*} [defaultValue] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be left undefined.\n * @return {Matrix} self\n */\n Matrix.prototype.set = function (index, value, defaultValue) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke set on a Matrix interface');\n };\n\n /**\n * Resize the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (resize in place).\n *\n * @param {number[]} size The new size the matrix should have.\n * @param {*} [defaultValue=0] Default value, filled in on new entries.\n * If not provided, the matrix elements will\n * be filled with zeros.\n * @param {boolean} [copy] Return a resized copy of the matrix\n *\n * @return {Matrix} The resized matrix\n */\n Matrix.prototype.resize = function (size, defaultValue) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke resize on a Matrix interface');\n };\n\n /**\n * Reshape the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (reshape in place).\n *\n * @param {number[]} size The new size the matrix should have.\n * @param {boolean} [copy] Return a reshaped copy of the matrix\n *\n * @return {Matrix} The reshaped matrix\n */\n Matrix.prototype.reshape = function (size, defaultValue) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke reshape on a Matrix interface');\n };\n\n /**\n * Create a clone of the matrix\n * @return {Matrix} clone\n */\n Matrix.prototype.clone = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke clone on a Matrix interface');\n };\n\n /**\n * Retrieve the size of the matrix.\n * @returns {number[]} size\n */\n Matrix.prototype.size = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke size on a Matrix interface');\n };\n\n /**\n * Create a new matrix with the results of the callback function executed on\n * each entry of the matrix.\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} [skipZeros] Invoke callback function for non-zero values only.\n *\n * @return {Matrix} matrix\n */\n Matrix.prototype.map = function (callback, skipZeros) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke map on a Matrix interface');\n };\n\n /**\n * Execute a callback function on each entry of the matrix.\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n */\n Matrix.prototype.forEach = function (callback) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke forEach on a Matrix interface');\n };\n\n /**\n * Iterate over the matrix elements\n * @return {Iterable<{ value, index: number[] }>}\n */\n Matrix.prototype[Symbol.iterator] = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot iterate a Matrix interface');\n };\n\n /**\n * Create an Array with a copy of the data of the Matrix\n * @returns {Array} array\n */\n Matrix.prototype.toArray = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke toArray on a Matrix interface');\n };\n\n /**\n * Get the primitive value of the Matrix: a multidimensional array\n * @returns {Array} array\n */\n Matrix.prototype.valueOf = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke valueOf on a Matrix interface');\n };\n\n /**\n * Get a string representation of the matrix, with optional formatting options.\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @returns {string} str\n */\n Matrix.prototype.format = function (options) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke format on a Matrix interface');\n };\n\n /**\n * Get a string representation of the matrix\n * @returns {string} str\n */\n Matrix.prototype.toString = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke toString on a Matrix interface');\n };\n return Matrix;\n}, {\n isClass: true\n});","import { isBigNumber, isNumber } from '../is.js';\nimport { isInteger, normalizeFormatOptions } from '../number.js';\n\n/**\n * Formats a BigNumber in a given base\n * @param {BigNumber} n\n * @param {number} base\n * @param {number} size\n * @returns {string}\n */\nfunction formatBigNumberToBase(n, base, size) {\n var BigNumberCtor = n.constructor;\n var big2 = new BigNumberCtor(2);\n var suffix = '';\n if (size) {\n if (size < 1) {\n throw new Error('size must be in greater than 0');\n }\n if (!isInteger(size)) {\n throw new Error('size must be an integer');\n }\n if (n.greaterThan(big2.pow(size - 1).sub(1)) || n.lessThan(big2.pow(size - 1).mul(-1))) {\n throw new Error(\"Value must be in range [-2^\".concat(size - 1, \", 2^\").concat(size - 1, \"-1]\"));\n }\n if (!n.isInteger()) {\n throw new Error('Value must be an integer');\n }\n if (n.lessThan(0)) {\n n = n.add(big2.pow(size));\n }\n suffix = \"i\".concat(size);\n }\n switch (base) {\n case 2:\n return \"\".concat(n.toBinary()).concat(suffix);\n case 8:\n return \"\".concat(n.toOctal()).concat(suffix);\n case 16:\n return \"\".concat(n.toHexadecimal()).concat(suffix);\n default:\n throw new Error(\"Base \".concat(base, \" not supported \"));\n }\n}\n\n/**\n * Convert a BigNumber to a formatted string representation.\n *\n * Syntax:\n *\n * format(value)\n * format(value, options)\n * format(value, precision)\n * format(value, fn)\n *\n * Where:\n *\n * {number} value The value to be formatted\n * {Object} options An object with formatting options. Available options:\n * {string} notation\n * Number notation. Choose from:\n * 'fixed' Always use regular number notation.\n * For example '123.40' and '14000000'\n * 'exponential' Always use exponential notation.\n * For example '1.234e+2' and '1.4e+7'\n * 'auto' (default) Regular number notation for numbers\n * having an absolute value between\n * `lower` and `upper` bounds, and uses\n * exponential notation elsewhere.\n * Lower bound is included, upper bound\n * is excluded.\n * For example '123.4' and '1.4e7'.\n * 'bin', 'oct, or\n * 'hex' Format the number using binary, octal,\n * or hexadecimal notation.\n * For example '0b1101' and '0x10fe'.\n * {number} wordSize The word size in bits to use for formatting\n * in binary, octal, or hexadecimal notation.\n * To be used only with 'bin', 'oct', or 'hex'\n * values for 'notation' option. When this option\n * is defined the value is formatted as a signed\n * twos complement integer of the given word size\n * and the size suffix is appended to the output.\n * For example\n * format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'.\n * Default value is undefined.\n * {number} precision A number between 0 and 16 to round\n * the digits of the number.\n * In case of notations 'exponential',\n * 'engineering', and 'auto',\n * `precision` defines the total\n * number of significant digits returned.\n * In case of notation 'fixed',\n * `precision` defines the number of\n * significant digits after the decimal\n * point.\n * `precision` is undefined by default.\n * {number} lowerExp Exponent determining the lower boundary\n * for formatting a value with an exponent\n * when `notation='auto`.\n * Default value is `-3`.\n * {number} upperExp Exponent determining the upper boundary\n * for formatting a value with an exponent\n * when `notation='auto`.\n * Default value is `5`.\n * {Function} fn A custom formatting function. Can be used to override the\n * built-in notations. Function `fn` is called with `value` as\n * parameter and must return a string. Is useful for example to\n * format all values inside a matrix in a particular way.\n *\n * Examples:\n *\n * format(6.4) // '6.4'\n * format(1240000) // '1.24e6'\n * format(1/3) // '0.3333333333333333'\n * format(1/3, 3) // '0.333'\n * format(21385, 2) // '21000'\n * format(12e8, {notation: 'fixed'}) // returns '1200000000'\n * format(2.3, {notation: 'fixed', precision: 4}) // returns '2.3000'\n * format(52.8, {notation: 'exponential'}) // returns '5.28e+1'\n * format(12400, {notation: 'engineering'}) // returns '12.400e+3'\n *\n * @param {BigNumber} value\n * @param {Object | Function | number | BigNumber} [options]\n * @return {string} str The formatted value\n */\nexport function format(value, options) {\n if (typeof options === 'function') {\n // handle format(value, fn)\n return options(value);\n }\n\n // handle special cases\n if (!value.isFinite()) {\n return value.isNaN() ? 'NaN' : value.gt(0) ? 'Infinity' : '-Infinity';\n }\n var {\n notation,\n precision,\n wordSize\n } = normalizeFormatOptions(options);\n\n // handle the various notations\n switch (notation) {\n case 'fixed':\n return toFixed(value, precision);\n case 'exponential':\n return toExponential(value, precision);\n case 'engineering':\n return toEngineering(value, precision);\n case 'bin':\n return formatBigNumberToBase(value, 2, wordSize);\n case 'oct':\n return formatBigNumberToBase(value, 8, wordSize);\n case 'hex':\n return formatBigNumberToBase(value, 16, wordSize);\n case 'auto':\n {\n // determine lower and upper bound for exponential notation.\n // TODO: implement support for upper and lower to be BigNumbers themselves\n var lowerExp = _toNumberOrDefault(options === null || options === void 0 ? void 0 : options.lowerExp, -3);\n var upperExp = _toNumberOrDefault(options === null || options === void 0 ? void 0 : options.upperExp, 5);\n\n // handle special case zero\n if (value.isZero()) return '0';\n\n // determine whether or not to output exponential notation\n var str;\n var rounded = value.toSignificantDigits(precision);\n var exp = rounded.e;\n if (exp >= lowerExp && exp < upperExp) {\n // normal number notation\n str = rounded.toFixed();\n } else {\n // exponential notation\n str = toExponential(value, precision);\n }\n\n // remove trailing zeros after the decimal point\n return str.replace(/((\\.\\d*?)(0+))($|e)/, function () {\n var digits = arguments[2];\n var e = arguments[4];\n return digits !== '.' ? digits + e : e;\n });\n }\n default:\n throw new Error('Unknown notation \"' + notation + '\". ' + 'Choose \"auto\", \"exponential\", \"fixed\", \"bin\", \"oct\", or \"hex.');\n }\n}\n\n/**\n * Format a BigNumber in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3'\n * @param {BigNumber} value\n * @param {number} [precision] Optional number of significant figures to return.\n */\nexport function toEngineering(value, precision) {\n // find nearest lower multiple of 3 for exponent\n var e = value.e;\n var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3;\n\n // find difference in exponents, and calculate the value without exponent\n var valueWithoutExp = value.mul(Math.pow(10, -newExp));\n var valueStr = valueWithoutExp.toPrecision(precision);\n if (valueStr.includes('e')) {\n var BigNumber = value.constructor;\n valueStr = new BigNumber(valueStr).toFixed();\n }\n return valueStr + 'e' + (e >= 0 ? '+' : '') + newExp.toString();\n}\n\n/**\n * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'\n * @param {BigNumber} value\n * @param {number} [precision] Number of digits in formatted output.\n * If not provided, the maximum available digits\n * is used.\n * @returns {string} str\n */\nexport function toExponential(value, precision) {\n if (precision !== undefined) {\n return value.toExponential(precision - 1); // Note the offset of one\n } else {\n return value.toExponential();\n }\n}\n\n/**\n * Format a number with fixed notation.\n * @param {BigNumber} value\n * @param {number} [precision=undefined] Optional number of decimals after the\n * decimal point. Undefined by default.\n */\nexport function toFixed(value, precision) {\n return value.toFixed(precision);\n}\nfunction _toNumberOrDefault(value, defaultValue) {\n if (isNumber(value)) {\n return value;\n } else if (isBigNumber(value)) {\n return value.toNumber();\n } else {\n return defaultValue;\n }\n}","import { isBigNumber, isString, typeOf } from './is.js';\nimport { format as formatNumber } from './number.js';\nimport { format as formatBigNumber } from './bignumber/formatter.js';\n\n/**\n * Check if a text ends with a certain string.\n * @param {string} text\n * @param {string} search\n */\nexport function endsWith(text, search) {\n var start = text.length - search.length;\n var end = text.length;\n return text.substring(start, end) === search;\n}\n\n/**\n * Format a value of any type into a string.\n *\n * Usage:\n * math.format(value)\n * math.format(value, precision)\n * math.format(value, options)\n *\n * When value is a function:\n *\n * - When the function has a property `syntax`, it returns this\n * syntax description.\n * - In other cases, a string `'function'` is returned.\n *\n * When `value` is an Object:\n *\n * - When the object contains a property `format` being a function, this\n * function is invoked as `value.format(options)` and the result is returned.\n * - When the object has its own `toString` method, this method is invoked\n * and the result is returned.\n * - In other cases the function will loop over all object properties and\n * return JSON object notation like '{\"a\": 2, \"b\": 3}'.\n *\n * Example usage:\n * math.format(2/7) // '0.2857142857142857'\n * math.format(math.pi, 3) // '3.14'\n * math.format(new Complex(2, 3)) // '2 + 3i'\n * math.format('hello') // '\"hello\"'\n *\n * @param {*} value Value to be stringified\n * @param {Object | number | Function} [options]\n * Formatting options. See src/utils/number.js:format for a\n * description of the available options controlling number output.\n * This generic \"format\" also supports the option property `truncate: NN`\n * giving the maximum number NN of characters to return (if there would\n * have been more, they are deleted and replaced by an ellipsis).\n * @return {string} str\n */\nexport function format(value, options) {\n var result = _format(value, options);\n if (options && typeof options === 'object' && 'truncate' in options && result.length > options.truncate) {\n return result.substring(0, options.truncate - 3) + '...';\n }\n return result;\n}\nfunction _format(value, options) {\n if (typeof value === 'number') {\n return formatNumber(value, options);\n }\n if (isBigNumber(value)) {\n return formatBigNumber(value, options);\n }\n\n // note: we use unsafe duck-typing here to check for Fractions, this is\n // ok here since we're only invoking toString or concatenating its values\n if (looksLikeFraction(value)) {\n if (!options || options.fraction !== 'decimal') {\n // output as ratio, like '1/3'\n return \"\".concat(value.s * value.n, \"/\").concat(value.d);\n } else {\n // output as decimal, like '0.(3)'\n return value.toString();\n }\n }\n if (Array.isArray(value)) {\n return formatArray(value, options);\n }\n if (isString(value)) {\n return stringify(value);\n }\n if (typeof value === 'function') {\n return value.syntax ? String(value.syntax) : 'function';\n }\n if (value && typeof value === 'object') {\n if (typeof value.format === 'function') {\n return value.format(options);\n } else if (value && value.toString(options) !== {}.toString()) {\n // this object has a non-native toString method, use that one\n return value.toString(options);\n } else {\n var entries = Object.keys(value).map(key => {\n return stringify(key) + ': ' + format(value[key], options);\n });\n return '{' + entries.join(', ') + '}';\n }\n }\n return String(value);\n}\n\n/**\n * Stringify a value into a string enclosed in double quotes.\n * Unescaped double quotes and backslashes inside the value are escaped.\n * @param {*} value\n * @return {string}\n */\nexport function stringify(value) {\n var text = String(value);\n var escaped = '';\n var i = 0;\n while (i < text.length) {\n var c = text.charAt(i);\n escaped += c in controlCharacters ? controlCharacters[c] : c;\n i++;\n }\n return '\"' + escaped + '\"';\n}\nvar controlCharacters = {\n '\"': '\\\\\"',\n '\\\\': '\\\\\\\\',\n '\\b': '\\\\b',\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t'\n};\n\n/**\n * Escape special HTML characters\n * @param {*} value\n * @return {string}\n */\nexport function escape(value) {\n var text = String(value);\n text = text.replace(/&/g, '&').replace(/\"/g, '"').replace(/'/g, ''').replace(//g, '>');\n return text;\n}\n\n/**\n * Recursively format an n-dimensional matrix\n * Example output: \"[[1, 2], [3, 4]]\"\n * @param {Array} array\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @returns {string} str\n */\nfunction formatArray(array, options) {\n if (Array.isArray(array)) {\n var str = '[';\n var len = array.length;\n for (var i = 0; i < len; i++) {\n if (i !== 0) {\n str += ', ';\n }\n str += formatArray(array[i], options);\n }\n str += ']';\n return str;\n } else {\n return format(array, options);\n }\n}\n\n/**\n * Check whether a value looks like a Fraction (unsafe duck-type check)\n * @param {*} value\n * @return {boolean}\n */\nfunction looksLikeFraction(value) {\n return value && typeof value === 'object' && typeof value.s === 'bigint' && typeof value.n === 'bigint' && typeof value.d === 'bigint' || false;\n}\n\n/**\n * Compare two strings\n * @param {string} x\n * @param {string} y\n * @returns {number}\n */\nexport function compareText(x, y) {\n // we don't want to convert numbers to string, only accept string input\n if (!isString(x)) {\n throw new TypeError('Unexpected type of argument in function compareText ' + '(expected: string or Array or Matrix, actual: ' + typeOf(x) + ', index: 0)');\n }\n if (!isString(y)) {\n throw new TypeError('Unexpected type of argument in function compareText ' + '(expected: string or Array or Matrix, actual: ' + typeOf(y) + ', index: 1)');\n }\n return x === y ? 0 : x > y ? 1 : -1;\n}","/**\n * Create a range error with the message:\n * 'Dimension mismatch ( != )'\n * @param {number | number[]} actual The actual size\n * @param {number | number[]} expected The expected size\n * @param {string} [relation='!='] Optional relation between actual\n * and expected size: '!=', '<', etc.\n * @extends RangeError\n */\nexport function DimensionError(actual, expected, relation) {\n if (!(this instanceof DimensionError)) {\n throw new SyntaxError('Constructor must be called with the new operator');\n }\n this.actual = actual;\n this.expected = expected;\n this.relation = relation;\n this.message = 'Dimension mismatch (' + (Array.isArray(actual) ? '[' + actual.join(', ') + ']' : actual) + ' ' + (this.relation || '!=') + ' ' + (Array.isArray(expected) ? '[' + expected.join(', ') + ']' : expected) + ')';\n this.stack = new Error().stack;\n}\nDimensionError.prototype = new RangeError();\nDimensionError.prototype.constructor = RangeError;\nDimensionError.prototype.name = 'DimensionError';\nDimensionError.prototype.isDimensionError = true;","/**\n * Create a range error with the message:\n * 'Index out of range (index < min)'\n * 'Index out of range (index < max)'\n *\n * @param {number} index The actual index\n * @param {number} [min=0] Minimum index (included)\n * @param {number} [max] Maximum index (excluded)\n * @extends RangeError\n */\nexport function IndexError(index, min, max) {\n if (!(this instanceof IndexError)) {\n throw new SyntaxError('Constructor must be called with the new operator');\n }\n this.index = index;\n if (arguments.length < 3) {\n this.min = 0;\n this.max = min;\n } else {\n this.min = min;\n this.max = max;\n }\n if (this.min !== undefined && this.index < this.min) {\n this.message = 'Index out of range (' + this.index + ' < ' + this.min + ')';\n } else if (this.max !== undefined && this.index >= this.max) {\n this.message = 'Index out of range (' + this.index + ' > ' + (this.max - 1) + ')';\n } else {\n this.message = 'Index out of range (' + this.index + ')';\n }\n this.stack = new Error().stack;\n}\nIndexError.prototype = new RangeError();\nIndexError.prototype.constructor = RangeError;\nIndexError.prototype.name = 'IndexError';\nIndexError.prototype.isIndexError = true;","import _extends from \"@babel/runtime/helpers/extends\";\nimport { isInteger } from './number.js';\nimport { isNumber, isBigNumber, isArray, isString } from './is.js';\nimport { format } from './string.js';\nimport { DimensionError } from '../error/DimensionError.js';\nimport { IndexError } from '../error/IndexError.js';\nimport { deepStrictEqual } from './object.js';\n\n/**\n * Calculate the size of a multi dimensional array.\n * This function checks the size of the first entry, it does not validate\n * whether all dimensions match. (use function `validate` for that)\n * @param {Array} x\n * @return {number[]} size\n */\nexport function arraySize(x) {\n var s = [];\n while (Array.isArray(x)) {\n s.push(x.length);\n x = x[0];\n }\n return s;\n}\n\n/**\n * Recursively validate whether each element in a multi dimensional array\n * has a size corresponding to the provided size array.\n * @param {Array} array Array to be validated\n * @param {number[]} size Array with the size of each dimension\n * @param {number} dim Current dimension\n * @throws DimensionError\n * @private\n */\nfunction _validate(array, size, dim) {\n var i;\n var len = array.length;\n if (len !== size[dim]) {\n throw new DimensionError(len, size[dim]);\n }\n if (dim < size.length - 1) {\n // recursively validate each child array\n var dimNext = dim + 1;\n for (i = 0; i < len; i++) {\n var child = array[i];\n if (!Array.isArray(child)) {\n throw new DimensionError(size.length - 1, size.length, '<');\n }\n _validate(array[i], size, dimNext);\n }\n } else {\n // last dimension. none of the children may be an array\n for (i = 0; i < len; i++) {\n if (Array.isArray(array[i])) {\n throw new DimensionError(size.length + 1, size.length, '>');\n }\n }\n }\n}\n\n/**\n * Validate whether each element in a multi dimensional array has\n * a size corresponding to the provided size array.\n * @param {Array} array Array to be validated\n * @param {number[]} size Array with the size of each dimension\n * @throws DimensionError\n */\nexport function validate(array, size) {\n var isScalar = size.length === 0;\n if (isScalar) {\n // scalar\n if (Array.isArray(array)) {\n throw new DimensionError(array.length, 0);\n }\n } else {\n // array\n _validate(array, size, 0);\n }\n}\n\n/**\n * Validate whether the source of the index matches the size of the Array\n * @param {Array | Matrix} value Array to be validated\n * @param {Index} index Index with the source information to validate\n * @throws DimensionError\n */\nexport function validateIndexSourceSize(value, index) {\n var valueSize = value.isMatrix ? value._size : arraySize(value);\n var sourceSize = index._sourceSize;\n // checks if the source size is not null and matches the valueSize\n sourceSize.forEach((sourceDim, i) => {\n if (sourceDim !== null && sourceDim !== valueSize[i]) {\n throw new DimensionError(sourceDim, valueSize[i]);\n }\n });\n}\n\n/**\n * Test whether index is an integer number with index >= 0 and index < length\n * when length is provided\n * @param {number} index Zero-based index\n * @param {number} [length] Length of the array\n */\nexport function validateIndex(index, length) {\n if (index !== undefined) {\n if (!isNumber(index) || !isInteger(index)) {\n throw new TypeError('Index must be an integer (value: ' + index + ')');\n }\n if (index < 0 || typeof length === 'number' && index >= length) {\n throw new IndexError(index, length);\n }\n }\n}\n\n/**\n * Test if an index has empty values\n * @param {Index} index Zero-based index\n */\nexport function isEmptyIndex(index) {\n for (var i = 0; i < index._dimensions.length; ++i) {\n var dimension = index._dimensions[i];\n if (dimension._data && isArray(dimension._data)) {\n if (dimension._size[0] === 0) {\n return true;\n }\n } else if (dimension.isRange) {\n if (dimension.start === dimension.end) {\n return true;\n }\n } else if (isString(dimension)) {\n if (dimension.length === 0) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Resize a multi dimensional array. The resized array is returned.\n * @param {Array | number} array Array to be resized\n * @param {number[]} size Array with the size of each dimension\n * @param {*} [defaultValue=0] Value to be filled in new entries,\n * zero by default. Specify for example `null`,\n * to clearly see entries that are not explicitly\n * set.\n * @return {Array} array The resized array\n */\nexport function resize(array, size, defaultValue) {\n // check the type of the arguments\n if (!Array.isArray(size)) {\n throw new TypeError('Array expected');\n }\n if (size.length === 0) {\n throw new Error('Resizing to scalar is not supported');\n }\n\n // check whether size contains positive integers\n size.forEach(function (value) {\n if (!isNumber(value) || !isInteger(value) || value < 0) {\n throw new TypeError('Invalid size, must contain positive integers ' + '(size: ' + format(size) + ')');\n }\n });\n\n // convert number to an array\n if (isNumber(array) || isBigNumber(array)) {\n array = [array];\n }\n\n // recursively resize the array\n var _defaultValue = defaultValue !== undefined ? defaultValue : 0;\n _resize(array, size, 0, _defaultValue);\n return array;\n}\n\n/**\n * Recursively resize a multi dimensional array\n * @param {Array} array Array to be resized\n * @param {number[]} size Array with the size of each dimension\n * @param {number} dim Current dimension\n * @param {*} [defaultValue] Value to be filled in new entries,\n * undefined by default.\n * @private\n */\nfunction _resize(array, size, dim, defaultValue) {\n var i;\n var elem;\n var oldLen = array.length;\n var newLen = size[dim];\n var minLen = Math.min(oldLen, newLen);\n\n // apply new length\n array.length = newLen;\n if (dim < size.length - 1) {\n // non-last dimension\n var dimNext = dim + 1;\n\n // resize existing child arrays\n for (i = 0; i < minLen; i++) {\n // resize child array\n elem = array[i];\n if (!Array.isArray(elem)) {\n elem = [elem]; // add a dimension\n array[i] = elem;\n }\n _resize(elem, size, dimNext, defaultValue);\n }\n\n // create new child arrays\n for (i = minLen; i < newLen; i++) {\n // get child array\n elem = [];\n array[i] = elem;\n\n // resize new child array\n _resize(elem, size, dimNext, defaultValue);\n }\n } else {\n // last dimension\n\n // remove dimensions of existing values\n for (i = 0; i < minLen; i++) {\n while (Array.isArray(array[i])) {\n array[i] = array[i][0];\n }\n }\n\n // fill new elements with the default value\n for (i = minLen; i < newLen; i++) {\n array[i] = defaultValue;\n }\n }\n}\n\n/**\n * Re-shape a multi dimensional array to fit the specified dimensions\n * @param {Array} array Array to be reshaped\n * @param {number[]} sizes List of sizes for each dimension\n * @returns {Array} Array whose data has been formatted to fit the\n * specified dimensions\n *\n * @throws {DimensionError} If the product of the new dimension sizes does\n * not equal that of the old ones\n */\nexport function reshape(array, sizes) {\n var flatArray = flatten(array, true); // since it has rectangular\n var currentLength = flatArray.length;\n if (!Array.isArray(array) || !Array.isArray(sizes)) {\n throw new TypeError('Array expected');\n }\n if (sizes.length === 0) {\n throw new DimensionError(0, currentLength, '!=');\n }\n sizes = processSizesWildcard(sizes, currentLength);\n var newLength = product(sizes);\n if (currentLength !== newLength) {\n throw new DimensionError(newLength, currentLength, '!=');\n }\n try {\n return _reshape(flatArray, sizes);\n } catch (e) {\n if (e instanceof DimensionError) {\n throw new DimensionError(newLength, currentLength, '!=');\n }\n throw e;\n }\n}\n\n/**\n * Replaces the wildcard -1 in the sizes array.\n * @param {number[]} sizes List of sizes for each dimension. At most one wildcard.\n * @param {number} currentLength Number of elements in the array.\n * @throws {Error} If more than one wildcard or unable to replace it.\n * @returns {number[]} The sizes array with wildcard replaced.\n */\nexport function processSizesWildcard(sizes, currentLength) {\n var newLength = product(sizes);\n var processedSizes = sizes.slice();\n var WILDCARD = -1;\n var wildCardIndex = sizes.indexOf(WILDCARD);\n var isMoreThanOneWildcard = sizes.indexOf(WILDCARD, wildCardIndex + 1) >= 0;\n if (isMoreThanOneWildcard) {\n throw new Error('More than one wildcard in sizes');\n }\n var hasWildcard = wildCardIndex >= 0;\n var canReplaceWildcard = currentLength % newLength === 0;\n if (hasWildcard) {\n if (canReplaceWildcard) {\n processedSizes[wildCardIndex] = -currentLength / newLength;\n } else {\n throw new Error('Could not replace wildcard, since ' + currentLength + ' is no multiple of ' + -newLength);\n }\n }\n return processedSizes;\n}\n\n/**\n * Computes the product of all array elements.\n * @param {number[]} array Array of factors\n * @returns {number} Product of all elements\n */\nfunction product(array) {\n return array.reduce((prev, curr) => prev * curr, 1);\n}\n\n/**\n * Iteratively re-shape a multi dimensional array to fit the specified dimensions\n * @param {Array} array Array to be reshaped\n * @param {number[]} sizes List of sizes for each dimension\n * @returns {Array} Array whose data has been formatted to fit the\n * specified dimensions\n */\n\nfunction _reshape(array, sizes) {\n // testing if there are enough elements for the requested shape\n var tmpArray = array;\n var tmpArray2;\n // for each dimension starting by the last one and ignoring the first one\n for (var sizeIndex = sizes.length - 1; sizeIndex > 0; sizeIndex--) {\n var size = sizes[sizeIndex];\n tmpArray2 = [];\n\n // aggregate the elements of the current tmpArray in elements of the requested size\n var length = tmpArray.length / size;\n for (var i = 0; i < length; i++) {\n tmpArray2.push(tmpArray.slice(i * size, (i + 1) * size));\n }\n // set it as the new tmpArray for the next loop turn or for return\n tmpArray = tmpArray2;\n }\n return tmpArray;\n}\n\n/**\n * Squeeze a multi dimensional array\n * @param {Array} array\n * @param {Array} [size]\n * @returns {Array} returns the array itself\n */\nexport function squeeze(array, size) {\n var s = size || arraySize(array);\n\n // squeeze outer dimensions\n while (Array.isArray(array) && array.length === 1) {\n array = array[0];\n s.shift();\n }\n\n // find the first dimension to be squeezed\n var dims = s.length;\n while (s[dims - 1] === 1) {\n dims--;\n }\n\n // squeeze inner dimensions\n if (dims < s.length) {\n array = _squeeze(array, dims, 0);\n s.length = dims;\n }\n return array;\n}\n\n/**\n * Recursively squeeze a multi dimensional array\n * @param {Array} array\n * @param {number} dims Required number of dimensions\n * @param {number} dim Current dimension\n * @returns {Array | *} Returns the squeezed array\n * @private\n */\nfunction _squeeze(array, dims, dim) {\n var i, ii;\n if (dim < dims) {\n var next = dim + 1;\n for (i = 0, ii = array.length; i < ii; i++) {\n array[i] = _squeeze(array[i], dims, next);\n }\n } else {\n while (Array.isArray(array)) {\n array = array[0];\n }\n }\n return array;\n}\n\n/**\n * Unsqueeze a multi dimensional array: add dimensions when missing\n *\n * Parameter `size` will be mutated to match the new, unsqueezed matrix size.\n *\n * @param {Array} array\n * @param {number} dims Desired number of dimensions of the array\n * @param {number} [outer] Number of outer dimensions to be added\n * @param {Array} [size] Current size of array.\n * @returns {Array} returns the array itself\n * @private\n */\nexport function unsqueeze(array, dims, outer, size) {\n var s = size || arraySize(array);\n\n // unsqueeze outer dimensions\n if (outer) {\n for (var i = 0; i < outer; i++) {\n array = [array];\n s.unshift(1);\n }\n }\n\n // unsqueeze inner dimensions\n array = _unsqueeze(array, dims, 0);\n while (s.length < dims) {\n s.push(1);\n }\n return array;\n}\n\n/**\n * Recursively unsqueeze a multi dimensional array\n * @param {Array} array\n * @param {number} dims Required number of dimensions\n * @param {number} dim Current dimension\n * @returns {Array | *} Returns the unsqueezed array\n * @private\n */\nfunction _unsqueeze(array, dims, dim) {\n var i, ii;\n if (Array.isArray(array)) {\n var next = dim + 1;\n for (i = 0, ii = array.length; i < ii; i++) {\n array[i] = _unsqueeze(array[i], dims, next);\n }\n } else {\n for (var d = dim; d < dims; d++) {\n array = [array];\n }\n }\n return array;\n}\n/**\n * Flatten a multi dimensional array, put all elements in a one dimensional\n * array\n * @param {Array} array A multi dimensional array\n * @param {boolean} isRectangular Optional. If the array is rectangular (not jagged)\n * @return {Array} The flattened array (1 dimensional)\n */\nexport function flatten(array) {\n var isRectangular = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (!Array.isArray(array)) {\n // if not an array, return as is\n return array;\n }\n if (typeof isRectangular !== 'boolean') {\n throw new TypeError('Boolean expected for second argument of flatten');\n }\n var flat = [];\n if (isRectangular) {\n _flattenRectangular(array);\n } else {\n _flatten(array);\n }\n return flat;\n function _flatten(array) {\n for (var i = 0; i < array.length; i++) {\n var item = array[i];\n if (Array.isArray(item)) {\n _flatten(item);\n } else {\n flat.push(item);\n }\n }\n }\n function _flattenRectangular(array) {\n if (Array.isArray(array[0])) {\n for (var i = 0; i < array.length; i++) {\n _flattenRectangular(array[i]);\n }\n } else {\n for (var _i = 0; _i < array.length; _i++) {\n flat.push(array[_i]);\n }\n }\n }\n}\n\n/**\n * A safe map\n * @param {Array} array\n * @param {function} callback\n */\nexport function map(array, callback) {\n return Array.prototype.map.call(array, callback);\n}\n\n/**\n * A safe forEach\n * @param {Array} array\n * @param {function} callback\n */\nexport function forEach(array, callback) {\n Array.prototype.forEach.call(array, callback);\n}\n\n/**\n * A safe filter\n * @param {Array} array\n * @param {function} callback\n */\nexport function filter(array, callback) {\n if (arraySize(array).length !== 1) {\n throw new Error('Only one dimensional matrices supported');\n }\n return Array.prototype.filter.call(array, callback);\n}\n\n/**\n * Filter values in an array given a regular expression\n * @param {Array} array\n * @param {RegExp} regexp\n * @return {Array} Returns the filtered array\n * @private\n */\nexport function filterRegExp(array, regexp) {\n if (arraySize(array).length !== 1) {\n throw new Error('Only one dimensional matrices supported');\n }\n return Array.prototype.filter.call(array, entry => regexp.test(entry));\n}\n\n/**\n * A safe join\n * @param {Array} array\n * @param {string} separator\n */\nexport function join(array, separator) {\n return Array.prototype.join.call(array, separator);\n}\n\n/**\n * Assign a numeric identifier to every element of a sorted array\n * @param {Array} a An array\n * @return {Array} An array of objects containing the original value and its identifier\n */\nexport function identify(a) {\n if (!Array.isArray(a)) {\n throw new TypeError('Array input expected');\n }\n if (a.length === 0) {\n return a;\n }\n var b = [];\n var count = 0;\n b[0] = {\n value: a[0],\n identifier: 0\n };\n for (var i = 1; i < a.length; i++) {\n if (a[i] === a[i - 1]) {\n count++;\n } else {\n count = 0;\n }\n b.push({\n value: a[i],\n identifier: count\n });\n }\n return b;\n}\n\n/**\n * Remove the numeric identifier from the elements\n * @param {array} a An array\n * @return {array} An array of values without identifiers\n */\nexport function generalize(a) {\n if (!Array.isArray(a)) {\n throw new TypeError('Array input expected');\n }\n if (a.length === 0) {\n return a;\n }\n var b = [];\n for (var i = 0; i < a.length; i++) {\n b.push(a[i].value);\n }\n return b;\n}\n\n/**\n * Check the datatype of a given object\n * This is a low level implementation that should only be used by\n * parent Matrix classes such as SparseMatrix or DenseMatrix\n * This method does not validate Array Matrix shape\n * @param {Array} array\n * @param {function} typeOf Callback function to use to determine the type of a value\n * @return {string}\n */\nexport function getArrayDataType(array, typeOf) {\n var type; // to hold type info\n var length = 0; // to hold length value to ensure it has consistent sizes\n\n for (var i = 0; i < array.length; i++) {\n var item = array[i];\n var _isArray = Array.isArray(item);\n\n // Saving the target matrix row size\n if (i === 0 && _isArray) {\n length = item.length;\n }\n\n // If the current item is an array but the length does not equal the targetVectorSize\n if (_isArray && item.length !== length) {\n return undefined;\n }\n var itemType = _isArray ? getArrayDataType(item, typeOf) // recurse into a nested array\n : typeOf(item);\n if (type === undefined) {\n type = itemType; // first item\n } else if (type !== itemType) {\n return 'mixed';\n } else {\n // we're good, everything has the same type so far\n }\n }\n return type;\n}\n\n/**\n * Return the last item from an array\n * @param {Array} array\n * @returns {*}\n */\nexport function last(array) {\n return array[array.length - 1];\n}\n\n/**\n * Get all but the last element of array.\n * @param {Array} array\n * @returns {Array}\n */\nexport function initial(array) {\n return array.slice(0, array.length - 1);\n}\n\n/**\n * Recursively concatenate two matrices.\n * The contents of the matrices are not cloned.\n * @param {Array} a Multi dimensional array\n * @param {Array} b Multi dimensional array\n * @param {number} concatDim The dimension on which to concatenate (zero-based)\n * @param {number} dim The current dim (zero-based)\n * @return {Array} c The concatenated matrix\n * @private\n */\nfunction concatRecursive(a, b, concatDim, dim) {\n if (dim < concatDim) {\n // recurse into next dimension\n if (a.length !== b.length) {\n throw new DimensionError(a.length, b.length);\n }\n var c = [];\n for (var i = 0; i < a.length; i++) {\n c[i] = concatRecursive(a[i], b[i], concatDim, dim + 1);\n }\n return c;\n } else {\n // concatenate this dimension\n return a.concat(b);\n }\n}\n\n/**\n * Concatenates many arrays in the specified direction\n * @param {...Array} arrays All the arrays to concatenate\n * @param {number} concatDim The dimension on which to concatenate (zero-based)\n * @returns {Array}\n */\nexport function concat() {\n var arrays = Array.prototype.slice.call(arguments, 0, -1);\n var concatDim = Array.prototype.slice.call(arguments, -1);\n if (arrays.length === 1) {\n return arrays[0];\n }\n if (arrays.length > 1) {\n return arrays.slice(1).reduce(function (A, B) {\n return concatRecursive(A, B, concatDim, 0);\n }, arrays[0]);\n } else {\n throw new Error('Wrong number of arguments in function concat');\n }\n}\n\n/**\n * Receives two or more sizes and gets the broadcasted size for both.\n * @param {...number[]} sizes Sizes to broadcast together\n * @returns {number[]} The broadcasted size\n */\nexport function broadcastSizes() {\n for (var _len = arguments.length, sizes = new Array(_len), _key = 0; _key < _len; _key++) {\n sizes[_key] = arguments[_key];\n }\n var dimensions = sizes.map(s => s.length);\n var N = Math.max(...dimensions);\n var sizeMax = new Array(N).fill(null);\n // check for every size\n for (var i = 0; i < sizes.length; i++) {\n var size = sizes[i];\n var dim = dimensions[i];\n for (var j = 0; j < dim; j++) {\n var n = N - dim + j;\n if (size[j] > sizeMax[n]) {\n sizeMax[n] = size[j];\n }\n }\n }\n for (var _i2 = 0; _i2 < sizes.length; _i2++) {\n checkBroadcastingRules(sizes[_i2], sizeMax);\n }\n return sizeMax;\n}\n\n/**\n * Checks if it's possible to broadcast a size to another size\n * @param {number[]} size The size of the array to check\n * @param {number[]} toSize The size of the array to validate if it can be broadcasted to\n */\nexport function checkBroadcastingRules(size, toSize) {\n var N = toSize.length;\n var dim = size.length;\n for (var j = 0; j < dim; j++) {\n var n = N - dim + j;\n if (size[j] < toSize[n] && size[j] > 1 || size[j] > toSize[n]) {\n throw new Error(\"shape mismatch: mismatch is found in arg with shape (\".concat(size, \") not possible to broadcast dimension \").concat(dim, \" with size \").concat(size[j], \" to size \").concat(toSize[n]));\n }\n }\n}\n\n/**\n * Broadcasts a single array to a certain size\n * @param {Array} array Array to be broadcasted\n * @param {number[]} toSize Size to broadcast the array\n * @returns {Array} The broadcasted array\n */\nexport function broadcastTo(array, toSize) {\n var Asize = arraySize(array);\n if (deepStrictEqual(Asize, toSize)) {\n return array;\n }\n checkBroadcastingRules(Asize, toSize);\n var broadcastedSize = broadcastSizes(Asize, toSize);\n var N = broadcastedSize.length;\n var paddedSize = [...Array(N - Asize.length).fill(1), ...Asize];\n var A = clone(array);\n // reshape A if needed to make it ready for concat\n if (Asize.length < N) {\n A = reshape(A, paddedSize);\n Asize = arraySize(A);\n }\n\n // stretches the array on each dimension to make it the same size as index\n for (var dim = 0; dim < N; dim++) {\n if (Asize[dim] < broadcastedSize[dim]) {\n A = stretch(A, broadcastedSize[dim], dim);\n Asize = arraySize(A);\n }\n }\n return A;\n}\n\n/**\n * Broadcasts arrays and returns the broadcasted arrays in an array\n * @param {...Array | any} arrays\n * @returns {Array[]} The broadcasted arrays\n */\nexport function broadcastArrays() {\n for (var _len2 = arguments.length, arrays = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n arrays[_key2] = arguments[_key2];\n }\n if (arrays.length === 0) {\n throw new Error('Insufficient number of arguments in function broadcastArrays');\n }\n if (arrays.length === 1) {\n return arrays[0];\n }\n var sizes = arrays.map(function (array) {\n return arraySize(array);\n });\n var broadcastedSize = broadcastSizes(...sizes);\n var broadcastedArrays = [];\n arrays.forEach(function (array) {\n broadcastedArrays.push(broadcastTo(array, broadcastedSize));\n });\n return broadcastedArrays;\n}\n\n/**\n * Stretches a matrix up to a certain size in a certain dimension\n * @param {Array} arrayToStretch\n * @param {number[]} sizeToStretch\n * @param {number} dimToStretch\n * @returns {Array} The stretched array\n */\nexport function stretch(arrayToStretch, sizeToStretch, dimToStretch) {\n return concat(...Array(sizeToStretch).fill(arrayToStretch), dimToStretch);\n}\n\n/**\n* Retrieves a single element from an array given an index.\n*\n* @param {Array} array - The array from which to retrieve the value.\n* @param {Array} index - An array of indices specifying the position of the desired element in each dimension.\n* @returns {*} - The value at the specified position in the array.\n*\n* @example\n* const arr = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]];\n* const index = [1, 0, 1];\n* console.log(get(arr, index)); // 6\n*/\nexport function get(array, index) {\n if (!Array.isArray(array)) {\n throw new Error('Array expected');\n }\n var size = arraySize(array);\n if (index.length !== size.length) {\n throw new DimensionError(index.length, size.length);\n }\n for (var x = 0; x < index.length; x++) {\n validateIndex(index[x], size[x]);\n }\n return index.reduce((acc, curr) => acc[curr], array);\n}\n\n/**\n * Recursively maps over each element of nested array using a provided callback function.\n *\n * @param {Array} array - The array to be mapped.\n * @param {Function} callback - The function to execute on each element, taking three arguments:\n * - `value` (any): The current element being processed in the array.\n * - `index` (Array): The index of the current element being processed in the array.\n * - `array` (Array): The array `deepMap` was called upon.\n * @param {boolean} [skipIndex=false] - If true, the callback function is called with only the value.\n * @returns {Array} A new array with each element being the result of the callback function.\n */\nexport function deepMap(array, callback) {\n var skipIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n if (array.length === 0) {\n return [];\n }\n if (skipIndex) {\n return recursiveMap(array);\n }\n var index = [];\n return recursiveMapWithIndex(array, 0);\n function recursiveMapWithIndex(value, depth) {\n if (Array.isArray(value)) {\n var N = value.length;\n var result = Array(N);\n for (var i = 0; i < N; i++) {\n index[depth] = i;\n result[i] = recursiveMapWithIndex(value[i], depth + 1);\n }\n return result;\n } else {\n return callback(value, index.slice(0, depth), array);\n }\n }\n function recursiveMap(value) {\n if (Array.isArray(value)) {\n var N = value.length;\n var result = Array(N);\n for (var i = 0; i < N; i++) {\n result[i] = recursiveMap(value[i]);\n }\n return result;\n } else {\n return callback(value);\n }\n }\n}\n\n/**\n * Recursively iterates over each element in a multi-dimensional array and applies a callback function.\n *\n * @param {Array} array - The multi-dimensional array to iterate over.\n * @param {Function} callback - The function to execute for each element. It receives three arguments:\n * - {any} value: The current element being processed in the array.\n * - {Array} index: The index of the current element in each dimension.\n * - {Array} array: The original array being processed.\n * @param {boolean} [skipIndex=false] - If true, the callback function is called with only the value.\n */\nexport function deepForEach(array, callback) {\n var skipIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n if (array.length === 0) {\n return;\n }\n if (skipIndex) {\n recursiveForEach(array);\n return;\n }\n var index = [];\n recursiveForEachWithIndex(array, 0);\n function recursiveForEachWithIndex(value, depth) {\n if (Array.isArray(value)) {\n var N = value.length;\n for (var i = 0; i < N; i++) {\n index[depth] = i;\n recursiveForEachWithIndex(value[i], depth + 1);\n }\n } else {\n callback(value, index.slice(0, depth), array);\n }\n }\n function recursiveForEach(value) {\n if (Array.isArray(value)) {\n var N = value.length;\n for (var i = 0; i < N; i++) {\n recursiveForEach(value[i]);\n }\n } else {\n callback(value);\n }\n }\n}\n\n/**\n * Deep clones a multidimensional array\n * @param {Array} array\n * @returns {Array} cloned array\n */\nexport function clone(array) {\n return _extends([], array);\n}","import typed from 'typed-function';\nimport { get, arraySize } from './array.js';\nimport { typeOf as _typeOf } from './is.js';\n\n/**\n * Simplifies a callback function by reducing its complexity and potentially improving its performance.\n *\n * @param {Function} callback The original callback function to simplify.\n * @param {Array|Matrix} array The array that will be used with the callback function.\n * @param {string} name The name of the function that is using the callback.\n * @param {boolean} [isUnary=false] If true, the callback function is unary and will be optimized as such.\n * @returns {Function} Returns a simplified version of the callback function.\n */\nexport function optimizeCallback(callback, array, name) {\n var isUnary = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n if (typed.isTypedFunction(callback)) {\n var numberOfArguments;\n if (isUnary) {\n numberOfArguments = 1;\n } else {\n var firstIndex = (array.isMatrix ? array.size() : arraySize(array)).map(() => 0);\n var firstValue = array.isMatrix ? array.get(firstIndex) : get(array, firstIndex);\n numberOfArguments = _findNumberOfArgumentsTyped(callback, firstValue, firstIndex, array);\n }\n var fastCallback;\n if (array.isMatrix && array.dataType !== 'mixed' && array.dataType !== undefined) {\n var singleSignature = _findSingleSignatureWithArity(callback, numberOfArguments);\n fastCallback = singleSignature !== undefined ? singleSignature : callback;\n } else {\n fastCallback = callback;\n }\n if (numberOfArguments >= 1 && numberOfArguments <= 3) {\n return {\n isUnary: numberOfArguments === 1,\n fn: function fn() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _tryFunctionWithArgs(fastCallback, args.slice(0, numberOfArguments), name, callback.name);\n }\n };\n }\n return {\n isUnary: false,\n fn: function fn() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _tryFunctionWithArgs(fastCallback, args, name, callback.name);\n }\n };\n }\n if (isUnary === undefined) {\n return {\n isUnary: _findIfCallbackIsUnary(callback),\n fn: callback\n };\n } else {\n return {\n isUnary,\n fn: callback\n };\n }\n}\nfunction _findSingleSignatureWithArity(callback, arity) {\n var matchingFunctions = [];\n Object.entries(callback.signatures).forEach(_ref => {\n var [signature, func] = _ref;\n if (signature.split(',').length === arity) {\n matchingFunctions.push(func);\n }\n });\n if (matchingFunctions.length === 1) {\n return matchingFunctions[0];\n }\n}\n\n/**\n * Determines if a given callback function is unary (i.e., takes exactly one argument).\n *\n * This function checks the following conditions to determine if the callback is unary:\n * 1. The callback function should have exactly one parameter.\n * 2. The callback function should not use the `arguments` object.\n * 3. The callback function should not use rest parameters (`...`).\n * If in doubt, this function shall return `false` to be safe\n *\n * @param {Function} callback - The callback function to be checked.\n * @returns {boolean} - Returns `true` if the callback is unary, otherwise `false`.\n */\nfunction _findIfCallbackIsUnary(callback) {\n if (callback.length !== 1) return false;\n var callbackStr = callback.toString();\n // Check if the callback function uses `arguments`\n if (/arguments/.test(callbackStr)) return false;\n\n // Extract the parameters of the callback function\n var paramsStr = callbackStr.match(/\\(.*?\\)/);\n // Check if the callback function uses rest parameters\n if (/\\.\\.\\./.test(paramsStr)) return false;\n return true;\n}\nfunction _findNumberOfArgumentsTyped(callback, value, index, array) {\n var testArgs = [value, index, array];\n for (var i = 3; i > 0; i--) {\n var args = testArgs.slice(0, i);\n if (typed.resolve(callback, args) !== null) {\n return i;\n }\n }\n}\n\n/**\n * @param {function} func The selected function taken from one of the signatures of the callback function\n * @param {Array} args List with arguments to apply to the selected signature\n * @param {string} mappingFnName the name of the function that is using the callback\n * @param {string} callbackName the name of the callback function\n * @returns {*} Returns the return value of the invoked signature\n * @throws {TypeError} Throws an error when no matching signature was found\n */\nfunction _tryFunctionWithArgs(func, args, mappingFnName, callbackName) {\n try {\n return func(...args);\n } catch (err) {\n _createCallbackError(err, args, mappingFnName, callbackName);\n }\n}\n\n/**\n * Creates and throws a detailed TypeError when a callback function fails.\n *\n * @param {Error} err The original error thrown by the callback function.\n * @param {Array} args The arguments that were passed to the callback function.\n * @param {string} mappingFnName The name of the function that is using the callback.\n * @param {string} callbackName The name of the callback function.\n * @throws {TypeError} Throws a detailed TypeError with enriched error message.\n */\nfunction _createCallbackError(err, args, mappingFnName, callbackName) {\n var _err$data;\n // Enrich the error message so the user understands that it took place inside the callback function\n if (err instanceof TypeError && ((_err$data = err.data) === null || _err$data === void 0 ? void 0 : _err$data.category) === 'wrongType') {\n var argsDesc = [];\n argsDesc.push(\"value: \".concat(_typeOf(args[0])));\n if (args.length >= 2) {\n argsDesc.push(\"index: \".concat(_typeOf(args[1])));\n }\n if (args.length >= 3) {\n argsDesc.push(\"array: \".concat(_typeOf(args[2])));\n }\n throw new TypeError(\"Function \".concat(mappingFnName, \" cannot apply callback arguments \") + \"\".concat(callbackName, \"(\").concat(argsDesc.join(', '), \") at index \").concat(JSON.stringify(args[1])));\n } else {\n throw new TypeError(\"Function \".concat(mappingFnName, \" cannot apply callback arguments \") + \"to function \".concat(callbackName, \": \").concat(err.message));\n }\n}","// deno-lint-ignore-file no-this-alias\nimport { isArray, isBigNumber, isCollection, isIndex, isMatrix, isNumber, isString, typeOf } from '../../utils/is.js';\nimport { arraySize, getArrayDataType, processSizesWildcard, reshape, resize, unsqueeze, validate, validateIndex, broadcastTo, get } from '../../utils/array.js';\nimport { format } from '../../utils/string.js';\nimport { isInteger } from '../../utils/number.js';\nimport { clone, deepStrictEqual } from '../../utils/object.js';\nimport { DimensionError } from '../../error/DimensionError.js';\nimport { factory } from '../../utils/factory.js';\nimport { optimizeCallback } from '../../utils/optimizeCallback.js';\nvar name = 'DenseMatrix';\nvar dependencies = ['Matrix'];\nexport var createDenseMatrixClass = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n Matrix\n } = _ref;\n /**\n * Dense Matrix implementation. A regular, dense matrix, supporting multi-dimensional matrices. This is the default matrix type.\n * @class DenseMatrix\n * @enum {{ value, index: number[] }}\n */\n function DenseMatrix(data, datatype) {\n if (!(this instanceof DenseMatrix)) {\n throw new SyntaxError('Constructor must be called with the new operator');\n }\n if (datatype && !isString(datatype)) {\n throw new Error('Invalid datatype: ' + datatype);\n }\n if (isMatrix(data)) {\n // check data is a DenseMatrix\n if (data.type === 'DenseMatrix') {\n // clone data & size\n this._data = clone(data._data);\n this._size = clone(data._size);\n this._datatype = datatype || data._datatype;\n } else {\n // build data from existing matrix\n this._data = data.toArray();\n this._size = data.size();\n this._datatype = datatype || data._datatype;\n }\n } else if (data && isArray(data.data) && isArray(data.size)) {\n // initialize fields from JSON representation\n this._data = data.data;\n this._size = data.size;\n // verify the dimensions of the array\n validate(this._data, this._size);\n this._datatype = datatype || data.datatype;\n } else if (isArray(data)) {\n // replace nested Matrices with Arrays\n this._data = preprocess(data);\n // get the dimensions of the array\n this._size = arraySize(this._data);\n // verify the dimensions of the array, TODO: compute size while processing array\n validate(this._data, this._size);\n // data type unknown\n this._datatype = datatype;\n } else if (data) {\n // unsupported type\n throw new TypeError('Unsupported type of data (' + typeOf(data) + ')');\n } else {\n // nothing provided\n this._data = [];\n this._size = [0];\n this._datatype = datatype;\n }\n }\n DenseMatrix.prototype = new Matrix();\n\n /**\n * Create a new DenseMatrix\n */\n DenseMatrix.prototype.createDenseMatrix = function (data, datatype) {\n return new DenseMatrix(data, datatype);\n };\n\n /**\n * Attach type information\n */\n Object.defineProperty(DenseMatrix, 'name', {\n value: 'DenseMatrix'\n });\n DenseMatrix.prototype.constructor = DenseMatrix;\n DenseMatrix.prototype.type = 'DenseMatrix';\n DenseMatrix.prototype.isDenseMatrix = true;\n\n /**\n * Get the matrix type\n *\n * Usage:\n * const matrixType = matrix.getDataType() // retrieves the matrix type\n *\n * @memberOf DenseMatrix\n * @return {string} type information; if multiple types are found from the Matrix, it will return \"mixed\"\n */\n DenseMatrix.prototype.getDataType = function () {\n return getArrayDataType(this._data, typeOf);\n };\n\n /**\n * Get the storage format used by the matrix.\n *\n * Usage:\n * const format = matrix.storage() // retrieve storage format\n *\n * @memberof DenseMatrix\n * @return {string} The storage format.\n */\n DenseMatrix.prototype.storage = function () {\n return 'dense';\n };\n\n /**\n * Get the datatype of the data stored in the matrix.\n *\n * Usage:\n * const format = matrix.datatype() // retrieve matrix datatype\n *\n * @memberof DenseMatrix\n * @return {string} The datatype.\n */\n DenseMatrix.prototype.datatype = function () {\n return this._datatype;\n };\n\n /**\n * Create a new DenseMatrix\n * @memberof DenseMatrix\n * @param {Array} data\n * @param {string} [datatype]\n */\n DenseMatrix.prototype.create = function (data, datatype) {\n return new DenseMatrix(data, datatype);\n };\n\n /**\n * Get a subset of the matrix, or replace a subset of the matrix.\n *\n * Usage:\n * const subset = matrix.subset(index) // retrieve subset\n * const value = matrix.subset(index, replacement) // replace subset\n *\n * @memberof DenseMatrix\n * @param {Index} index\n * @param {Array | Matrix | *} [replacement]\n * @param {*} [defaultValue=0] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be filled with zeros.\n */\n DenseMatrix.prototype.subset = function (index, replacement, defaultValue) {\n switch (arguments.length) {\n case 1:\n return _get(this, index);\n\n // intentional fall through\n case 2:\n case 3:\n return _set(this, index, replacement, defaultValue);\n default:\n throw new SyntaxError('Wrong number of arguments');\n }\n };\n\n /**\n * Get a single element from the matrix.\n * @memberof DenseMatrix\n * @param {number[]} index Zero-based index\n * @return {*} value\n */\n DenseMatrix.prototype.get = function (index) {\n return get(this._data, index);\n };\n\n /**\n * Replace a single element in the matrix.\n * @memberof DenseMatrix\n * @param {number[]} index Zero-based index\n * @param {*} value\n * @param {*} [defaultValue] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be left undefined.\n * @return {DenseMatrix} self\n */\n DenseMatrix.prototype.set = function (index, value, defaultValue) {\n if (!isArray(index)) {\n throw new TypeError('Array expected');\n }\n if (index.length < this._size.length) {\n throw new DimensionError(index.length, this._size.length, '<');\n }\n var i, ii, indexI;\n\n // enlarge matrix when needed\n var size = index.map(function (i) {\n return i + 1;\n });\n _fit(this, size, defaultValue);\n\n // traverse over the dimensions\n var data = this._data;\n for (i = 0, ii = index.length - 1; i < ii; i++) {\n indexI = index[i];\n validateIndex(indexI, data.length);\n data = data[indexI];\n }\n\n // set new value\n indexI = index[index.length - 1];\n validateIndex(indexI, data.length);\n data[indexI] = value;\n return this;\n };\n\n /**\n * Get a submatrix of this matrix\n * @memberof DenseMatrix\n * @param {DenseMatrix} matrix\n * @param {Index} index Zero-based index\n * @private\n */\n function _get(matrix, index) {\n if (!isIndex(index)) {\n throw new TypeError('Invalid index');\n }\n var isScalar = index.isScalar();\n if (isScalar) {\n // return a scalar\n return matrix.get(index.min());\n } else {\n // validate dimensions\n var size = index.size();\n if (size.length !== matrix._size.length) {\n throw new DimensionError(size.length, matrix._size.length);\n }\n\n // validate if any of the ranges in the index is out of range\n var min = index.min();\n var max = index.max();\n for (var i = 0, ii = matrix._size.length; i < ii; i++) {\n validateIndex(min[i], matrix._size[i]);\n validateIndex(max[i], matrix._size[i]);\n }\n\n // retrieve submatrix\n // TODO: more efficient when creating an empty matrix and setting _data and _size manually\n return new DenseMatrix(_getSubmatrix(matrix._data, index, size.length, 0), matrix._datatype);\n }\n }\n\n /**\n * Recursively get a submatrix of a multi dimensional matrix.\n * Index is not checked for correct number or length of dimensions.\n * @memberof DenseMatrix\n * @param {Array} data\n * @param {Index} index\n * @param {number} dims Total number of dimensions\n * @param {number} dim Current dimension\n * @return {Array} submatrix\n * @private\n */\n function _getSubmatrix(data, index, dims, dim) {\n var last = dim === dims - 1;\n var range = index.dimension(dim);\n if (last) {\n return range.map(function (i) {\n validateIndex(i, data.length);\n return data[i];\n }).valueOf();\n } else {\n return range.map(function (i) {\n validateIndex(i, data.length);\n var child = data[i];\n return _getSubmatrix(child, index, dims, dim + 1);\n }).valueOf();\n }\n }\n\n /**\n * Replace a submatrix in this matrix\n * Indexes are zero-based.\n * @memberof DenseMatrix\n * @param {DenseMatrix} matrix\n * @param {Index} index\n * @param {DenseMatrix | Array | *} submatrix\n * @param {*} defaultValue Default value, filled in on new entries when\n * the matrix is resized.\n * @return {DenseMatrix} matrix\n * @private\n */\n function _set(matrix, index, submatrix, defaultValue) {\n if (!index || index.isIndex !== true) {\n throw new TypeError('Invalid index');\n }\n\n // get index size and check whether the index contains a single value\n var iSize = index.size();\n var isScalar = index.isScalar();\n\n // calculate the size of the submatrix, and convert it into an Array if needed\n var sSize;\n if (isMatrix(submatrix)) {\n sSize = submatrix.size();\n submatrix = submatrix.valueOf();\n } else {\n sSize = arraySize(submatrix);\n }\n if (isScalar) {\n // set a scalar\n\n // check whether submatrix is a scalar\n if (sSize.length !== 0) {\n throw new TypeError('Scalar expected');\n }\n matrix.set(index.min(), submatrix, defaultValue);\n } else {\n // set a submatrix\n\n // broadcast submatrix\n if (!deepStrictEqual(sSize, iSize)) {\n try {\n if (sSize.length === 0) {\n submatrix = broadcastTo([submatrix], iSize);\n } else {\n submatrix = broadcastTo(submatrix, iSize);\n }\n sSize = arraySize(submatrix);\n } catch (_unused) {}\n }\n\n // validate dimensions\n if (iSize.length < matrix._size.length) {\n throw new DimensionError(iSize.length, matrix._size.length, '<');\n }\n if (sSize.length < iSize.length) {\n // calculate number of missing outer dimensions\n var i = 0;\n var outer = 0;\n while (iSize[i] === 1 && sSize[i] === 1) {\n i++;\n }\n while (iSize[i] === 1) {\n outer++;\n i++;\n }\n\n // unsqueeze both outer and inner dimensions\n submatrix = unsqueeze(submatrix, iSize.length, outer, sSize);\n }\n\n // check whether the size of the submatrix matches the index size\n if (!deepStrictEqual(iSize, sSize)) {\n throw new DimensionError(iSize, sSize, '>');\n }\n\n // enlarge matrix when needed\n var size = index.max().map(function (i) {\n return i + 1;\n });\n _fit(matrix, size, defaultValue);\n\n // insert the sub matrix\n var dims = iSize.length;\n var dim = 0;\n _setSubmatrix(matrix._data, index, submatrix, dims, dim);\n }\n return matrix;\n }\n\n /**\n * Replace a submatrix of a multi dimensional matrix.\n * @memberof DenseMatrix\n * @param {Array} data\n * @param {Index} index\n * @param {Array} submatrix\n * @param {number} dims Total number of dimensions\n * @param {number} dim\n * @private\n */\n function _setSubmatrix(data, index, submatrix, dims, dim) {\n var last = dim === dims - 1;\n var range = index.dimension(dim);\n if (last) {\n range.forEach(function (dataIndex, subIndex) {\n validateIndex(dataIndex);\n data[dataIndex] = submatrix[subIndex[0]];\n });\n } else {\n range.forEach(function (dataIndex, subIndex) {\n validateIndex(dataIndex);\n _setSubmatrix(data[dataIndex], index, submatrix[subIndex[0]], dims, dim + 1);\n });\n }\n }\n\n /**\n * Resize the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (resize in place).\n *\n * @memberof DenseMatrix\n * @param {number[] || Matrix} size The new size the matrix should have.\n * @param {*} [defaultValue=0] Default value, filled in on new entries.\n * If not provided, the matrix elements will\n * be filled with zeros.\n * @param {boolean} [copy] Return a resized copy of the matrix\n *\n * @return {Matrix} The resized matrix\n */\n DenseMatrix.prototype.resize = function (size, defaultValue, copy) {\n // validate arguments\n if (!isCollection(size)) {\n throw new TypeError('Array or Matrix expected');\n }\n\n // SparseMatrix input is always 2d, flatten this into 1d if it's indeed a vector\n var sizeArray = size.valueOf().map(value => {\n return Array.isArray(value) && value.length === 1 ? value[0] : value;\n });\n\n // matrix to resize\n var m = copy ? this.clone() : this;\n // resize matrix\n return _resize(m, sizeArray, defaultValue);\n };\n function _resize(matrix, size, defaultValue) {\n // check size\n if (size.length === 0) {\n // first value in matrix\n var v = matrix._data;\n // go deep\n while (isArray(v)) {\n v = v[0];\n }\n return v;\n }\n // resize matrix\n matrix._size = size.slice(0); // copy the array\n matrix._data = resize(matrix._data, matrix._size, defaultValue);\n // return matrix\n return matrix;\n }\n\n /**\n * Reshape the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (reshape in place).\n *\n * NOTE: This might be better suited to copy by default, instead of modifying\n * in place. For now, it operates in place to remain consistent with\n * resize().\n *\n * @memberof DenseMatrix\n * @param {number[]} size The new size the matrix should have.\n * @param {boolean} [copy] Return a reshaped copy of the matrix\n *\n * @return {Matrix} The reshaped matrix\n */\n DenseMatrix.prototype.reshape = function (size, copy) {\n var m = copy ? this.clone() : this;\n m._data = reshape(m._data, size);\n var currentLength = m._size.reduce((length, size) => length * size);\n m._size = processSizesWildcard(size, currentLength);\n return m;\n };\n\n /**\n * Enlarge the matrix when it is smaller than given size.\n * If the matrix is larger or equal sized, nothing is done.\n * @memberof DenseMatrix\n * @param {DenseMatrix} matrix The matrix to be resized\n * @param {number[]} size\n * @param {*} defaultValue Default value, filled in on new entries.\n * @private\n */\n function _fit(matrix, size, defaultValue) {\n var\n // copy the array\n newSize = matrix._size.slice(0);\n var changed = false;\n\n // add dimensions when needed\n while (newSize.length < size.length) {\n newSize.push(0);\n changed = true;\n }\n\n // enlarge size when needed\n for (var i = 0, ii = size.length; i < ii; i++) {\n if (size[i] > newSize[i]) {\n newSize[i] = size[i];\n changed = true;\n }\n }\n if (changed) {\n // resize only when size is changed\n _resize(matrix, newSize, defaultValue);\n }\n }\n\n /**\n * Create a clone of the matrix\n * @memberof DenseMatrix\n * @return {DenseMatrix} clone\n */\n DenseMatrix.prototype.clone = function () {\n var m = new DenseMatrix({\n data: clone(this._data),\n size: clone(this._size),\n datatype: this._datatype\n });\n return m;\n };\n\n /**\n * Retrieve the size of the matrix.\n * @memberof DenseMatrix\n * @returns {number[]} size\n */\n DenseMatrix.prototype.size = function () {\n return this._size.slice(0); // return a clone of _size\n };\n\n /**\n * Applies a callback function to a reference to each element of the matrix\n * @memberof DenseMatrix\n * @param {Function} callback The callback function is invoked with three\n * parameters: the array containing the element,\n * the index of the element within that array (as an integer),\n * and for non unarry callbacks copy of the current index (as an array of integers).\n */\n DenseMatrix.prototype._forEach = function (callback) {\n var isUnary = callback.length === 2; // callback has 2 parameters: value, index\n var maxDepth = this._size.length - 1;\n if (maxDepth < 0) return;\n if (isUnary) {\n iterateUnary(this._data);\n return;\n }\n if (maxDepth === 0) {\n for (var i = 0; i < this._data.length; i++) {\n callback(this._data, i, [i]);\n }\n return;\n }\n var index = new Array(maxDepth + 1);\n iterate(this._data);\n function iterate(data) {\n var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n if (depth < maxDepth) {\n for (var _i = 0; _i < data.length; _i++) {\n index[depth] = _i;\n iterate(data[_i], depth + 1);\n }\n } else {\n for (var _i2 = 0; _i2 < data.length; _i2++) {\n index[depth] = _i2;\n callback(data, _i2, index.slice());\n }\n }\n }\n function iterateUnary(data) {\n var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n if (depth < maxDepth) {\n for (var _i3 = 0; _i3 < data.length; _i3++) {\n iterateUnary(data[_i3], depth + 1);\n }\n } else {\n for (var _i4 = 0; _i4 < data.length; _i4++) {\n callback(data, _i4);\n }\n }\n }\n };\n\n /**\n * Create a new matrix with the results of the callback function executed on\n * each entry of the matrix.\n * @memberof DenseMatrix\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} skipZeros If true, the callback function is invoked only for non-zero entries\n * @param {boolean} isUnary If true, the callback function is invoked with one parameter\n *\n * @return {DenseMatrix} matrix\n */\n DenseMatrix.prototype.map = function (callback) {\n var skipZeros = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var isUnary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var me = this;\n var result = new DenseMatrix(me);\n var fastCallback = optimizeCallback(callback, me._data, 'map', isUnary);\n var applyCallback = isUnary || fastCallback.isUnary ? (arr, i) => {\n arr[i] = fastCallback.fn(arr[i]);\n } : (arr, i, index) => {\n arr[i] = fastCallback.fn(arr[i], index, me);\n };\n result._forEach(applyCallback);\n return result;\n };\n\n /**\n * Execute a callback function on each entry of the matrix.\n * @memberof DenseMatrix\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} skipZeros If true, the callback function is invoked only for non-zero entries\n * @param {boolean} isUnary If true, the callback function is invoked with one parameter\n */\n DenseMatrix.prototype.forEach = function (callback) {\n var skipZeros = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var isUnary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var me = this;\n var fastCallback = optimizeCallback(callback, me._data, 'map', isUnary);\n var applyCallback = isUnary || fastCallback.isUnary ? (arr, i) => {\n fastCallback.fn(arr[i]);\n } : (arr, i, index) => {\n fastCallback.fn(arr[i], index, me);\n };\n me._forEach(applyCallback);\n };\n\n /**\n * Iterate over the matrix elements\n * @return {Iterable<{ value, index: number[] }>}\n */\n DenseMatrix.prototype[Symbol.iterator] = function* () {\n var maxDepth = this._size.length - 1;\n if (maxDepth < 0) {\n return;\n }\n if (maxDepth === 0) {\n for (var i = 0; i < this._data.length; i++) {\n yield {\n value: this._data[i],\n index: [i]\n };\n }\n return;\n }\n var index = [];\n var _recurse = function* recurse(value, depth) {\n if (depth < maxDepth) {\n for (var _i5 = 0; _i5 < value.length; _i5++) {\n index[depth] = _i5;\n yield* _recurse(value[_i5], depth + 1);\n }\n } else {\n for (var _i6 = 0; _i6 < value.length; _i6++) {\n index[depth] = _i6;\n yield {\n value: value[_i6],\n index: index.slice()\n };\n }\n }\n };\n yield* _recurse(this._data, 0);\n };\n\n /**\n * Returns an array containing the rows of a 2D matrix\n * @returns {Array}\n */\n DenseMatrix.prototype.rows = function () {\n var result = [];\n var s = this.size();\n if (s.length !== 2) {\n throw new TypeError('Rows can only be returned for a 2D matrix.');\n }\n var data = this._data;\n for (var row of data) {\n result.push(new DenseMatrix([row], this._datatype));\n }\n return result;\n };\n\n /**\n * Returns an array containing the columns of a 2D matrix\n * @returns {Array}\n */\n DenseMatrix.prototype.columns = function () {\n var _this = this;\n var result = [];\n var s = this.size();\n if (s.length !== 2) {\n throw new TypeError('Rows can only be returned for a 2D matrix.');\n }\n var data = this._data;\n var _loop = function _loop(i) {\n var col = data.map(row => [row[i]]);\n result.push(new DenseMatrix(col, _this._datatype));\n };\n for (var i = 0; i < s[1]; i++) {\n _loop(i);\n }\n return result;\n };\n\n /**\n * Create an Array with a copy of the data of the DenseMatrix\n * @memberof DenseMatrix\n * @returns {Array} array\n */\n DenseMatrix.prototype.toArray = function () {\n return clone(this._data);\n };\n\n /**\n * Get the primitive value of the DenseMatrix: a multidimensional array\n * @memberof DenseMatrix\n * @returns {Array} array\n */\n DenseMatrix.prototype.valueOf = function () {\n return this._data;\n };\n\n /**\n * Get a string representation of the matrix, with optional formatting options.\n * @memberof DenseMatrix\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @returns {string} str\n */\n DenseMatrix.prototype.format = function (options) {\n return format(this._data, options);\n };\n\n /**\n * Get a string representation of the matrix\n * @memberof DenseMatrix\n * @returns {string} str\n */\n DenseMatrix.prototype.toString = function () {\n return format(this._data);\n };\n\n /**\n * Get a JSON representation of the matrix\n * @memberof DenseMatrix\n * @returns {Object}\n */\n DenseMatrix.prototype.toJSON = function () {\n return {\n mathjs: 'DenseMatrix',\n data: this._data,\n size: this._size,\n datatype: this._datatype\n };\n };\n\n /**\n * Get the kth Matrix diagonal.\n *\n * @memberof DenseMatrix\n * @param {number | BigNumber} [k=0] The kth diagonal where the vector will retrieved.\n *\n * @returns {Matrix} The matrix with the diagonal values.\n */\n DenseMatrix.prototype.diagonal = function (k) {\n // validate k if any\n if (k) {\n // convert BigNumber to a number\n if (isBigNumber(k)) {\n k = k.toNumber();\n }\n // is must be an integer\n if (!isNumber(k) || !isInteger(k)) {\n throw new TypeError('The parameter k must be an integer number');\n }\n } else {\n // default value\n k = 0;\n }\n var kSuper = k > 0 ? k : 0;\n var kSub = k < 0 ? -k : 0;\n\n // rows & columns\n var rows = this._size[0];\n var columns = this._size[1];\n\n // number diagonal values\n var n = Math.min(rows - kSub, columns - kSuper);\n\n // x is a matrix get diagonal from matrix\n var data = [];\n\n // loop rows\n for (var i = 0; i < n; i++) {\n data[i] = this._data[i + kSub][i + kSuper];\n }\n\n // create DenseMatrix\n return new DenseMatrix({\n data,\n size: [n],\n datatype: this._datatype\n });\n };\n\n /**\n * Create a diagonal matrix.\n *\n * @memberof DenseMatrix\n * @param {Array} size The matrix size.\n * @param {number | Matrix | Array } value The values for the diagonal.\n * @param {number | BigNumber} [k=0] The kth diagonal where the vector will be filled in.\n * @param {number} [defaultValue] The default value for non-diagonal\n * @param {string} [datatype] The datatype for the diagonal\n *\n * @returns {DenseMatrix}\n */\n DenseMatrix.diagonal = function (size, value, k, defaultValue) {\n if (!isArray(size)) {\n throw new TypeError('Array expected, size parameter');\n }\n if (size.length !== 2) {\n throw new Error('Only two dimensions matrix are supported');\n }\n\n // map size & validate\n size = size.map(function (s) {\n // check it is a big number\n if (isBigNumber(s)) {\n // convert it\n s = s.toNumber();\n }\n // validate arguments\n if (!isNumber(s) || !isInteger(s) || s < 1) {\n throw new Error('Size values must be positive integers');\n }\n return s;\n });\n\n // validate k if any\n if (k) {\n // convert BigNumber to a number\n if (isBigNumber(k)) {\n k = k.toNumber();\n }\n // is must be an integer\n if (!isNumber(k) || !isInteger(k)) {\n throw new TypeError('The parameter k must be an integer number');\n }\n } else {\n // default value\n k = 0;\n }\n var kSuper = k > 0 ? k : 0;\n var kSub = k < 0 ? -k : 0;\n\n // rows and columns\n var rows = size[0];\n var columns = size[1];\n\n // number of non-zero items\n var n = Math.min(rows - kSub, columns - kSuper);\n\n // value extraction function\n var _value;\n\n // check value\n if (isArray(value)) {\n // validate array\n if (value.length !== n) {\n // number of values in array must be n\n throw new Error('Invalid value array length');\n }\n // define function\n _value = function _value(i) {\n // return value @ i\n return value[i];\n };\n } else if (isMatrix(value)) {\n // matrix size\n var ms = value.size();\n // validate matrix\n if (ms.length !== 1 || ms[0] !== n) {\n // number of values in array must be n\n throw new Error('Invalid matrix length');\n }\n // define function\n _value = function _value(i) {\n // return value @ i\n return value.get([i]);\n };\n } else {\n // define function\n _value = function _value() {\n // return value\n return value;\n };\n }\n\n // discover default value if needed\n if (!defaultValue) {\n // check first value in array\n defaultValue = isBigNumber(_value(0)) ? _value(0).mul(0) // trick to create a BigNumber with value zero\n : 0;\n }\n\n // empty array\n var data = [];\n\n // check we need to resize array\n if (size.length > 0) {\n // resize array\n data = resize(data, size, defaultValue);\n // fill diagonal\n for (var d = 0; d < n; d++) {\n data[d + kSub][d + kSuper] = _value(d);\n }\n }\n\n // create DenseMatrix\n return new DenseMatrix({\n data,\n size: [rows, columns]\n });\n };\n\n /**\n * Generate a matrix from a JSON object\n * @memberof DenseMatrix\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"DenseMatrix\", data: [], size: []}`,\n * where mathjs is optional\n * @returns {DenseMatrix}\n */\n DenseMatrix.fromJSON = function (json) {\n return new DenseMatrix(json);\n };\n\n /**\n * Swap rows i and j in Matrix.\n *\n * @memberof DenseMatrix\n * @param {number} i Matrix row index 1\n * @param {number} j Matrix row index 2\n *\n * @return {Matrix} The matrix reference\n */\n DenseMatrix.prototype.swapRows = function (i, j) {\n // check index\n if (!isNumber(i) || !isInteger(i) || !isNumber(j) || !isInteger(j)) {\n throw new Error('Row index must be positive integers');\n }\n // check dimensions\n if (this._size.length !== 2) {\n throw new Error('Only two dimensional matrix is supported');\n }\n // validate index\n validateIndex(i, this._size[0]);\n validateIndex(j, this._size[0]);\n\n // swap rows\n DenseMatrix._swapRows(i, j, this._data);\n // return current instance\n return this;\n };\n\n /**\n * Swap rows i and j in Dense Matrix data structure.\n *\n * @param {number} i Matrix row index 1\n * @param {number} j Matrix row index 2\n * @param {Array} data Matrix data\n */\n DenseMatrix._swapRows = function (i, j, data) {\n // swap values i <-> j\n var vi = data[i];\n data[i] = data[j];\n data[j] = vi;\n };\n\n /**\n * Preprocess data, which can be an Array or DenseMatrix with nested Arrays and\n * Matrices. Clones all (nested) Arrays, and replaces all nested Matrices with Arrays\n * @memberof DenseMatrix\n * @param {Array | Matrix} data\n * @return {Array} data\n */\n function preprocess(data) {\n if (isMatrix(data)) {\n return preprocess(data.valueOf());\n }\n if (isArray(data)) {\n return data.map(preprocess);\n }\n return data;\n }\n return DenseMatrix;\n}, {\n isClass: true\n});","import { isCollection, isMatrix } from './is.js';\nimport { IndexError } from '../error/IndexError.js';\nimport { arraySize, deepMap as arrayDeepMap, deepForEach as arrayDeepForEach } from './array.js';\nimport { _switch } from './switch.js';\n\n/**\n * Test whether an array contains collections\n * @param {Array} array\n * @returns {boolean} Returns true when the array contains one or multiple\n * collections (Arrays or Matrices). Returns false otherwise.\n */\nexport function containsCollections(array) {\n for (var i = 0; i < array.length; i++) {\n if (isCollection(array[i])) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Recursively loop over all elements in a given multi dimensional array\n * and invoke the callback on each of the elements.\n * @param {Array | Matrix} array\n * @param {Function} callback The callback method is invoked with one\n * parameter: the current element in the array\n */\nexport function deepForEach(array, callback) {\n if (isMatrix(array)) {\n array.forEach(x => callback(x), false, true);\n } else {\n arrayDeepForEach(array, callback, true);\n }\n}\n\n/**\n * Execute the callback function element wise for each element in array and any\n * nested array\n * Returns an array with the results\n * @param {Array | Matrix} array\n * @param {Function} callback The callback is called with two parameters:\n * value1 and value2, which contain the current\n * element of both arrays.\n * @param {boolean} [skipZeros] Invoke callback function for non-zero values only.\n *\n * @return {Array | Matrix} res\n */\nexport function deepMap(array, callback, skipZeros) {\n if (!skipZeros) {\n if (isMatrix(array)) {\n return array.map(x => callback(x), false, true);\n } else {\n return arrayDeepMap(array, callback, true);\n }\n }\n var skipZerosCallback = x => x === 0 ? x : callback(x);\n if (isMatrix(array)) {\n return array.map(x => skipZerosCallback(x), false, true);\n } else {\n return arrayDeepMap(array, skipZerosCallback, true);\n }\n}\n\n/**\n * Reduce a given matrix or array to a new matrix or\n * array with one less dimension, applying the given\n * callback in the selected dimension.\n * @param {Array | Matrix} mat\n * @param {number} dim\n * @param {Function} callback\n * @return {Array | Matrix} res\n */\nexport function reduce(mat, dim, callback) {\n var size = Array.isArray(mat) ? arraySize(mat) : mat.size();\n if (dim < 0 || dim >= size.length) {\n // TODO: would be more clear when throwing a DimensionError here\n throw new IndexError(dim, size.length);\n }\n if (isMatrix(mat)) {\n return mat.create(_reduce(mat.valueOf(), dim, callback), mat.datatype());\n } else {\n return _reduce(mat, dim, callback);\n }\n}\n\n/**\n * Recursively reduce a matrix\n * @param {Array} mat\n * @param {number} dim\n * @param {Function} callback\n * @returns {Array} ret\n * @private\n */\nfunction _reduce(mat, dim, callback) {\n var i, ret, val, tran;\n if (dim <= 0) {\n if (!Array.isArray(mat[0])) {\n val = mat[0];\n for (i = 1; i < mat.length; i++) {\n val = callback(val, mat[i]);\n }\n return val;\n } else {\n tran = _switch(mat);\n ret = [];\n for (i = 0; i < tran.length; i++) {\n ret[i] = _reduce(tran[i], dim - 1, callback);\n }\n return ret;\n }\n } else {\n ret = [];\n for (i = 0; i < mat.length; i++) {\n ret[i] = _reduce(mat[i], dim - 1, callback);\n }\n return ret;\n }\n}\n\n// TODO: document function scatter\nexport function scatter(a, j, w, x, u, mark, cindex, f, inverse, update, value) {\n // a arrays\n var avalues = a._values;\n var aindex = a._index;\n var aptr = a._ptr;\n\n // vars\n var k, k0, k1, i;\n\n // check we need to process values (pattern matrix)\n if (x) {\n // values in j\n for (k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = aindex[k];\n // check value exists in current j\n if (w[i] !== mark) {\n // i is new entry in j\n w[i] = mark;\n // add i to pattern of C\n cindex.push(i);\n // x(i) = A, check we need to call function this time\n if (update) {\n // copy value to workspace calling callback function\n x[i] = inverse ? f(avalues[k], value) : f(value, avalues[k]);\n // function was called on current row\n u[i] = mark;\n } else {\n // copy value to workspace\n x[i] = avalues[k];\n }\n } else {\n // i exists in C already\n x[i] = inverse ? f(avalues[k], x[i]) : f(x[i], avalues[k]);\n // function was called on current row\n u[i] = mark;\n }\n }\n } else {\n // values in j\n for (k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = aindex[k];\n // check value exists in current j\n if (w[i] !== mark) {\n // i is new entry in j\n w[i] = mark;\n // add i to pattern of C\n cindex.push(i);\n } else {\n // indicate function was called on current row\n u[i] = mark;\n }\n }\n }\n}","import { cbrt, expm1, isInteger, log10, log1p, log2, sign, toFixed } from '../../utils/number.js';\nvar n1 = 'number';\nvar n2 = 'number, number';\nexport function absNumber(a) {\n return Math.abs(a);\n}\nabsNumber.signature = n1;\nexport function addNumber(a, b) {\n return a + b;\n}\naddNumber.signature = n2;\nexport function subtractNumber(a, b) {\n return a - b;\n}\nsubtractNumber.signature = n2;\nexport function multiplyNumber(a, b) {\n return a * b;\n}\nmultiplyNumber.signature = n2;\nexport function divideNumber(a, b) {\n return a / b;\n}\ndivideNumber.signature = n2;\nexport function unaryMinusNumber(x) {\n return -x;\n}\nunaryMinusNumber.signature = n1;\nexport function unaryPlusNumber(x) {\n return x;\n}\nunaryPlusNumber.signature = n1;\nexport function cbrtNumber(x) {\n return cbrt(x);\n}\ncbrtNumber.signature = n1;\nexport function cubeNumber(x) {\n return x * x * x;\n}\ncubeNumber.signature = n1;\nexport function expNumber(x) {\n return Math.exp(x);\n}\nexpNumber.signature = n1;\nexport function expm1Number(x) {\n return expm1(x);\n}\nexpm1Number.signature = n1;\n\n/**\n * Calculate gcd for numbers\n * @param {number} a\n * @param {number} b\n * @returns {number} Returns the greatest common denominator of a and b\n */\nexport function gcdNumber(a, b) {\n if (!isInteger(a) || !isInteger(b)) {\n throw new Error('Parameters in function gcd must be integer numbers');\n }\n\n // https://en.wikipedia.org/wiki/Euclidean_algorithm\n var r;\n while (b !== 0) {\n r = a % b;\n a = b;\n b = r;\n }\n return a < 0 ? -a : a;\n}\ngcdNumber.signature = n2;\n\n/**\n * Calculate lcm for two numbers\n * @param {number} a\n * @param {number} b\n * @returns {number} Returns the least common multiple of a and b\n */\nexport function lcmNumber(a, b) {\n if (!isInteger(a) || !isInteger(b)) {\n throw new Error('Parameters in function lcm must be integer numbers');\n }\n if (a === 0 || b === 0) {\n return 0;\n }\n\n // https://en.wikipedia.org/wiki/Euclidean_algorithm\n // evaluate lcm here inline to reduce overhead\n var t;\n var prod = a * b;\n while (b !== 0) {\n t = b;\n b = a % t;\n a = t;\n }\n return Math.abs(prod / a);\n}\nlcmNumber.signature = n2;\n\n/**\n * Calculate the logarithm of a value, optionally to a given base.\n * @param {number} x\n * @param {number | null | undefined} base\n * @return {number}\n */\nexport function logNumber(x, y) {\n if (y) {\n return Math.log(x) / Math.log(y);\n }\n return Math.log(x);\n}\n\n/**\n * Calculate the 10-base logarithm of a number\n * @param {number} x\n * @return {number}\n */\nexport function log10Number(x) {\n return log10(x);\n}\nlog10Number.signature = n1;\n\n/**\n * Calculate the 2-base logarithm of a number\n * @param {number} x\n * @return {number}\n */\nexport function log2Number(x) {\n return log2(x);\n}\nlog2Number.signature = n1;\n\n/**\n * Calculate the natural logarithm of a `number+1`\n * @param {number} x\n * @returns {number}\n */\nexport function log1pNumber(x) {\n return log1p(x);\n}\nlog1pNumber.signature = n1;\n\n/**\n * Calculate the modulus of two numbers\n * @param {number} x\n * @param {number} y\n * @returns {number} res\n * @private\n */\nexport function modNumber(x, y) {\n // We don't use JavaScript's % operator here as this doesn't work\n // correctly for x < 0 and x === 0\n // see https://en.wikipedia.org/wiki/Modulo_operation\n return y === 0 ? x : x - y * Math.floor(x / y);\n}\nmodNumber.signature = n2;\n\n/**\n * Calculate the nth root of a, solve x^root == a\n * http://rosettacode.org/wiki/Nth_root#JavaScript\n * @param {number} a\n * @param {number} [2] root\n * @private\n */\nexport function nthRootNumber(a) {\n var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;\n var inv = root < 0;\n if (inv) {\n root = -root;\n }\n if (root === 0) {\n throw new Error('Root must be non-zero');\n }\n if (a < 0 && Math.abs(root) % 2 !== 1) {\n throw new Error('Root must be odd when a is negative.');\n }\n\n // edge cases zero and infinity\n if (a === 0) {\n return inv ? Infinity : 0;\n }\n if (!isFinite(a)) {\n return inv ? 0 : a;\n }\n var x = Math.pow(Math.abs(a), 1 / root);\n // If a < 0, we require that root is an odd integer,\n // so (-1) ^ (1/root) = -1\n x = a < 0 ? -x : x;\n return inv ? 1 / x : x;\n\n // Very nice algorithm, but fails with nthRoot(-2, 3).\n // Newton's method has some well-known problems at times:\n // https://en.wikipedia.org/wiki/Newton%27s_method#Failure_analysis\n /*\n let x = 1 // Initial guess\n let xPrev = 1\n let i = 0\n const iMax = 10000\n do {\n const delta = (a / Math.pow(x, root - 1) - x) / root\n xPrev = x\n x = x + delta\n i++\n }\n while (xPrev !== x && i < iMax)\n if (xPrev !== x) {\n throw new Error('Function nthRoot failed to converge')\n }\n return inv ? 1 / x : x\n */\n}\nexport function signNumber(x) {\n return sign(x);\n}\nsignNumber.signature = n1;\nexport function sqrtNumber(x) {\n return Math.sqrt(x);\n}\nsqrtNumber.signature = n1;\nexport function squareNumber(x) {\n return x * x;\n}\nsquareNumber.signature = n1;\n\n/**\n * Calculate xgcd for two numbers\n * @param {number} a\n * @param {number} b\n * @return {number} result\n * @private\n */\nexport function xgcdNumber(a, b) {\n // source: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm\n var t; // used to swap two variables\n var q; // quotient\n var r; // remainder\n var x = 0;\n var lastx = 1;\n var y = 1;\n var lasty = 0;\n if (!isInteger(a) || !isInteger(b)) {\n throw new Error('Parameters in function xgcd must be integer numbers');\n }\n while (b) {\n q = Math.floor(a / b);\n r = a - q * b;\n t = x;\n x = lastx - q * x;\n lastx = t;\n t = y;\n y = lasty - q * y;\n lasty = t;\n a = b;\n b = r;\n }\n var res;\n if (a < 0) {\n res = [-a, -lastx, -lasty];\n } else {\n res = [a, a ? lastx : 0, lasty];\n }\n return res;\n}\nxgcdNumber.signature = n2;\n\n/**\n * Calculates the power of x to y, x^y, for two numbers.\n * @param {number} x\n * @param {number} y\n * @return {number} res\n */\nexport function powNumber(x, y) {\n // x^Infinity === 0 if -1 < x < 1\n // A real number 0 is returned instead of complex(0)\n if (x * x < 1 && y === Infinity || x * x > 1 && y === -Infinity) {\n return 0;\n }\n return Math.pow(x, y);\n}\npowNumber.signature = n2;\n\n/**\n * round a number to the given number of decimals, or to zero if decimals is\n * not provided\n * @param {number} value\n * @param {number} decimals number of decimals, between 0 and 15 (0 by default)\n * @return {number} roundedValue\n */\nexport function roundNumber(value) {\n var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n if (!isInteger(decimals) || decimals < 0 || decimals > 15) {\n throw new Error('Number of decimals in function round must be an integer from 0 to 15 inclusive');\n }\n return parseFloat(toFixed(value, decimals));\n}\n\n/**\n * Calculate the norm of a number, the absolute value.\n * @param {number} x\n * @return {number}\n */\nexport function normNumber(x) {\n return Math.abs(x);\n}\nnormNumber.signature = n1;","/** @param {number} i\n * @param {number} n\n * @returns {number} product of i to n\n */\nexport function product(i, n) {\n if (n < i) {\n return 1;\n }\n if (n === i) {\n return n;\n }\n var half = n + i >> 1; // divide (n + i) by 2 and truncate to integer\n return product(i, half) * product(half + 1, n);\n}","/* eslint-disable no-loss-of-precision */\n\nimport { isInteger } from '../../utils/number.js';\nimport { product } from '../../utils/product.js';\nexport function gammaNumber(n) {\n var x;\n if (isInteger(n)) {\n if (n <= 0) {\n return isFinite(n) ? Infinity : NaN;\n }\n if (n > 171) {\n return Infinity; // Will overflow\n }\n return product(1, n - 1);\n }\n if (n < 0.5) {\n return Math.PI / (Math.sin(Math.PI * n) * gammaNumber(1 - n));\n }\n if (n >= 171.35) {\n return Infinity; // will overflow\n }\n if (n > 85.0) {\n // Extended Stirling Approx\n var twoN = n * n;\n var threeN = twoN * n;\n var fourN = threeN * n;\n var fiveN = fourN * n;\n return Math.sqrt(2 * Math.PI / n) * Math.pow(n / Math.E, n) * (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + 5246819 / (75246796800 * fiveN * n));\n }\n --n;\n x = gammaP[0];\n for (var i = 1; i < gammaP.length; ++i) {\n x += gammaP[i] / (n + i);\n }\n var t = n + gammaG + 0.5;\n return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x;\n}\ngammaNumber.signature = 'number';\n\n// TODO: comment on the variables g and p\n\nexport var gammaG = 4.7421875;\nexport var gammaP = [0.99999999999999709182, 57.156235665862923517, -59.597960355475491248, 14.136097974741747174, -0.49191381609762019978, 0.33994649984811888699e-4, 0.46523628927048575665e-4, -0.98374475304879564677e-4, 0.15808870322491248884e-3, -0.21026444172410488319e-3, 0.21743961811521264320e-3, -0.16431810653676389022e-3, 0.84418223983852743293e-4, -0.26190838401581408670e-4, 0.36899182659531622704e-5];\n\n// lgamma implementation ref: https://mrob.com/pub/ries/lanczos-gamma.html#code\n\n// log(2 * pi) / 2\nexport var lnSqrt2PI = 0.91893853320467274178;\nexport var lgammaG = 5; // Lanczos parameter \"g\"\nexport var lgammaN = 7; // Range of coefficients \"n\"\n\nexport var lgammaSeries = [1.000000000190015, 76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5];\nexport function lgammaNumber(n) {\n if (n < 0) return NaN;\n if (n === 0) return Infinity;\n if (!isFinite(n)) return n;\n if (n < 0.5) {\n // Use Euler's reflection formula:\n // gamma(z) = PI / (sin(PI * z) * gamma(1 - z))\n return Math.log(Math.PI / Math.sin(Math.PI * n)) - lgammaNumber(1 - n);\n }\n\n // Compute the logarithm of the Gamma function using the Lanczos method\n\n n = n - 1;\n var base = n + lgammaG + 0.5; // Base of the Lanczos exponential\n var sum = lgammaSeries[0];\n\n // We start with the terms that have the smallest coefficients and largest denominator\n for (var i = lgammaN - 1; i >= 1; i--) {\n sum += lgammaSeries[i] / (n + i);\n }\n return lnSqrt2PI + (n + 0.5) * Math.log(base) - base + Math.log(sum);\n}\nlgammaNumber.signature = 'number';","/**\n * Compares two BigNumbers.\n * @param {BigNumber} a - First value to compare\n * @param {BigNumber} b - Second value to compare\n * @param {number} [relTol=1e-09] - The relative tolerance, indicating the maximum allowed difference relative to the larger absolute value. Must be greater than 0.\n * @param {number} [absTol=0] - The minimum absolute tolerance, useful for comparisons near zero. Must be at least 0.\n * @returns {boolean} whether the two numbers are nearly equal\n * @throws {Error} If `relTol` is less than or equal to 0.\n * @throws {Error} If `absTol` is less than 0.\n *\n * @example\n * nearlyEqual(1.000000001, 1.0, 1e-9); // true\n * nearlyEqual(1.000000002, 1.0, 0); // false\n * nearlyEqual(1.0, 1.009, undefined, 0.02); // true\n * nearlyEqual(0.000000001, 0.0, undefined, 1e-8); // true\n */\nexport function nearlyEqual(a, b) {\n var relTol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1e-9;\n var absTol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n if (relTol <= 0) {\n throw new Error('Relative tolerance must be greater than 0');\n }\n if (absTol < 0) {\n throw new Error('Absolute tolerance must be at least 0');\n }\n // NaN\n if (a.isNaN() || b.isNaN()) {\n return false;\n }\n if (!a.isFinite() || !b.isFinite()) {\n return a.eq(b);\n }\n // use \"==\" operator, handles infinities\n if (a.eq(b)) {\n return true;\n }\n // abs(a-b) <= max(relTol * max(abs(a), abs(b)), absTol)\n return a.minus(b).abs().lte(a.constructor.max(a.constructor.max(a.abs(), b.abs()).mul(relTol), absTol));\n}","import { deepMap } from '../../utils/collection.js';\nimport { factory } from '../../utils/factory.js';\nvar name = 'isZero';\nvar dependencies = ['typed', 'equalScalar'];\nexport var createIsZero = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n equalScalar\n } = _ref;\n /**\n * Test whether a value is zero.\n * The function can check for zero for types `number`, `BigNumber`, `Fraction`,\n * `Complex`, and `Unit`.\n *\n * The function is evaluated element-wise in case of Array or Matrix input.\n *\n * Syntax:\n *\n * math.isZero(x)\n *\n * Examples:\n *\n * math.isZero(0) // returns true\n * math.isZero(2) // returns false\n * math.isZero(0.5) // returns false\n * math.isZero(math.bignumber(0)) // returns true\n * math.isZero(math.fraction(0)) // returns true\n * math.isZero(math.fraction(1,3)) // returns false\n * math.isZero(math.complex('2 - 4i')) // returns false\n * math.isZero(math.complex('0i')) // returns true\n * math.isZero('0') // returns true\n * math.isZero('2') // returns false\n * math.isZero([2, 0, -3]) // returns [false, true, false]\n *\n * See also:\n *\n * isNumeric, isPositive, isNegative, isInteger\n *\n * @param {number | BigNumber | bigint | Complex | Fraction | Unit | Array | Matrix} x Value to be tested\n * @return {boolean} Returns true when `x` is zero.\n * Throws an error in case of an unknown data type.\n */\n return typed(name, {\n 'number | BigNumber | Complex | Fraction': x => equalScalar(x, 0),\n bigint: x => x === 0n,\n Unit: typed.referToSelf(self => x => typed.find(self, x.valueType())(x.value)),\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n });\n});","import { nearlyEqual } from './number.js';\n\n/**\n * Test whether two complex values are equal provided a given relTol and absTol.\n * Does not use or change the global Complex.EPSILON setting\n * @param {Complex} x - The first complex number for comparison.\n * @param {Complex} y - The second complex number for comparison.\n * @param {number} relTol - The relative tolerance for comparison.\n * @param {number} absTol - The absolute tolerance for comparison.\n * @returns {boolean} - Returns true if the two complex numbers are equal within the given tolerances, otherwise returns false.\n */\nexport function complexEquals(x, y, relTol, absTol) {\n return nearlyEqual(x.re, y.re, relTol, absTol) && nearlyEqual(x.im, y.im, relTol, absTol);\n}","import { factory } from '../../utils/factory.js';\nexport var createCompareUnits = /* #__PURE__ */factory('compareUnits', ['typed'], _ref => {\n var {\n typed\n } = _ref;\n return {\n 'Unit, Unit': typed.referToSelf(self => (x, y) => {\n if (!x.equalBase(y)) {\n throw new Error('Cannot compare units with different base');\n }\n return typed.find(self, [x.valueType(), y.valueType()])(x.value, y.value);\n })\n };\n});","import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js';\nimport { nearlyEqual } from '../../utils/number.js';\nimport { factory } from '../../utils/factory.js';\nimport { complexEquals } from '../../utils/complex.js';\nimport { createCompareUnits } from './compareUnits.js';\nvar name = 'equalScalar';\nvar dependencies = ['typed', 'config'];\nexport var createEqualScalar = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n config\n } = _ref;\n var compareUnits = createCompareUnits({\n typed\n });\n\n /**\n * Test whether two scalar values are nearly equal.\n *\n * @param {number | BigNumber | bigint | Fraction | boolean | Complex | Unit} x First value to compare\n * @param {number | BigNumber | bigint | Fraction | boolean | Complex} y Second value to compare\n * @return {boolean} Returns true when the compared values are equal, else returns false\n * @private\n */\n return typed(name, {\n 'boolean, boolean': function boolean_boolean(x, y) {\n return x === y;\n },\n 'number, number': function number_number(x, y) {\n return nearlyEqual(x, y, config.relTol, config.absTol);\n },\n 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) {\n return x.eq(y) || bigNearlyEqual(x, y, config.relTol, config.absTol);\n },\n 'bigint, bigint': function bigint_bigint(x, y) {\n return x === y;\n },\n 'Fraction, Fraction': function Fraction_Fraction(x, y) {\n return x.equals(y);\n },\n 'Complex, Complex': function Complex_Complex(x, y) {\n return complexEquals(x, y, config.relTol, config.absTol);\n }\n }, compareUnits);\n});\nexport var createEqualScalarNumber = factory(name, ['typed', 'config'], _ref2 => {\n var {\n typed,\n config\n } = _ref2;\n return typed(name, {\n 'number, number': function number_number(x, y) {\n return nearlyEqual(x, y, config.relTol, config.absTol);\n }\n });\n});","import { isArray, isBigNumber, isCollection, isIndex, isMatrix, isNumber, isString, typeOf } from '../../utils/is.js';\nimport { isInteger } from '../../utils/number.js';\nimport { format } from '../../utils/string.js';\nimport { clone, deepStrictEqual } from '../../utils/object.js';\nimport { arraySize, getArrayDataType, processSizesWildcard, unsqueeze, validateIndex } from '../../utils/array.js';\nimport { factory } from '../../utils/factory.js';\nimport { DimensionError } from '../../error/DimensionError.js';\nimport { optimizeCallback } from '../../utils/optimizeCallback.js';\nvar name = 'SparseMatrix';\nvar dependencies = ['typed', 'equalScalar', 'Matrix'];\nexport var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n equalScalar,\n Matrix\n } = _ref;\n /**\n * Sparse Matrix implementation. This type implements\n * a [Compressed Column Storage](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_(CSC_or_CCS))\n * format for two-dimensional sparse matrices.\n * @class SparseMatrix\n */\n function SparseMatrix(data, datatype) {\n if (!(this instanceof SparseMatrix)) {\n throw new SyntaxError('Constructor must be called with the new operator');\n }\n if (datatype && !isString(datatype)) {\n throw new Error('Invalid datatype: ' + datatype);\n }\n if (isMatrix(data)) {\n // create from matrix\n _createFromMatrix(this, data, datatype);\n } else if (data && isArray(data.index) && isArray(data.ptr) && isArray(data.size)) {\n // initialize fields\n this._values = data.values;\n this._index = data.index;\n this._ptr = data.ptr;\n this._size = data.size;\n this._datatype = datatype || data.datatype;\n } else if (isArray(data)) {\n // create from array\n _createFromArray(this, data, datatype);\n } else if (data) {\n // unsupported type\n throw new TypeError('Unsupported type of data (' + typeOf(data) + ')');\n } else {\n // nothing provided\n this._values = [];\n this._index = [];\n this._ptr = [0];\n this._size = [0, 0];\n this._datatype = datatype;\n }\n }\n function _createFromMatrix(matrix, source, datatype) {\n // check matrix type\n if (source.type === 'SparseMatrix') {\n // clone arrays\n matrix._values = source._values ? clone(source._values) : undefined;\n matrix._index = clone(source._index);\n matrix._ptr = clone(source._ptr);\n matrix._size = clone(source._size);\n matrix._datatype = datatype || source._datatype;\n } else {\n // build from matrix data\n _createFromArray(matrix, source.valueOf(), datatype || source._datatype);\n }\n }\n function _createFromArray(matrix, data, datatype) {\n // initialize fields\n matrix._values = [];\n matrix._index = [];\n matrix._ptr = [];\n matrix._datatype = datatype;\n // discover rows & columns, do not use math.size() to avoid looping array twice\n var rows = data.length;\n var columns = 0;\n\n // equal signature to use\n var eq = equalScalar;\n // zero value\n var zero = 0;\n if (isString(datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [datatype, datatype]) || equalScalar;\n // convert 0 to the same datatype\n zero = typed.convert(0, datatype);\n }\n\n // check we have rows (empty array)\n if (rows > 0) {\n // column index\n var j = 0;\n do {\n // store pointer to values index\n matrix._ptr.push(matrix._index.length);\n // loop rows\n for (var i = 0; i < rows; i++) {\n // current row\n var row = data[i];\n // check row is an array\n if (isArray(row)) {\n // update columns if needed (only on first column)\n if (j === 0 && columns < row.length) {\n columns = row.length;\n }\n // check row has column\n if (j < row.length) {\n // value\n var v = row[j];\n // check value != 0\n if (!eq(v, zero)) {\n // store value\n matrix._values.push(v);\n // index\n matrix._index.push(i);\n }\n }\n } else {\n // update columns if needed (only on first column)\n if (j === 0 && columns < 1) {\n columns = 1;\n }\n // check value != 0 (row is a scalar)\n if (!eq(row, zero)) {\n // store value\n matrix._values.push(row);\n // index\n matrix._index.push(i);\n }\n }\n }\n // increment index\n j++;\n } while (j < columns);\n }\n // store number of values in ptr\n matrix._ptr.push(matrix._index.length);\n // size\n matrix._size = [rows, columns];\n }\n SparseMatrix.prototype = new Matrix();\n\n /**\n * Create a new SparseMatrix\n */\n SparseMatrix.prototype.createSparseMatrix = function (data, datatype) {\n return new SparseMatrix(data, datatype);\n };\n\n /**\n * Attach type information\n */\n Object.defineProperty(SparseMatrix, 'name', {\n value: 'SparseMatrix'\n });\n SparseMatrix.prototype.constructor = SparseMatrix;\n SparseMatrix.prototype.type = 'SparseMatrix';\n SparseMatrix.prototype.isSparseMatrix = true;\n\n /**\n * Get the matrix type\n *\n * Usage:\n * const matrixType = matrix.getDataType() // retrieves the matrix type\n *\n * @memberOf SparseMatrix\n * @return {string} type information; if multiple types are found from the Matrix, it will return \"mixed\"\n */\n SparseMatrix.prototype.getDataType = function () {\n return getArrayDataType(this._values, typeOf);\n };\n\n /**\n * Get the storage format used by the matrix.\n *\n * Usage:\n * const format = matrix.storage() // retrieve storage format\n *\n * @memberof SparseMatrix\n * @return {string} The storage format.\n */\n SparseMatrix.prototype.storage = function () {\n return 'sparse';\n };\n\n /**\n * Get the datatype of the data stored in the matrix.\n *\n * Usage:\n * const format = matrix.datatype() // retrieve matrix datatype\n *\n * @memberof SparseMatrix\n * @return {string} The datatype.\n */\n SparseMatrix.prototype.datatype = function () {\n return this._datatype;\n };\n\n /**\n * Create a new SparseMatrix\n * @memberof SparseMatrix\n * @param {Array} data\n * @param {string} [datatype]\n */\n SparseMatrix.prototype.create = function (data, datatype) {\n return new SparseMatrix(data, datatype);\n };\n\n /**\n * Get the matrix density.\n *\n * Usage:\n * const density = matrix.density() // retrieve matrix density\n *\n * @memberof SparseMatrix\n * @return {number} The matrix density.\n */\n SparseMatrix.prototype.density = function () {\n // rows & columns\n var rows = this._size[0];\n var columns = this._size[1];\n // calculate density\n return rows !== 0 && columns !== 0 ? this._index.length / (rows * columns) : 0;\n };\n\n /**\n * Get a subset of the matrix, or replace a subset of the matrix.\n *\n * Usage:\n * const subset = matrix.subset(index) // retrieve subset\n * const value = matrix.subset(index, replacement) // replace subset\n *\n * @memberof SparseMatrix\n * @param {Index} index\n * @param {Array | Matrix | *} [replacement]\n * @param {*} [defaultValue=0] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be filled with zeros.\n */\n SparseMatrix.prototype.subset = function (index, replacement, defaultValue) {\n // check it is a pattern matrix\n if (!this._values) {\n throw new Error('Cannot invoke subset on a Pattern only matrix');\n }\n\n // check arguments\n switch (arguments.length) {\n case 1:\n return _getsubset(this, index);\n\n // intentional fall through\n case 2:\n case 3:\n return _setsubset(this, index, replacement, defaultValue);\n default:\n throw new SyntaxError('Wrong number of arguments');\n }\n };\n function _getsubset(matrix, idx) {\n // check idx\n if (!isIndex(idx)) {\n throw new TypeError('Invalid index');\n }\n var isScalar = idx.isScalar();\n if (isScalar) {\n // return a scalar\n return matrix.get(idx.min());\n }\n // validate dimensions\n var size = idx.size();\n if (size.length !== matrix._size.length) {\n throw new DimensionError(size.length, matrix._size.length);\n }\n\n // vars\n var i, ii, k, kk;\n\n // validate if any of the ranges in the index is out of range\n var min = idx.min();\n var max = idx.max();\n for (i = 0, ii = matrix._size.length; i < ii; i++) {\n validateIndex(min[i], matrix._size[i]);\n validateIndex(max[i], matrix._size[i]);\n }\n\n // matrix arrays\n var mvalues = matrix._values;\n var mindex = matrix._index;\n var mptr = matrix._ptr;\n\n // rows & columns dimensions for result matrix\n var rows = idx.dimension(0);\n var columns = idx.dimension(1);\n\n // workspace & permutation vector\n var w = [];\n var pv = [];\n\n // loop rows in resulting matrix\n rows.forEach(function (i, r) {\n // update permutation vector\n pv[i] = r[0];\n // mark i in workspace\n w[i] = true;\n });\n\n // result matrix arrays\n var values = mvalues ? [] : undefined;\n var index = [];\n var ptr = [];\n\n // loop columns in result matrix\n columns.forEach(function (j) {\n // update ptr\n ptr.push(index.length);\n // loop values in column j\n for (k = mptr[j], kk = mptr[j + 1]; k < kk; k++) {\n // row\n i = mindex[k];\n // check row is in result matrix\n if (w[i] === true) {\n // push index\n index.push(pv[i]);\n // check we need to process values\n if (values) {\n values.push(mvalues[k]);\n }\n }\n }\n });\n // update ptr\n ptr.push(index.length);\n\n // return matrix\n return new SparseMatrix({\n values,\n index,\n ptr,\n size,\n datatype: matrix._datatype\n });\n }\n function _setsubset(matrix, index, submatrix, defaultValue) {\n // check index\n if (!index || index.isIndex !== true) {\n throw new TypeError('Invalid index');\n }\n\n // get index size and check whether the index contains a single value\n var iSize = index.size();\n var isScalar = index.isScalar();\n\n // calculate the size of the submatrix, and convert it into an Array if needed\n var sSize;\n if (isMatrix(submatrix)) {\n // submatrix size\n sSize = submatrix.size();\n // use array representation\n submatrix = submatrix.toArray();\n } else {\n // get submatrix size (array, scalar)\n sSize = arraySize(submatrix);\n }\n\n // check index is a scalar\n if (isScalar) {\n // verify submatrix is a scalar\n if (sSize.length !== 0) {\n throw new TypeError('Scalar expected');\n }\n // set value\n matrix.set(index.min(), submatrix, defaultValue);\n } else {\n // validate dimensions, index size must be one or two dimensions\n if (iSize.length !== 1 && iSize.length !== 2) {\n throw new DimensionError(iSize.length, matrix._size.length, '<');\n }\n\n // check submatrix and index have the same dimensions\n if (sSize.length < iSize.length) {\n // calculate number of missing outer dimensions\n var i = 0;\n var outer = 0;\n while (iSize[i] === 1 && sSize[i] === 1) {\n i++;\n }\n while (iSize[i] === 1) {\n outer++;\n i++;\n }\n // unsqueeze both outer and inner dimensions\n submatrix = unsqueeze(submatrix, iSize.length, outer, sSize);\n }\n\n // check whether the size of the submatrix matches the index size\n if (!deepStrictEqual(iSize, sSize)) {\n throw new DimensionError(iSize, sSize, '>');\n }\n\n // insert the sub matrix\n if (iSize.length === 1) {\n // if the replacement index only has 1 dimension, go trough each one and set its value\n var range = index.dimension(0);\n range.forEach(function (dataIndex, subIndex) {\n validateIndex(dataIndex);\n matrix.set([dataIndex, 0], submatrix[subIndex[0]], defaultValue);\n });\n } else {\n // if the replacement index has 2 dimensions, go through each one and set the value in the correct index\n var firstDimensionRange = index.dimension(0);\n var secondDimensionRange = index.dimension(1);\n firstDimensionRange.forEach(function (firstDataIndex, firstSubIndex) {\n validateIndex(firstDataIndex);\n secondDimensionRange.forEach(function (secondDataIndex, secondSubIndex) {\n validateIndex(secondDataIndex);\n matrix.set([firstDataIndex, secondDataIndex], submatrix[firstSubIndex[0]][secondSubIndex[0]], defaultValue);\n });\n });\n }\n }\n return matrix;\n }\n\n /**\n * Get a single element from the matrix.\n * @memberof SparseMatrix\n * @param {number[]} index Zero-based index\n * @return {*} value\n */\n SparseMatrix.prototype.get = function (index) {\n if (!isArray(index)) {\n throw new TypeError('Array expected');\n }\n if (index.length !== this._size.length) {\n throw new DimensionError(index.length, this._size.length);\n }\n\n // check it is a pattern matrix\n if (!this._values) {\n throw new Error('Cannot invoke get on a Pattern only matrix');\n }\n\n // row and column\n var i = index[0];\n var j = index[1];\n\n // check i, j are valid\n validateIndex(i, this._size[0]);\n validateIndex(j, this._size[1]);\n\n // find value index\n var k = _getValueIndex(i, this._ptr[j], this._ptr[j + 1], this._index);\n // check k is prior to next column k and it is in the correct row\n if (k < this._ptr[j + 1] && this._index[k] === i) {\n return this._values[k];\n }\n return 0;\n };\n\n /**\n * Replace a single element in the matrix.\n * @memberof SparseMatrix\n * @param {number[]} index Zero-based index\n * @param {*} v\n * @param {*} [defaultValue] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be set to zero.\n * @return {SparseMatrix} self\n */\n SparseMatrix.prototype.set = function (index, v, defaultValue) {\n if (!isArray(index)) {\n throw new TypeError('Array expected');\n }\n if (index.length !== this._size.length) {\n throw new DimensionError(index.length, this._size.length);\n }\n\n // check it is a pattern matrix\n if (!this._values) {\n throw new Error('Cannot invoke set on a Pattern only matrix');\n }\n\n // row and column\n var i = index[0];\n var j = index[1];\n\n // rows & columns\n var rows = this._size[0];\n var columns = this._size[1];\n\n // equal signature to use\n var eq = equalScalar;\n // zero value\n var zero = 0;\n if (isString(this._datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [this._datatype, this._datatype]) || equalScalar;\n // convert 0 to the same datatype\n zero = typed.convert(0, this._datatype);\n }\n\n // check we need to resize matrix\n if (i > rows - 1 || j > columns - 1) {\n // resize matrix\n _resize(this, Math.max(i + 1, rows), Math.max(j + 1, columns), defaultValue);\n // update rows & columns\n rows = this._size[0];\n columns = this._size[1];\n }\n\n // check i, j are valid\n validateIndex(i, rows);\n validateIndex(j, columns);\n\n // find value index\n var k = _getValueIndex(i, this._ptr[j], this._ptr[j + 1], this._index);\n // check k is prior to next column k and it is in the correct row\n if (k < this._ptr[j + 1] && this._index[k] === i) {\n // check value != 0\n if (!eq(v, zero)) {\n // update value\n this._values[k] = v;\n } else {\n // remove value from matrix\n _remove(k, j, this._values, this._index, this._ptr);\n }\n } else {\n if (!eq(v, zero)) {\n // insert value @ (i, j)\n _insert(k, i, j, v, this._values, this._index, this._ptr);\n }\n }\n return this;\n };\n function _getValueIndex(i, top, bottom, index) {\n // check row is on the bottom side\n if (bottom - top === 0) {\n return bottom;\n }\n // loop rows [top, bottom[\n for (var r = top; r < bottom; r++) {\n // check we found value index\n if (index[r] === i) {\n return r;\n }\n }\n // we did not find row\n return top;\n }\n function _remove(k, j, values, index, ptr) {\n // remove value @ k\n values.splice(k, 1);\n index.splice(k, 1);\n // update pointers\n for (var x = j + 1; x < ptr.length; x++) {\n ptr[x]--;\n }\n }\n function _insert(k, i, j, v, values, index, ptr) {\n // insert value\n values.splice(k, 0, v);\n // update row for k\n index.splice(k, 0, i);\n // update column pointers\n for (var x = j + 1; x < ptr.length; x++) {\n ptr[x]++;\n }\n }\n\n /**\n * Resize the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (resize in place).\n *\n * @memberof SparseMatrix\n * @param {number[] | Matrix} size The new size the matrix should have.\n * Since sparse matrices are always two-dimensional,\n * size must be two numbers in either an array or a matrix\n * @param {*} [defaultValue=0] Default value, filled in on new entries.\n * If not provided, the matrix elements will\n * be filled with zeros.\n * @param {boolean} [copy] Return a resized copy of the matrix\n *\n * @return {Matrix} The resized matrix\n */\n SparseMatrix.prototype.resize = function (size, defaultValue, copy) {\n // validate arguments\n if (!isCollection(size)) {\n throw new TypeError('Array or Matrix expected');\n }\n\n // SparseMatrix input is always 2d, flatten this into 1d if it's indeed a vector\n var sizeArray = size.valueOf().map(value => {\n return Array.isArray(value) && value.length === 1 ? value[0] : value;\n });\n if (sizeArray.length !== 2) {\n throw new Error('Only two dimensions matrix are supported');\n }\n\n // check sizes\n sizeArray.forEach(function (value) {\n if (!isNumber(value) || !isInteger(value) || value < 0) {\n throw new TypeError('Invalid size, must contain positive integers ' + '(size: ' + format(sizeArray) + ')');\n }\n });\n\n // matrix to resize\n var m = copy ? this.clone() : this;\n // resize matrix\n return _resize(m, sizeArray[0], sizeArray[1], defaultValue);\n };\n function _resize(matrix, rows, columns, defaultValue) {\n // value to insert at the time of growing matrix\n var value = defaultValue || 0;\n\n // equal signature to use\n var eq = equalScalar;\n // zero value\n var zero = 0;\n if (isString(matrix._datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [matrix._datatype, matrix._datatype]) || equalScalar;\n // convert 0 to the same datatype\n zero = typed.convert(0, matrix._datatype);\n // convert value to the same datatype\n value = typed.convert(value, matrix._datatype);\n }\n\n // should we insert the value?\n var ins = !eq(value, zero);\n\n // old columns and rows\n var r = matrix._size[0];\n var c = matrix._size[1];\n var i, j, k;\n\n // check we need to increase columns\n if (columns > c) {\n // loop new columns\n for (j = c; j < columns; j++) {\n // update matrix._ptr for current column\n matrix._ptr[j] = matrix._values.length;\n // check we need to insert matrix._values\n if (ins) {\n // loop rows\n for (i = 0; i < r; i++) {\n // add new matrix._values\n matrix._values.push(value);\n // update matrix._index\n matrix._index.push(i);\n }\n }\n }\n // store number of matrix._values in matrix._ptr\n matrix._ptr[columns] = matrix._values.length;\n } else if (columns < c) {\n // truncate matrix._ptr\n matrix._ptr.splice(columns + 1, c - columns);\n // truncate matrix._values and matrix._index\n matrix._values.splice(matrix._ptr[columns], matrix._values.length);\n matrix._index.splice(matrix._ptr[columns], matrix._index.length);\n }\n // update columns\n c = columns;\n\n // check we need to increase rows\n if (rows > r) {\n // check we have to insert values\n if (ins) {\n // inserts\n var n = 0;\n // loop columns\n for (j = 0; j < c; j++) {\n // update matrix._ptr for current column\n matrix._ptr[j] = matrix._ptr[j] + n;\n // where to insert matrix._values\n k = matrix._ptr[j + 1] + n;\n // pointer\n var p = 0;\n // loop new rows, initialize pointer\n for (i = r; i < rows; i++, p++) {\n // add value\n matrix._values.splice(k + p, 0, value);\n // update matrix._index\n matrix._index.splice(k + p, 0, i);\n // increment inserts\n n++;\n }\n }\n // store number of matrix._values in matrix._ptr\n matrix._ptr[c] = matrix._values.length;\n }\n } else if (rows < r) {\n // deletes\n var d = 0;\n // loop columns\n for (j = 0; j < c; j++) {\n // update matrix._ptr for current column\n matrix._ptr[j] = matrix._ptr[j] - d;\n // where matrix._values start for next column\n var k0 = matrix._ptr[j];\n var k1 = matrix._ptr[j + 1] - d;\n // loop matrix._index\n for (k = k0; k < k1; k++) {\n // row\n i = matrix._index[k];\n // check we need to delete value and matrix._index\n if (i > rows - 1) {\n // remove value\n matrix._values.splice(k, 1);\n // remove item from matrix._index\n matrix._index.splice(k, 1);\n // increase deletes\n d++;\n }\n }\n }\n // update matrix._ptr for current column\n matrix._ptr[j] = matrix._values.length;\n }\n // update matrix._size\n matrix._size[0] = rows;\n matrix._size[1] = columns;\n // return matrix\n return matrix;\n }\n\n /**\n * Reshape the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (reshape in place).\n *\n * NOTE: This might be better suited to copy by default, instead of modifying\n * in place. For now, it operates in place to remain consistent with\n * resize().\n *\n * @memberof SparseMatrix\n * @param {number[]} sizes The new size the matrix should have.\n * Since sparse matrices are always two-dimensional,\n * size must be two numbers in either an array or a matrix\n * @param {boolean} [copy] Return a reshaped copy of the matrix\n *\n * @return {Matrix} The reshaped matrix\n */\n SparseMatrix.prototype.reshape = function (sizes, copy) {\n // validate arguments\n if (!isArray(sizes)) {\n throw new TypeError('Array expected');\n }\n if (sizes.length !== 2) {\n throw new Error('Sparse matrices can only be reshaped in two dimensions');\n }\n\n // check sizes\n sizes.forEach(function (value) {\n if (!isNumber(value) || !isInteger(value) || value <= -2 || value === 0) {\n throw new TypeError('Invalid size, must contain positive integers or -1 ' + '(size: ' + format(sizes) + ')');\n }\n });\n var currentLength = this._size[0] * this._size[1];\n sizes = processSizesWildcard(sizes, currentLength);\n var newLength = sizes[0] * sizes[1];\n\n // m * n must not change\n if (currentLength !== newLength) {\n throw new Error('Reshaping sparse matrix will result in the wrong number of elements');\n }\n\n // matrix to reshape\n var m = copy ? this.clone() : this;\n\n // return unchanged if the same shape\n if (this._size[0] === sizes[0] && this._size[1] === sizes[1]) {\n return m;\n }\n\n // Convert to COO format (generate a column index)\n var colIndex = [];\n for (var i = 0; i < m._ptr.length; i++) {\n for (var j = 0; j < m._ptr[i + 1] - m._ptr[i]; j++) {\n colIndex.push(i);\n }\n }\n\n // Clone the values array\n var values = m._values.slice();\n\n // Clone the row index array\n var rowIndex = m._index.slice();\n\n // Transform the (row, column) indices\n for (var _i = 0; _i < m._index.length; _i++) {\n var r1 = rowIndex[_i];\n var c1 = colIndex[_i];\n var flat = r1 * m._size[1] + c1;\n colIndex[_i] = flat % sizes[1];\n rowIndex[_i] = Math.floor(flat / sizes[1]);\n }\n\n // Now reshaping is supposed to preserve the row-major order, BUT these sparse matrices are stored\n // in column-major order, so we have to reorder the value array now. One option is to use a multisort,\n // sorting several arrays based on some other array.\n\n // OR, we could easily just:\n\n // 1. Remove all values from the matrix\n m._values.length = 0;\n m._index.length = 0;\n m._ptr.length = sizes[1] + 1;\n m._size = sizes.slice();\n for (var _i2 = 0; _i2 < m._ptr.length; _i2++) {\n m._ptr[_i2] = 0;\n }\n\n // 2. Re-insert all elements in the proper order (simplified code from SparseMatrix.prototype.set)\n // This step is probably the most time-consuming\n for (var h = 0; h < values.length; h++) {\n var _i3 = rowIndex[h];\n var _j = colIndex[h];\n var v = values[h];\n var k = _getValueIndex(_i3, m._ptr[_j], m._ptr[_j + 1], m._index);\n _insert(k, _i3, _j, v, m._values, m._index, m._ptr);\n }\n\n // The value indices are inserted out of order, but apparently that's... still OK?\n\n return m;\n };\n\n /**\n * Create a clone of the matrix\n * @memberof SparseMatrix\n * @return {SparseMatrix} clone\n */\n SparseMatrix.prototype.clone = function () {\n var m = new SparseMatrix({\n values: this._values ? clone(this._values) : undefined,\n index: clone(this._index),\n ptr: clone(this._ptr),\n size: clone(this._size),\n datatype: this._datatype\n });\n return m;\n };\n\n /**\n * Retrieve the size of the matrix.\n * @memberof SparseMatrix\n * @returns {number[]} size\n */\n SparseMatrix.prototype.size = function () {\n return this._size.slice(0); // copy the Array\n };\n\n /**\n * Create a new matrix with the results of the callback function executed on\n * each entry of the matrix.\n * @memberof SparseMatrix\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} [skipZeros] Invoke callback function for non-zero values only.\n *\n * @return {SparseMatrix} matrix\n */\n SparseMatrix.prototype.map = function (callback, skipZeros) {\n // check it is a pattern matrix\n if (!this._values) {\n throw new Error('Cannot invoke map on a Pattern only matrix');\n }\n // matrix instance\n var me = this;\n // rows and columns\n var rows = this._size[0];\n var columns = this._size[1];\n var fastCallback = optimizeCallback(callback, me, 'map');\n // invoke callback\n var invoke = function invoke(v, i, j) {\n // invoke callback\n return fastCallback.fn(v, [i, j], me);\n };\n // invoke _map\n return _map(this, 0, rows - 1, 0, columns - 1, invoke, skipZeros);\n };\n\n /**\n * Create a new matrix with the results of the callback function executed on the interval\n * [minRow..maxRow, minColumn..maxColumn].\n */\n function _map(matrix, minRow, maxRow, minColumn, maxColumn, callback, skipZeros) {\n // result arrays\n var values = [];\n var index = [];\n var ptr = [];\n\n // equal signature to use\n var eq = equalScalar;\n // zero value\n var zero = 0;\n if (isString(matrix._datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [matrix._datatype, matrix._datatype]) || equalScalar;\n // convert 0 to the same datatype\n zero = typed.convert(0, matrix._datatype);\n }\n\n // invoke callback\n var invoke = function invoke(v, x, y) {\n // invoke callback\n var value = callback(v, x, y);\n // check value != 0\n if (!eq(value, zero)) {\n // store value\n values.push(value);\n // index\n index.push(x);\n }\n };\n // loop columns\n for (var j = minColumn; j <= maxColumn; j++) {\n // store pointer to values index\n ptr.push(values.length);\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n var k0 = matrix._ptr[j];\n var k1 = matrix._ptr[j + 1];\n if (skipZeros) {\n // loop k within [k0, k1[\n for (var k = k0; k < k1; k++) {\n // row index\n var i = matrix._index[k];\n // check i is in range\n if (i >= minRow && i <= maxRow) {\n // value @ k\n invoke(matrix._values[k], i - minRow, j - minColumn);\n }\n }\n } else {\n // create a cache holding all defined values\n var _values = {};\n for (var _k = k0; _k < k1; _k++) {\n var _i4 = matrix._index[_k];\n _values[_i4] = matrix._values[_k];\n }\n\n // loop over all rows (indexes can be unordered so we can't use that),\n // and either read the value or zero\n for (var _i5 = minRow; _i5 <= maxRow; _i5++) {\n var value = _i5 in _values ? _values[_i5] : 0;\n invoke(value, _i5 - minRow, j - minColumn);\n }\n }\n }\n\n // store number of values in ptr\n ptr.push(values.length);\n // return sparse matrix\n return new SparseMatrix({\n values,\n index,\n ptr,\n size: [maxRow - minRow + 1, maxColumn - minColumn + 1]\n });\n }\n\n /**\n * Execute a callback function on each entry of the matrix.\n * @memberof SparseMatrix\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} [skipZeros] Invoke callback function for non-zero values only.\n * If false, the indices are guaranteed to be in order,\n * if true, the indices can be unordered.\n */\n SparseMatrix.prototype.forEach = function (callback, skipZeros) {\n // check it is a pattern matrix\n if (!this._values) {\n throw new Error('Cannot invoke forEach on a Pattern only matrix');\n }\n // matrix instance\n var me = this;\n // rows and columns\n var rows = this._size[0];\n var columns = this._size[1];\n var fastCallback = optimizeCallback(callback, me, 'forEach');\n // loop columns\n for (var j = 0; j < columns; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n var k0 = this._ptr[j];\n var k1 = this._ptr[j + 1];\n if (skipZeros) {\n // loop k within [k0, k1[\n for (var k = k0; k < k1; k++) {\n // row index\n var i = this._index[k];\n\n // value @ k\n // TODO apply a non indexed version of algorithm in case fastCallback is not optimized\n fastCallback.fn(this._values[k], [i, j], me);\n }\n } else {\n // create a cache holding all defined values\n var values = {};\n for (var _k2 = k0; _k2 < k1; _k2++) {\n var _i6 = this._index[_k2];\n values[_i6] = this._values[_k2];\n }\n\n // loop over all rows (indexes can be unordered so we can't use that),\n // and either read the value or zero\n for (var _i7 = 0; _i7 < rows; _i7++) {\n var value = _i7 in values ? values[_i7] : 0;\n fastCallback.fn(value, [_i7, j], me);\n }\n }\n }\n };\n\n /**\n * Iterate over the matrix elements, skipping zeros\n * @return {Iterable<{ value, index: number[] }>}\n */\n SparseMatrix.prototype[Symbol.iterator] = function* () {\n if (!this._values) {\n throw new Error('Cannot iterate a Pattern only matrix');\n }\n var columns = this._size[1];\n for (var j = 0; j < columns; j++) {\n var k0 = this._ptr[j];\n var k1 = this._ptr[j + 1];\n for (var k = k0; k < k1; k++) {\n // row index\n var i = this._index[k];\n yield {\n value: this._values[k],\n index: [i, j]\n };\n }\n }\n };\n\n /**\n * Create an Array with a copy of the data of the SparseMatrix\n * @memberof SparseMatrix\n * @returns {Array} array\n */\n SparseMatrix.prototype.toArray = function () {\n return _toArray(this._values, this._index, this._ptr, this._size, true);\n };\n\n /**\n * Get the primitive value of the SparseMatrix: a two dimensions array\n * @memberof SparseMatrix\n * @returns {Array} array\n */\n SparseMatrix.prototype.valueOf = function () {\n return _toArray(this._values, this._index, this._ptr, this._size, false);\n };\n function _toArray(values, index, ptr, size, copy) {\n // rows and columns\n var rows = size[0];\n var columns = size[1];\n // result\n var a = [];\n // vars\n var i, j;\n // initialize array\n for (i = 0; i < rows; i++) {\n a[i] = [];\n for (j = 0; j < columns; j++) {\n a[i][j] = 0;\n }\n }\n\n // loop columns\n for (j = 0; j < columns; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n var k0 = ptr[j];\n var k1 = ptr[j + 1];\n // loop k within [k0, k1[\n for (var k = k0; k < k1; k++) {\n // row index\n i = index[k];\n // set value (use one for pattern matrix)\n a[i][j] = values ? copy ? clone(values[k]) : values[k] : 1;\n }\n }\n return a;\n }\n\n /**\n * Get a string representation of the matrix, with optional formatting options.\n * @memberof SparseMatrix\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @returns {string} str\n */\n SparseMatrix.prototype.format = function (options) {\n // rows and columns\n var rows = this._size[0];\n var columns = this._size[1];\n // density\n var density = this.density();\n // rows & columns\n var str = 'Sparse Matrix [' + format(rows, options) + ' x ' + format(columns, options) + '] density: ' + format(density, options) + '\\n';\n // loop columns\n for (var j = 0; j < columns; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n var k0 = this._ptr[j];\n var k1 = this._ptr[j + 1];\n // loop k within [k0, k1[\n for (var k = k0; k < k1; k++) {\n // row index\n var i = this._index[k];\n // append value\n str += '\\n (' + format(i, options) + ', ' + format(j, options) + ') ==> ' + (this._values ? format(this._values[k], options) : 'X');\n }\n }\n return str;\n };\n\n /**\n * Get a string representation of the matrix\n * @memberof SparseMatrix\n * @returns {string} str\n */\n SparseMatrix.prototype.toString = function () {\n return format(this.toArray());\n };\n\n /**\n * Get a JSON representation of the matrix\n * @memberof SparseMatrix\n * @returns {Object}\n */\n SparseMatrix.prototype.toJSON = function () {\n return {\n mathjs: 'SparseMatrix',\n values: this._values,\n index: this._index,\n ptr: this._ptr,\n size: this._size,\n datatype: this._datatype\n };\n };\n\n /**\n * Get the kth Matrix diagonal.\n *\n * @memberof SparseMatrix\n * @param {number | BigNumber} [k=0] The kth diagonal where the vector will retrieved.\n *\n * @returns {Matrix} The matrix vector with the diagonal values.\n */\n SparseMatrix.prototype.diagonal = function (k) {\n // validate k if any\n if (k) {\n // convert BigNumber to a number\n if (isBigNumber(k)) {\n k = k.toNumber();\n }\n // is must be an integer\n if (!isNumber(k) || !isInteger(k)) {\n throw new TypeError('The parameter k must be an integer number');\n }\n } else {\n // default value\n k = 0;\n }\n var kSuper = k > 0 ? k : 0;\n var kSub = k < 0 ? -k : 0;\n\n // rows & columns\n var rows = this._size[0];\n var columns = this._size[1];\n\n // number diagonal values\n var n = Math.min(rows - kSub, columns - kSuper);\n\n // diagonal arrays\n var values = [];\n var index = [];\n var ptr = [];\n // initial ptr value\n ptr[0] = 0;\n // loop columns\n for (var j = kSuper; j < columns && values.length < n; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n var k0 = this._ptr[j];\n var k1 = this._ptr[j + 1];\n // loop x within [k0, k1[\n for (var x = k0; x < k1; x++) {\n // row index\n var i = this._index[x];\n // check row\n if (i === j - kSuper + kSub) {\n // value on this column\n values.push(this._values[x]);\n // store row\n index[values.length - 1] = i - kSub;\n // exit loop\n break;\n }\n }\n }\n // close ptr\n ptr.push(values.length);\n // return matrix\n return new SparseMatrix({\n values,\n index,\n ptr,\n size: [n, 1]\n });\n };\n\n /**\n * Generate a matrix from a JSON object\n * @memberof SparseMatrix\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"SparseMatrix\", \"values\": [], \"index\": [], \"ptr\": [], \"size\": []}`,\n * where mathjs is optional\n * @returns {SparseMatrix}\n */\n SparseMatrix.fromJSON = function (json) {\n return new SparseMatrix(json);\n };\n\n /**\n * Create a diagonal matrix.\n *\n * @memberof SparseMatrix\n * @param {Array} size The matrix size.\n * @param {number | Array | Matrix } value The values for the diagonal.\n * @param {number | BigNumber} [k=0] The kth diagonal where the vector will be filled in.\n * @param {number} [defaultValue] The default value for non-diagonal\n * @param {string} [datatype] The Matrix datatype, values must be of this datatype.\n *\n * @returns {SparseMatrix}\n */\n SparseMatrix.diagonal = function (size, value, k, defaultValue, datatype) {\n if (!isArray(size)) {\n throw new TypeError('Array expected, size parameter');\n }\n if (size.length !== 2) {\n throw new Error('Only two dimensions matrix are supported');\n }\n\n // map size & validate\n size = size.map(function (s) {\n // check it is a big number\n if (isBigNumber(s)) {\n // convert it\n s = s.toNumber();\n }\n // validate arguments\n if (!isNumber(s) || !isInteger(s) || s < 1) {\n throw new Error('Size values must be positive integers');\n }\n return s;\n });\n\n // validate k if any\n if (k) {\n // convert BigNumber to a number\n if (isBigNumber(k)) {\n k = k.toNumber();\n }\n // is must be an integer\n if (!isNumber(k) || !isInteger(k)) {\n throw new TypeError('The parameter k must be an integer number');\n }\n } else {\n // default value\n k = 0;\n }\n\n // equal signature to use\n var eq = equalScalar;\n // zero value\n var zero = 0;\n if (isString(datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [datatype, datatype]) || equalScalar;\n // convert 0 to the same datatype\n zero = typed.convert(0, datatype);\n }\n var kSuper = k > 0 ? k : 0;\n var kSub = k < 0 ? -k : 0;\n\n // rows and columns\n var rows = size[0];\n var columns = size[1];\n\n // number of non-zero items\n var n = Math.min(rows - kSub, columns - kSuper);\n\n // value extraction function\n var _value;\n\n // check value\n if (isArray(value)) {\n // validate array\n if (value.length !== n) {\n // number of values in array must be n\n throw new Error('Invalid value array length');\n }\n // define function\n _value = function _value(i) {\n // return value @ i\n return value[i];\n };\n } else if (isMatrix(value)) {\n // matrix size\n var ms = value.size();\n // validate matrix\n if (ms.length !== 1 || ms[0] !== n) {\n // number of values in array must be n\n throw new Error('Invalid matrix length');\n }\n // define function\n _value = function _value(i) {\n // return value @ i\n return value.get([i]);\n };\n } else {\n // define function\n _value = function _value() {\n // return value\n return value;\n };\n }\n\n // create arrays\n var values = [];\n var index = [];\n var ptr = [];\n\n // loop items\n for (var j = 0; j < columns; j++) {\n // number of rows with value\n ptr.push(values.length);\n // diagonal index\n var i = j - kSuper;\n // check we need to set diagonal value\n if (i >= 0 && i < n) {\n // get value @ i\n var v = _value(i);\n // check for zero\n if (!eq(v, zero)) {\n // column\n index.push(i + kSub);\n // add value\n values.push(v);\n }\n }\n }\n // last value should be number of values\n ptr.push(values.length);\n // create SparseMatrix\n return new SparseMatrix({\n values,\n index,\n ptr,\n size: [rows, columns]\n });\n };\n\n /**\n * Swap rows i and j in Matrix.\n *\n * @memberof SparseMatrix\n * @param {number} i Matrix row index 1\n * @param {number} j Matrix row index 2\n *\n * @return {Matrix} The matrix reference\n */\n SparseMatrix.prototype.swapRows = function (i, j) {\n // check index\n if (!isNumber(i) || !isInteger(i) || !isNumber(j) || !isInteger(j)) {\n throw new Error('Row index must be positive integers');\n }\n // check dimensions\n if (this._size.length !== 2) {\n throw new Error('Only two dimensional matrix is supported');\n }\n // validate index\n validateIndex(i, this._size[0]);\n validateIndex(j, this._size[0]);\n\n // swap rows\n SparseMatrix._swapRows(i, j, this._size[1], this._values, this._index, this._ptr);\n // return current instance\n return this;\n };\n\n /**\n * Loop rows with data in column j.\n *\n * @param {number} j Column\n * @param {Array} values Matrix values\n * @param {Array} index Matrix row indeces\n * @param {Array} ptr Matrix column pointers\n * @param {Function} callback Callback function invoked for every row in column j\n */\n SparseMatrix._forEachRow = function (j, values, index, ptr, callback) {\n // indeces for column j\n var k0 = ptr[j];\n var k1 = ptr[j + 1];\n\n // loop\n for (var k = k0; k < k1; k++) {\n // invoke callback\n callback(index[k], values[k]);\n }\n };\n\n /**\n * Swap rows x and y in Sparse Matrix data structures.\n *\n * @param {number} x Matrix row index 1\n * @param {number} y Matrix row index 2\n * @param {number} columns Number of columns in matrix\n * @param {Array} values Matrix values\n * @param {Array} index Matrix row indeces\n * @param {Array} ptr Matrix column pointers\n */\n SparseMatrix._swapRows = function (x, y, columns, values, index, ptr) {\n // loop columns\n for (var j = 0; j < columns; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n var k0 = ptr[j];\n var k1 = ptr[j + 1];\n // find value index @ x\n var kx = _getValueIndex(x, k0, k1, index);\n // find value index @ x\n var ky = _getValueIndex(y, k0, k1, index);\n // check both rows exist in matrix\n if (kx < k1 && ky < k1 && index[kx] === x && index[ky] === y) {\n // swap values (check for pattern matrix)\n if (values) {\n var v = values[kx];\n values[kx] = values[ky];\n values[ky] = v;\n }\n // next column\n continue;\n }\n // check x row exist & no y row\n if (kx < k1 && index[kx] === x && (ky >= k1 || index[ky] !== y)) {\n // value @ x (check for pattern matrix)\n var vx = values ? values[kx] : undefined;\n // insert value @ y\n index.splice(ky, 0, y);\n if (values) {\n values.splice(ky, 0, vx);\n }\n // remove value @ x (adjust array index if needed)\n index.splice(ky <= kx ? kx + 1 : kx, 1);\n if (values) {\n values.splice(ky <= kx ? kx + 1 : kx, 1);\n }\n // next column\n continue;\n }\n // check y row exist & no x row\n if (ky < k1 && index[ky] === y && (kx >= k1 || index[kx] !== x)) {\n // value @ y (check for pattern matrix)\n var vy = values ? values[ky] : undefined;\n // insert value @ x\n index.splice(kx, 0, x);\n if (values) {\n values.splice(kx, 0, vy);\n }\n // remove value @ y (adjust array index if needed)\n index.splice(kx <= ky ? ky + 1 : ky, 1);\n if (values) {\n values.splice(kx <= ky ? ky + 1 : ky, 1);\n }\n }\n }\n };\n return SparseMatrix;\n}, {\n isClass: true\n});","import { factory } from '../utils/factory.js';\nimport { deepMap } from '../utils/collection.js';\nvar name = 'number';\nvar dependencies = ['typed'];\n\n/**\n * Separates the radix, integer part, and fractional part of a non decimal number string\n * @param {string} input string to parse\n * @returns {object} the parts of the string or null if not a valid input\n */\nfunction getNonDecimalNumberParts(input) {\n var nonDecimalWithRadixMatch = input.match(/(0[box])([0-9a-fA-F]*)\\.([0-9a-fA-F]*)/);\n if (nonDecimalWithRadixMatch) {\n var radix = {\n '0b': 2,\n '0o': 8,\n '0x': 16\n }[nonDecimalWithRadixMatch[1]];\n var integerPart = nonDecimalWithRadixMatch[2];\n var fractionalPart = nonDecimalWithRadixMatch[3];\n return {\n input,\n radix,\n integerPart,\n fractionalPart\n };\n } else {\n return null;\n }\n}\n\n/**\n * Makes a number from a radix, and integer part, and a fractional part\n * @param {parts} [x] parts of the number string (from getNonDecimalNumberParts)\n * @returns {number} the number\n */\nfunction makeNumberFromNonDecimalParts(parts) {\n var n = parseInt(parts.integerPart, parts.radix);\n var f = 0;\n for (var i = 0; i < parts.fractionalPart.length; i++) {\n var digitValue = parseInt(parts.fractionalPart[i], parts.radix);\n f += digitValue / Math.pow(parts.radix, i + 1);\n }\n var result = n + f;\n if (isNaN(result)) {\n throw new SyntaxError('String \"' + parts.input + '\" is not a valid number');\n }\n return result;\n}\nexport var createNumber = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed\n } = _ref;\n /**\n * Create a number or convert a string, boolean, or unit to a number.\n * When value is a matrix, all elements will be converted to number.\n *\n * Syntax:\n *\n * math.number(value)\n * math.number(unit, valuelessUnit)\n *\n * Examples:\n *\n * math.number(2) // returns number 2\n * math.number('7.2') // returns number 7.2\n * math.number(true) // returns number 1\n * math.number([true, false, true, true]) // returns [1, 0, 1, 1]\n * math.number(math.unit('52cm'), 'm') // returns 0.52\n *\n * See also:\n *\n * bignumber, bigint, boolean, numeric, complex, index, matrix, string, unit\n *\n * @param {string | number | BigNumber | Fraction | boolean | Array | Matrix | Unit | null} [value] Value to be converted\n * @param {Unit | string} [valuelessUnit] A valueless unit, used to convert a unit to a number\n * @return {number | Array | Matrix} The created number\n */\n var number = typed('number', {\n '': function _() {\n return 0;\n },\n number: function number(x) {\n return x;\n },\n string: function string(x) {\n if (x === 'NaN') return NaN;\n var nonDecimalNumberParts = getNonDecimalNumberParts(x);\n if (nonDecimalNumberParts) {\n return makeNumberFromNonDecimalParts(nonDecimalNumberParts);\n }\n var size = 0;\n var wordSizeSuffixMatch = x.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);\n if (wordSizeSuffixMatch) {\n // x includes a size suffix like 0xffffi32, so we extract\n // the suffix and remove it from x\n size = Number(wordSizeSuffixMatch[2]);\n x = wordSizeSuffixMatch[1];\n }\n var num = Number(x);\n if (isNaN(num)) {\n throw new SyntaxError('String \"' + x + '\" is not a valid number');\n }\n if (wordSizeSuffixMatch) {\n // x is a signed bin, oct, or hex literal\n // num is the value of string x if x is interpreted as unsigned\n if (num > 2 ** size - 1) {\n // literal is too large for size suffix\n throw new SyntaxError(\"String \\\"\".concat(x, \"\\\" is out of range\"));\n }\n // check if the bit at index size - 1 is set and if so do the twos complement\n if (num >= 2 ** (size - 1)) {\n num = num - 2 ** size;\n }\n }\n return num;\n },\n BigNumber: function BigNumber(x) {\n return x.toNumber();\n },\n bigint: function bigint(x) {\n return Number(x);\n },\n Fraction: function Fraction(x) {\n return x.valueOf();\n },\n Unit: typed.referToSelf(self => x => {\n var clone = x.clone();\n clone.value = self(x.value);\n return clone;\n }),\n null: function _null(x) {\n return 0;\n },\n 'Unit, string | Unit': function Unit_string__Unit(unit, valuelessUnit) {\n return unit.toNumber(valuelessUnit);\n },\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n });\n\n // reviver function to parse a JSON object like:\n //\n // {\"mathjs\":\"number\",\"value\":\"2.3\"}\n //\n // into a number 2.3\n number.fromJSON = function (json) {\n return parseFloat(json.value);\n };\n return number;\n});","import { factory } from '../../../utils/factory.js';\nimport { deepMap } from '../../../utils/collection.js';\nvar name = 'bignumber';\nvar dependencies = ['typed', 'BigNumber'];\nexport var createBignumber = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n BigNumber\n } = _ref;\n /**\n * Create a BigNumber, which can store numbers with arbitrary precision.\n * When a matrix is provided, all elements will be converted to BigNumber.\n *\n * Syntax:\n *\n * math.bignumber(x)\n *\n * Examples:\n *\n * 0.1 + 0.2 // returns number 0.30000000000000004\n * math.bignumber(0.1) + math.bignumber(0.2) // returns BigNumber 0.3\n *\n *\n * 7.2e500 // returns number Infinity\n * math.bignumber('7.2e500') // returns BigNumber 7.2e500\n *\n * See also:\n *\n * number, bigint, boolean, complex, index, matrix, string, unit\n *\n * @param {number | string | Fraction | BigNumber | bigint | Array | Matrix | boolean | null} [value] Value for the big number,\n * 0 by default.\n * @returns {BigNumber} The created bignumber\n */\n return typed('bignumber', {\n '': function _() {\n return new BigNumber(0);\n },\n number: function number(x) {\n // convert to string to prevent errors in case of >15 digits\n return new BigNumber(x + '');\n },\n string: function string(x) {\n var wordSizeSuffixMatch = x.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);\n if (wordSizeSuffixMatch) {\n // x has a word size suffix\n var size = wordSizeSuffixMatch[2];\n var n = BigNumber(wordSizeSuffixMatch[1]);\n var twoPowSize = new BigNumber(2).pow(Number(size));\n if (n.gt(twoPowSize.sub(1))) {\n throw new SyntaxError(\"String \\\"\".concat(x, \"\\\" is out of range\"));\n }\n var twoPowSizeSubOne = new BigNumber(2).pow(Number(size) - 1);\n if (n.gte(twoPowSizeSubOne)) {\n return n.sub(twoPowSize);\n } else {\n return n;\n }\n }\n return new BigNumber(x);\n },\n BigNumber: function BigNumber(x) {\n // we assume a BigNumber is immutable\n return x;\n },\n bigint: function bigint(x) {\n return new BigNumber(x.toString());\n },\n Unit: typed.referToSelf(self => x => {\n var clone = x.clone();\n clone.value = self(x.value);\n return clone;\n }),\n Fraction: function Fraction(x) {\n return new BigNumber(String(x.n)).div(String(x.d)).times(String(x.s));\n },\n null: function _null(_x) {\n return new BigNumber(0);\n },\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n });\n});","import { factory } from '../../../utils/factory.js';\nimport { deepMap } from '../../../utils/collection.js';\nvar name = 'fraction';\nvar dependencies = ['typed', 'Fraction'];\nexport var createFraction = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n Fraction\n } = _ref;\n /**\n * Create a fraction or convert a value to a fraction.\n *\n * With one numeric argument, produces the closest rational approximation to the\n * input.\n * With two arguments, the first is the numerator and the second is the denominator,\n * and creates the corresponding fraction. Both numerator and denominator must be\n * integers.\n * With one object argument, looks for the integer numerator as the value of property\n * 'n' and the integer denominator as the value of property 'd'.\n * With a matrix argument, creates a matrix of the same shape with entries\n * converted into fractions.\n *\n * Syntax:\n * math.fraction(value)\n * math.fraction(numerator, denominator)\n * math.fraction({n: numerator, d: denominator})\n * math.fraction(matrix: Array | Matrix)\n *\n * Examples:\n *\n * math.fraction(6.283) // returns Fraction 6283/1000\n * math.fraction(1, 3) // returns Fraction 1/3\n * math.fraction('2/3') // returns Fraction 2/3\n * math.fraction({n: 2, d: 3}) // returns Fraction 2/3\n * math.fraction([0.2, 0.25, 1.25]) // returns Array [1/5, 1/4, 5/4]\n * math.fraction(4, 5.1) // throws Error: Parameters must be integer\n *\n * See also:\n *\n * bignumber, number, string, unit\n *\n * @param {number | string | Fraction | BigNumber | bigint | Unit | Array | Matrix} [args]\n * Arguments specifying the value, or numerator and denominator of\n * the fraction\n * @return {Fraction | Array | Matrix} Returns a fraction\n */\n return typed('fraction', {\n number: function number(x) {\n if (!isFinite(x) || isNaN(x)) {\n throw new Error(x + ' cannot be represented as a fraction');\n }\n return new Fraction(x);\n },\n string: function string(x) {\n return new Fraction(x);\n },\n 'number, number': function number_number(numerator, denominator) {\n return new Fraction(numerator, denominator);\n },\n 'bigint, bigint': function bigint_bigint(numerator, denominator) {\n return new Fraction(numerator, denominator);\n },\n null: function _null(x) {\n return new Fraction(0);\n },\n BigNumber: function BigNumber(x) {\n return new Fraction(x.toString());\n },\n bigint: function bigint(x) {\n return new Fraction(x.toString());\n },\n Fraction: function Fraction(x) {\n return x; // fractions are immutable\n },\n Unit: typed.referToSelf(self => x => {\n var clone = x.clone();\n clone.value = self(x.value);\n return clone;\n }),\n Object: function Object(x) {\n return new Fraction(x);\n },\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n });\n});","import { factory } from '../../../utils/factory.js';\nvar name = 'matrix';\nvar dependencies = ['typed', 'Matrix', 'DenseMatrix', 'SparseMatrix'];\nexport var createMatrix = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n Matrix,\n DenseMatrix,\n SparseMatrix\n } = _ref;\n /**\n * Create a Matrix. The function creates a new `math.Matrix` object from\n * an `Array`. A Matrix has utility functions to manipulate the data in the\n * matrix, like getting the size and getting or setting values in the matrix.\n * Supported storage formats are 'dense' and 'sparse'.\n *\n * Syntax:\n *\n * math.matrix() // creates an empty matrix using default storage format (dense).\n * math.matrix(data) // creates a matrix with initial data using default storage format (dense).\n * math.matrix('dense') // creates an empty matrix using the given storage format.\n * math.matrix(data, 'dense') // creates a matrix with initial data using the given storage format.\n * math.matrix(data, 'sparse') // creates a sparse matrix with initial data.\n * math.matrix(data, 'sparse', 'number') // creates a sparse matrix with initial data, number data type.\n *\n * Examples:\n *\n * let m = math.matrix([[1, 2], [3, 4]])\n * m.size() // Array [2, 2]\n * m.resize([3, 2], 5)\n * m.valueOf() // Array [[1, 2], [3, 4], [5, 5]]\n * m.get([1, 0]) // number 3\n *\n * See also:\n *\n * bignumber, boolean, complex, index, number, string, unit, sparse\n *\n * @param {Array | Matrix} [data] A multi dimensional array\n * @param {string} [format] The Matrix storage format, either `'dense'` or `'sparse'`\n * @param {string} [datatype] Type of the values\n *\n * @return {Matrix} The created matrix\n */\n return typed(name, {\n '': function _() {\n return _create([]);\n },\n string: function string(format) {\n return _create([], format);\n },\n 'string, string': function string_string(format, datatype) {\n return _create([], format, datatype);\n },\n Array: function Array(data) {\n return _create(data);\n },\n Matrix: function Matrix(data) {\n return _create(data, data.storage());\n },\n 'Array | Matrix, string': _create,\n 'Array | Matrix, string, string': _create\n });\n\n /**\n * Create a new Matrix with given storage format\n * @param {Array} data\n * @param {string} [format]\n * @param {string} [datatype]\n * @returns {Matrix} Returns a new Matrix\n * @private\n */\n function _create(data, format, datatype) {\n // get storage format constructor\n if (format === 'dense' || format === 'default' || format === undefined) {\n return new DenseMatrix(data, datatype);\n }\n if (format === 'sparse') {\n return new SparseMatrix(data, datatype);\n }\n throw new TypeError('Unknown matrix type ' + JSON.stringify(format) + '.');\n }\n});","import { factory } from '../../utils/factory.js';\nimport { deepMap } from '../../utils/collection.js';\nimport { unaryMinusNumber } from '../../plain/number/index.js';\nvar name = 'unaryMinus';\nvar dependencies = ['typed'];\nexport var createUnaryMinus = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed\n } = _ref;\n /**\n * Inverse the sign of a value, apply a unary minus operation.\n *\n * For matrices, the function is evaluated element wise. Boolean values and\n * strings will be converted to a number. For complex numbers, both real and\n * complex value are inverted.\n *\n * Syntax:\n *\n * math.unaryMinus(x)\n *\n * Examples:\n *\n * math.unaryMinus(3.5) // returns -3.5\n * math.unaryMinus(-4.2) // returns 4.2\n *\n * See also:\n *\n * add, subtract, unaryPlus\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x Number to be inverted.\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Returns the value with inverted sign.\n */\n return typed(name, {\n number: unaryMinusNumber,\n 'Complex | BigNumber | Fraction': x => x.neg(),\n bigint: x => -x,\n Unit: typed.referToSelf(self => x => {\n var res = x.clone();\n res.value = typed.find(self, res.valueType())(x.value);\n return res;\n }),\n // deep map collection, skip zeros since unaryMinus(0) = 0\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self, true))\n\n // TODO: add support for string\n });\n});","import { factory } from '../../utils/factory.js';\nimport { deepMap } from '../../utils/collection.js';\nimport { absNumber } from '../../plain/number/index.js';\nvar name = 'abs';\nvar dependencies = ['typed'];\nexport var createAbs = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed\n } = _ref;\n /**\n * Calculate the absolute value of a number. For matrices, the function is\n * evaluated element wise.\n *\n * Syntax:\n *\n * math.abs(x)\n *\n * Examples:\n *\n * math.abs(3.5) // returns number 3.5\n * math.abs(-4.2) // returns number 4.2\n *\n * math.abs([3, -5, -1, 0, 2]) // returns Array [3, 5, 1, 0, 2]\n *\n * See also:\n *\n * sign\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit} x\n * A number or matrix for which to get the absolute value\n * @return {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit}\n * Absolute value of `x`\n */\n return typed(name, {\n number: absNumber,\n 'Complex | BigNumber | Fraction | Unit': x => x.abs(),\n bigint: x => x < 0n ? -x : x,\n // deep map collection, skip zeros since abs(0) = 0\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self, true))\n });\n});","import { factory } from '../../utils/factory.js';\nimport { addNumber } from '../../plain/number/index.js';\nvar name = 'addScalar';\nvar dependencies = ['typed'];\nexport var createAddScalar = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed\n } = _ref;\n /**\n * Add two scalar values, `x + y`.\n * This function is meant for internal use: it is used by the public function\n * `add`\n *\n * This function does not support collections (Array or Matrix).\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value to add\n * @param {number | BigNumber | bigint | Fraction | Complex} y Second value to add\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Sum of `x` and `y`\n * @private\n */\n return typed(name, {\n 'number, number': addNumber,\n 'Complex, Complex': function Complex_Complex(x, y) {\n return x.add(y);\n },\n 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) {\n return x.plus(y);\n },\n 'bigint, bigint': function bigint_bigint(x, y) {\n return x + y;\n },\n 'Fraction, Fraction': function Fraction_Fraction(x, y) {\n return x.add(y);\n },\n 'Unit, Unit': typed.referToSelf(self => (x, y) => {\n if (x.value === null || x.value === undefined) {\n throw new Error('Parameter x contains a unit with undefined value');\n }\n if (y.value === null || y.value === undefined) {\n throw new Error('Parameter y contains a unit with undefined value');\n }\n if (!x.equalBase(y)) throw new Error('Units do not match');\n var res = x.clone();\n res.value = typed.find(self, [res.valueType(), y.valueType()])(res.value, y.value);\n res.fixPrefix = false;\n return res;\n })\n });\n});","import { factory } from '../../utils/factory.js';\nimport { subtractNumber } from '../../plain/number/index.js';\nvar name = 'subtractScalar';\nvar dependencies = ['typed'];\nexport var createSubtractScalar = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed\n } = _ref;\n /**\n * Subtract two scalar values, `x - y`.\n * This function is meant for internal use: it is used by the public function\n * `subtract`\n *\n * This function does not support collections (Array or Matrix).\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value\n * @param {number | BigNumber | bigint | Fraction | Complex} y Second value to be subtracted from `x`\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Difference of `x` and `y`\n * @private\n */\n return typed(name, {\n 'number, number': subtractNumber,\n 'Complex, Complex': function Complex_Complex(x, y) {\n return x.sub(y);\n },\n 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) {\n return x.minus(y);\n },\n 'bigint, bigint': function bigint_bigint(x, y) {\n return x - y;\n },\n 'Fraction, Fraction': function Fraction_Fraction(x, y) {\n return x.sub(y);\n },\n 'Unit, Unit': typed.referToSelf(self => (x, y) => {\n if (x.value === null || x.value === undefined) {\n throw new Error('Parameter x contains a unit with undefined value');\n }\n if (y.value === null || y.value === undefined) {\n throw new Error('Parameter y contains a unit with undefined value');\n }\n if (!x.equalBase(y)) throw new Error('Units do not match');\n var res = x.clone();\n res.value = typed.find(self, [res.valueType(), y.valueType()])(res.value, y.value);\n res.fixPrefix = false;\n return res;\n })\n });\n});","import { factory } from '../../../utils/factory.js';\nvar name = 'matAlgo11xS0s';\nvar dependencies = ['typed', 'equalScalar'];\nexport var createMatAlgo11xS0s = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n equalScalar\n } = _ref;\n /**\n * Iterates over SparseMatrix S nonzero items and invokes the callback function f(Sij, b).\n * Callback function invoked NZ times (number of nonzero items in S).\n *\n *\n * ┌ f(Sij, b) ; S(i,j) !== 0\n * C(i,j) = ┤\n * └ 0 ; otherwise\n *\n *\n * @param {Matrix} s The SparseMatrix instance (S)\n * @param {Scalar} b The Scalar value\n * @param {Function} callback The f(Aij,b) operation to invoke\n * @param {boolean} inverse A true value indicates callback should be invoked f(b,Sij)\n *\n * @return {Matrix} SparseMatrix (C)\n *\n * https://github.com/josdejong/mathjs/pull/346#issuecomment-97626813\n */\n return function matAlgo11xS0s(s, b, callback, inverse) {\n // sparse matrix arrays\n var avalues = s._values;\n var aindex = s._index;\n var aptr = s._ptr;\n var asize = s._size;\n var adt = s._datatype;\n\n // sparse matrix cannot be a Pattern matrix\n if (!avalues) {\n throw new Error('Cannot perform operation on Pattern Sparse Matrix and Scalar value');\n }\n\n // rows & columns\n var rows = asize[0];\n var columns = asize[1];\n\n // datatype\n var dt;\n // equal signature to use\n var eq = equalScalar;\n // zero value\n var zero = 0;\n // callback signature to use\n var cf = callback;\n\n // process data types\n if (typeof adt === 'string') {\n // datatype\n dt = adt;\n // find signature that matches (dt, dt)\n eq = typed.find(equalScalar, [dt, dt]);\n // convert 0 to the same datatype\n zero = typed.convert(0, dt);\n // convert b to the same datatype\n b = typed.convert(b, dt);\n // callback\n cf = typed.find(callback, [dt, dt]);\n }\n\n // result arrays\n var cvalues = [];\n var cindex = [];\n var cptr = [];\n\n // loop columns\n for (var j = 0; j < columns; j++) {\n // initialize ptr\n cptr[j] = cindex.length;\n // values in j\n for (var k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n var i = aindex[k];\n // invoke callback\n var v = inverse ? cf(b, avalues[k]) : cf(avalues[k], b);\n // check value is zero\n if (!eq(v, zero)) {\n // push index & value\n cindex.push(i);\n cvalues.push(v);\n }\n }\n }\n // update ptr\n cptr[columns] = cindex.length;\n\n // return sparse matrix\n return s.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [rows, columns],\n datatype: dt\n });\n };\n});","import { factory } from '../../../utils/factory.js';\nimport { clone } from '../../../utils/object.js';\nvar name = 'matAlgo14xDs';\nvar dependencies = ['typed'];\nexport var createMatAlgo14xDs = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed\n } = _ref;\n /**\n * Iterates over DenseMatrix items and invokes the callback function f(Aij..z, b).\n * Callback function invoked MxN times.\n *\n * C(i,j,...z) = f(Aij..z, b)\n *\n * @param {Matrix} a The DenseMatrix instance (A)\n * @param {Scalar} b The Scalar value\n * @param {Function} callback The f(Aij..z,b) operation to invoke\n * @param {boolean} inverse A true value indicates callback should be invoked f(b,Aij..z)\n *\n * @return {Matrix} DenseMatrix (C)\n *\n * https://github.com/josdejong/mathjs/pull/346#issuecomment-97659042\n */\n return function matAlgo14xDs(a, b, callback, inverse) {\n // a arrays\n var adata = a._data;\n var asize = a._size;\n var adt = a._datatype;\n\n // datatype\n var dt;\n // callback signature to use\n var cf = callback;\n\n // process data types\n if (typeof adt === 'string') {\n // datatype\n dt = adt;\n // convert b to the same datatype\n b = typed.convert(b, dt);\n // callback\n cf = typed.find(callback, [dt, dt]);\n }\n\n // populate cdata, iterate through dimensions\n var cdata = asize.length > 0 ? _iterate(cf, 0, asize, asize[0], adata, b, inverse) : [];\n\n // c matrix\n return a.createDenseMatrix({\n data: cdata,\n size: clone(asize),\n datatype: dt\n });\n };\n\n // recursive function\n function _iterate(f, level, s, n, av, bv, inverse) {\n // initialize array for this level\n var cv = [];\n // check we reach the last level\n if (level === s.length - 1) {\n // loop arrays in last level\n for (var i = 0; i < n; i++) {\n // invoke callback and store value\n cv[i] = inverse ? f(bv, av[i]) : f(av[i], bv);\n }\n } else {\n // iterate current level\n for (var j = 0; j < n; j++) {\n // iterate next level\n cv[j] = _iterate(f, level + 1, s, s[level + 1], av[j], bv, inverse);\n }\n }\n return cv;\n }\n});","import { factory } from '../../utils/factory.js';\nimport { multiplyNumber } from '../../plain/number/index.js';\nvar name = 'multiplyScalar';\nvar dependencies = ['typed'];\nexport var createMultiplyScalar = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed\n } = _ref;\n /**\n * Multiply two scalar values, `x * y`.\n * This function is meant for internal use: it is used by the public function\n * `multiply`\n *\n * This function does not support collections (Array or Matrix).\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value to multiply\n * @param {number | BigNumber | bigint | Fraction | Complex} y Second value to multiply\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Multiplication of `x` and `y`\n * @private\n */\n return typed('multiplyScalar', {\n 'number, number': multiplyNumber,\n 'Complex, Complex': function Complex_Complex(x, y) {\n return x.mul(y);\n },\n 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) {\n return x.times(y);\n },\n 'bigint, bigint': function bigint_bigint(x, y) {\n return x * y;\n },\n 'Fraction, Fraction': function Fraction_Fraction(x, y) {\n return x.mul(y);\n },\n 'number | Fraction | BigNumber | Complex, Unit': (x, y) => y.multiply(x),\n 'Unit, number | Fraction | BigNumber | Complex | Unit': (x, y) => x.multiply(y)\n });\n});","import { factory } from '../../utils/factory.js';\nimport { isMatrix } from '../../utils/is.js';\nimport { arraySize } from '../../utils/array.js';\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js';\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js';\nvar name = 'multiply';\nvar dependencies = ['typed', 'matrix', 'addScalar', 'multiplyScalar', 'equalScalar', 'dot'];\nexport var createMultiply = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n matrix,\n addScalar,\n multiplyScalar,\n equalScalar,\n dot\n } = _ref;\n var matAlgo11xS0s = createMatAlgo11xS0s({\n typed,\n equalScalar\n });\n var matAlgo14xDs = createMatAlgo14xDs({\n typed\n });\n function _validateMatrixDimensions(size1, size2) {\n // check left operand dimensions\n switch (size1.length) {\n case 1:\n // check size2\n switch (size2.length) {\n case 1:\n // Vector x Vector\n if (size1[0] !== size2[0]) {\n // throw error\n throw new RangeError('Dimension mismatch in multiplication. Vectors must have the same length');\n }\n break;\n case 2:\n // Vector x Matrix\n if (size1[0] !== size2[0]) {\n // throw error\n throw new RangeError('Dimension mismatch in multiplication. Vector length (' + size1[0] + ') must match Matrix rows (' + size2[0] + ')');\n }\n break;\n default:\n throw new Error('Can only multiply a 1 or 2 dimensional matrix (Matrix B has ' + size2.length + ' dimensions)');\n }\n break;\n case 2:\n // check size2\n switch (size2.length) {\n case 1:\n // Matrix x Vector\n if (size1[1] !== size2[0]) {\n // throw error\n throw new RangeError('Dimension mismatch in multiplication. Matrix columns (' + size1[1] + ') must match Vector length (' + size2[0] + ')');\n }\n break;\n case 2:\n // Matrix x Matrix\n if (size1[1] !== size2[0]) {\n // throw error\n throw new RangeError('Dimension mismatch in multiplication. Matrix A columns (' + size1[1] + ') must match Matrix B rows (' + size2[0] + ')');\n }\n break;\n default:\n throw new Error('Can only multiply a 1 or 2 dimensional matrix (Matrix B has ' + size2.length + ' dimensions)');\n }\n break;\n default:\n throw new Error('Can only multiply a 1 or 2 dimensional matrix (Matrix A has ' + size1.length + ' dimensions)');\n }\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Dense Vector (N)\n * @param {Matrix} b Dense Vector (N)\n *\n * @return {number} Scalar value\n */\n function _multiplyVectorVector(a, b, n) {\n // check empty vector\n if (n === 0) {\n throw new Error('Cannot multiply two empty vectors');\n }\n return dot(a, b);\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Dense Vector (M)\n * @param {Matrix} b Matrix (MxN)\n *\n * @return {Matrix} Dense Vector (N)\n */\n function _multiplyVectorMatrix(a, b) {\n // process storage\n if (b.storage() !== 'dense') {\n throw new Error('Support for SparseMatrix not implemented');\n }\n return _multiplyVectorDenseMatrix(a, b);\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Dense Vector (M)\n * @param {Matrix} b Dense Matrix (MxN)\n *\n * @return {Matrix} Dense Vector (N)\n */\n function _multiplyVectorDenseMatrix(a, b) {\n // a dense\n var adata = a._data;\n var asize = a._size;\n var adt = a._datatype || a.getDataType();\n // b dense\n var bdata = b._data;\n var bsize = b._size;\n var bdt = b._datatype || b.getDataType();\n // rows & columns\n var alength = asize[0];\n var bcolumns = bsize[1];\n\n // datatype\n var dt;\n // addScalar signature to use\n var af = addScalar;\n // multiplyScalar signature to use\n var mf = multiplyScalar;\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt;\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt]);\n mf = typed.find(multiplyScalar, [dt, dt]);\n }\n\n // result\n var c = [];\n\n // loop matrix columns\n for (var j = 0; j < bcolumns; j++) {\n // sum (do not initialize it with zero)\n var sum = mf(adata[0], bdata[0][j]);\n // loop vector\n for (var i = 1; i < alength; i++) {\n // multiply & accumulate\n sum = af(sum, mf(adata[i], bdata[i][j]));\n }\n c[j] = sum;\n }\n\n // return matrix\n return a.createDenseMatrix({\n data: c,\n size: [bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n });\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Matrix (MxN)\n * @param {Matrix} b Dense Vector (N)\n *\n * @return {Matrix} Dense Vector (M)\n */\n var _multiplyMatrixVector = typed('_multiplyMatrixVector', {\n 'DenseMatrix, any': _multiplyDenseMatrixVector,\n 'SparseMatrix, any': _multiplySparseMatrixVector\n });\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Matrix (MxN)\n * @param {Matrix} b Matrix (NxC)\n *\n * @return {Matrix} Matrix (MxC)\n */\n var _multiplyMatrixMatrix = typed('_multiplyMatrixMatrix', {\n 'DenseMatrix, DenseMatrix': _multiplyDenseMatrixDenseMatrix,\n 'DenseMatrix, SparseMatrix': _multiplyDenseMatrixSparseMatrix,\n 'SparseMatrix, DenseMatrix': _multiplySparseMatrixDenseMatrix,\n 'SparseMatrix, SparseMatrix': _multiplySparseMatrixSparseMatrix\n });\n\n /**\n * C = A * B\n *\n * @param {Matrix} a DenseMatrix (MxN)\n * @param {Matrix} b Dense Vector (N)\n *\n * @return {Matrix} Dense Vector (M)\n */\n function _multiplyDenseMatrixVector(a, b) {\n // a dense\n var adata = a._data;\n var asize = a._size;\n var adt = a._datatype || a.getDataType();\n // b dense\n var bdata = b._data;\n var bdt = b._datatype || b.getDataType();\n // rows & columns\n var arows = asize[0];\n var acolumns = asize[1];\n\n // datatype\n var dt;\n // addScalar signature to use\n var af = addScalar;\n // multiplyScalar signature to use\n var mf = multiplyScalar;\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt;\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt]);\n mf = typed.find(multiplyScalar, [dt, dt]);\n }\n\n // result\n var c = [];\n\n // loop matrix a rows\n for (var i = 0; i < arows; i++) {\n // current row\n var row = adata[i];\n // sum (do not initialize it with zero)\n var sum = mf(row[0], bdata[0]);\n // loop matrix a columns\n for (var j = 1; j < acolumns; j++) {\n // multiply & accumulate\n sum = af(sum, mf(row[j], bdata[j]));\n }\n c[i] = sum;\n }\n\n // return matrix\n return a.createDenseMatrix({\n data: c,\n size: [arows],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n });\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a DenseMatrix (MxN)\n * @param {Matrix} b DenseMatrix (NxC)\n *\n * @return {Matrix} DenseMatrix (MxC)\n */\n function _multiplyDenseMatrixDenseMatrix(a, b) {\n // getDataType()\n // a dense\n var adata = a._data;\n var asize = a._size;\n var adt = a._datatype || a.getDataType();\n // b dense\n var bdata = b._data;\n var bsize = b._size;\n var bdt = b._datatype || b.getDataType();\n // rows & columns\n var arows = asize[0];\n var acolumns = asize[1];\n var bcolumns = bsize[1];\n\n // datatype\n var dt;\n // addScalar signature to use\n var af = addScalar;\n // multiplyScalar signature to use\n var mf = multiplyScalar;\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed' && adt !== 'mixed') {\n // datatype\n dt = adt;\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt]);\n mf = typed.find(multiplyScalar, [dt, dt]);\n }\n\n // result\n var c = [];\n\n // loop matrix a rows\n for (var i = 0; i < arows; i++) {\n // current row\n var row = adata[i];\n // initialize row array\n c[i] = [];\n // loop matrix b columns\n for (var j = 0; j < bcolumns; j++) {\n // sum (avoid initializing sum to zero)\n var sum = mf(row[0], bdata[0][j]);\n // loop matrix a columns\n for (var x = 1; x < acolumns; x++) {\n // multiply & accumulate\n sum = af(sum, mf(row[x], bdata[x][j]));\n }\n c[i][j] = sum;\n }\n }\n\n // return matrix\n return a.createDenseMatrix({\n data: c,\n size: [arows, bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n });\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a DenseMatrix (MxN)\n * @param {Matrix} b SparseMatrix (NxC)\n *\n * @return {Matrix} SparseMatrix (MxC)\n */\n function _multiplyDenseMatrixSparseMatrix(a, b) {\n // a dense\n var adata = a._data;\n var asize = a._size;\n var adt = a._datatype || a.getDataType();\n // b sparse\n var bvalues = b._values;\n var bindex = b._index;\n var bptr = b._ptr;\n var bsize = b._size;\n var bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType();\n // validate b matrix\n if (!bvalues) {\n throw new Error('Cannot multiply Dense Matrix times Pattern only Matrix');\n }\n // rows & columns\n var arows = asize[0];\n var bcolumns = bsize[1];\n\n // datatype\n var dt;\n // addScalar signature to use\n var af = addScalar;\n // multiplyScalar signature to use\n var mf = multiplyScalar;\n // equalScalar signature to use\n var eq = equalScalar;\n // zero value\n var zero = 0;\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt;\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt]);\n mf = typed.find(multiplyScalar, [dt, dt]);\n eq = typed.find(equalScalar, [dt, dt]);\n // convert 0 to the same datatype\n zero = typed.convert(0, dt);\n }\n\n // result\n var cvalues = [];\n var cindex = [];\n var cptr = [];\n // c matrix\n var c = b.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [arows, bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n });\n\n // loop b columns\n for (var jb = 0; jb < bcolumns; jb++) {\n // update ptr\n cptr[jb] = cindex.length;\n // indeces in column jb\n var kb0 = bptr[jb];\n var kb1 = bptr[jb + 1];\n // do not process column jb if no data exists\n if (kb1 > kb0) {\n // last row mark processed\n var last = 0;\n // loop a rows\n for (var i = 0; i < arows; i++) {\n // column mark\n var mark = i + 1;\n // C[i, jb]\n var cij = void 0;\n // values in b column j\n for (var kb = kb0; kb < kb1; kb++) {\n // row\n var ib = bindex[kb];\n // check value has been initialized\n if (last !== mark) {\n // first value in column jb\n cij = mf(adata[i][ib], bvalues[kb]);\n // update mark\n last = mark;\n } else {\n // accumulate value\n cij = af(cij, mf(adata[i][ib], bvalues[kb]));\n }\n }\n // check column has been processed and value != 0\n if (last === mark && !eq(cij, zero)) {\n // push row & value\n cindex.push(i);\n cvalues.push(cij);\n }\n }\n }\n }\n // update ptr\n cptr[bcolumns] = cindex.length;\n\n // return sparse matrix\n return c;\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a SparseMatrix (MxN)\n * @param {Matrix} b Dense Vector (N)\n *\n * @return {Matrix} SparseMatrix (M, 1)\n */\n function _multiplySparseMatrixVector(a, b) {\n // a sparse\n var avalues = a._values;\n var aindex = a._index;\n var aptr = a._ptr;\n var adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType();\n // validate a matrix\n if (!avalues) {\n throw new Error('Cannot multiply Pattern only Matrix times Dense Matrix');\n }\n // b dense\n var bdata = b._data;\n var bdt = b._datatype || b.getDataType();\n // rows & columns\n var arows = a._size[0];\n var brows = b._size[0];\n // result\n var cvalues = [];\n var cindex = [];\n var cptr = [];\n\n // datatype\n var dt;\n // addScalar signature to use\n var af = addScalar;\n // multiplyScalar signature to use\n var mf = multiplyScalar;\n // equalScalar signature to use\n var eq = equalScalar;\n // zero value\n var zero = 0;\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt;\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt]);\n mf = typed.find(multiplyScalar, [dt, dt]);\n eq = typed.find(equalScalar, [dt, dt]);\n // convert 0 to the same datatype\n zero = typed.convert(0, dt);\n }\n\n // workspace\n var x = [];\n // vector with marks indicating a value x[i] exists in a given column\n var w = [];\n\n // update ptr\n cptr[0] = 0;\n // rows in b\n for (var ib = 0; ib < brows; ib++) {\n // b[ib]\n var vbi = bdata[ib];\n // check b[ib] != 0, avoid loops\n if (!eq(vbi, zero)) {\n // A values & index in ib column\n for (var ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {\n // a row\n var ia = aindex[ka];\n // check value exists in current j\n if (!w[ia]) {\n // ia is new entry in j\n w[ia] = true;\n // add i to pattern of C\n cindex.push(ia);\n // x(ia) = A\n x[ia] = mf(vbi, avalues[ka]);\n } else {\n // i exists in C already\n x[ia] = af(x[ia], mf(vbi, avalues[ka]));\n }\n }\n }\n }\n // copy values from x to column jb of c\n for (var p1 = cindex.length, p = 0; p < p1; p++) {\n // row\n var ic = cindex[p];\n // copy value\n cvalues[p] = x[ic];\n }\n // update ptr\n cptr[1] = cindex.length;\n\n // matrix to return\n return a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [arows, 1],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n });\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a SparseMatrix (MxN)\n * @param {Matrix} b DenseMatrix (NxC)\n *\n * @return {Matrix} SparseMatrix (MxC)\n */\n function _multiplySparseMatrixDenseMatrix(a, b) {\n // a sparse\n var avalues = a._values;\n var aindex = a._index;\n var aptr = a._ptr;\n var adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType();\n // validate a matrix\n if (!avalues) {\n throw new Error('Cannot multiply Pattern only Matrix times Dense Matrix');\n }\n // b dense\n var bdata = b._data;\n var bdt = b._datatype || b.getDataType();\n // rows & columns\n var arows = a._size[0];\n var brows = b._size[0];\n var bcolumns = b._size[1];\n\n // datatype\n var dt;\n // addScalar signature to use\n var af = addScalar;\n // multiplyScalar signature to use\n var mf = multiplyScalar;\n // equalScalar signature to use\n var eq = equalScalar;\n // zero value\n var zero = 0;\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt;\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt]);\n mf = typed.find(multiplyScalar, [dt, dt]);\n eq = typed.find(equalScalar, [dt, dt]);\n // convert 0 to the same datatype\n zero = typed.convert(0, dt);\n }\n\n // result\n var cvalues = [];\n var cindex = [];\n var cptr = [];\n // c matrix\n var c = a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [arows, bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n });\n\n // workspace\n var x = [];\n // vector with marks indicating a value x[i] exists in a given column\n var w = [];\n\n // loop b columns\n for (var jb = 0; jb < bcolumns; jb++) {\n // update ptr\n cptr[jb] = cindex.length;\n // mark in workspace for current column\n var mark = jb + 1;\n // rows in jb\n for (var ib = 0; ib < brows; ib++) {\n // b[ib, jb]\n var vbij = bdata[ib][jb];\n // check b[ib, jb] != 0, avoid loops\n if (!eq(vbij, zero)) {\n // A values & index in ib column\n for (var ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {\n // a row\n var ia = aindex[ka];\n // check value exists in current j\n if (w[ia] !== mark) {\n // ia is new entry in j\n w[ia] = mark;\n // add i to pattern of C\n cindex.push(ia);\n // x(ia) = A\n x[ia] = mf(vbij, avalues[ka]);\n } else {\n // i exists in C already\n x[ia] = af(x[ia], mf(vbij, avalues[ka]));\n }\n }\n }\n }\n // copy values from x to column jb of c\n for (var p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) {\n // row\n var ic = cindex[p];\n // copy value\n cvalues[p] = x[ic];\n }\n }\n // update ptr\n cptr[bcolumns] = cindex.length;\n\n // return sparse matrix\n return c;\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a SparseMatrix (MxN)\n * @param {Matrix} b SparseMatrix (NxC)\n *\n * @return {Matrix} SparseMatrix (MxC)\n */\n function _multiplySparseMatrixSparseMatrix(a, b) {\n // a sparse\n var avalues = a._values;\n var aindex = a._index;\n var aptr = a._ptr;\n var adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType();\n // b sparse\n var bvalues = b._values;\n var bindex = b._index;\n var bptr = b._ptr;\n var bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType();\n\n // rows & columns\n var arows = a._size[0];\n var bcolumns = b._size[1];\n // flag indicating both matrices (a & b) contain data\n var values = avalues && bvalues;\n\n // datatype\n var dt;\n // addScalar signature to use\n var af = addScalar;\n // multiplyScalar signature to use\n var mf = multiplyScalar;\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt;\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt]);\n mf = typed.find(multiplyScalar, [dt, dt]);\n }\n\n // result\n var cvalues = values ? [] : undefined;\n var cindex = [];\n var cptr = [];\n // c matrix\n var c = a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [arows, bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n });\n\n // workspace\n var x = values ? [] : undefined;\n // vector with marks indicating a value x[i] exists in a given column\n var w = [];\n // variables\n var ka, ka0, ka1, kb, kb0, kb1, ia, ib;\n // loop b columns\n for (var jb = 0; jb < bcolumns; jb++) {\n // update ptr\n cptr[jb] = cindex.length;\n // mark in workspace for current column\n var mark = jb + 1;\n // B values & index in j\n for (kb0 = bptr[jb], kb1 = bptr[jb + 1], kb = kb0; kb < kb1; kb++) {\n // b row\n ib = bindex[kb];\n // check we need to process values\n if (values) {\n // loop values in a[:,ib]\n for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {\n // row\n ia = aindex[ka];\n // check value exists in current j\n if (w[ia] !== mark) {\n // ia is new entry in j\n w[ia] = mark;\n // add i to pattern of C\n cindex.push(ia);\n // x(ia) = A\n x[ia] = mf(bvalues[kb], avalues[ka]);\n } else {\n // i exists in C already\n x[ia] = af(x[ia], mf(bvalues[kb], avalues[ka]));\n }\n }\n } else {\n // loop values in a[:,ib]\n for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {\n // row\n ia = aindex[ka];\n // check value exists in current j\n if (w[ia] !== mark) {\n // ia is new entry in j\n w[ia] = mark;\n // add i to pattern of C\n cindex.push(ia);\n }\n }\n }\n }\n // check we need to process matrix values (pattern matrix)\n if (values) {\n // copy values from x to column jb of c\n for (var p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) {\n // row\n var ic = cindex[p];\n // copy value\n cvalues[p] = x[ic];\n }\n }\n }\n // update ptr\n cptr[bcolumns] = cindex.length;\n\n // return sparse matrix\n return c;\n }\n\n /**\n * Multiply two or more values, `x * y`.\n * For matrices, the matrix product is calculated.\n *\n * Syntax:\n *\n * math.multiply(x, y)\n * math.multiply(x, y, z, ...)\n *\n * Examples:\n *\n * math.multiply(4, 5.2) // returns number 20.8\n * math.multiply(2, 3, 4) // returns number 24\n *\n * const a = math.complex(2, 3)\n * const b = math.complex(4, 1)\n * math.multiply(a, b) // returns Complex 5 + 14i\n *\n * const c = [[1, 2], [4, 3]]\n * const d = [[1, 2, 3], [3, -4, 7]]\n * math.multiply(c, d) // returns Array [[7, -6, 17], [13, -4, 33]]\n *\n * const e = math.unit('2.1 km')\n * math.multiply(3, e) // returns Unit 6.3 km\n *\n * See also:\n *\n * divide, prod, cross, dot\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x First value to multiply\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} y Second value to multiply\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Multiplication of `x` and `y`\n */\n return typed(name, multiplyScalar, {\n // we extend the signatures of multiplyScalar with signatures dealing with matrices\n\n 'Array, Array': typed.referTo('Matrix, Matrix', selfMM => (x, y) => {\n // check dimensions\n _validateMatrixDimensions(arraySize(x), arraySize(y));\n\n // use dense matrix implementation\n var m = selfMM(matrix(x), matrix(y));\n // return array or scalar\n return isMatrix(m) ? m.valueOf() : m;\n }),\n 'Matrix, Matrix': function Matrix_Matrix(x, y) {\n // dimensions\n var xsize = x.size();\n var ysize = y.size();\n\n // check dimensions\n _validateMatrixDimensions(xsize, ysize);\n\n // process dimensions\n if (xsize.length === 1) {\n // process y dimensions\n if (ysize.length === 1) {\n // Vector * Vector\n return _multiplyVectorVector(x, y, xsize[0]);\n }\n // Vector * Matrix\n return _multiplyVectorMatrix(x, y);\n }\n // process y dimensions\n if (ysize.length === 1) {\n // Matrix * Vector\n return _multiplyMatrixVector(x, y);\n }\n // Matrix * Matrix\n return _multiplyMatrixMatrix(x, y);\n },\n 'Matrix, Array': typed.referTo('Matrix,Matrix', selfMM => (x, y) => selfMM(x, matrix(y))),\n 'Array, Matrix': typed.referToSelf(self => (x, y) => {\n // use Matrix * Matrix implementation\n return self(matrix(x, y.storage()), y);\n }),\n 'SparseMatrix, any': function SparseMatrix_any(x, y) {\n return matAlgo11xS0s(x, y, multiplyScalar, false);\n },\n 'DenseMatrix, any': function DenseMatrix_any(x, y) {\n return matAlgo14xDs(x, y, multiplyScalar, false);\n },\n 'any, SparseMatrix': function any_SparseMatrix(x, y) {\n return matAlgo11xS0s(y, x, multiplyScalar, true);\n },\n 'any, DenseMatrix': function any_DenseMatrix(x, y) {\n return matAlgo14xDs(y, x, multiplyScalar, true);\n },\n 'Array, any': function Array_any(x, y) {\n // use matrix implementation\n return matAlgo14xDs(matrix(x), y, multiplyScalar, false).valueOf();\n },\n 'any, Array': function any_Array(x, y) {\n // use matrix implementation\n return matAlgo14xDs(matrix(y), x, multiplyScalar, true).valueOf();\n },\n 'any, any': multiplyScalar,\n 'any, any, ...any': typed.referToSelf(self => (x, y, rest) => {\n var result = self(x, y);\n for (var i = 0; i < rest.length; i++) {\n result = self(result, rest[i]);\n }\n return result;\n })\n });\n});","import { factory } from '../../utils/factory.js';\nimport { deepMap } from '../../utils/collection.js';\nvar name = 'conj';\nvar dependencies = ['typed'];\nexport var createConj = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed\n } = _ref;\n /**\n * Compute the complex conjugate of a complex value.\n * If `x = a+bi`, the complex conjugate of `x` is `a - bi`.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.conj(x)\n *\n * Examples:\n *\n * math.conj(math.complex('2 + 3i')) // returns Complex 2 - 3i\n * math.conj(math.complex('2 - 3i')) // returns Complex 2 + 3i\n * math.conj(math.complex('-5.2i')) // returns Complex 5.2i\n *\n * See also:\n *\n * re, im, arg, abs\n *\n * @param {number | BigNumber | Complex | Array | Matrix} x\n * A complex number or array with complex numbers\n * @return {number | BigNumber | Complex | Array | Matrix}\n * The complex conjugate of x\n */\n return typed(name, {\n 'number | BigNumber | Fraction': x => x,\n Complex: x => x.conjugate(),\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n });\n});","import { isBigNumber } from '../../utils/is.js';\nimport { resize } from '../../utils/array.js';\nimport { isInteger } from '../../utils/number.js';\nimport { factory } from '../../utils/factory.js';\nvar name = 'identity';\nvar dependencies = ['typed', 'config', 'matrix', 'BigNumber', 'DenseMatrix', 'SparseMatrix'];\nexport var createIdentity = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n config,\n matrix,\n BigNumber,\n DenseMatrix,\n SparseMatrix\n } = _ref;\n /**\n * Create a 2-dimensional identity matrix with size m x n or n x n.\n * The matrix has ones on the diagonal and zeros elsewhere.\n *\n * Syntax:\n *\n * math.identity(n)\n * math.identity(n, format)\n * math.identity(m, n)\n * math.identity(m, n, format)\n * math.identity([m, n])\n * math.identity([m, n], format)\n *\n * Examples:\n *\n * math.identity(3) // returns [[1, 0, 0], [0, 1, 0], [0, 0, 1]]\n * math.identity(3, 2) // returns [[1, 0], [0, 1], [0, 0]]\n *\n * const A = [[1, 2, 3], [4, 5, 6]]\n * math.identity(math.size(A)) // returns [[1, 0, 0], [0, 1, 0]]\n *\n * See also:\n *\n * diag, ones, zeros, size, range\n *\n * @param {...number | Matrix | Array} size The size for the matrix\n * @param {string} [format] The Matrix storage format\n *\n * @return {Matrix | Array | number} A matrix with ones on the diagonal.\n */\n return typed(name, {\n '': function _() {\n return config.matrix === 'Matrix' ? matrix([]) : [];\n },\n string: function string(format) {\n return matrix(format);\n },\n 'number | BigNumber': function number__BigNumber(rows) {\n return _identity(rows, rows, config.matrix === 'Matrix' ? 'dense' : undefined);\n },\n 'number | BigNumber, string': function number__BigNumber_string(rows, format) {\n return _identity(rows, rows, format);\n },\n 'number | BigNumber, number | BigNumber': function number__BigNumber_number__BigNumber(rows, cols) {\n return _identity(rows, cols, config.matrix === 'Matrix' ? 'dense' : undefined);\n },\n 'number | BigNumber, number | BigNumber, string': function number__BigNumber_number__BigNumber_string(rows, cols, format) {\n return _identity(rows, cols, format);\n },\n Array: function Array(size) {\n return _identityVector(size);\n },\n 'Array, string': function Array_string(size, format) {\n return _identityVector(size, format);\n },\n Matrix: function Matrix(size) {\n return _identityVector(size.valueOf(), size.storage());\n },\n 'Matrix, string': function Matrix_string(size, format) {\n return _identityVector(size.valueOf(), format);\n }\n });\n function _identityVector(size, format) {\n switch (size.length) {\n case 0:\n return format ? matrix(format) : [];\n case 1:\n return _identity(size[0], size[0], format);\n case 2:\n return _identity(size[0], size[1], format);\n default:\n throw new Error('Vector containing two values expected');\n }\n }\n\n /**\n * Create an identity matrix\n * @param {number | BigNumber} rows\n * @param {number | BigNumber} cols\n * @param {string} [format]\n * @returns {Matrix}\n * @private\n */\n function _identity(rows, cols, format) {\n // BigNumber constructor with the right precision\n var Big = isBigNumber(rows) || isBigNumber(cols) ? BigNumber : null;\n if (isBigNumber(rows)) rows = rows.toNumber();\n if (isBigNumber(cols)) cols = cols.toNumber();\n if (!isInteger(rows) || rows < 1) {\n throw new Error('Parameters in function identity must be positive integers');\n }\n if (!isInteger(cols) || cols < 1) {\n throw new Error('Parameters in function identity must be positive integers');\n }\n var one = Big ? new BigNumber(1) : 1;\n var defaultValue = Big ? new Big(0) : 0;\n var size = [rows, cols];\n\n // check we need to return a matrix\n if (format) {\n // create diagonal matrix (use optimized implementation for storage format)\n if (format === 'sparse') {\n return SparseMatrix.diagonal(size, one, 0, defaultValue);\n }\n if (format === 'dense') {\n return DenseMatrix.diagonal(size, one, 0, defaultValue);\n }\n throw new TypeError(\"Unknown matrix type \\\"\".concat(format, \"\\\"\"));\n }\n\n // create and resize array\n var res = resize([], size, defaultValue);\n // fill in ones on the diagonal\n var minimum = rows < cols ? rows : cols;\n // fill diagonal\n for (var d = 0; d < minimum; d++) {\n res[d][d] = one;\n }\n return res;\n }\n});","export function noBignumber() {\n throw new Error('No \"bignumber\" implementation available');\n}\nexport function noFraction() {\n throw new Error('No \"fraction\" implementation available');\n}\nexport function noMatrix() {\n throw new Error('No \"matrix\" implementation available');\n}\nexport function noIndex() {\n throw new Error('No \"index\" implementation available');\n}\nexport function noSubset() {\n throw new Error('No \"matrix\" implementation available');\n}","import { arraySize } from '../../utils/array.js';\nimport { factory } from '../../utils/factory.js';\nimport { noMatrix } from '../../utils/noop.js';\nvar name = 'size';\nvar dependencies = ['typed', 'config', '?matrix'];\nexport var createSize = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n config,\n matrix\n } = _ref;\n /**\n * Calculate the size of a matrix or scalar.\n *\n * Syntax:\n *\n * math.size(x)\n *\n * Examples:\n *\n * math.size(2.3) // returns []\n * math.size('hello world') // returns [11]\n *\n * const A = [[1, 2, 3], [4, 5, 6]]\n * math.size(A) // returns [2, 3]\n * math.size(math.range(1,6).toArray()) // returns [5]\n *\n * See also:\n *\n * count, resize, squeeze, subset\n *\n * @param {boolean | number | Complex | Unit | string | Array | Matrix} x A matrix\n * @return {Array | Matrix} A vector with size of `x`.\n */\n return typed(name, {\n Matrix: function Matrix(x) {\n return x.create(x.size(), 'number');\n },\n Array: arraySize,\n string: function string(x) {\n return config.matrix === 'Array' ? [x.length] : matrix([x.length], 'dense', 'number');\n },\n 'number | Complex | BigNumber | Unit | boolean | null': function number__Complex__BigNumber__Unit__boolean__null(x) {\n // scalar\n return config.matrix === 'Array' ? [] : matrix ? matrix([], 'dense', 'number') : noMatrix();\n }\n });\n});","/* eslint-disable no-loss-of-precision */\n\nimport { deepMap } from '../../utils/collection.js';\nimport { sign } from '../../utils/number.js';\nimport { factory } from '../../utils/factory.js';\nvar name = 'erf';\nvar dependencies = ['typed'];\nexport var createErf = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed\n } = _ref;\n /**\n * Compute the erf function of a value using a rational Chebyshev\n * approximations for different intervals of x.\n *\n * This is a translation of W. J. Cody's Fortran implementation from 1987\n * ( https://www.netlib.org/specfun/erf ). See the AMS publication\n * \"Rational Chebyshev Approximations for the Error Function\" by W. J. Cody\n * for an explanation of this process.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.erf(x)\n *\n * Examples:\n *\n * math.erf(0.2) // returns 0.22270258921047847\n * math.erf(-0.5) // returns -0.5204998778130465\n * math.erf(4) // returns 0.9999999845827421\n *\n * See also:\n * zeta\n *\n * @param {number | Array | Matrix} x A real number\n * @return {number | Array | Matrix} The erf of `x`\n */\n return typed('name', {\n number: function number(x) {\n var y = Math.abs(x);\n if (y >= MAX_NUM) {\n return sign(x);\n }\n if (y <= THRESH) {\n return sign(x) * erf1(y);\n }\n if (y <= 4.0) {\n return sign(x) * (1 - erfc2(y));\n }\n return sign(x) * (1 - erfc3(y));\n },\n 'Array | Matrix': typed.referToSelf(self => n => deepMap(n, self))\n\n // TODO: For complex numbers, use the approximation for the Faddeeva function\n // from \"More Efficient Computation of the Complex Error Function\" (AMS)\n });\n\n /**\n * Approximates the error function erf() for x <= 0.46875 using this function:\n * n\n * erf(x) = x * sum (p_j * x^(2j)) / (q_j * x^(2j))\n * j=0\n */\n function erf1(y) {\n var ysq = y * y;\n var xnum = P[0][4] * ysq;\n var xden = ysq;\n var i;\n for (i = 0; i < 3; i += 1) {\n xnum = (xnum + P[0][i]) * ysq;\n xden = (xden + Q[0][i]) * ysq;\n }\n return y * (xnum + P[0][3]) / (xden + Q[0][3]);\n }\n\n /**\n * Approximates the complement of the error function erfc() for\n * 0.46875 <= x <= 4.0 using this function:\n * n\n * erfc(x) = e^(-x^2) * sum (p_j * x^j) / (q_j * x^j)\n * j=0\n */\n function erfc2(y) {\n var xnum = P[1][8] * y;\n var xden = y;\n var i;\n for (i = 0; i < 7; i += 1) {\n xnum = (xnum + P[1][i]) * y;\n xden = (xden + Q[1][i]) * y;\n }\n var result = (xnum + P[1][7]) / (xden + Q[1][7]);\n var ysq = parseInt(y * 16) / 16;\n var del = (y - ysq) * (y + ysq);\n return Math.exp(-ysq * ysq) * Math.exp(-del) * result;\n }\n\n /**\n * Approximates the complement of the error function erfc() for x > 4.0 using\n * this function:\n *\n * erfc(x) = (e^(-x^2) / x) * [ 1/sqrt(pi) +\n * n\n * 1/(x^2) * sum (p_j * x^(-2j)) / (q_j * x^(-2j)) ]\n * j=0\n */\n function erfc3(y) {\n var ysq = 1 / (y * y);\n var xnum = P[2][5] * ysq;\n var xden = ysq;\n var i;\n for (i = 0; i < 4; i += 1) {\n xnum = (xnum + P[2][i]) * ysq;\n xden = (xden + Q[2][i]) * ysq;\n }\n var result = ysq * (xnum + P[2][4]) / (xden + Q[2][4]);\n result = (SQRPI - result) / y;\n ysq = parseInt(y * 16) / 16;\n var del = (y - ysq) * (y + ysq);\n return Math.exp(-ysq * ysq) * Math.exp(-del) * result;\n }\n});\n\n/**\n * Upper bound for the first approximation interval, 0 <= x <= THRESH\n * @constant\n */\nvar THRESH = 0.46875;\n\n/**\n * Constant used by W. J. Cody's Fortran77 implementation to denote sqrt(pi)\n * @constant\n */\nvar SQRPI = 5.6418958354775628695e-1;\n\n/**\n * Coefficients for each term of the numerator sum (p_j) for each approximation\n * interval (see W. J. Cody's paper for more details)\n * @constant\n */\nvar P = [[3.16112374387056560e00, 1.13864154151050156e02, 3.77485237685302021e02, 3.20937758913846947e03, 1.85777706184603153e-1], [5.64188496988670089e-1, 8.88314979438837594e00, 6.61191906371416295e01, 2.98635138197400131e02, 8.81952221241769090e02, 1.71204761263407058e03, 2.05107837782607147e03, 1.23033935479799725e03, 2.15311535474403846e-8], [3.05326634961232344e-1, 3.60344899949804439e-1, 1.25781726111229246e-1, 1.60837851487422766e-2, 6.58749161529837803e-4, 1.63153871373020978e-2]];\n\n/**\n * Coefficients for each term of the denominator sum (q_j) for each approximation\n * interval (see W. J. Cody's paper for more details)\n * @constant\n */\nvar Q = [[2.36012909523441209e01, 2.44024637934444173e02, 1.28261652607737228e03, 2.84423683343917062e03], [1.57449261107098347e01, 1.17693950891312499e02, 5.37181101862009858e02, 1.62138957456669019e03, 3.29079923573345963e03, 4.36261909014324716e03, 3.43936767414372164e03, 1.23033935480374942e03], [2.56852019228982242e00, 1.87295284992346047e00, 5.27905102951428412e-1, 6.05183413124413191e-2, 2.33520497626869185e-3]];\n\n/**\n * Maximum/minimum safe numbers to input to erf() (in ES6+, this number is\n * Number.[MAX|MIN]_SAFE_INTEGER). erf() for all numbers beyond this limit will\n * return 1\n */\nvar MAX_NUM = Math.pow(2, 53);","import { typeOf } from '../../utils/is.js';\nimport { factory } from '../../utils/factory.js';\nimport { noBignumber, noFraction } from '../../utils/noop.js';\nvar name = 'numeric';\nvar dependencies = ['number', '?bignumber', '?fraction'];\nexport var createNumeric = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n number: _number,\n bignumber,\n fraction\n } = _ref;\n var validInputTypes = {\n string: true,\n number: true,\n BigNumber: true,\n Fraction: true\n };\n\n // Load the conversion functions for each output type\n var validOutputTypes = {\n number: x => _number(x),\n BigNumber: bignumber ? x => bignumber(x) : noBignumber,\n bigint: x => BigInt(x),\n Fraction: fraction ? x => fraction(x) : noFraction\n };\n\n /**\n * Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.\n *\n * Syntax:\n *\n * math.numeric(x)\n *\n * Examples:\n *\n * math.numeric('4') // returns 4\n * math.numeric('4', 'number') // returns 4\n * math.numeric('4', 'bigint') // returns 4n\n * math.numeric('4', 'BigNumber') // returns BigNumber 4\n * math.numeric('4', 'Fraction') // returns Fraction 4\n * math.numeric(4, 'Fraction') // returns Fraction 4\n * math.numeric(math.fraction(2, 5), 'number') // returns 0.4\n *\n * See also:\n *\n * number, fraction, bignumber, bigint, string, format\n *\n * @param {string | number | BigNumber | bigint | Fraction } value\n * A numeric value or a string containing a numeric value\n * @param {string} outputType\n * Desired numeric output type.\n * Available values: 'number', 'BigNumber', or 'Fraction'\n * @return {number | BigNumber | bigint | Fraction}\n * Returns an instance of the numeric in the requested type\n */\n return function numeric(value) {\n var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'number';\n var check = arguments.length > 2 ? arguments[2] : undefined;\n if (check !== undefined) {\n throw new SyntaxError('numeric() takes one or two arguments');\n }\n var inputType = typeOf(value);\n if (!(inputType in validInputTypes)) {\n throw new TypeError('Cannot convert ' + value + ' of type \"' + inputType + '\"; valid input types are ' + Object.keys(validInputTypes).join(', '));\n }\n if (!(outputType in validOutputTypes)) {\n throw new TypeError('Cannot convert ' + value + ' to type \"' + outputType + '\"; valid output types are ' + Object.keys(validOutputTypes).join(', '));\n }\n if (outputType === inputType) {\n return value;\n } else {\n return validOutputTypes[outputType](value);\n }\n };\n});","import { factory } from '../../utils/factory.js';\nvar name = 'divideScalar';\nvar dependencies = ['typed', 'numeric'];\nexport var createDivideScalar = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n numeric\n } = _ref;\n /**\n * Divide two scalar values, `x / y`.\n * This function is meant for internal use: it is used by the public functions\n * `divide` and `inv`.\n *\n * This function does not support collections (Array or Matrix).\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x Numerator\n * @param {number | BigNumber | bigint | Fraction | Complex} y Denominator\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Quotient, `x / y`\n * @private\n */\n return typed(name, {\n 'number, number': function number_number(x, y) {\n return x / y;\n },\n 'Complex, Complex': function Complex_Complex(x, y) {\n return x.div(y);\n },\n 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) {\n return x.div(y);\n },\n 'bigint, bigint': function bigint_bigint(x, y) {\n return x / y;\n },\n 'Fraction, Fraction': function Fraction_Fraction(x, y) {\n return x.div(y);\n },\n 'Unit, number | Complex | Fraction | BigNumber | Unit': (x, y) => x.divide(y),\n 'number | Fraction | Complex | BigNumber, Unit': (x, y) => y.divideInto(x)\n });\n});","import { factory } from '../../utils/factory.js';\nimport { isInteger } from '../../utils/number.js';\nimport { arraySize as size } from '../../utils/array.js';\nimport { powNumber } from '../../plain/number/index.js';\nvar name = 'pow';\nvar dependencies = ['typed', 'config', 'identity', 'multiply', 'matrix', 'inv', 'fraction', 'number', 'Complex'];\nexport var createPow = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n config,\n identity,\n multiply,\n matrix,\n inv,\n number,\n fraction,\n Complex\n } = _ref;\n /**\n * Calculates the power of x to y, `x ^ y`.\n *\n * Matrix exponentiation is supported for square matrices `x` and integers `y`:\n * when `y` is nonnegative, `x` may be any square matrix; and when `y` is\n * negative, `x` must be invertible, and then this function returns\n * inv(x)^(-y).\n *\n * For cubic roots of negative numbers, the function returns the principal\n * root by default. In order to let the function return the real root,\n * math.js can be configured with `math.config({predictable: true})`.\n * To retrieve all cubic roots of a value, use `math.cbrt(x, true)`.\n *\n * Syntax:\n *\n * math.pow(x, y)\n *\n * Examples:\n *\n * math.pow(2, 3) // returns number 8\n *\n * const a = math.complex(2, 3)\n * math.pow(a, 2) // returns Complex -5 + 12i\n *\n * const b = [[1, 2], [4, 3]]\n * math.pow(b, 2) // returns Array [[9, 8], [16, 17]]\n *\n * const c = [[1, 2], [4, 3]]\n * math.pow(c, -1) // returns Array [[-0.6, 0.4], [0.8, -0.2]]\n *\n * See also:\n *\n * multiply, sqrt, cbrt, nthRoot\n *\n * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} x The base\n * @param {number | BigNumber | bigint | Complex} y The exponent\n * @return {number | BigNumber | bigint | Complex | Array | Matrix} The value of `x` to the power `y`\n */\n return typed(name, {\n 'number, number': _pow,\n 'Complex, Complex': function Complex_Complex(x, y) {\n return x.pow(y);\n },\n 'BigNumber, BigNumber': function BigNumber_BigNumber(x, y) {\n if (y.isInteger() || x >= 0 || config.predictable) {\n return x.pow(y);\n } else {\n return new Complex(x.toNumber(), 0).pow(y.toNumber(), 0);\n }\n },\n 'bigint, bigint': (x, y) => x ** y,\n 'Fraction, Fraction': function Fraction_Fraction(x, y) {\n var result = x.pow(y);\n if (result != null) {\n return result;\n }\n if (config.predictable) {\n throw new Error('Result of pow is non-rational and cannot be expressed as a fraction');\n } else {\n return _pow(x.valueOf(), y.valueOf());\n }\n },\n 'Array, number': _powArray,\n 'Array, BigNumber': function Array_BigNumber(x, y) {\n return _powArray(x, y.toNumber());\n },\n 'Matrix, number': _powMatrix,\n 'Matrix, BigNumber': function Matrix_BigNumber(x, y) {\n return _powMatrix(x, y.toNumber());\n },\n 'Unit, number | BigNumber': function Unit_number__BigNumber(x, y) {\n return x.pow(y);\n }\n });\n\n /**\n * Calculates the power of x to y, x^y, for two numbers.\n * @param {number} x\n * @param {number} y\n * @return {number | Complex} res\n * @private\n */\n function _pow(x, y) {\n // Alternatively could define a 'realmode' config option or something, but\n // 'predictable' will work for now\n if (config.predictable && !isInteger(y) && x < 0) {\n // Check to see if y can be represented as a fraction\n try {\n var yFrac = fraction(y);\n var yNum = number(yFrac);\n if (y === yNum || Math.abs((y - yNum) / y) < 1e-14) {\n if (yFrac.d % 2n === 1n) {\n return (yFrac.n % 2n === 0n ? 1 : -1) * Math.pow(-x, y);\n }\n }\n } catch (ex) {\n // fraction() throws an error if y is Infinity, etc.\n }\n\n // Unable to express y as a fraction, so continue on\n }\n\n // **for predictable mode** x^Infinity === NaN if x < -1\n // N.B. this behavour is different from `Math.pow` which gives\n // (-2)^Infinity === Infinity\n if (config.predictable && (x < -1 && y === Infinity || x > -1 && x < 0 && y === -Infinity)) {\n return NaN;\n }\n if (isInteger(y) || x >= 0 || config.predictable) {\n return powNumber(x, y);\n } else {\n // TODO: the following infinity checks are duplicated from powNumber. Deduplicate this somehow\n\n // x^Infinity === 0 if -1 < x < 1\n // A real number 0 is returned instead of complex(0)\n if (x * x < 1 && y === Infinity || x * x > 1 && y === -Infinity) {\n return 0;\n }\n return new Complex(x, 0).pow(y, 0);\n }\n }\n\n /**\n * Calculate the power of a 2d array\n * @param {Array} x must be a 2 dimensional, square matrix\n * @param {number} y a integer value (positive if `x` is not invertible)\n * @returns {Array}\n * @private\n */\n function _powArray(x, y) {\n if (!isInteger(y)) {\n throw new TypeError('For A^b, b must be an integer (value is ' + y + ')');\n }\n // verify that A is a 2 dimensional square matrix\n var s = size(x);\n if (s.length !== 2) {\n throw new Error('For A^b, A must be 2 dimensional (A has ' + s.length + ' dimensions)');\n }\n if (s[0] !== s[1]) {\n throw new Error('For A^b, A must be square (size is ' + s[0] + 'x' + s[1] + ')');\n }\n if (y < 0) {\n try {\n return _powArray(inv(x), -y);\n } catch (error) {\n if (error.message === 'Cannot calculate inverse, determinant is zero') {\n throw new TypeError('For A^b, when A is not invertible, b must be a positive integer (value is ' + y + ')');\n }\n throw error;\n }\n }\n var res = identity(s[0]).valueOf();\n var px = x;\n while (y >= 1) {\n if ((y & 1) === 1) {\n res = multiply(px, res);\n }\n y >>= 1;\n px = multiply(px, px);\n }\n return res;\n }\n\n /**\n * Calculate the power of a 2d matrix\n * @param {Matrix} x must be a 2 dimensional, square matrix\n * @param {number} y a positive, integer value\n * @returns {Matrix}\n * @private\n */\n function _powMatrix(x, y) {\n return matrix(_powArray(x.valueOf(), y));\n }\n});","import { factory } from '../../utils/factory.js';\nimport { isMatrix } from '../../utils/is.js';\nvar name = 'dot';\nvar dependencies = ['typed', 'addScalar', 'multiplyScalar', 'conj', 'size'];\nexport var createDot = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n addScalar,\n multiplyScalar,\n conj,\n size\n } = _ref;\n /**\n * Calculate the dot product of two vectors. The dot product of\n * `A = [a1, a2, ..., an]` and `B = [b1, b2, ..., bn]` is defined as:\n *\n * dot(A, B) = conj(a1) * b1 + conj(a2) * b2 + ... + conj(an) * bn\n *\n * Syntax:\n *\n * math.dot(x, y)\n *\n * Examples:\n *\n * math.dot([2, 4, 1], [2, 2, 3]) // returns number 15\n * math.multiply([2, 4, 1], [2, 2, 3]) // returns number 15\n *\n * See also:\n *\n * multiply, cross\n *\n * @param {Array | Matrix} x First vector\n * @param {Array | Matrix} y Second vector\n * @return {number} Returns the dot product of `x` and `y`\n */\n return typed(name, {\n 'Array | DenseMatrix, Array | DenseMatrix': _denseDot,\n 'SparseMatrix, SparseMatrix': _sparseDot\n });\n function _validateDim(x, y) {\n var xSize = _size(x);\n var ySize = _size(y);\n var xLen, yLen;\n if (xSize.length === 1) {\n xLen = xSize[0];\n } else if (xSize.length === 2 && xSize[1] === 1) {\n xLen = xSize[0];\n } else {\n throw new RangeError('Expected a column vector, instead got a matrix of size (' + xSize.join(', ') + ')');\n }\n if (ySize.length === 1) {\n yLen = ySize[0];\n } else if (ySize.length === 2 && ySize[1] === 1) {\n yLen = ySize[0];\n } else {\n throw new RangeError('Expected a column vector, instead got a matrix of size (' + ySize.join(', ') + ')');\n }\n if (xLen !== yLen) throw new RangeError('Vectors must have equal length (' + xLen + ' != ' + yLen + ')');\n if (xLen === 0) throw new RangeError('Cannot calculate the dot product of empty vectors');\n return xLen;\n }\n function _denseDot(a, b) {\n var N = _validateDim(a, b);\n var adata = isMatrix(a) ? a._data : a;\n var adt = isMatrix(a) ? a._datatype || a.getDataType() : undefined;\n var bdata = isMatrix(b) ? b._data : b;\n var bdt = isMatrix(b) ? b._datatype || b.getDataType() : undefined;\n\n // are these 2-dimensional column vectors? (as opposed to 1-dimensional vectors)\n var aIsColumn = _size(a).length === 2;\n var bIsColumn = _size(b).length === 2;\n var add = addScalar;\n var mul = multiplyScalar;\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n var dt = adt;\n // find signatures that matches (dt, dt)\n add = typed.find(addScalar, [dt, dt]);\n mul = typed.find(multiplyScalar, [dt, dt]);\n }\n\n // both vectors 1-dimensional\n if (!aIsColumn && !bIsColumn) {\n var c = mul(conj(adata[0]), bdata[0]);\n for (var i = 1; i < N; i++) {\n c = add(c, mul(conj(adata[i]), bdata[i]));\n }\n return c;\n }\n\n // a is 1-dim, b is column\n if (!aIsColumn && bIsColumn) {\n var _c = mul(conj(adata[0]), bdata[0][0]);\n for (var _i = 1; _i < N; _i++) {\n _c = add(_c, mul(conj(adata[_i]), bdata[_i][0]));\n }\n return _c;\n }\n\n // a is column, b is 1-dim\n if (aIsColumn && !bIsColumn) {\n var _c2 = mul(conj(adata[0][0]), bdata[0]);\n for (var _i2 = 1; _i2 < N; _i2++) {\n _c2 = add(_c2, mul(conj(adata[_i2][0]), bdata[_i2]));\n }\n return _c2;\n }\n\n // both vectors are column\n if (aIsColumn && bIsColumn) {\n var _c3 = mul(conj(adata[0][0]), bdata[0][0]);\n for (var _i3 = 1; _i3 < N; _i3++) {\n _c3 = add(_c3, mul(conj(adata[_i3][0]), bdata[_i3][0]));\n }\n return _c3;\n }\n }\n function _sparseDot(x, y) {\n _validateDim(x, y);\n var xindex = x._index;\n var xvalues = x._values;\n var yindex = y._index;\n var yvalues = y._values;\n\n // TODO optimize add & mul using datatype\n var c = 0;\n var add = addScalar;\n var mul = multiplyScalar;\n var i = 0;\n var j = 0;\n while (i < xindex.length && j < yindex.length) {\n var I = xindex[i];\n var J = yindex[j];\n if (I < J) {\n i++;\n continue;\n }\n if (I > J) {\n j++;\n continue;\n }\n if (I === J) {\n c = add(c, mul(xvalues[i], yvalues[j]));\n i++;\n j++;\n }\n }\n return c;\n }\n\n // TODO remove this once #1771 is fixed\n function _size(x) {\n return isMatrix(x) ? x.size() : size(x);\n }\n});","import { isMatrix } from '../../utils/is.js';\nimport { clone } from '../../utils/object.js';\nimport { format } from '../../utils/string.js';\nimport { factory } from '../../utils/factory.js';\nvar name = 'det';\nvar dependencies = ['typed', 'matrix', 'subtractScalar', 'multiply', 'divideScalar', 'isZero', 'unaryMinus'];\nexport var createDet = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n matrix,\n subtractScalar,\n multiply,\n divideScalar,\n isZero,\n unaryMinus\n } = _ref;\n /**\n * Calculate the determinant of a matrix.\n *\n * Syntax:\n *\n * math.det(x)\n *\n * Examples:\n *\n * math.det([[1, 2], [3, 4]]) // returns -2\n *\n * const A = [\n * [-2, 2, 3],\n * [-1, 1, 3],\n * [2, 0, -1]\n * ]\n * math.det(A) // returns 6\n *\n * See also:\n *\n * inv\n *\n * @param {Array | Matrix} x A matrix\n * @return {number} The determinant of `x`\n */\n return typed(name, {\n any: function any(x) {\n return clone(x);\n },\n 'Array | Matrix': function det(x) {\n var size;\n if (isMatrix(x)) {\n size = x.size();\n } else if (Array.isArray(x)) {\n x = matrix(x);\n size = x.size();\n } else {\n // a scalar\n size = [];\n }\n switch (size.length) {\n case 0:\n // scalar\n return clone(x);\n case 1:\n // vector\n if (size[0] === 1) {\n return clone(x.valueOf()[0]);\n }\n if (size[0] === 0) {\n return 1; // det of an empty matrix is per definition 1\n } else {\n throw new RangeError('Matrix must be square ' + '(size: ' + format(size) + ')');\n }\n case 2:\n {\n // two-dimensional array\n var rows = size[0];\n var cols = size[1];\n if (rows === cols) {\n return _det(x.clone().valueOf(), rows, cols);\n }\n if (cols === 0) {\n return 1; // det of an empty matrix is per definition 1\n } else {\n throw new RangeError('Matrix must be square ' + '(size: ' + format(size) + ')');\n }\n }\n default:\n // multi dimensional array\n throw new RangeError('Matrix must be two dimensional ' + '(size: ' + format(size) + ')');\n }\n }\n });\n\n /**\n * Calculate the determinant of a matrix\n * @param {Array[]} matrix A square, two dimensional matrix\n * @param {number} rows Number of rows of the matrix (zero-based)\n * @param {number} cols Number of columns of the matrix (zero-based)\n * @returns {number} det\n * @private\n */\n function _det(matrix, rows, cols) {\n if (rows === 1) {\n // this is a 1 x 1 matrix\n return clone(matrix[0][0]);\n } else if (rows === 2) {\n // this is a 2 x 2 matrix\n // the determinant of [a11,a12;a21,a22] is det = a11*a22-a21*a12\n return subtractScalar(multiply(matrix[0][0], matrix[1][1]), multiply(matrix[1][0], matrix[0][1]));\n } else {\n // Bareiss algorithm\n // this algorithm have same complexity as LUP decomposition (O(n^3))\n // but it preserve precision of floating point more relative to the LUP decomposition\n var negated = false;\n var rowIndices = new Array(rows).fill(0).map((_, i) => i); // matrix index of row i\n for (var k = 0; k < rows; k++) {\n var k_ = rowIndices[k];\n if (isZero(matrix[k_][k])) {\n var _k = void 0;\n for (_k = k + 1; _k < rows; _k++) {\n if (!isZero(matrix[rowIndices[_k]][k])) {\n k_ = rowIndices[_k];\n rowIndices[_k] = rowIndices[k];\n rowIndices[k] = k_;\n negated = !negated;\n break;\n }\n }\n if (_k === rows) return matrix[k_][k]; // some zero of the type\n }\n var piv = matrix[k_][k];\n var piv_ = k === 0 ? 1 : matrix[rowIndices[k - 1]][k - 1];\n for (var i = k + 1; i < rows; i++) {\n var i_ = rowIndices[i];\n for (var j = k + 1; j < rows; j++) {\n matrix[i_][j] = divideScalar(subtractScalar(multiply(matrix[i_][j], piv), multiply(matrix[i_][k], matrix[k_][j])), piv_);\n }\n }\n }\n var det = matrix[rowIndices[rows - 1]][rows - 1];\n return negated ? unaryMinus(det) : det;\n }\n }\n});","import { isMatrix } from '../../utils/is.js';\nimport { arraySize } from '../../utils/array.js';\nimport { factory } from '../../utils/factory.js';\nimport { format } from '../../utils/string.js';\nvar name = 'inv';\nvar dependencies = ['typed', 'matrix', 'divideScalar', 'addScalar', 'multiply', 'unaryMinus', 'det', 'identity', 'abs'];\nexport var createInv = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n matrix,\n divideScalar,\n addScalar,\n multiply,\n unaryMinus,\n det,\n identity,\n abs\n } = _ref;\n /**\n * Calculate the inverse of a square matrix.\n *\n * Syntax:\n *\n * math.inv(x)\n *\n * Examples:\n *\n * math.inv([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]]\n * math.inv(4) // returns 0.25\n * 1 / 4 // returns 0.25\n *\n * See also:\n *\n * det, transpose\n *\n * @param {number | Complex | Array | Matrix} x Matrix to be inversed\n * @return {number | Complex | Array | Matrix} The inverse of `x`.\n */\n return typed(name, {\n 'Array | Matrix': function Array__Matrix(x) {\n var size = isMatrix(x) ? x.size() : arraySize(x);\n switch (size.length) {\n case 1:\n // vector\n if (size[0] === 1) {\n if (isMatrix(x)) {\n return matrix([divideScalar(1, x.valueOf()[0])]);\n } else {\n return [divideScalar(1, x[0])];\n }\n } else {\n throw new RangeError('Matrix must be square ' + '(size: ' + format(size) + ')');\n }\n case 2:\n // two dimensional array\n {\n var rows = size[0];\n var cols = size[1];\n if (rows === cols) {\n if (isMatrix(x)) {\n return matrix(_inv(x.valueOf(), rows, cols), x.storage());\n } else {\n // return an Array\n return _inv(x, rows, cols);\n }\n } else {\n throw new RangeError('Matrix must be square ' + '(size: ' + format(size) + ')');\n }\n }\n default:\n // multi dimensional array\n throw new RangeError('Matrix must be two dimensional ' + '(size: ' + format(size) + ')');\n }\n },\n any: function any(x) {\n // scalar\n return divideScalar(1, x); // FIXME: create a BigNumber one when configured for bignumbers\n }\n });\n\n /**\n * Calculate the inverse of a square matrix\n * @param {Array[]} mat A square matrix\n * @param {number} rows Number of rows\n * @param {number} cols Number of columns, must equal rows\n * @return {Array[]} inv Inverse matrix\n * @private\n */\n function _inv(mat, rows, cols) {\n var r, s, f, value, temp;\n if (rows === 1) {\n // this is a 1 x 1 matrix\n value = mat[0][0];\n if (value === 0) {\n throw Error('Cannot calculate inverse, determinant is zero');\n }\n return [[divideScalar(1, value)]];\n } else if (rows === 2) {\n // this is a 2 x 2 matrix\n var d = det(mat);\n if (d === 0) {\n throw Error('Cannot calculate inverse, determinant is zero');\n }\n return [[divideScalar(mat[1][1], d), divideScalar(unaryMinus(mat[0][1]), d)], [divideScalar(unaryMinus(mat[1][0]), d), divideScalar(mat[0][0], d)]];\n } else {\n // this is a matrix of 3 x 3 or larger\n // calculate inverse using gauss-jordan elimination\n // https://en.wikipedia.org/wiki/Gaussian_elimination\n // http://mathworld.wolfram.com/MatrixInverse.html\n // http://math.uww.edu/~mcfarlat/inverse.htm\n\n // make a copy of the matrix (only the arrays, not of the elements)\n var A = mat.concat();\n for (r = 0; r < rows; r++) {\n A[r] = A[r].concat();\n }\n\n // create an identity matrix which in the end will contain the\n // matrix inverse\n var B = identity(rows).valueOf();\n\n // loop over all columns, and perform row reductions\n for (var c = 0; c < cols; c++) {\n // Pivoting: Swap row c with row r, where row r contains the largest element A[r][c]\n var ABig = abs(A[c][c]);\n var rBig = c;\n r = c + 1;\n while (r < rows) {\n if (abs(A[r][c]) > ABig) {\n ABig = abs(A[r][c]);\n rBig = r;\n }\n r++;\n }\n if (ABig === 0) {\n throw Error('Cannot calculate inverse, determinant is zero');\n }\n r = rBig;\n if (r !== c) {\n temp = A[c];\n A[c] = A[r];\n A[r] = temp;\n temp = B[c];\n B[c] = B[r];\n B[r] = temp;\n }\n\n // eliminate non-zero values on the other rows at column c\n var Ac = A[c];\n var Bc = B[c];\n for (r = 0; r < rows; r++) {\n var Ar = A[r];\n var Br = B[r];\n if (r !== c) {\n // eliminate value at column c and row r\n if (Ar[c] !== 0) {\n f = divideScalar(unaryMinus(Ar[c]), Ac[c]);\n\n // add (f * row c) to row r to eliminate the value\n // at column c\n for (s = c; s < cols; s++) {\n Ar[s] = addScalar(Ar[s], multiply(f, Ac[s]));\n }\n for (s = 0; s < cols; s++) {\n Br[s] = addScalar(Br[s], multiply(f, Bc[s]));\n }\n }\n } else {\n // normalize value at Acc to 1,\n // divide each value on row r with the value at Acc\n f = Ac[c];\n for (s = c; s < cols; s++) {\n Ar[s] = divideScalar(Ar[s], f);\n }\n for (s = 0; s < cols; s++) {\n Br[s] = divideScalar(Br[s], f);\n }\n }\n }\n }\n return B;\n }\n }\n});","import { factory } from '../../utils/factory.js';\nimport { gammaG, gammaNumber, gammaP } from '../../plain/number/index.js';\nvar name = 'gamma';\nvar dependencies = ['typed', 'config', 'multiplyScalar', 'pow', 'BigNumber', 'Complex'];\nexport var createGamma = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n typed,\n config,\n multiplyScalar,\n pow,\n BigNumber: _BigNumber,\n Complex\n } = _ref;\n /**\n * Compute the gamma function of a value using Lanczos approximation for\n * small values, and an extended Stirling approximation for large values.\n *\n * To avoid confusion with the matrix Gamma function, this function does\n * not apply to matrices.\n *\n * Syntax:\n *\n * math.gamma(n)\n *\n * Examples:\n *\n * math.gamma(5) // returns 24\n * math.gamma(-0.5) // returns -3.5449077018110335\n * math.gamma(math.i) // returns -0.15494982830180973 - 0.49801566811835596i\n *\n * See also:\n *\n * combinations, factorial, permutations\n *\n * @param {number | BigNumber | Complex} n A real or complex number\n * @return {number | BigNumber | Complex} The gamma of `n`\n */\n\n function gammaComplex(n) {\n if (n.im === 0) {\n return gammaNumber(n.re);\n }\n\n // Lanczos approximation doesn't work well with real part lower than 0.5\n // So reflection formula is required\n if (n.re < 0.5) {\n // Euler's reflection formula\n // gamma(1-z) * gamma(z) = PI / sin(PI * z)\n // real part of Z should not be integer [sin(PI) == 0 -> 1/0 - undefined]\n // thanks to imperfect sin implementation sin(PI * n) != 0\n // we can safely use it anyway\n var _t = new Complex(1 - n.re, -n.im);\n var r = new Complex(Math.PI * n.re, Math.PI * n.im);\n return new Complex(Math.PI).div(r.sin()).div(gammaComplex(_t));\n }\n\n // Lanczos approximation\n // z -= 1\n n = new Complex(n.re - 1, n.im);\n\n // x = gammaPval[0]\n var x = new Complex(gammaP[0], 0);\n // for (i, gammaPval) in enumerate(gammaP):\n for (var i = 1; i < gammaP.length; ++i) {\n // x += gammaPval / (z + i)\n var gammaPval = new Complex(gammaP[i], 0);\n x = x.add(gammaPval.div(n.add(i)));\n }\n // t = z + gammaG + 0.5\n var t = new Complex(n.re + gammaG + 0.5, n.im);\n\n // y = sqrt(2 * pi) * t ** (z + 0.5) * exp(-t) * x\n var twoPiSqrt = Math.sqrt(2 * Math.PI);\n var tpow = t.pow(n.add(0.5));\n var expt = t.neg().exp();\n\n // y = [x] * [sqrt(2 * pi)] * [t ** (z + 0.5)] * [exp(-t)]\n return x.mul(twoPiSqrt).mul(tpow).mul(expt);\n }\n return typed(name, {\n number: gammaNumber,\n Complex: gammaComplex,\n BigNumber: function BigNumber(n) {\n if (n.isInteger()) {\n return n.isNegative() || n.isZero() ? new _BigNumber(Infinity) : bigFactorial(n.minus(1));\n }\n if (!n.isFinite()) {\n return new _BigNumber(n.isNegative() ? NaN : Infinity);\n }\n throw new Error('Integer BigNumber expected');\n }\n });\n\n /**\n * Calculate factorial for a BigNumber\n * @param {BigNumber} n\n * @returns {BigNumber} Returns the factorial of n\n */\n function bigFactorial(n) {\n if (n < 8) {\n return new _BigNumber([1, 1, 2, 6, 24, 120, 720, 5040][n]);\n }\n var precision = config.precision + (Math.log(n.toNumber()) | 0);\n var Big = _BigNumber.clone({\n precision\n });\n if (n % 2 === 1) {\n return n.times(bigFactorial(new _BigNumber(n - 1)));\n }\n var p = n;\n var prod = new Big(n);\n var sum = n.toNumber();\n while (p > 2) {\n p -= 2;\n sum += p;\n prod = prod.times(sum);\n }\n return new _BigNumber(prod.toPrecision(_BigNumber.precision));\n }\n});","/* eslint-disable no-loss-of-precision */\n\n// References\n// ----------\n// [1] Hare, \"Computing the Principal Branch of log-Gamma\", Journal of Algorithms, 1997.\n// [2] https://math.stackexchange.com/questions/1338753/how-do-i-calculate-values-for-gamma-function-with-complex-arguments\n\nimport { lgammaNumber, lnSqrt2PI } from '../../plain/number/index.js';\nimport { factory } from '../../utils/factory.js';\nimport { copysign } from '../../utils/number.js';\nvar name = 'lgamma';\nvar dependencies = ['Complex', 'typed'];\nexport var createLgamma = /* #__PURE__ */factory(name, dependencies, _ref => {\n var {\n Complex,\n typed\n } = _ref;\n // Stirling series is non-convergent, we need to use the recurrence `lgamma(z) = lgamma(z+1) - log z` to get\n // sufficient accuracy.\n //\n // These two values are copied from Scipy implementation:\n // https://github.com/scipy/scipy/blob/v1.8.0/scipy/special/_loggamma.pxd#L37\n var SMALL_RE = 7;\n var SMALL_IM = 7;\n\n /**\n * The coefficients are B[2*n]/(2*n*(2*n - 1)) where B[2*n] is the (2*n)th Bernoulli number. See (1.1) in [1].\n *\n * If you cannot access the paper, can also get these values from the formula in [2].\n *\n * 1 / 12 = 0.00833333333333333333333333333333\n * 1 / 360 = 0.00277777777777777777777777777778\n * ...\n * 3617 / 133400 = 0.02955065359477124183006535947712\n */\n var coeffs = [-2.955065359477124183e-2, 6.4102564102564102564e-3, -1.9175269175269175269e-3, 8.4175084175084175084e-4, -5.952380952380952381e-4, 7.9365079365079365079e-4, -2.7777777777777777778e-3, 8.3333333333333333333e-2];\n\n /**\n * Logarithm of the gamma function for real, positive numbers and complex numbers,\n * using Lanczos approximation for numbers and Stirling series for complex numbers.\n *\n * Syntax:\n *\n * math.lgamma(n)\n *\n * Examples:\n *\n * math.lgamma(5) // returns 3.178053830347945\n * math.lgamma(0) // returns Infinity\n * math.lgamma(-0.5) // returns NaN\n * math.lgamma(math.i) // returns -0.6509231993018536 - 1.8724366472624294i\n *\n * See also:\n *\n * gamma\n *\n * @param {number | Complex} n A real or complex number\n * @return {number | Complex} The log gamma of `n`\n */\n return typed(name, {\n number: lgammaNumber,\n Complex: lgammaComplex,\n BigNumber: function BigNumber() {\n throw new Error(\"mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber\");\n }\n });\n function lgammaComplex(n) {\n var TWOPI = 6.2831853071795864769252842; // 2*pi\n var LOGPI = 1.1447298858494001741434262; // log(pi)\n\n var REFLECTION = 0.1;\n if (n.isNaN()) {\n return new Complex(NaN, NaN);\n } else if (n.im === 0) {\n return new Complex(lgammaNumber(n.re), 0);\n } else if (n.re >= SMALL_RE || Math.abs(n.im) >= SMALL_IM) {\n return lgammaStirling(n);\n } else if (n.re <= REFLECTION) {\n // Reflection formula. see Proposition 3.1 in [1]\n var tmp = copysign(TWOPI, n.im) * Math.floor(0.5 * n.re + 0.25);\n var a = n.mul(Math.PI).sin().log();\n var b = lgammaComplex(new Complex(1 - n.re, -n.im));\n return new Complex(LOGPI, tmp).sub(a).sub(b);\n } else if (n.im >= 0) {\n return lgammaRecurrence(n);\n } else {\n return lgammaRecurrence(n.conjugate()).conjugate();\n }\n }\n function lgammaStirling(z) {\n // formula ref in [2]\n // computation ref:\n // https://github.com/scipy/scipy/blob/v1.8.0/scipy/special/_loggamma.pxd#L101\n\n // left part\n\n // x (log(x) - 1) + 1/2 (log(2PI) - log(x))\n // => (x - 0.5) * log(x) - x + log(2PI) / 2\n var leftPart = z.sub(0.5).mul(z.log()).sub(z).add(lnSqrt2PI);\n\n // right part\n\n var rz = new Complex(1, 0).div(z);\n var rzz = rz.div(z);\n var a = coeffs[0];\n var b = coeffs[1];\n var r = 2 * rzz.re;\n var s = rzz.re * rzz.re + rzz.im * rzz.im;\n for (var i = 2; i < 8; i++) {\n var tmp = b;\n b = -s * a + coeffs[i];\n a = r * a + tmp;\n }\n var rightPart = rz.mul(rzz.mul(a).add(b));\n\n // plus left and right\n\n return leftPart.add(rightPart);\n }\n function lgammaRecurrence(z) {\n // computation ref:\n // https://github.com/scipy/scipy/blob/v1.8.0/scipy/special/_loggamma.pxd#L78\n\n var signflips = 0;\n var sb = 0;\n var shiftprod = z;\n z = z.add(1);\n while (z.re <= SMALL_RE) {\n shiftprod = shiftprod.mul(z);\n var nsb = shiftprod.im < 0 ? 1 : 0;\n if (nsb !== 0 && sb === 0) signflips++;\n sb = nsb;\n z = z.add(1);\n }\n return lgammaStirling(z).sub(shiftprod.log()).sub(new Complex(0, signflips * 2 * Math.PI * 1));\n }\n});","/**\n * THIS FILE IS AUTO-GENERATED\n * DON'T MAKE CHANGES HERE\n */\nimport { config } from './configReadonly.js';\nimport { createBigNumberClass, createComplexClass, createE, createFalse, createFineStructure, createFractionClass, createI, createInfinity, createLN10, createLOG10E, createMatrixClass, createNaN, createNull, createPhi, createRangeClass, createResultSet, createSQRT1_2,\n// eslint-disable-line camelcase\ncreateSackurTetrode, createTau, createTrue, createVersion, createDenseMatrixClass, createEfimovFactor, createLN2, createPi, createReplacer, createSQRT2, createTyped, createWeakMixingAngle, createAbs, createAcos, createAcot, createAcsc, createAddScalar, createArg, createAsech, createAsinh, createAtan, createAtanh, createBigint, createBitNot, createBoolean, createClone, createCombinations, createComplex, createConj, createCos, createCot, createCsc, createCube, createEqualScalar, createErf, createExp, createExpm1, createFilter, createFlatten, createForEach, createFormat, createGetMatrixDataType, createHex, createIm, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLgamma, createLog10, createLog2, createMap, createMultiplyScalar, createNot, createNumber, createOct, createPickRandom, createPrint, createRandom, createRe, createSec, createSign, createSin, createSparseMatrixClass, createSplitUnit, createSquare, createString, createSubtractScalar, createTan, createTypeOf, createAcosh, createAcsch, createAsec, createBignumber, createCombinationsWithRep, createCosh, createCsch, createIsNaN, createIsPrime, createMapSlices, createMatrix, createMatrixFromFunction, createOnes, createRandomInt, createReshape, createSech, createSinh, createSparse, createSqrt, createSqueeze, createTanh, createTranspose, createXgcd, createZeros, createAcoth, createAsin, createBin, createConcat, createCoth, createCtranspose, createDiag, createDotMultiply, createEqual, createFraction, createIdentity, createIsNumeric, createKron, createLargerEq, createLeftShift, createMode, createNthRoot, createNumeric, createProd, createResize, createRightArithShift, createRound, createSize, createSmaller, createTo, createUnaryMinus, createUnequal, createXor, createAdd, createAtan2, createBitAnd, createBitOr, createBitXor, createCbrt, createCompare, createCompareText, createCount, createDeepEqual, createDivideScalar, createDotDivide, createEqualText, createFloor, createGcd, createHasNumericValue, createHypot, createImmutableDenseMatrixClass, createIndexClass, createLarger, createLog, createLsolve, createMatrixFromColumns, createMax, createMin, createMod, createNthRoots, createOr, createPartitionSelect, createQr, createRightLogShift, createSmallerEq, createSubset, createSubtract, createTrace, createUsolve, createCatalan, createCompareNatural, createComposition, createDiff, createDistance, createDot, createFibonacciHeapClass, createIndex, createInvmod, createLcm, createLog1p, createLsolveAll, createMatrixFromRows, createMultiply, createRange, createRow, createSetCartesian, createSetDistinct, createSetIsSubset, createSetPowerset, createSlu, createSort, createUnaryPlus, createUsolveAll, createZpk2tf, createAnd, createCeil, createColumn, createCross, createDet, createFix, createInv, createPinv, createPow, createSetDifference, createSetMultiplicity, createSetSymDifference, createSpaClass, createSqrtm, createSum, createUnitClass, createVacuumImpedance, createWienDisplacement, createAtomicMass, createBohrMagneton, createBoltzmann, createConductanceQuantum, createCoulomb, createCumSum, createDeuteronMass, createDotPow, createElectricConstant, createElementaryCharge, createExpm, createFaraday, createFft, createGamma, createGravitationConstant, createHartreeEnergy, createIfft, createInverseConductanceQuantum, createKlitzing, createLoschmidt, createMagneticConstant, createMolarMass, createMolarPlanckConstant, createNeutronMass, createNuclearMagneton, createPlanckCharge, createPlanckLength, createPlanckTemperature, createProtonMass, createQuantumOfCirculation, createReducedPlanckConstant, createRydberg, createSecondRadiation, createSetSize, createSpeedOfLight, createStefanBoltzmann, createThomsonCrossSection, createAvogadro, createBohrRadius, createCreateUnit, createDivide, createElectronMass, createFactorial, createFirstRadiation, createGravity, createIntersect, createLup, createMagneticFluxQuantum, createMolarMassC12, createMultinomial, createPermutations, createPlanckMass, createPolynomialRoot, createSetIntersect, createSolveODE, createStirlingS2, createUnitFunction, createBellNumbers, createEigs, createFermiCoupling, createGasConstant, createKldivergence, createLusolve, createMean, createMolarVolume, createPlanckConstant, createQuantileSeq, createSetUnion, createVariance, createClassicalElectronRadius, createMedian, createCorr, createFreqz, createMad, createStd, createZeta, createNorm, createRotationMatrix, createPlanckTime, createSchur, createRotate, createSylvester, createLyap } from '../factoriesAny.js';\nexport var BigNumber = /* #__PURE__ */createBigNumberClass({\n config\n});\nexport var Complex = /* #__PURE__ */createComplexClass({});\nexport var e = /* #__PURE__ */createE({\n BigNumber,\n config\n});\nexport var _false = /* #__PURE__ */createFalse({});\nexport var fineStructure = /* #__PURE__ */createFineStructure({\n BigNumber,\n config\n});\nexport var Fraction = /* #__PURE__ */createFractionClass({});\nexport var i = /* #__PURE__ */createI({\n Complex\n});\nexport var _Infinity = /* #__PURE__ */createInfinity({\n BigNumber,\n config\n});\nexport var LN10 = /* #__PURE__ */createLN10({\n BigNumber,\n config\n});\nexport var LOG10E = /* #__PURE__ */createLOG10E({\n BigNumber,\n config\n});\nexport var Matrix = /* #__PURE__ */createMatrixClass({});\nexport var _NaN = /* #__PURE__ */createNaN({\n BigNumber,\n config\n});\nexport var _null = /* #__PURE__ */createNull({});\nexport var phi = /* #__PURE__ */createPhi({\n BigNumber,\n config\n});\nexport var Range = /* #__PURE__ */createRangeClass({});\nexport var ResultSet = /* #__PURE__ */createResultSet({});\nexport var SQRT1_2 = /* #__PURE__ */createSQRT1_2({\n BigNumber,\n config\n});\nexport var sackurTetrode = /* #__PURE__ */createSackurTetrode({\n BigNumber,\n config\n});\nexport var tau = /* #__PURE__ */createTau({\n BigNumber,\n config\n});\nexport var _true = /* #__PURE__ */createTrue({});\nexport var version = /* #__PURE__ */createVersion({});\nexport var DenseMatrix = /* #__PURE__ */createDenseMatrixClass({\n Matrix\n});\nexport var efimovFactor = /* #__PURE__ */createEfimovFactor({\n BigNumber,\n config\n});\nexport var LN2 = /* #__PURE__ */createLN2({\n BigNumber,\n config\n});\nexport var pi = /* #__PURE__ */createPi({\n BigNumber,\n config\n});\nexport var replacer = /* #__PURE__ */createReplacer({});\nexport var SQRT2 = /* #__PURE__ */createSQRT2({\n BigNumber,\n config\n});\nexport var typed = /* #__PURE__ */createTyped({\n BigNumber,\n Complex,\n DenseMatrix,\n Fraction\n});\nexport var weakMixingAngle = /* #__PURE__ */createWeakMixingAngle({\n BigNumber,\n config\n});\nexport var abs = /* #__PURE__ */createAbs({\n typed\n});\nexport var acos = /* #__PURE__ */createAcos({\n Complex,\n config,\n typed\n});\nexport var acot = /* #__PURE__ */createAcot({\n BigNumber,\n typed\n});\nexport var acsc = /* #__PURE__ */createAcsc({\n BigNumber,\n Complex,\n config,\n typed\n});\nexport var addScalar = /* #__PURE__ */createAddScalar({\n typed\n});\nexport var arg = /* #__PURE__ */createArg({\n typed\n});\nexport var asech = /* #__PURE__ */createAsech({\n BigNumber,\n Complex,\n config,\n typed\n});\nexport var asinh = /* #__PURE__ */createAsinh({\n typed\n});\nexport var atan = /* #__PURE__ */createAtan({\n typed\n});\nexport var atanh = /* #__PURE__ */createAtanh({\n Complex,\n config,\n typed\n});\nexport var bigint = /* #__PURE__ */createBigint({\n typed\n});\nexport var bitNot = /* #__PURE__ */createBitNot({\n typed\n});\nexport var boolean = /* #__PURE__ */createBoolean({\n typed\n});\nexport var clone = /* #__PURE__ */createClone({\n typed\n});\nexport var combinations = /* #__PURE__ */createCombinations({\n typed\n});\nexport var complex = /* #__PURE__ */createComplex({\n Complex,\n typed\n});\nexport var conj = /* #__PURE__ */createConj({\n typed\n});\nexport var cos = /* #__PURE__ */createCos({\n typed\n});\nexport var cot = /* #__PURE__ */createCot({\n BigNumber,\n typed\n});\nexport var csc = /* #__PURE__ */createCsc({\n BigNumber,\n typed\n});\nexport var cube = /* #__PURE__ */createCube({\n typed\n});\nexport var equalScalar = /* #__PURE__ */createEqualScalar({\n config,\n typed\n});\nexport var erf = /* #__PURE__ */createErf({\n typed\n});\nexport var exp = /* #__PURE__ */createExp({\n typed\n});\nexport var expm1 = /* #__PURE__ */createExpm1({\n Complex,\n typed\n});\nexport var filter = /* #__PURE__ */createFilter({\n typed\n});\nexport var flatten = /* #__PURE__ */createFlatten({\n typed\n});\nexport var forEach = /* #__PURE__ */createForEach({\n typed\n});\nexport var format = /* #__PURE__ */createFormat({\n typed\n});\nexport var getMatrixDataType = /* #__PURE__ */createGetMatrixDataType({\n typed\n});\nexport var hex = /* #__PURE__ */createHex({\n format,\n typed\n});\nexport var im = /* #__PURE__ */createIm({\n typed\n});\nexport var isInteger = /* #__PURE__ */createIsInteger({\n typed\n});\nexport var isNegative = /* #__PURE__ */createIsNegative({\n config,\n typed\n});\nexport var isPositive = /* #__PURE__ */createIsPositive({\n config,\n typed\n});\nexport var isZero = /* #__PURE__ */createIsZero({\n equalScalar,\n typed\n});\nexport var LOG2E = /* #__PURE__ */createLOG2E({\n BigNumber,\n config\n});\nexport var lgamma = /* #__PURE__ */createLgamma({\n Complex,\n typed\n});\nexport var log10 = /* #__PURE__ */createLog10({\n Complex,\n config,\n typed\n});\nexport var log2 = /* #__PURE__ */createLog2({\n Complex,\n config,\n typed\n});\nexport var map = /* #__PURE__ */createMap({\n typed\n});\nexport var multiplyScalar = /* #__PURE__ */createMultiplyScalar({\n typed\n});\nexport var not = /* #__PURE__ */createNot({\n typed\n});\nexport var number = /* #__PURE__ */createNumber({\n typed\n});\nexport var oct = /* #__PURE__ */createOct({\n format,\n typed\n});\nexport var pickRandom = /* #__PURE__ */createPickRandom({\n config,\n typed\n});\nexport var print = /* #__PURE__ */createPrint({\n typed\n});\nexport var random = /* #__PURE__ */createRandom({\n config,\n typed\n});\nexport var re = /* #__PURE__ */createRe({\n typed\n});\nexport var sec = /* #__PURE__ */createSec({\n BigNumber,\n typed\n});\nexport var sign = /* #__PURE__ */createSign({\n BigNumber,\n Fraction,\n complex,\n typed\n});\nexport var sin = /* #__PURE__ */createSin({\n typed\n});\nexport var SparseMatrix = /* #__PURE__ */createSparseMatrixClass({\n Matrix,\n equalScalar,\n typed\n});\nexport var splitUnit = /* #__PURE__ */createSplitUnit({\n typed\n});\nexport var square = /* #__PURE__ */createSquare({\n typed\n});\nexport var string = /* #__PURE__ */createString({\n typed\n});\nexport var subtractScalar = /* #__PURE__ */createSubtractScalar({\n typed\n});\nexport var tan = /* #__PURE__ */createTan({\n typed\n});\nexport var typeOf = /* #__PURE__ */createTypeOf({\n typed\n});\nexport var acosh = /* #__PURE__ */createAcosh({\n Complex,\n config,\n typed\n});\nexport var acsch = /* #__PURE__ */createAcsch({\n BigNumber,\n typed\n});\nexport var asec = /* #__PURE__ */createAsec({\n BigNumber,\n Complex,\n config,\n typed\n});\nexport var bignumber = /* #__PURE__ */createBignumber({\n BigNumber,\n typed\n});\nexport var combinationsWithRep = /* #__PURE__ */createCombinationsWithRep({\n typed\n});\nexport var cosh = /* #__PURE__ */createCosh({\n typed\n});\nexport var csch = /* #__PURE__ */createCsch({\n BigNumber,\n typed\n});\nexport var isNaN = /* #__PURE__ */createIsNaN({\n typed\n});\nexport var isPrime = /* #__PURE__ */createIsPrime({\n typed\n});\nexport var mapSlices = /* #__PURE__ */createMapSlices({\n isInteger,\n typed\n});\nexport var apply = mapSlices;\nexport var matrix = /* #__PURE__ */createMatrix({\n DenseMatrix,\n Matrix,\n SparseMatrix,\n typed\n});\nexport var matrixFromFunction = /* #__PURE__ */createMatrixFromFunction({\n isZero,\n matrix,\n typed\n});\nexport var ones = /* #__PURE__ */createOnes({\n BigNumber,\n config,\n matrix,\n typed\n});\nexport var randomInt = /* #__PURE__ */createRandomInt({\n config,\n log2,\n typed\n});\nexport var reshape = /* #__PURE__ */createReshape({\n isInteger,\n matrix,\n typed\n});\nexport var sech = /* #__PURE__ */createSech({\n BigNumber,\n typed\n});\nexport var sinh = /* #__PURE__ */createSinh({\n typed\n});\nexport var sparse = /* #__PURE__ */createSparse({\n SparseMatrix,\n typed\n});\nexport var sqrt = /* #__PURE__ */createSqrt({\n Complex,\n config,\n typed\n});\nexport var squeeze = /* #__PURE__ */createSqueeze({\n typed\n});\nexport var tanh = /* #__PURE__ */createTanh({\n typed\n});\nexport var transpose = /* #__PURE__ */createTranspose({\n matrix,\n typed\n});\nexport var xgcd = /* #__PURE__ */createXgcd({\n BigNumber,\n config,\n matrix,\n typed\n});\nexport var zeros = /* #__PURE__ */createZeros({\n BigNumber,\n config,\n matrix,\n typed\n});\nexport var acoth = /* #__PURE__ */createAcoth({\n BigNumber,\n Complex,\n config,\n typed\n});\nexport var asin = /* #__PURE__ */createAsin({\n Complex,\n config,\n typed\n});\nexport var bin = /* #__PURE__ */createBin({\n format,\n typed\n});\nexport var concat = /* #__PURE__ */createConcat({\n isInteger,\n matrix,\n typed\n});\nexport var coth = /* #__PURE__ */createCoth({\n BigNumber,\n typed\n});\nexport var ctranspose = /* #__PURE__ */createCtranspose({\n conj,\n transpose,\n typed\n});\nexport var diag = /* #__PURE__ */createDiag({\n DenseMatrix,\n SparseMatrix,\n matrix,\n typed\n});\nexport var dotMultiply = /* #__PURE__ */createDotMultiply({\n concat,\n equalScalar,\n matrix,\n multiplyScalar,\n typed\n});\nexport var equal = /* #__PURE__ */createEqual({\n DenseMatrix,\n SparseMatrix,\n concat,\n equalScalar,\n matrix,\n typed\n});\nexport var fraction = /* #__PURE__ */createFraction({\n Fraction,\n typed\n});\nexport var identity = /* #__PURE__ */createIdentity({\n BigNumber,\n DenseMatrix,\n SparseMatrix,\n config,\n matrix,\n typed\n});\nexport var isNumeric = /* #__PURE__ */createIsNumeric({\n typed\n});\nexport var kron = /* #__PURE__ */createKron({\n matrix,\n multiplyScalar,\n typed\n});\nexport var largerEq = /* #__PURE__ */createLargerEq({\n DenseMatrix,\n SparseMatrix,\n concat,\n config,\n matrix,\n typed\n});\nexport var leftShift = /* #__PURE__ */createLeftShift({\n DenseMatrix,\n concat,\n equalScalar,\n matrix,\n typed,\n zeros\n});\nexport var mode = /* #__PURE__ */createMode({\n isNaN,\n isNumeric,\n typed\n});\nexport var nthRoot = /* #__PURE__ */createNthRoot({\n BigNumber,\n concat,\n equalScalar,\n matrix,\n typed\n});\nexport var numeric = /* #__PURE__ */createNumeric({\n bignumber,\n fraction,\n number\n});\nexport var prod = /* #__PURE__ */createProd({\n config,\n multiplyScalar,\n numeric,\n typed\n});\nexport var resize = /* #__PURE__ */createResize({\n config,\n matrix\n});\nexport var rightArithShift = /* #__PURE__ */createRightArithShift({\n DenseMatrix,\n concat,\n equalScalar,\n matrix,\n typed,\n zeros\n});\nexport var round = /* #__PURE__ */createRound({\n BigNumber,\n DenseMatrix,\n config,\n equalScalar,\n matrix,\n typed,\n zeros\n});\nexport var size = /* #__PURE__ */createSize({\n matrix,\n config,\n typed\n});\nexport var smaller = /* #__PURE__ */createSmaller({\n DenseMatrix,\n SparseMatrix,\n bignumber,\n concat,\n config,\n matrix,\n typed\n});\nexport var to = /* #__PURE__ */createTo({\n concat,\n matrix,\n typed\n});\nexport var unaryMinus = /* #__PURE__ */createUnaryMinus({\n typed\n});\nexport var unequal = /* #__PURE__ */createUnequal({\n DenseMatrix,\n SparseMatrix,\n concat,\n config,\n equalScalar,\n matrix,\n typed\n});\nexport var xor = /* #__PURE__ */createXor({\n DenseMatrix,\n SparseMatrix,\n concat,\n matrix,\n typed\n});\nexport var add = /* #__PURE__ */createAdd({\n DenseMatrix,\n SparseMatrix,\n addScalar,\n concat,\n equalScalar,\n matrix,\n typed\n});\nexport var atan2 = /* #__PURE__ */createAtan2({\n BigNumber,\n DenseMatrix,\n concat,\n equalScalar,\n matrix,\n typed\n});\nexport var bitAnd = /* #__PURE__ */createBitAnd({\n concat,\n equalScalar,\n matrix,\n typed\n});\nexport var bitOr = /* #__PURE__ */createBitOr({\n DenseMatrix,\n concat,\n equalScalar,\n matrix,\n typed\n});\nexport var bitXor = /* #__PURE__ */createBitXor({\n DenseMatrix,\n SparseMatrix,\n concat,\n matrix,\n typed\n});\nexport var cbrt = /* #__PURE__ */createCbrt({\n BigNumber,\n Complex,\n Fraction,\n config,\n isNegative,\n matrix,\n typed,\n unaryMinus\n});\nexport var compare = /* #__PURE__ */createCompare({\n BigNumber,\n DenseMatrix,\n Fraction,\n concat,\n config,\n equalScalar,\n matrix,\n typed\n});\nexport var compareText = /* #__PURE__ */createCompareText({\n concat,\n matrix,\n typed\n});\nexport var count = /* #__PURE__ */createCount({\n prod,\n size,\n typed\n});\nexport var deepEqual = /* #__PURE__ */createDeepEqual({\n equal,\n typed\n});\nexport var divideScalar = /* #__PURE__ */createDivideScalar({\n numeric,\n typed\n});\nexport var dotDivide = /* #__PURE__ */createDotDivide({\n DenseMatrix,\n SparseMatrix,\n concat,\n divideScalar,\n equalScalar,\n matrix,\n typed\n});\nexport var equalText = /* #__PURE__ */createEqualText({\n compareText,\n isZero,\n typed\n});\nexport var floor = /* #__PURE__ */createFloor({\n DenseMatrix,\n config,\n equalScalar,\n matrix,\n round,\n typed,\n zeros\n});\nexport var gcd = /* #__PURE__ */createGcd({\n BigNumber,\n DenseMatrix,\n concat,\n config,\n equalScalar,\n matrix,\n round,\n typed,\n zeros\n});\nexport var hasNumericValue = /* #__PURE__ */createHasNumericValue({\n isNumeric,\n typed\n});\nexport var hypot = /* #__PURE__ */createHypot({\n abs,\n addScalar,\n divideScalar,\n isPositive,\n multiplyScalar,\n smaller,\n sqrt,\n typed\n});\nexport var ImmutableDenseMatrix = /* #__PURE__ */createImmutableDenseMatrixClass({\n DenseMatrix,\n smaller\n});\nexport var Index = /* #__PURE__ */createIndexClass({\n ImmutableDenseMatrix,\n getMatrixDataType\n});\nexport var larger = /* #__PURE__ */createLarger({\n DenseMatrix,\n SparseMatrix,\n bignumber,\n concat,\n config,\n matrix,\n typed\n});\nexport var log = /* #__PURE__ */createLog({\n Complex,\n config,\n divideScalar,\n typeOf,\n typed\n});\nexport var lsolve = /* #__PURE__ */createLsolve({\n DenseMatrix,\n divideScalar,\n equalScalar,\n matrix,\n multiplyScalar,\n subtractScalar,\n typed\n});\nexport var matrixFromColumns = /* #__PURE__ */createMatrixFromColumns({\n flatten,\n matrix,\n size,\n typed\n});\nexport var max = /* #__PURE__ */createMax({\n config,\n isNaN,\n larger,\n numeric,\n typed\n});\nexport var min = /* #__PURE__ */createMin({\n config,\n isNaN,\n numeric,\n smaller,\n typed\n});\nexport var mod = /* #__PURE__ */createMod({\n DenseMatrix,\n concat,\n config,\n equalScalar,\n matrix,\n round,\n typed,\n zeros\n});\nexport var nthRoots = /* #__PURE__ */createNthRoots({\n Complex,\n config,\n divideScalar,\n typed\n});\nexport var or = /* #__PURE__ */createOr({\n DenseMatrix,\n concat,\n equalScalar,\n matrix,\n typed\n});\nexport var partitionSelect = /* #__PURE__ */createPartitionSelect({\n compare,\n isNaN,\n isNumeric,\n typed\n});\nexport var qr = /* #__PURE__ */createQr({\n addScalar,\n complex,\n conj,\n divideScalar,\n equal,\n identity,\n isZero,\n matrix,\n multiplyScalar,\n sign,\n sqrt,\n subtractScalar,\n typed,\n unaryMinus,\n zeros\n});\nexport var rightLogShift = /* #__PURE__ */createRightLogShift({\n DenseMatrix,\n concat,\n equalScalar,\n matrix,\n typed,\n zeros\n});\nexport var smallerEq = /* #__PURE__ */createSmallerEq({\n DenseMatrix,\n SparseMatrix,\n concat,\n config,\n matrix,\n typed\n});\nexport var subset = /* #__PURE__ */createSubset({\n add,\n matrix,\n typed,\n zeros\n});\nexport var subtract = /* #__PURE__ */createSubtract({\n DenseMatrix,\n concat,\n equalScalar,\n matrix,\n subtractScalar,\n typed,\n unaryMinus\n});\nexport var trace = /* #__PURE__ */createTrace({\n add,\n matrix,\n typed\n});\nexport var usolve = /* #__PURE__ */createUsolve({\n DenseMatrix,\n divideScalar,\n equalScalar,\n matrix,\n multiplyScalar,\n subtractScalar,\n typed\n});\nexport var catalan = /* #__PURE__ */createCatalan({\n addScalar,\n combinations,\n divideScalar,\n isInteger,\n isNegative,\n multiplyScalar,\n typed\n});\nexport var compareNatural = /* #__PURE__ */createCompareNatural({\n compare,\n typed\n});\nexport var composition = /* #__PURE__ */createComposition({\n addScalar,\n combinations,\n isInteger,\n isNegative,\n isPositive,\n larger,\n typed\n});\nexport var diff = /* #__PURE__ */createDiff({\n matrix,\n number,\n subtract,\n typed\n});\nexport var distance = /* #__PURE__ */createDistance({\n abs,\n addScalar,\n deepEqual,\n divideScalar,\n multiplyScalar,\n sqrt,\n subtractScalar,\n typed\n});\nexport var dot = /* #__PURE__ */createDot({\n addScalar,\n conj,\n multiplyScalar,\n size,\n typed\n});\nexport var FibonacciHeap = /* #__PURE__ */createFibonacciHeapClass({\n larger,\n smaller\n});\nexport var index = /* #__PURE__ */createIndex({\n Index,\n typed\n});\nexport var invmod = /* #__PURE__ */createInvmod({\n BigNumber,\n add,\n config,\n equal,\n isInteger,\n mod,\n smaller,\n typed,\n xgcd\n});\nexport var lcm = /* #__PURE__ */createLcm({\n concat,\n equalScalar,\n matrix,\n typed\n});\nexport var log1p = /* #__PURE__ */createLog1p({\n Complex,\n config,\n divideScalar,\n log,\n typed\n});\nexport var lsolveAll = /* #__PURE__ */createLsolveAll({\n DenseMatrix,\n divideScalar,\n equalScalar,\n matrix,\n multiplyScalar,\n subtractScalar,\n typed\n});\nexport var matrixFromRows = /* #__PURE__ */createMatrixFromRows({\n flatten,\n matrix,\n size,\n typed\n});\nexport var multiply = /* #__PURE__ */createMultiply({\n addScalar,\n dot,\n equalScalar,\n matrix,\n multiplyScalar,\n typed\n});\nexport var range = /* #__PURE__ */createRange({\n bignumber,\n matrix,\n add,\n config,\n isPositive,\n larger,\n largerEq,\n smaller,\n smallerEq,\n typed\n});\nexport var row = /* #__PURE__ */createRow({\n Index,\n matrix,\n range,\n typed\n});\nexport var setCartesian = /* #__PURE__ */createSetCartesian({\n DenseMatrix,\n Index,\n compareNatural,\n size,\n subset,\n typed\n});\nexport var setDistinct = /* #__PURE__ */createSetDistinct({\n DenseMatrix,\n Index,\n compareNatural,\n size,\n subset,\n typed\n});\nexport var setIsSubset = /* #__PURE__ */createSetIsSubset({\n Index,\n compareNatural,\n size,\n subset,\n typed\n});\nexport var setPowerset = /* #__PURE__ */createSetPowerset({\n Index,\n compareNatural,\n size,\n subset,\n typed\n});\nexport var slu = /* #__PURE__ */createSlu({\n SparseMatrix,\n abs,\n add,\n divideScalar,\n larger,\n largerEq,\n multiply,\n subtract,\n transpose,\n typed\n});\nexport var sort = /* #__PURE__ */createSort({\n compare,\n compareNatural,\n matrix,\n typed\n});\nexport var unaryPlus = /* #__PURE__ */createUnaryPlus({\n config,\n numeric,\n typed\n});\nexport var usolveAll = /* #__PURE__ */createUsolveAll({\n DenseMatrix,\n divideScalar,\n equalScalar,\n matrix,\n multiplyScalar,\n subtractScalar,\n typed\n});\nexport var zpk2tf = /* #__PURE__ */createZpk2tf({\n Complex,\n add,\n multiply,\n number,\n typed\n});\nexport var and = /* #__PURE__ */createAnd({\n concat,\n equalScalar,\n matrix,\n not,\n typed,\n zeros\n});\nexport var ceil = /* #__PURE__ */createCeil({\n DenseMatrix,\n config,\n equalScalar,\n matrix,\n round,\n typed,\n zeros\n});\nexport var column = /* #__PURE__ */createColumn({\n Index,\n matrix,\n range,\n typed\n});\nexport var cross = /* #__PURE__ */createCross({\n matrix,\n multiply,\n subtract,\n typed\n});\nexport var det = /* #__PURE__ */createDet({\n divideScalar,\n isZero,\n matrix,\n multiply,\n subtractScalar,\n typed,\n unaryMinus\n});\nexport var fix = /* #__PURE__ */createFix({\n Complex,\n DenseMatrix,\n ceil,\n equalScalar,\n floor,\n matrix,\n typed,\n zeros\n});\nexport var inv = /* #__PURE__ */createInv({\n abs,\n addScalar,\n det,\n divideScalar,\n identity,\n matrix,\n multiply,\n typed,\n unaryMinus\n});\nexport var pinv = /* #__PURE__ */createPinv({\n Complex,\n add,\n ctranspose,\n deepEqual,\n divideScalar,\n dot,\n dotDivide,\n equal,\n inv,\n matrix,\n multiply,\n typed\n});\nexport var pow = /* #__PURE__ */createPow({\n Complex,\n config,\n fraction,\n identity,\n inv,\n matrix,\n multiply,\n number,\n typed\n});\nexport var setDifference = /* #__PURE__ */createSetDifference({\n DenseMatrix,\n Index,\n compareNatural,\n size,\n subset,\n typed\n});\nexport var setMultiplicity = /* #__PURE__ */createSetMultiplicity({\n Index,\n compareNatural,\n size,\n subset,\n typed\n});\nexport var setSymDifference = /* #__PURE__ */createSetSymDifference({\n Index,\n concat,\n setDifference,\n size,\n subset,\n typed\n});\nexport var Spa = /* #__PURE__ */createSpaClass({\n FibonacciHeap,\n addScalar,\n equalScalar\n});\nexport var sqrtm = /* #__PURE__ */createSqrtm({\n abs,\n add,\n identity,\n inv,\n map,\n max,\n multiply,\n size,\n sqrt,\n subtract,\n typed\n});\nexport var sum = /* #__PURE__ */createSum({\n add,\n config,\n numeric,\n typed\n});\nexport var Unit = /* #__PURE__ */createUnitClass({\n BigNumber,\n Complex,\n Fraction,\n abs,\n addScalar,\n config,\n divideScalar,\n equal,\n fix,\n format,\n isNumeric,\n multiplyScalar,\n number,\n pow,\n round,\n subtractScalar\n});\nexport var vacuumImpedance = /* #__PURE__ */createVacuumImpedance({\n BigNumber,\n Unit,\n config\n});\nexport var wienDisplacement = /* #__PURE__ */createWienDisplacement({\n BigNumber,\n Unit,\n config\n});\nexport var atomicMass = /* #__PURE__ */createAtomicMass({\n BigNumber,\n Unit,\n config\n});\nexport var bohrMagneton = /* #__PURE__ */createBohrMagneton({\n BigNumber,\n Unit,\n config\n});\nexport var boltzmann = /* #__PURE__ */createBoltzmann({\n BigNumber,\n Unit,\n config\n});\nexport var conductanceQuantum = /* #__PURE__ */createConductanceQuantum({\n BigNumber,\n Unit,\n config\n});\nexport var coulomb = /* #__PURE__ */createCoulomb({\n BigNumber,\n Unit,\n config\n});\nexport var cumsum = /* #__PURE__ */createCumSum({\n add,\n typed,\n unaryPlus\n});\nexport var deuteronMass = /* #__PURE__ */createDeuteronMass({\n BigNumber,\n Unit,\n config\n});\nexport var dotPow = /* #__PURE__ */createDotPow({\n DenseMatrix,\n SparseMatrix,\n concat,\n equalScalar,\n matrix,\n pow,\n typed\n});\nexport var electricConstant = /* #__PURE__ */createElectricConstant({\n BigNumber,\n Unit,\n config\n});\nexport var elementaryCharge = /* #__PURE__ */createElementaryCharge({\n BigNumber,\n Unit,\n config\n});\nexport var expm = /* #__PURE__ */createExpm({\n abs,\n add,\n identity,\n inv,\n multiply,\n typed\n});\nexport var faraday = /* #__PURE__ */createFaraday({\n BigNumber,\n Unit,\n config\n});\nexport var fft = /* #__PURE__ */createFft({\n addScalar,\n ceil,\n conj,\n divideScalar,\n dotDivide,\n exp,\n i,\n log2,\n matrix,\n multiplyScalar,\n pow,\n tau,\n typed\n});\nexport var gamma = /* #__PURE__ */createGamma({\n BigNumber,\n Complex,\n config,\n multiplyScalar,\n pow,\n typed\n});\nexport var gravitationConstant = /* #__PURE__ */createGravitationConstant({\n BigNumber,\n Unit,\n config\n});\nexport var hartreeEnergy = /* #__PURE__ */createHartreeEnergy({\n BigNumber,\n Unit,\n config\n});\nexport var ifft = /* #__PURE__ */createIfft({\n conj,\n dotDivide,\n fft,\n typed\n});\nexport var inverseConductanceQuantum = /* #__PURE__ */createInverseConductanceQuantum({\n BigNumber,\n Unit,\n config\n});\nexport var klitzing = /* #__PURE__ */createKlitzing({\n BigNumber,\n Unit,\n config\n});\nexport var loschmidt = /* #__PURE__ */createLoschmidt({\n BigNumber,\n Unit,\n config\n});\nexport var magneticConstant = /* #__PURE__ */createMagneticConstant({\n BigNumber,\n Unit,\n config\n});\nexport var molarMass = /* #__PURE__ */createMolarMass({\n BigNumber,\n Unit,\n config\n});\nexport var molarPlanckConstant = /* #__PURE__ */createMolarPlanckConstant({\n BigNumber,\n Unit,\n config\n});\nexport var neutronMass = /* #__PURE__ */createNeutronMass({\n BigNumber,\n Unit,\n config\n});\nexport var nuclearMagneton = /* #__PURE__ */createNuclearMagneton({\n BigNumber,\n Unit,\n config\n});\nexport var planckCharge = /* #__PURE__ */createPlanckCharge({\n BigNumber,\n Unit,\n config\n});\nexport var planckLength = /* #__PURE__ */createPlanckLength({\n BigNumber,\n Unit,\n config\n});\nexport var planckTemperature = /* #__PURE__ */createPlanckTemperature({\n BigNumber,\n Unit,\n config\n});\nexport var protonMass = /* #__PURE__ */createProtonMass({\n BigNumber,\n Unit,\n config\n});\nexport var quantumOfCirculation = /* #__PURE__ */createQuantumOfCirculation({\n BigNumber,\n Unit,\n config\n});\nexport var reducedPlanckConstant = /* #__PURE__ */createReducedPlanckConstant({\n BigNumber,\n Unit,\n config\n});\nexport var rydberg = /* #__PURE__ */createRydberg({\n BigNumber,\n Unit,\n config\n});\nexport var secondRadiation = /* #__PURE__ */createSecondRadiation({\n BigNumber,\n Unit,\n config\n});\nexport var setSize = /* #__PURE__ */createSetSize({\n compareNatural,\n typed\n});\nexport var speedOfLight = /* #__PURE__ */createSpeedOfLight({\n BigNumber,\n Unit,\n config\n});\nexport var stefanBoltzmann = /* #__PURE__ */createStefanBoltzmann({\n BigNumber,\n Unit,\n config\n});\nexport var thomsonCrossSection = /* #__PURE__ */createThomsonCrossSection({\n BigNumber,\n Unit,\n config\n});\nexport var avogadro = /* #__PURE__ */createAvogadro({\n BigNumber,\n Unit,\n config\n});\nexport var bohrRadius = /* #__PURE__ */createBohrRadius({\n BigNumber,\n Unit,\n config\n});\nexport var createUnit = /* #__PURE__ */createCreateUnit({\n Unit,\n typed\n});\nexport var divide = /* #__PURE__ */createDivide({\n divideScalar,\n equalScalar,\n inv,\n matrix,\n multiply,\n typed\n});\nexport var electronMass = /* #__PURE__ */createElectronMass({\n BigNumber,\n Unit,\n config\n});\nexport var factorial = /* #__PURE__ */createFactorial({\n gamma,\n typed\n});\nexport var firstRadiation = /* #__PURE__ */createFirstRadiation({\n BigNumber,\n Unit,\n config\n});\nexport var gravity = /* #__PURE__ */createGravity({\n BigNumber,\n Unit,\n config\n});\nexport var intersect = /* #__PURE__ */createIntersect({\n abs,\n add,\n addScalar,\n config,\n divideScalar,\n equalScalar,\n flatten,\n isNumeric,\n isZero,\n matrix,\n multiply,\n multiplyScalar,\n smaller,\n subtract,\n typed\n});\nexport var lup = /* #__PURE__ */createLup({\n DenseMatrix,\n Spa,\n SparseMatrix,\n abs,\n addScalar,\n divideScalar,\n equalScalar,\n larger,\n matrix,\n multiplyScalar,\n subtractScalar,\n typed,\n unaryMinus\n});\nexport var magneticFluxQuantum = /* #__PURE__ */createMagneticFluxQuantum({\n BigNumber,\n Unit,\n config\n});\nexport var molarMassC12 = /* #__PURE__ */createMolarMassC12({\n BigNumber,\n Unit,\n config\n});\nexport var multinomial = /* #__PURE__ */createMultinomial({\n add,\n divide,\n factorial,\n isInteger,\n isPositive,\n multiply,\n typed\n});\nexport var permutations = /* #__PURE__ */createPermutations({\n factorial,\n typed\n});\nexport var planckMass = /* #__PURE__ */createPlanckMass({\n BigNumber,\n Unit,\n config\n});\nexport var polynomialRoot = /* #__PURE__ */createPolynomialRoot({\n add,\n cbrt,\n divide,\n equalScalar,\n im,\n isZero,\n multiply,\n re,\n sqrt,\n subtract,\n typeOf,\n typed,\n unaryMinus\n});\nexport var setIntersect = /* #__PURE__ */createSetIntersect({\n DenseMatrix,\n Index,\n compareNatural,\n size,\n subset,\n typed\n});\nexport var solveODE = /* #__PURE__ */createSolveODE({\n abs,\n add,\n bignumber,\n divide,\n isNegative,\n isPositive,\n larger,\n map,\n matrix,\n max,\n multiply,\n smaller,\n subtract,\n typed,\n unaryMinus\n});\nexport var stirlingS2 = /* #__PURE__ */createStirlingS2({\n bignumber,\n addScalar,\n combinations,\n divideScalar,\n factorial,\n isInteger,\n isNegative,\n larger,\n multiplyScalar,\n number,\n pow,\n subtractScalar,\n typed\n});\nexport var unit = /* #__PURE__ */createUnitFunction({\n Unit,\n typed\n});\nexport var bellNumbers = /* #__PURE__ */createBellNumbers({\n addScalar,\n isInteger,\n isNegative,\n stirlingS2,\n typed\n});\nexport var eigs = /* #__PURE__ */createEigs({\n abs,\n add,\n addScalar,\n atan,\n bignumber,\n column,\n complex,\n config,\n cos,\n diag,\n divideScalar,\n dot,\n equal,\n flatten,\n im,\n inv,\n larger,\n matrix,\n matrixFromColumns,\n multiply,\n multiplyScalar,\n number,\n qr,\n re,\n reshape,\n sin,\n size,\n smaller,\n sqrt,\n subtract,\n typed,\n usolve,\n usolveAll\n});\nexport var fermiCoupling = /* #__PURE__ */createFermiCoupling({\n BigNumber,\n Unit,\n config\n});\nexport var gasConstant = /* #__PURE__ */createGasConstant({\n BigNumber,\n Unit,\n config\n});\nexport var kldivergence = /* #__PURE__ */createKldivergence({\n divide,\n dotDivide,\n isNumeric,\n log,\n map,\n matrix,\n multiply,\n sum,\n typed\n});\nexport var lusolve = /* #__PURE__ */createLusolve({\n DenseMatrix,\n lsolve,\n lup,\n matrix,\n slu,\n typed,\n usolve\n});\nexport var mean = /* #__PURE__ */createMean({\n add,\n divide,\n typed\n});\nexport var molarVolume = /* #__PURE__ */createMolarVolume({\n BigNumber,\n Unit,\n config\n});\nexport var planckConstant = /* #__PURE__ */createPlanckConstant({\n BigNumber,\n Unit,\n config\n});\nexport var quantileSeq = /* #__PURE__ */createQuantileSeq({\n bignumber,\n add,\n compare,\n divide,\n isInteger,\n larger,\n mapSlices,\n multiply,\n partitionSelect,\n smaller,\n smallerEq,\n subtract,\n typed\n});\nexport var setUnion = /* #__PURE__ */createSetUnion({\n Index,\n concat,\n setIntersect,\n setSymDifference,\n size,\n subset,\n typed\n});\nexport var variance = /* #__PURE__ */createVariance({\n add,\n divide,\n isNaN,\n mapSlices,\n multiply,\n subtract,\n typed\n});\nexport var classicalElectronRadius = /* #__PURE__ */createClassicalElectronRadius({\n BigNumber,\n Unit,\n config\n});\nexport var median = /* #__PURE__ */createMedian({\n add,\n compare,\n divide,\n partitionSelect,\n typed\n});\nexport var corr = /* #__PURE__ */createCorr({\n add,\n divide,\n matrix,\n mean,\n multiply,\n pow,\n sqrt,\n subtract,\n sum,\n typed\n});\nexport var freqz = /* #__PURE__ */createFreqz({\n Complex,\n add,\n divide,\n matrix,\n multiply,\n typed\n});\nexport var mad = /* #__PURE__ */createMad({\n abs,\n map,\n median,\n subtract,\n typed\n});\nexport var std = /* #__PURE__ */createStd({\n map,\n sqrt,\n typed,\n variance\n});\nexport var zeta = /* #__PURE__ */createZeta({\n BigNumber,\n Complex,\n add,\n config,\n divide,\n equal,\n factorial,\n gamma,\n isNegative,\n multiply,\n pi,\n pow,\n sin,\n smallerEq,\n subtract,\n typed\n});\nexport var norm = /* #__PURE__ */createNorm({\n abs,\n add,\n conj,\n ctranspose,\n eigs,\n equalScalar,\n larger,\n matrix,\n multiply,\n pow,\n smaller,\n sqrt,\n typed\n});\nexport var rotationMatrix = /* #__PURE__ */createRotationMatrix({\n BigNumber,\n DenseMatrix,\n SparseMatrix,\n addScalar,\n config,\n cos,\n matrix,\n multiplyScalar,\n norm,\n sin,\n typed,\n unaryMinus\n});\nexport var planckTime = /* #__PURE__ */createPlanckTime({\n BigNumber,\n Unit,\n config\n});\nexport var schur = /* #__PURE__ */createSchur({\n identity,\n matrix,\n multiply,\n norm,\n qr,\n subtract,\n typed\n});\nexport var rotate = /* #__PURE__ */createRotate({\n multiply,\n rotationMatrix,\n typed\n});\nexport var sylvester = /* #__PURE__ */createSylvester({\n abs,\n add,\n concat,\n identity,\n index,\n lusolve,\n matrix,\n matrixFromColumns,\n multiply,\n range,\n schur,\n subset,\n subtract,\n transpose,\n typed\n});\nexport var lyap = /* #__PURE__ */createLyap({\n matrix,\n multiply,\n sylvester,\n transpose,\n typed\n});","/**\n * Stack is implemented for control and stash registers.\n */\ninterface IStack {\n push(...items: T[]): void\n pop(): T | undefined\n peek(): T | undefined\n size(): number\n isEmpty(): boolean\n getStack(): T[]\n}\n\nexport class Stack implements IStack {\n // Bottom of the array is at index 0\n public storage: T[] = []\n\n public constructor() {}\n\n public push(...items: T[]): void {\n for (const item of items) {\n this.storage.push(item)\n }\n }\n\n public pop(): T | undefined {\n return this.storage.pop()\n }\n\n public peek(): T | undefined {\n if (this.isEmpty()) {\n return undefined\n }\n return this.storage[this.size() - 1]\n }\n\n public size(): number {\n return this.storage.length\n }\n\n public isEmpty(): boolean {\n return this.size() == 0\n }\n\n public getStack(): T[] {\n // return a copy of the stack's contents\n return [...this.storage]\n }\n\n public some(predicate: (value: T) => boolean): boolean {\n return this.storage.some(predicate)\n }\n\n // required for first-class continuations,\n // which directly mutate this stack globally.\n public setTo(otherStack: Stack): void {\n this.storage = otherStack.storage\n }\n}\n\n","// astHelpers.ts\nimport type * as es from 'estree';\nimport { StatementSequence } from './types';\nimport { ControlItem } from './control';\n\n/**\n * Create a StatementSequence node.\n */\nexport const statementSequence = (\n body: es.Statement[],\n loc?: es.SourceLocation | null\n): StatementSequence => ({\n type: 'StatementSequence',\n body,\n loc,\n innerComments: undefined,\n});\n\nexport const isNode = (item: any): item is es.Node => {\n return typeof item === 'object' && item !== null && 'type' in item;\n};\n\nexport const isBlockStatement = (node: es.Node | StatementSequence): node is es.BlockStatement => {\n return node.type === 'BlockStatement';\n};\n\nexport const hasDeclarations = (node: es.BlockStatement): boolean => {\n return node.body.some(stmt => stmt.type === 'VariableDeclaration' || stmt.type === 'FunctionDeclaration');\n};\n\nexport const blockArrowFunction = (\n params: es.Identifier[],\n body: es.Statement[] | es.BlockStatement | es.Expression,\n loc?: es.SourceLocation | null\n): es.ArrowFunctionExpression => ({\n type: 'ArrowFunctionExpression',\n expression: false,\n generator: false,\n params,\n body: Array.isArray(body) ? blockStatement(body) : body,\n loc\n})\n\nexport const blockStatement = (\n body: es.Statement[],\n loc?: es.SourceLocation | null\n): es.BlockStatement => ({\n type: 'BlockStatement',\n body,\n loc\n})\n\nexport const constantDeclaration = (\n name: string,\n init: es.Expression,\n loc?: es.SourceLocation | null\n) => declaration(name, 'declaration', init, loc)\n\nexport const declaration = (\n name: string,\n kind: AllowedDeclarations,\n init: es.Expression,\n loc?: es.SourceLocation | null\n): pyVariableDeclaration => ({\n type: 'VariableDeclaration',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: identifier(name),\n init\n }\n ],\n kind: 'declaration',\n loc\n})\n\ntype AllowedDeclarations = 'declaration' | 'const'\n\nexport interface pyVariableDeclaration {\n type: \"VariableDeclaration\";\n declarations: pyVariableDeclarator[];\n kind: \"declaration\" | \"const\";\n loc?: es.SourceLocation | null | undefined;\n range?: [number, number] | undefined;\n}\n\nexport interface pyVariableDeclarator {\n type: \"VariableDeclarator\";\n id: Pattern;\n init?: es.Expression | null | undefined;\n}\n\nexport type Pattern = es.Identifier | es.ObjectPattern | es.ArrayPattern | es.RestElement | es.AssignmentPattern | es.MemberExpression;\n\nexport const identifier = (name: string, loc?: es.SourceLocation | null): es.Identifier => ({\n type: 'Identifier',\n name,\n loc\n})\n\nexport const returnStatement = (\n argument: es.Expression,\n loc?: es.SourceLocation | null\n): es.ReturnStatement => ({\n type: 'ReturnStatement',\n argument,\n loc\n})\n\nexport const hasReturnStatement = (block: es.BlockStatement | StatementSequence): boolean => {\n let hasReturn = false\n for (const statement of block.body) {\n if (isReturnStatement(statement)) {\n hasReturn = true\n } else if (isIfStatement(statement)) {\n // Parser enforces that if/else have braces (block statement)\n hasReturn = hasReturn || hasReturnStatementIf(statement as es.IfStatement)\n } else if (isBlockStatement(statement) || isStatementSequence(statement)) {\n hasReturn = hasReturn && hasReturnStatement(statement)\n }\n }\n return hasReturn\n}\n\nexport const isReturnStatement = (node: es.Node): node is es.ReturnStatement => {\n return (node as es.ReturnStatement).type == 'ReturnStatement'\n}\n\nexport const isIfStatement = (node: es.Node): node is es.IfStatement => {\n return (node as es.IfStatement).type == 'IfStatement'\n}\n\nexport const hasReturnStatementIf = (statement: es.IfStatement): boolean => {\n let hasReturn = true\n // Parser enforces that if/else have braces (block statement)\n hasReturn = hasReturn && hasReturnStatement(statement.consequent as es.BlockStatement)\n if (statement.alternate) {\n if (isIfStatement(statement.alternate)) {\n hasReturn = hasReturn && hasReturnStatementIf(statement.alternate as es.IfStatement)\n } else if (isBlockStatement(statement.alternate) || isStatementSequence(statement.alternate)) {\n hasReturn = hasReturn && hasReturnStatement(statement.alternate)\n }\n }\n return hasReturn\n}\n\nexport const isStatementSequence = (node: ControlItem): node is StatementSequence => {\n return (node as StatementSequence).type == 'StatementSequence'\n}\n\nexport const literal = (\n value: string | number | boolean | null,\n loc?: es.SourceLocation | null\n): es.Literal => ({\n type: 'Literal',\n value,\n loc\n})\n","import { Environment } from './environment';\nimport { Closure } from './closure';\n\n// Every array also has the properties `id` and `environment` for use in the frontend CSE Machine\nexport type EnvArray = any[] & {\n readonly id: string\n environment: Environment\n}\n\n// Objects in the heap can only store arrays or closures\nexport type HeapObject = EnvArray | Closure\n\n/**\n * The heap stores all objects in each environment.\n */\nexport class Heap {\n private storage: Set | null = null\n\n public constructor() {}\n\n add(...items: HeapObject[]): void {\n this.storage ??= new Set()\n for (const item of items) {\n this.storage.add(item)\n }\n }\n\n /** Checks the existence of `item` in the heap. */\n contains(item: any): boolean {\n return this.storage?.has(item) ?? false\n }\n\n /** Gets the number of items in the heap. */\n size(): number {\n return this.storage?.size ?? 0\n }\n\n /**\n * Removes `item` from current heap and adds it to `otherHeap`.\n * If the current heap does not contain `item`, nothing happens.\n * @returns whether the item transfer is successful\n */\n move(item: HeapObject, otherHeap: Heap): boolean {\n if (!this.contains(item)) return false\n this.storage!.delete(item)\n otherHeap.add(item)\n return true\n }\n\n /** Returns a copy of the heap's contents. */\n getHeap(): Set {\n return new Set(this.storage)\n }\n}\n","import { Value } from './stash';\nimport * as es from 'estree';\nimport { Heap } from './heap';\nimport { Context } from './context';\nimport { Control } from './control';\nimport { Closure } from './closure';\nimport { isIdentifier } from './utils';\nimport { Node } from './types';\n\nexport interface Frame {\n [name: string]: any\n}\n\nexport interface Environment {\n readonly id: string\n name: string\n tail: Environment | null\n callExpression?: es.CallExpression\n head: Frame\n heap: Heap\n thisContext?: Value\n}\n\nexport const uniqueId = (context: Context): string => {\n return `${context.runtime.objectCount++}`\n}\n\nexport const createEnvironment = (\n context: Context,\n closure: Closure,\n args: Value[],\n callExpression: es.CallExpression\n): Environment => {\n const environment: Environment = {\n // TODO: name\n name: '',\n tail: closure.environment,\n head: {},\n heap: new Heap(),\n id: uniqueId(context),\n callExpression: {\n ...callExpression,\n //arguments: args.map(ast.primitive)\n }\n }\n \n // console.info('closure.node.params:', closure.node.params);\n // console.info('Number of params:', closure.node.params.length);\n\n closure.node.params.forEach((param, index) => {\n if (isRestElement(param)) {\n const array = args.slice(index)\n handleArrayCreation(context, array, environment)\n environment.head[(param.argument as es.Identifier).name] = array\n } else {\n environment.head[(param as es.Identifier).name] = args[index]\n }\n })\n return environment\n}\n\nexport const createSimpleEnvironment = (\n context: Context,\n name: string,\n tail: Environment | null = null\n): Environment => {\n return {\n id: uniqueId(context),\n name,\n tail,\n head: {},\n heap: new Heap(),\n // callExpression 和 thisContext 可选,根据需要传递\n };\n};\n\nexport const createProgramEnvironment = (context: Context, isPrelude: boolean): Environment => {\n return createSimpleEnvironment(context, isPrelude ? 'prelude' : 'programEnvironment');\n};\n\nexport const createBlockEnvironment = (\n context: Context,\n name = 'blockEnvironment'\n): Environment => {\n return {\n name,\n tail: currentEnvironment(context),\n head: {},\n heap: new Heap(),\n id: uniqueId(context)\n }\n}\n\nexport const isRestElement = (node: Node): node is es.RestElement => {\n return (node as es.RestElement).type === 'RestElement';\n};\n\nexport const handleArrayCreation = (\n context: Context,\n array: any[],\n envOverride?: Environment\n): void => {\n const environment = envOverride ?? currentEnvironment(context);\n Object.defineProperties(array, {\n id: { value: uniqueId(context) },\n environment: { value: environment, writable: true }\n });\n environment.heap.add(array as any); // 假设 heap.add 已定义\n};\n\nexport const currentEnvironment = (context: Context): Environment => {\n return context.runtime.environments[0];\n};\n\nexport const popEnvironment = (context: Context) => context.runtime.environments.shift()\n\nexport const pushEnvironment = (context: Context, environment: Environment) => {\n context.runtime.environments.unshift(environment)\n context.runtime.environmentTree.insert(environment)\n}\n","import { ExprNS, StmtNS } from '../ast-types';\nimport { Token } from '../tokenizer';\nimport type * as es from 'estree';\nimport { Stack } from './stack';\nimport { isNode, isBlockStatement, hasDeclarations, statementSequence } from './ast-helper';\nimport { Environment } from './environment';\n\nexport type Node = { isEnvDependent?: boolean } & (\n | es.Node\n | StatementSequence\n);\n\nexport interface StatementSequence extends es.BaseStatement {\n type: 'StatementSequence';\n body: es.Statement[];\n innerComments?: es.Comment[] | undefined;\n // isEnvDependent?: boolean\n}\n\nexport enum InstrType {\n RESET = 'Reset',\n WHILE = 'While',\n FOR = 'For',\n ASSIGNMENT = 'Assignment',\n ANN_ASSIGNMENT = 'AnnAssignment',\n APPLICATION = 'Application',\n UNARY_OP = 'UnaryOperation',\n BINARY_OP = 'BinaryOperation',\n BOOL_OP = 'BoolOperation',\n COMPARE = 'Compare',\n CALL = 'Call',\n RETURN = 'Return',\n BREAK = 'Break',\n CONTINUE = 'Continue',\n IF = 'If',\n FUNCTION_DEF = 'FunctionDef',\n LAMBDA = 'Lambda',\n MULTI_LAMBDA = 'MultiLambda',\n GROUPING = 'Grouping',\n LITERAL = 'Literal',\n VARIABLE = 'Variable',\n TERNARY = 'Ternary',\n PASS = 'Pass',\n ASSERT = 'Assert',\n IMPORT = 'Import',\n GLOBAL = 'Global',\n NONLOCAL = 'NonLocal',\n Program = 'Program',\n BRANCH = 'Branch',\n POP = 'Pop',\n ENVIRONMENT = 'environment',\n MARKER = 'marker',\n}\n\ninterface BaseInstr {\n instrType: InstrType\n srcNode: Node\n isEnvDependent?: boolean\n}\n\nexport interface WhileInstr extends BaseInstr {\n test: es.Expression\n body: es.Statement\n}\n\nexport interface ForInstr extends BaseInstr {\n init: es.VariableDeclaration | es.Expression\n test: es.Expression\n update: es.Expression\n body: es.Statement\n}\n\nexport interface AssmtInstr extends BaseInstr {\n symbol: string\n constant: boolean\n declaration: boolean\n}\n\nexport interface UnOpInstr extends BaseInstr {\n symbol: es.UnaryOperator\n}\n\nexport interface BinOpInstr extends BaseInstr {\n symbol: es.Identifier\n}\n\nexport interface AppInstr extends BaseInstr {\n numOfArgs: number\n srcNode: es.CallExpression\n}\n\nexport interface BranchInstr extends BaseInstr {\n consequent: es.Expression | es.Statement\n alternate: es.Expression | es.Statement | null | undefined\n}\n\nexport interface EnvInstr extends BaseInstr {\n env: Environment\n}\n\nexport interface ArrLitInstr extends BaseInstr {\n arity: number\n}\n\nexport interface AssmtInstr extends BaseInstr {\n symbol: string\n constant: boolean\n declaration: boolean\n}\n\nexport type Instr =\n | BaseInstr\n | WhileInstr\n | AssmtInstr\n | AppInstr\n | BranchInstr\n | EnvInstr\n | ArrLitInstr","import { Environment } from \"./environment\";\nimport { AppInstr, AssmtInstr, BinOpInstr, BranchInstr, EnvInstr, Instr, InstrType, Node, UnOpInstr } from \"./types\";\nimport type * as es from 'estree';\n\nexport const popInstr = (srcNode: Node): Instr => ({ instrType: InstrType.POP, srcNode })\n\nexport const assmtInstr = (\n symbol: string,\n constant: boolean,\n declaration: boolean,\n srcNode: Node\n): AssmtInstr => ({\n instrType: InstrType.ASSIGNMENT,\n symbol,\n constant,\n declaration,\n srcNode\n})\n\nexport const appInstr = (numOfArgs: number, srcNode: es.CallExpression): AppInstr => ({\n instrType: InstrType.APPLICATION,\n numOfArgs,\n srcNode\n})\n\nexport const envInstr = (env: Environment, srcNode: Node): EnvInstr => ({\n instrType: InstrType.ENVIRONMENT,\n env,\n srcNode\n})\n\nexport const markerInstr = (srcNode: Node): Instr => ({\n instrType: InstrType.MARKER,\n srcNode\n})\n\nexport const binOpInstr = (symbol: any, srcNode: Node): BinOpInstr => ({\n instrType: InstrType.BINARY_OP,\n symbol,\n srcNode\n})\n\nexport const resetInstr = (srcNode: Node): Instr => ({\n instrType: InstrType.RESET,\n srcNode\n})\n\nexport const branchInstr = (\n consequent: es.Expression | es.Statement,\n alternate: es.Expression | es.Statement | null | undefined,\n srcNode: Node\n): BranchInstr => ({\n instrType: InstrType.BRANCH,\n consequent,\n alternate,\n srcNode\n})\n\nexport const conditionalExpression = (\n test: es.Expression,\n consequent: es.Expression,\n alternate: es.Expression,\n loc?: es.SourceLocation | null\n): es.ConditionalExpression => ({\n type: 'ConditionalExpression',\n test,\n consequent,\n alternate,\n loc\n})\n\nexport const unOpInstr = (symbol: es.UnaryOperator, srcNode: Node): UnOpInstr => ({\n instrType: InstrType.UNARY_OP,\n symbol,\n srcNode\n})\n","// closure.ts\n\nimport * as es from 'estree'\nimport { Environment } from './environment'\nimport { Context } from './context' // 假设 Context 定义在 context.ts 中\nimport { StatementSequence } from './types'\nimport { blockArrowFunction, blockStatement, hasReturnStatement, identifier, isBlockStatement, returnStatement } from './ast-helper'\nimport { ControlItem } from './control'\n\nexport class Closure {\n public originalNode?: es.ArrowFunctionExpression\n\n /** Unique ID defined for closure */\n //public readonly id: string\n\n /** Name of the constant declaration that the closure is assigned to */\n public declaredName?: string\n\n constructor(\n public node: es.ArrowFunctionExpression,\n public environment: Environment,\n public context: Context,\n public predefined: boolean = false\n) {\n this.originalNode = node\n } \n\n static makeFromArrowFunction(\n node: es.ArrowFunctionExpression,\n environment: Environment,\n context: Context,\n dummyReturn: boolean = false,\n predefined: boolean = false\n ): Closure {\n const functionBody: es.BlockStatement | StatementSequence =\n !isBlockStatement(node.body) && !isStatementSequence(node.body)\n ? blockStatement([returnStatement(node.body, node.body.loc)], node.body.loc)\n : dummyReturn && !hasReturnStatement(node.body)\n ? blockStatement(\n [\n ...node.body.body,\n returnStatement(identifier('undefined', node.body.loc), node.body.loc)\n ],\n node.body.loc\n )\n : node.body\n\n const closure = new Closure(blockArrowFunction(node.params as es.Identifier[], functionBody, node.loc), \n environment, context, predefined)\n\n closure.originalNode = node\n\n return closure\n }\n}\n\nexport const isStatementSequence = (node: ControlItem): node is StatementSequence => {\n return (node as StatementSequence).type == 'StatementSequence'\n}\n","import { ErrorSeverity, ErrorType, SourceError } from '../types'\nimport * as es from 'estree'\n\n// todo\n// just put on here temporarily\nexport const UNKNOWN_LOCATION: es.SourceLocation = {\n start: {\n line: -1,\n column: -1\n },\n end: {\n line: -1,\n column: -1\n }\n}\n\nexport class RuntimeSourceError implements SourceError {\n public type = ErrorType.RUNTIME\n public severity = ErrorSeverity.ERROR\n public location: es.SourceLocation\n public message = 'Error'\n \n constructor(node?: es.Node) {\n this.location = node?.loc ?? UNKNOWN_LOCATION\n }\n \n public explain() {\n return ''\n }\n \n public elaborate() {\n return this.explain()\n }\n}\n\n\n","import * as es from 'estree'\nimport { ErrorType, SourceError } from '../types'\nimport { RuntimeSourceError } from './runtimeSourceError';\n\nexport class TypeConcatenateError extends RuntimeSourceError {\n constructor(node: es.Node) {\n super(node);\n this.type = ErrorType.TYPE;\n }\n\n public explain(): string {\n return `TypeError: can only concatenate str (not \"int\") to str.`;\n }\n\n public elaborate(): string {\n return `You are trying to concatenate a string with an integer. To fix this, convert the integer to a string using str(), or ensure both operands are of the same type.`;\n }\n}\n\nexport class MissingRequiredPositionalError extends RuntimeSourceError {\n private functionName: string;\n private missingParamCnt: number;\n private missingParamName: string;\n \n constructor(node: es.Node, functionName: string, params: es.Pattern[], args: any) {\n super(node);\n this.type = ErrorType.TYPE;\n this.functionName = functionName;\n this.missingParamCnt = params.length - args.length;\n const missingNames: string[] = [];\n for (let i = args.length; i < params.length; i++) {\n const param = params[i] as es.Identifier;\n missingNames.push(\"\\'\"+param.name+\"\\'\");\n }\n this.missingParamName = this.joinWithCommasAndAnd(missingNames);\n }\n \n public explain(): string {\n return `TypeError: ${this.functionName}() missing ${this.missingParamCnt} required positional argument: ${this.missingParamName}`;\n }\n \n public elaborate(): string {\n return `You called ${this.functionName}() without providing the required positional argument ${this.missingParamName}. Make sure to pass all required arguments when calling ${this.functionName}.`;\n }\n\n private joinWithCommasAndAnd(names: string[]): string {\n if (names.length === 0) {\n return '';\n } else if (names.length === 1) {\n return names[0];\n } else if (names.length === 2) {\n return `${names[0]} and ${names[1]}`;\n } else {\n const last = names.pop();\n return `${names.join(', ')} and ${last}`;\n }\n }\n}\n\nexport class TooManyPositionalArgumentsError extends RuntimeSourceError {\n private functionName: string;\n private expectedCount: number;\n private givenCount: number;\n \n constructor(node: es.Node, functionName: string, params: es.Pattern[], args: any) {\n super(node);\n this.type = ErrorType.TYPE;\n this.functionName = functionName;\n this.expectedCount = params.length;\n this.givenCount = args.length;\n }\n \n public explain(): string {\n return `TypeError: ${this.functionName}() takes ${this.expectedCount} positional arguments but ${this.givenCount} were given`;\n }\n \n public elaborate(): string {\n return `You called ${this.functionName}() with ${this.givenCount} positional arguments, but it only expects ${this.expectedCount}. Make sure to pass the correct number of arguments when calling ${this.functionName}.`;\n }\n}\n","import { ExprNS, StmtNS } from '../ast-types';\nimport { Token } from '../tokenizer';\nimport type * as es from 'estree';\nimport { Stack } from './stack';\nimport { isNode, isBlockStatement, hasDeclarations } from './ast-helper';\nimport { currentEnvironment, Environment } from './environment';\nimport { Control, ControlItem } from './control';\nimport {\n AppInstr,\n Instr,\n InstrType,\n BranchInstr,\n WhileInstr,\n ForInstr,\n Node,\n StatementSequence\n} from './types'\nimport { Context } from './context'\nimport * as instr from './instrCreator'\nimport { Value } from './stash';\nimport { Closure } from './closure';\nimport { RuntimeSourceError } from '../errors/runtimeSourceError';\nimport { CseError } from './error';\nimport { MissingRequiredPositionalError, TooManyPositionalArgumentsError } from '../errors/errors';\n\nexport const isIdentifier = (node: Node): node is es.Identifier => {\n return (node as es.Identifier).name !== undefined\n}\n\ntype PropertySetter = Map\ntype Transformer = (item: ControlItem) => ControlItem\n\nconst setToTrue = (item: ControlItem): ControlItem => {\n item.isEnvDependent = true\n return item\n}\n\nconst setToFalse = (item: ControlItem): ControlItem => {\n item.isEnvDependent = false\n return item\n}\n\nconst propertySetter: PropertySetter = new Map([\n // AST Nodes\n [\n 'Program',\n (item: ControlItem) => {\n const node = item as Node & es.Program;\n node.isEnvDependent = node.body.some(elem => isEnvDependent(elem));\n return node;\n }\n ],\n ['Literal', setToFalse],\n ['ImportDeclaration', setToFalse],\n ['BreakStatement', setToFalse],\n ['ContinueStatement', setToFalse],\n ['DebuggerStatement', setToFalse],\n ['VariableDeclaration', setToTrue],\n ['FunctionDeclaration', setToTrue],\n ['ArrowFunctionExpression', setToTrue],\n ['Identifier', setToTrue],\n [\n 'LogicalExpression',\n (item: ControlItem) => {\n const node = item as Node & es.LogicalExpression;\n node.isEnvDependent = isEnvDependent(node.left) || isEnvDependent(node.right);\n return node;\n }\n ],\n [\n 'BinaryExpression',\n (item: ControlItem) => {\n const node = item as Node & es.BinaryExpression;\n node.isEnvDependent = isEnvDependent(node.left) || isEnvDependent(node.right);\n return node;\n }\n ],\n [\n 'UnaryExpression',\n (item: ControlItem) => {\n const node = item as Node & es.UnaryExpression;\n node.isEnvDependent = isEnvDependent(node.argument);\n return node;\n }\n ],\n [\n 'ConditionalExpression',\n (item: ControlItem) => {\n const node = item as Node & es.ConditionalExpression;\n node.isEnvDependent =\n isEnvDependent(node.consequent) ||\n isEnvDependent(node.alternate) ||\n isEnvDependent(node.test);\n return node;\n }\n ],\n [\n 'MemberExpression',\n (item: ControlItem) => {\n const node = item as Node & es.MemberExpression;\n node.isEnvDependent = isEnvDependent(node.property) || isEnvDependent(node.object);\n return node;\n }\n ],\n [\n 'ArrayExpression',\n (item: ControlItem) => {\n const node = item as Node & es.ArrayExpression;\n node.isEnvDependent = node.elements.some(elem => isEnvDependent(elem));\n return node;\n }\n ],\n [\n 'AssignmentExpression',\n (item: ControlItem) => {\n const node = item as Node & es.AssignmentExpression;\n node.isEnvDependent = isEnvDependent(node.left) || isEnvDependent(node.right);\n return node;\n }\n ],\n [\n 'ReturnStatement',\n (item: ControlItem) => {\n const node = item as Node & es.ReturnStatement;\n node.isEnvDependent = isEnvDependent(node.argument);\n return node;\n }\n ],\n [\n 'CallExpression',\n (item: ControlItem) => {\n const node = item as Node & es.CallExpression;\n node.isEnvDependent =\n isEnvDependent(node.callee) || node.arguments.some(arg => isEnvDependent(arg));\n return node;\n }\n ],\n [\n 'ExpressionStatement',\n (item: ControlItem) => {\n const node = item as Node & es.ExpressionStatement;\n node.isEnvDependent = isEnvDependent(node.expression);\n return node;\n }\n ],\n [\n 'IfStatement',\n (item: ControlItem) => {\n const node = item as Node & es.IfStatement;\n node.isEnvDependent =\n isEnvDependent(node.test) ||\n isEnvDependent(node.consequent) ||\n isEnvDependent(node.alternate);\n return node;\n }\n ],\n [\n 'ForStatement',\n (item: ControlItem) => {\n const node = item as Node & es.ForStatement;\n node.isEnvDependent =\n isEnvDependent(node.body) ||\n isEnvDependent(node.init) ||\n isEnvDependent(node.test) ||\n isEnvDependent(node.update);\n return node;\n }\n ],\n [\n 'WhileStatement',\n (item: ControlItem) => {\n const node = item as Node & es.WhileStatement;\n node.isEnvDependent = isEnvDependent(node.body) || isEnvDependent(node.test);\n return node;\n }\n ],\n [\n 'BlockStatement',\n (item: ControlItem) => {\n const node = item as Node & es.BlockStatement;\n node.isEnvDependent = node.body.some(stm => isEnvDependent(stm));\n return node;\n }\n ],\n [\n 'StatementSequence',\n (item: ControlItem) => {\n const node = item as ControlItem & StatementSequence;\n node.isEnvDependent = node.body.some(stm => isEnvDependent(stm));\n return node;\n }\n ],\n ['ImportSpecifier', setToTrue],\n ['ImportDefaultSpecifier', setToTrue],\n \n // InstrType\n [InstrType.RESET, setToFalse],\n [InstrType.UNARY_OP, setToFalse],\n [InstrType.BINARY_OP, setToFalse],\n [InstrType.CONTINUE, setToFalse],\n [InstrType.ASSIGNMENT, setToTrue],\n [\n InstrType.WHILE,\n (item: ControlItem) => {\n const instr = item as WhileInstr;\n instr.isEnvDependent = isEnvDependent(instr.test) || isEnvDependent(instr.body);\n return instr;\n }\n ],\n [\n InstrType.FOR,\n (item: ControlItem) => {\n const instr = item as ForInstr;\n instr.isEnvDependent =\n isEnvDependent(instr.init) ||\n isEnvDependent(instr.test) ||\n isEnvDependent(instr.update) ||\n isEnvDependent(instr.body);\n return instr;\n }\n ],\n [\n InstrType.BRANCH,\n (item: ControlItem) => {\n const instr = item as BranchInstr;\n instr.isEnvDependent = isEnvDependent(instr.consequent) || isEnvDependent(instr.alternate);\n return instr;\n }\n ]\n ]);\n \n export { propertySetter };\n\n\n/**\n * Checks whether the evaluation of the given control item depends on the current environment.\n * The item is also considered environment dependent if its evaluation introduces\n * environment dependent items\n * @param item The control item to be checked\n * @return `true` if the item is environment depedent, else `false`.\n */\nexport function isEnvDependent(item: ControlItem | null | undefined): boolean {\n if (item === null || item === undefined) {\n return false\n }\n // If result is already calculated, return it\n if (item.isEnvDependent !== undefined) {\n return item.isEnvDependent\n }\n let setter: Transformer | undefined;\n if (isNode(item)) {\n setter = propertySetter.get(item.type);\n } else if (isInstr(item)) {\n setter = propertySetter.get(item.instrType);\n }\n\n if (setter) {\n return setter(item)?.isEnvDependent ?? false\n }\n \n return false\n}\n\n// function isInstr(item: ControlItem): item is Instr & { isEnvDependent?: boolean } {\n// return (item as Instr).instrType !== undefined;\n// }\n\n// export const envChanging = (command: ControlItem): boolean => {\n// if (isNode(command)) {\n// const type = command.type\n// return (\n// type === 'Program' ||\n// type === 'BlockStatement' ||\n// type === 'ArrowFunctionExpression' ||\n// (type === 'ExpressionStatement' && command.expression.type === 'ArrowFunctionExpression')\n// )\n// } else {\n// const type = command.instrType\n// return (\n// type === InstrType.ENVIRONMENT ||\n// type === InstrType.ARRAY_LITERAL ||\n// type === InstrType.ASSIGNMENT ||\n// type === InstrType.ARRAY_ASSIGNMENT ||\n// (type === InstrType.APPLICATION && (command as AppInstr).numOfArgs > 0)\n// )\n// }\n// }\n\nexport const envChanging = (command: ControlItem): boolean => {\n if (isNode(command)) {\n const type = command.type;\n return (\n type === 'Program' ||\n type === 'BlockStatement' ||\n type === 'ArrowFunctionExpression' ||\n (type === 'ExpressionStatement' && command.expression.type === 'ArrowFunctionExpression')\n );\n } else if (isInstr(command)) {\n const type = command.instrType;\n return (\n false\n );\n } else {\n return false;\n }\n};\n\nexport function declareFunctionsAndVariables(\n context: Context,\n node: es.BlockStatement,\n environment: Environment\n) {\n for (const statement of node.body) {\n switch (statement.type) {\n case 'VariableDeclaration':\n declareVariables(context, statement, environment)\n break\n case 'FunctionDeclaration':\n // FunctionDeclaration is always of type constant\n declareIdentifier(\n context,\n (statement.id as es.Identifier).name,\n statement,\n environment,\n true\n )\n break\n }\n }\n}\n\nfunction declareVariables(\n context: Context,\n node: es.VariableDeclaration,\n environment: Environment\n) {\n for (const declaration of node.declarations) {\n // Retrieve declaration type from node\n const constant = node.kind === 'const'\n declareIdentifier(context, (declaration.id as es.Identifier).name, node, environment, constant)\n }\n}\n\nexport function declareIdentifier(\n context: Context,\n name: string,\n node: Node,\n environment: Environment,\n constant: boolean = false\n) {\n if (environment.head.hasOwnProperty(name)) {\n const descriptors = Object.getOwnPropertyDescriptors(environment.head)\n\n // return handleRuntimeError(\n // context,\n // new errors.VariableRedeclaration(node, name, descriptors[name].writable)\n // )\n }\n //environment.head[name] = constant ? UNASSIGNED_CONST : UNASSIGNED_LET\n environment.head[name] = 'declaration'\n \n return environment\n}\n\nexport const handleSequence = (seq: es.Statement[]): ControlItem[] => {\n const result: ControlItem[] = []\n let valueProduced = false\n for (const command of seq) {\n //if (!isImportDeclaration(command)) {\n if (valueProducing(command)) {\n // Value producing statements have an extra pop instruction\n if (valueProduced) {\n result.push(instr.popInstr(command))\n } else {\n valueProduced = true\n }\n }\n result.push(command)\n //}\n }\n // Push statements in reverse order\n return result.reverse()\n}\n\nexport const valueProducing = (command: Node): boolean => {\n const type = command.type\n return (\n type !== 'VariableDeclaration' &&\n type !== 'FunctionDeclaration' &&\n type !== 'ContinueStatement' &&\n type !== 'BreakStatement' &&\n type !== 'DebuggerStatement' &&\n (type !== 'BlockStatement' || command.body.some(valueProducing))\n )\n}\n\nexport function defineVariable(\n context: Context,\n name: string,\n value: Value,\n constant = false,\n node: es.VariableDeclaration | es.ImportDeclaration\n) {\n const environment = currentEnvironment(context)\n\n if (environment.head[name] !== 'declaration') {\n // error\n //return handleRuntimeError(context, new errors.VariableRedeclaration(node, name, !constant))\n }\n\n if (constant && value instanceof Closure) {\n value.declaredName = name;\n }\n\n Object.defineProperty(environment.head, name, {\n value,\n writable: !constant,\n enumerable: true\n })\n\n return environment\n}\n\nexport const getVariable = (context: Context, name: string, node: es.Identifier) => {\n let environment: Environment | null = currentEnvironment(context)\n while (environment) {\n if (environment.head.hasOwnProperty(name)) {\n if (\n environment.head[name] === 'declaration'\n ) {\n //return handleRuntimeError(context, new errors.UnassignedVariable(name, node))\n } else {\n return environment.head[name]\n }\n } else {\n environment = environment.tail\n }\n }\n //return handleRuntimeError(context, new errors.UndefinedVariable(name, node))\n}\n\nexport const checkStackOverFlow = (context: Context, control: Control) => {\n // todo\n}\n\nexport const checkNumberOfArguments = (\n command: ControlItem,\n context: Context,\n callee: Closure | Value,\n args: Value[],\n exp: es.CallExpression\n) => {\n if (callee instanceof Closure) {\n // User-defined or Pre-defined functions\n const params = callee.node.params\n // console.info(\"params: \", params);\n // console.info(\"args: \", args);\n //const hasVarArgs = params[params.length - 1]?.type === 'RestElement'\n\n if (params.length > args.length) {\n handleRuntimeError(context, new MissingRequiredPositionalError((command as es.Node), callee.declaredName!, params, args));\n } else if (params.length !== args.length) {\n handleRuntimeError(context, new TooManyPositionalArgumentsError((command as es.Node), callee.declaredName!, params, args));\n }\n //}\n\n // if (hasVarArgs ? params.length - 1 > args.length : params.length !== args.length) {\n // // error\n // // return handleRuntimeError(\n // // context,\n // // new errors.InvalidNumberOfArguments(\n // // exp,\n // // hasVarArgs ? params.length - 1 : params.length,\n // // args.length,\n // // hasVarArgs\n // // )\n // // )\n // }\n } else {\n // Pre-built functions\n const hasVarArgs = callee.minArgsNeeded != undefined\n if (hasVarArgs ? callee.minArgsNeeded > args.length : callee.length !== args.length) {\n // error\n // return handleRuntimeError(\n // context,\n // new errors.InvalidNumberOfArguments(\n // exp,\n // hasVarArgs ? callee.minArgsNeeded : callee.length,\n // args.length,\n // hasVarArgs\n // )\n // )\n }\n }\n return undefined\n}\n\nexport const isInstr = (command: ControlItem): command is Instr => {\n return (command as Instr).instrType !== undefined\n}\n\nexport const isSimpleFunction = (node: any) => {\n if (node.body.type !== 'BlockStatement' && node.body.type !== 'StatementSequence') {\n return true\n } else {\n const block = node.body\n return block.body.length === 1 && block.body[0].type === 'ReturnStatement'\n }\n}\n\nexport const reduceConditional = (\n node: es.IfStatement | es.ConditionalExpression\n): ControlItem[] => {\n return [instr.branchInstr(node.consequent, node.alternate, node), node.test]\n}\n\nexport const handleRuntimeError = (context: Context, error: RuntimeSourceError) => {\n context.errors.push(error)\n\n console.error(error.explain());\n console.error(error.elaborate());\n //console.log(\"Location:\", `Line ${e.location.start.line}, Column ${e.location.start.column}`);\n \n throw error;\n}\n\nexport function pythonMod(a: any, b: any): any {\n const mod = a % b;\n if ((mod >= 0 && b > 0) || (mod <= 0 && b < 0)) {\n return mod;\n } else {\n return mod + b;\n }\n}\n\nexport function hasImportDeclarations(node: es.BlockStatement): boolean {\n for (const statement of (node as unknown as es.Program).body) {\n if (statement.type === 'ImportDeclaration') {\n return true\n }\n }\n return false\n}\n\nexport const isImportDeclaration = (\n node: es.Program['body'][number]\n): node is es.ImportDeclaration => node.type === 'ImportDeclaration'\n\nexport function getModuleDeclarationSource(\n node: Exclude\n): string {\n assert(\n typeof node.source?.value === 'string',\n `Expected ${node.type} to have a source value of type string, got ${node.source?.value}`\n )\n return node.source.value\n}\n\nexport class AssertionError extends RuntimeSourceError {\n constructor(public readonly message: string) {\n super()\n }\n\n public explain(): string {\n return this.message\n }\n\n public elaborate(): string {\n return 'Please contact the administrators to let them know that this error has occurred'\n }\n}\n\nexport default function assert(condition: boolean, message: string): asserts condition {\n if (!condition) {\n throw new AssertionError(message)\n }\n}\n","import { ExprNS, StmtNS } from '../ast-types';\nimport { Token } from '../tokenizer';\nimport type * as es from 'estree';\nimport { Stack } from './stack';\nimport { isNode, isBlockStatement, hasDeclarations, statementSequence } from './ast-helper';\nimport { Environment } from './environment';\nimport { Node, StatementSequence, Instr } from './types';\nimport { isEnvDependent } from './utils';\n\nexport type ControlItem = (Node | Instr) & {\n isEnvDependent?: boolean;\n skipEnv?: boolean;\n};\n\nexport class Control extends Stack {\n private numEnvDependentItems: number\n public constructor(program?: es.Program | StatementSequence) {\n super()\n this.numEnvDependentItems = 0\n // Load program into control stack\n program ? this.push(program) : null\n }\n\n public canAvoidEnvInstr(): boolean {\n return this.numEnvDependentItems === 0\n }\n\n // For testing purposes\n public getNumEnvDependentItems(): number {\n return this.numEnvDependentItems\n }\n\n public pop(): ControlItem | undefined {\n const item = super.pop()\n if (item !== undefined && isEnvDependent(item)) {\n this.numEnvDependentItems--\n }\n return item\n }\n\n public push(...items: ControlItem[]): void {\n const itemsNew: ControlItem[] = Control.simplifyBlocksWithoutDeclarations(...items)\n itemsNew.forEach((item: ControlItem) => {\n if (isEnvDependent(item)) {\n this.numEnvDependentItems++\n }\n })\n super.push(...itemsNew)\n }\n\n /**\n * Before pushing block statements on the control stack, we check if the block statement has any declarations.\n * If not, the block is converted to a StatementSequence.\n * @param items The items being pushed on the control.\n * @returns The same set of control items, but with block statements without declarations converted to StatementSequences.\n * NOTE: this function handles any case where StatementSequence has to be converted back into BlockStatement due to type issues\n */\n private static simplifyBlocksWithoutDeclarations(...items: ControlItem[]): ControlItem[] {\n const itemsNew: ControlItem[] = []\n items.forEach(item => {\n if (isNode(item) && isBlockStatement(item) && !hasDeclarations(item)) {\n // Push block body as statement sequence\n const seq: StatementSequence = statementSequence(item.body, item.loc)\n itemsNew.push(seq)\n } else {\n itemsNew.push(item)\n }\n })\n return itemsNew\n }\n\n public copy(): Control {\n const newControl = new Control()\n const stackCopy = super.getStack()\n newControl.push(...stackCopy)\n return newControl\n }\n}\n","// Value.ts\nimport { ExprNS, StmtNS } from '../ast-types';\nimport { Closure } from './closure';\nimport { Environment } from './environment';\nimport { Stack } from './stack';\n\n/**\n * Value represents various runtime values in Python.\n */\nexport type Value = any\n// | NumberValue\n// | BoolValue\n// | StringValue\n// | FunctionValue\n// | LambdaValue\n// | MultiLambdaValue\n// | ErrorValue\n// | UndefinedValue\n// | string\n// | BigIntValue\n// | pyClosureValue;\n\nexport interface pyClosureValue {\n type: \"closure\";\n closure: Closure;\n}\n\nexport interface BigIntValue {\n type: 'bigint';\n value: bigint;\n}\n\nexport interface NumberValue {\n type: 'number';\n value: number;\n}\n\nexport interface BoolValue {\n type: 'bool';\n value: boolean;\n}\n\nexport interface StringValue {\n type: 'string';\n value: string;\n}\n\nexport interface FunctionValue {\n type: 'function';\n name: string;\n params: string[];\n body: StmtNS.Stmt[];\n env: Environment;\n}\n\nexport interface LambdaValue {\n type: 'lambda';\n parameters: string[];\n body: ExprNS.Expr;\n env: Environment;\n}\n\nexport interface MultiLambdaValue {\n type: 'multi_lambda';\n parameters: string[];\n body: StmtNS.Stmt[];\n varDecls: string[];\n env: Environment;\n}\n\nexport interface ErrorValue {\n type: 'error';\n message: string;\n}\n\n// TODO: Merge undefined and None.\nexport interface UndefinedValue {\n type: 'undefined';\n}\n\nexport class Stash extends Stack {\n public constructor() {\n super();\n }\n\n public copy(): Stash {\n const newStash = new Stash();\n const stackCopy = super.getStack();\n newStash.push(...stackCopy);\n return newStash;\n }\n}\n","import * as es from \"estree\";\nimport { handleRuntimeError, isIdentifier, pythonMod } from \"./utils\";\nimport { Context } from \"./context\";\nimport * as error from \"../errors/errors\"\nimport { PyComplexNumber } from \"../types\";\n\nexport type BinaryOperator =\n | \"==\"\n | \"!=\"\n | \"===\"\n | \"!==\"\n | \"<\"\n | \"<=\"\n | \">\"\n | \">=\"\n | \"<<\"\n | \">>\"\n | \">>>\"\n | \"+\"\n | \"-\"\n | \"*\"\n | \"/\"\n | \"%\"\n | \"**\"\n | \"|\"\n | \"^\"\n | \"&\"\n | \"in\"\n | \"instanceof\";\n\n\n\n// export function evaluateBinaryExpression(operator: BinaryOperator, left: any, right: any) {\n// switch (operator) {\n// case '+':\n// return left + right\n// case '-':\n// return left - right\n// case '*':\n// return left * right\n// case '/':\n// return left / right\n// case '%':\n// return left % right\n// case '===':\n// return left === right\n// case '!==':\n// return left !== right\n// case '<=':\n// return left <= right\n// case '<':\n// return left < right\n// case '>':\n// return left > right\n// case '>=':\n// return left >= right\n// default:\n// return undefined\n// }\n// }\n\nexport function evaluateUnaryExpression(operator: es.UnaryOperator, value: any) {\n if (operator === '!') {\n if (value.type === 'bool') {\n return {\n type: 'bool',\n value: !(Boolean(value.value))\n };\n } else {\n // TODO: error\n }\n } else if (operator === '-') {\n if (value.type === 'bigint') {\n return {\n type: 'bigint',\n value: -value.value\n };\n } else if (value.type === 'number') {\n return {\n type: 'number',\n value: -Number(value.value)\n };\n } else {\n // TODO: error\n }\n // else if (value.type === 'bool') {\n // return {\n // type: 'bigint',\n // value: Boolean(value.value)?BigInt(-1):BigInt(0)\n // };\n // }\n } else if (operator === 'typeof') {\n // todo\n return {\n type: String,\n value: typeof value.value\n };\n } else {\n return value;\n }\n}\n\nexport function evaluateBinaryExpression(context: Context, identifier: any, left: any, right: any) {\n //if(isIdentifier(identifier)){\n //if(identifier.name === '__py_adder') {\n if (left.type === 'string' && right.type === 'string' && identifier.name === '__py_adder') {\n if(isIdentifier(identifier) && identifier.name === '__py_adder') {\n return {\n type: 'string',\n value: left.value + right.value\n };\n } else {\n let ret_type : any;\n let ret_value : any;\n if (identifier === '>') {\n ret_value = left.value > right.value;\n } else if(identifier === '>=') {\n ret_value = left.value >= right.value;\n } else if(identifier === '<') {\n ret_value = left.value < right.value;\n } else if(identifier === '<=') {\n ret_value = left.value <= right.value;\n } else if(identifier === '===') {\n ret_value = left.value === right.value;\n } else if(identifier === '!==') {\n ret_value = left.value !== right.value;\n } else {\n // TODO: error\n }\n\n return {\n type: 'bool',\n value: ret_value\n };\n }\n } else {\n // numbers: only int and float, not bool\n const numericTypes = ['number', 'bigint', 'complex']; //, 'bool'\n if (!numericTypes.includes(left.type) || !numericTypes.includes(right.type)) {\n // TODO: \n //throw new Error('Placeholder: invalid operand types for addition');\n // console.info('not num or bigint', left.type, right.type);\n }\n\n // if (left.type === 'bool') {\n // left.type = 'bigint';\n // left.value = left.value?BigInt(1):BigInt(0);\n // }\n // if (right.type === 'bool') {\n // right.type = 'bigint';\n // right.value = right.value?BigInt(1):BigInt(0);\n // }\n\n let originalLeft = { type : left.type, value : left.value };\n let originalRight = { type : right.type, value : right.value };\n\n if (left.type !== right.type) {\n // left.type = 'number';\n // left.value = Number(left.value);\n // right.type = 'number';\n // right.value = Number(right.value);\n \n if (left.type === 'complex' || right.type === 'complex') {\n left.type = 'complex';\n right.type = 'complex';\n left.value = PyComplexNumber.fromValue(left.value);\n right.value = PyComplexNumber.fromValue(right.value);\n } else if (left.type === 'number' || right.type === 'number') {\n left.type = 'number';\n right.type = 'number';\n left.value = Number(left.value);\n right.value = Number(right.value);\n }\n }\n\n let ret_value : any;\n let ret_type : any = left.type;\n\n if(isIdentifier(identifier)) {\n if(identifier.name === '__py_adder') {\n if (left.type === 'complex' || right.type === 'complex') {\n const leftComplex = PyComplexNumber.fromValue(left.value);\n const rightComplex = PyComplexNumber.fromValue(right.value);\n ret_value = leftComplex.add(rightComplex);\n } else {\n ret_value = left.value + right.value;\n }\n } else if(identifier.name === '__py_minuser') {\n if (left.type === 'complex' || right.type === 'complex') {\n const leftComplex = PyComplexNumber.fromValue(left.value);\n const rightComplex = PyComplexNumber.fromValue(right.value);\n ret_value = leftComplex.sub(rightComplex);\n } else {\n ret_value = left.value - right.value;\n }\n } else if(identifier.name === '__py_multiplier') {\n if (left.type === 'complex' || right.type === 'complex') {\n const leftComplex = PyComplexNumber.fromValue(left.value);\n const rightComplex = PyComplexNumber.fromValue(right.value);\n ret_value = leftComplex.mul(rightComplex);\n } else {\n ret_value = left.value * right.value;\n }\n } else if(identifier.name === '__py_divider') {\n if (left.type === 'complex' || right.type === 'complex') {\n const leftComplex = PyComplexNumber.fromValue(left.value);\n const rightComplex = PyComplexNumber.fromValue(right.value);\n ret_value = leftComplex.div(rightComplex);\n } else {\n if(right.value !== 0) {\n ret_type = 'number';\n ret_value = Number(left.value) / Number(right.value);\n } else {\n // TODO: divide by 0 error\n }\n }\n } else if(identifier.name === '__py_modder') {\n if (left.type === 'complex') {\n // TODO: error\n }\n ret_value = pythonMod(left.value, right.value);\n } else if(identifier.name === '__py_floorer') {\n // TODO: floorer not in python now\n ret_value = 0;\n } else if(identifier.name === '__py_powerer') {\n if (left.type === 'complex') {\n const leftComplex = PyComplexNumber.fromValue(left.value);\n const rightComplex = PyComplexNumber.fromValue(right.value);\n ret_value = leftComplex.pow(rightComplex);\n } else {\n if (left.type === 'bigint' && right.value < 0) {\n ret_value = Number(left.value) ** Number(right.value);\n ret_type = 'number';\n } else {\n ret_value = left.value ** right.value;\n }\n }\n } else {\n // TODO: throw an error\n }\n } else {\n ret_type = 'bool';\n\n // one of them is complex, convert all to complex then compare\n // for complex, only '==' and '!=' valid\n if (left.type === 'complex') {\n const leftComplex = PyComplexNumber.fromValue(left.value);\n const rightComplex = PyComplexNumber.fromValue(right.value);\n if (identifier === '===') {\n ret_value = leftComplex.equals(rightComplex);\n } else if (identifier === '!==') {\n ret_value = !leftComplex.equals(rightComplex);\n } else {\n // TODO: error\n }\n } else if (originalLeft.type !== originalRight.type) {\n let int_num : any;\n let floatNum : any;\n let compare_res;\n if (originalLeft.type === 'bigint') {\n int_num = originalLeft;\n floatNum = originalRight;\n compare_res = pyCompare(int_num, floatNum);\n } else {\n int_num = originalRight;\n floatNum = originalLeft;\n compare_res = -pyCompare(int_num, floatNum);\n }\n\n if (identifier === '>') {\n ret_value = compare_res > 0;\n } else if(identifier === '>=') {\n ret_value = compare_res >= 0;\n } else if(identifier === '<') {\n ret_value = compare_res < 0;\n } else if(identifier === '<=') {\n ret_value = compare_res <= 0;\n } else if(identifier === '===') {\n ret_value = compare_res === 0;\n } else if(identifier === '!==') {\n ret_value = compare_res !== 0;\n } else {\n // TODO: error\n }\n\n \n } else {\n if (identifier === '>') {\n ret_value = left.value > right.value;\n } else if(identifier === '>=') {\n ret_value = left.value >= right.value;\n } else if(identifier === '<') {\n ret_value = left.value < right.value;\n } else if(identifier === '<=') {\n ret_value = left.value <= right.value;\n } else if(identifier === '===') {\n ret_value = left.value === right.value;\n } else if(identifier === '!==') {\n ret_value = left.value !== right.value;\n } else {\n // TODO: error\n }\n }\n\n \n }\n\n return {\n type: ret_type,\n value: ret_value\n };\n }\n}\n\nfunction pyCompare(int_num : any, float_num : any) {\n // int_num.value < float_num.value => -1\n // int_num.value = float_num.value => 0\n // int_num.value > float_num.value => 1\n\n // If float_num is positive Infinity, then int_num is considered smaller.\n if (float_num.value === Infinity) {\n return -1;\n }\n if (float_num.value === -Infinity) {\n return 1;\n }\n\n const signInt = (int_num.value < 0) ? -1 : (int_num.value > 0 ? 1 : 0);\n const signFlt = Math.sign(float_num.value); // -1, 0, or 1\n\n if (signInt < signFlt) return -1; // e.g. int<0, float>=0 => int < float\n if (signInt > signFlt) return 1; // e.g. int>=0, float<0 => int > float\n \n // Both have the same sign (including 0).\n // If both are zero, treat them as equal.\n if (signInt === 0 && signFlt === 0) {\n return 0;\n }\n\n // Both are either positive or negative.\n // If |int_num.value| is within 2^53, it can be safely converted to a JS number for an exact comparison.\n const absInt = int_num.value < 0 ? -int_num.value : int_num.value;\n const MAX_SAFE = 9007199254740991; // 2^53 - 1\n\n if (absInt <= MAX_SAFE) {\n // Safe conversion to double.\n const intAsNum = Number(int_num.value); \n const diff = intAsNum - float_num.value;\n if (diff === 0) return 0;\n return diff < 0 ? -1 : 1;\n }\n\n // For large integers exceeding 2^53, we need to distinguish more carefully.\n // General idea: Determine the order of magnitude of float_num.value (via log10) and compare it with\n // the number of digits of int_num.value. An approximate comparison can indicate whether\n // int_num.value is greater or less than float_num.value.\n \n // First, check if float_num.value is nearly zero (but not zero).\n if (float_num.value === 0) {\n // Although signFlt would be 0 and handled above, just to be safe:\n return signInt; \n }\n\n const absFlt = Math.abs(float_num.value);\n // Determine the order of magnitude.\n const exponent = Math.floor(Math.log10(absFlt)); \n // For example, if float_num.value = 3.333333e49, exponent = 49, indicating roughly 50 digits in its integer part.\n \n // Get the decimal string representation of the absolute integer.\n const intStr = absInt.toString(); \n const intDigits = intStr.length;\n\n // If exponent + 1 is less than intDigits, then |int_num.value| has more digits\n // and is larger (if positive) or smaller (if negative) than float_num.value.\n // Conversely, if exponent + 1 is greater than intDigits, int_num.value has fewer digits.\n const integerPartLen = exponent + 1;\n if (integerPartLen < intDigits) {\n // length of int_num.value is larger => all positive => int_num.value > float_num.value\n // => all negative => int_num.value < float_num.value\n return (signInt > 0) ? 1 : -1;\n } else if (integerPartLen > intDigits) {\n // length of int_num.value is smaller => all positive => int_num.value < float_num.value\n // => all negative => int_num.value > float_num.value\n return (signInt > 0) ? -1 : 1;\n } else {\n // (5.2) If the number of digits is the same, they may be extremely close.\n // Method: Convert float_num.value into an approximate BigInt string and perform a lexicographical comparison.\n const floatApproxStr = approximateBigIntString(absFlt, 30);\n \n const aTrim = intStr.replace(/^0+/, '');\n const bTrim = floatApproxStr.replace(/^0+/, '');\n\n // If lengths differ after trimming, the one with more digits is larger.\n if (aTrim.length > bTrim.length) {\n return (signInt > 0) ? 1 : -1;\n } else if (aTrim.length < bTrim.length) {\n return (signInt > 0) ? -1 : 1;\n } else {\n // Same length: use lexicographical comparison.\n const cmp = aTrim.localeCompare(bTrim);\n if (cmp === 0) {\n return 0;\n }\n // cmp>0 => aTrim > bTrim => aVal > bVal\n return (cmp > 0) ? (signInt > 0 ? 1 : -1)\n : (signInt > 0 ? -1 : 1);\n }\n }\n}\n\nfunction approximateBigIntString(num: number, precision: number): string {\n // Use scientific notation to obtain a string in the form \"3.333333333333333e+49\"\n const s = num.toExponential(precision); \n // Split into mantissa and exponent parts.\n // The regular expression matches strings of the form: /^([\\d.]+)e([+\\-]\\d+)$/\n const match = s.match(/^([\\d.]+)e([+\\-]\\d+)$/);\n if (!match) {\n // For extremely small or extremely large numbers, toExponential() should follow this format.\n // As a fallback, return Math.floor(num).toString()\n return Math.floor(num).toString();\n }\n let mantissaStr = match[1]; // \"3.3333333333...\"\n const exp = parseInt(match[2], 10); // e.g. +49\n\n // Remove the decimal point\n mantissaStr = mantissaStr.replace('.', ''); \n // Get the current length of the mantissa string\n const len = mantissaStr.length; \n // Calculate the required integer length: for exp ≥ 0, we want the integer part\n // to have (1 + exp) digits.\n const integerLen = 1 + exp; \n if (integerLen <= 0) {\n // This indicates num < 1 (e.g., exponent = -1, mantissa = \"3\" results in 0.xxx)\n // For big integer comparison, such a number is very small, so simply return \"0\"\n return \"0\";\n }\n\n if (len < integerLen) {\n // The mantissa is not long enough; pad with zeros at the end.\n return mantissaStr.padEnd(integerLen, '0');\n }\n // If the mantissa is too long, truncate it (this is equivalent to taking the floor).\n // Rounding could be applied if necessary, but truncation is sufficient for comparison.\n return mantissaStr.slice(0, integerLen);\n}\n ","export class CseError {\n message: string;\n constructor(message: string) {\n this.message = message;\n }\n}\n ","import * as es from 'estree'\nimport { isImportDeclaration, getModuleDeclarationSource } from './utils';\n\n/**\n * Python style dictionary\n */\nexport default class Dict {\n constructor(private readonly internalMap = new Map()) {}\n \n public get size() {\n return this.internalMap.size\n }\n \n public [Symbol.iterator]() {\n return this.internalMap[Symbol.iterator]()\n }\n \n public get(key: K) {\n return this.internalMap.get(key)\n }\n \n public set(key: K, value: V) {\n return this.internalMap.set(key, value)\n }\n \n public has(key: K) {\n return this.internalMap.has(key)\n }\n \n /**\n * Similar to how the python dictionary's setdefault function works:\n * If the key is not present, it is set to the given value, then that value is returned\n * Otherwise, `setdefault` returns the value stored in the dictionary without\n * modifying it\n */\n public setdefault(key: K, value: V) {\n if (!this.has(key)) {\n this.set(key, value)\n }\n \n return this.get(key)!\n }\n \n public update(key: K, defaultVal: V, updater: (oldV: V) => V) {\n const value = this.setdefault(key, defaultVal)\n const newValue = updater(value)\n this.set(key, newValue)\n return newValue\n }\n \n public entries() {\n return [...this.internalMap.entries()]\n }\n \n public forEach(func: (key: K, value: V) => void) {\n this.internalMap.forEach((v, k) => func(k, v))\n }\n \n /**\n * Similar to `mapAsync`, but for an async mapping function that does not return any value\n */\n public async forEachAsync(func: (k: K, v: V, index: number) => Promise): Promise {\n await Promise.all(this.map((key, value, i) => func(key, value, i)))\n }\n \n public map(func: (key: K, value: V, index: number) => T) {\n return this.entries().map(([k, v], i) => func(k, v, i))\n }\n \n /**\n * Using a mapping function that returns a promise, transform a map\n * to another map with different keys and values. All calls to the mapping function\n * execute asynchronously\n */\n public mapAsync(func: (key: K, value: V, index: number) => Promise) {\n return Promise.all(this.map((key, value, i) => func(key, value, i)))\n }\n \n public flatMap(func: (key: K, value: V, index: number) => U[]) {\n return this.entries().flatMap(([k, v], i) => func(k, v, i))\n }\n}\n\n/**\n * Convenience class for maps that store an array of values\n */\nexport class ArrayMap extends Dict {\n public add(key: K, item: V) {\n this.setdefault(key, []).push(item)\n }\n }\n \n export function filterImportDeclarations({\n body\n }: es.Program): [\n ArrayMap,\n Exclude[]\n ] {\n return body.reduce(\n ([importNodes, otherNodes], node) => {\n if (!isImportDeclaration(node)) return [importNodes, [...otherNodes, node]]\n \n const moduleName = getModuleDeclarationSource(node)\n importNodes.add(moduleName, node)\n return [importNodes, otherNodes]\n },\n [new ArrayMap(), []] as [\n ArrayMap,\n Exclude[]\n ]\n )\n}\n","/**\n * This interpreter implements an explicit-control evaluator.\n *\n * Heavily adapted from https://github.com/source-academy/JSpike/\n */\n\n/* tslint:disable:max-classes-per-file */\n\nimport * as es from 'estree'\nimport { Stack } from './stack'\nimport { Control, ControlItem } from './control';\nimport { Stash, Value } from './stash';\nimport { Environment, createBlockEnvironment, createEnvironment, createProgramEnvironment, currentEnvironment, popEnvironment, pushEnvironment } from './environment';\nimport { Context } from './context';\nimport { isNode, isBlockStatement, hasDeclarations, statementSequence, blockArrowFunction, constantDeclaration, pyVariableDeclaration, identifier, literal } from './ast-helper';\nimport { envChanging,declareFunctionsAndVariables, handleSequence, defineVariable, getVariable, checkStackOverFlow, checkNumberOfArguments, isInstr, isSimpleFunction, isIdentifier, reduceConditional, valueProducing, handleRuntimeError, hasImportDeclarations, declareIdentifier } from './utils';\nimport { AppInstr, AssmtInstr, BinOpInstr, BranchInstr, EnvInstr, Instr, InstrType, StatementSequence, UnOpInstr } from './types';\nimport * as instr from './instrCreator'\nimport { Closure } from './closure';\nimport { evaluateBinaryExpression, evaluateUnaryExpression } from './operators';\nimport { conditionalExpression } from './instrCreator';\nimport * as error from \"../errors/errors\"\nimport { ComplexLiteral, CSEBreak, None, PyComplexNumber, RecursivePartial, Representation, Result } from '../types';\nimport { builtIns, builtInConstants } from '../stdlib';\nimport { IOptions } from '..';\nimport { CseError } from './error';\nimport { filterImportDeclarations } from './dict';\nimport { RuntimeSourceError } from '../errors/runtimeSourceError';\nimport { Identifier } from '../conductor/types';\n\ntype CmdEvaluator = (\n command: ControlItem,\n context: Context,\n control: Control,\n stash: Stash,\n isPrelude: boolean\n) => void\n\nlet cseFinalPrint = \"\";\nexport function addPrint(str: string) {\n cseFinalPrint = cseFinalPrint + str + \"\\n\";\n}\n\n/**\n * Function that returns the appropriate Promise given the output of CSE machine evaluating, depending\n * on whether the program is finished evaluating, ran into a breakpoint or ran into an error.\n * @param context The context of the program.\n * @param value The value of CSE machine evaluating the program.\n * @returns The corresponding promise.\n */\nexport function CSEResultPromise(context: Context, value: Value): Promise {\n return new Promise((resolve, reject) => {\n if (value instanceof CSEBreak) {\n resolve({ status: 'suspended-cse-eval', context });\n } else if (value instanceof CseError) {\n resolve({ status: 'error' } as unknown as Result );\n } else {\n //const rep: Value = { type: \"string\", value: cseFinalPrint };\n const representation = new Representation(value);\n resolve({ status: 'finished', context, value, representation })\n }\n })\n}\n\n/**\n * Function to be called when a program is to be interpreted using\n * the explicit control evaluator.\n *\n * @param program The program to evaluate.\n * @param context The context to evaluate the program in.\n * @param options Evaluation options.\n * @returns The result of running the CSE machine.\n */\nexport function evaluate(program: es.Program, context: Context, options: RecursivePartial = {}): Value {\n try {\n // TODO: is undefined variables check necessary for Python?\n // checkProgramForUndefinedVariables(program, context)\n } catch (error: any) {\n context.errors.push(new CseError(error.message));\n return { type: 'error', message: error.message };\n }\n // TODO: should call transformer like in js-slang\n // seq.transform(program)\n\n try {\n context.runtime.isRunning = true\n context.control = new Control(program);\n context.stash = new Stash();\n // Adaptation for new feature\n const result = runCSEMachine(\n context,\n context.control,\n context.stash,\n options.envSteps!,\n options.stepLimit!,\n options.isPrelude\n );\n const rep: Value = { type: \"string\", value: cseFinalPrint };\n return rep;\n } catch (error: any) {\n context.errors.push(new CseError(error.message));\n return { type: 'error', message: error.message };\n } finally {\n context.runtime.isRunning = false\n }\n}\n\nfunction evaluateImports(program: es.Program, context: Context) {\n try {\n const [importNodeMap] = filterImportDeclarations(program)\n const environment = currentEnvironment(context)\n for (const [moduleName, nodes] of importNodeMap) {\n const functions = context.nativeStorage.loadedModules[moduleName]\n for (const node of nodes) {\n for (const spec of node.specifiers) {\n declareIdentifier(context, spec.local.name, node, environment)\n let obj: any\n\n switch (spec.type) {\n case 'ImportSpecifier': {\n if (spec.imported.type === 'Identifier') {\n obj = functions[spec.imported.name];\n } else {\n throw new Error(`Unexpected literal import: ${spec.imported.value}`);\n }\n //obj = functions[(spec.imported).name]\n break\n }\n case 'ImportDefaultSpecifier': {\n obj = functions.default\n break\n }\n case 'ImportNamespaceSpecifier': {\n obj = functions\n break\n }\n }\n\n defineVariable(context, spec.local.name, obj, true, node)\n }\n }\n }\n } catch (error) {\n handleRuntimeError(context, error as RuntimeSourceError)\n }\n}\n\n/**\n * The primary runner/loop of the explicit control evaluator.\n *\n * @param context The context to evaluate the program in.\n * @param control Points to the current Control stack.\n * @param stash Points to the current Stash.\n * @param envSteps Number of environment steps to run.\n * @param stepLimit Maximum number of steps to execute.\n * @param isPrelude Whether the program is the prelude.\n * @returns The top value of the stash after execution.\n */\nfunction runCSEMachine(\n context: Context,\n control: Control,\n stash: Stash,\n envSteps: number,\n stepLimit: number,\n isPrelude: boolean = false\n): Value {\n const eceState = generateCSEMachineStateStream(\n context,\n control,\n stash,\n envSteps,\n stepLimit,\n isPrelude\n );\n\n // Execute the generator until it completes\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const value of eceState) {\n }\n \n // Return the value at the top of the storage as the result\n const result = stash.peek();\n return result !== undefined ? result : { type: 'undefined' };\n}\n\n/**\n * Generator function that yields the state of the CSE Machine at each step.\n *\n * @param context The context of the program.\n * @param control The control stack.\n * @param stash The stash storage.\n * @param envSteps Number of environment steps to run.\n * @param stepLimit Maximum number of steps to execute.\n * @param isPrelude Whether the program is the prelude.\n * @yields The current state of the stash, control stack, and step count.\n */\nexport function* generateCSEMachineStateStream(\n context: Context,\n control: Control,\n stash: Stash,\n envSteps: number,\n stepLimit: number,\n isPrelude: boolean = false\n) {\n\n // steps: number of steps completed\n let steps = 0\n\n let command = control.peek()\n\n // Push first node to be evaluated into context.\n // The typeguard is there to guarantee that we are pushing a node (which should always be the case)\n if (command && isNode(command)) {\n context.runtime.nodes.unshift(command)\n }\n\n while (command) {\n // For local debug only\n // console.info('next command to be evaluated');\n // console.info(command);\n\n // Return to capture a snapshot of the control and stash after the target step count is reached\n if (!isPrelude && steps === envSteps) {\n yield { stash, control, steps }\n return\n }\n // Step limit reached, stop further evaluation\n if (!isPrelude && steps === stepLimit) {\n break\n }\n\n if (!isPrelude && envChanging(command)) {\n // command is evaluated on the next step\n // Hence, next step will change the environment\n context.runtime.changepointSteps.push(steps + 1)\n }\n\n control.pop()\n if (isNode(command)) {\n context.runtime.nodes.shift()\n context.runtime.nodes.unshift(command)\n //checkEditorBreakpoints(context, command)\n cmdEvaluators[command.type](command, context, control, stash, isPrelude)\n if (context.runtime.break && context.runtime.debuggerOn) {\n // TODO\n // We can put this under isNode since context.runtime.break\n // will only be updated after a debugger statement and so we will\n // run into a node immediately after.\n // With the new evaluator, we don't return a break\n // return new CSEBreak()\n }\n } else {\n // Command is an instruction\n cmdEvaluators[(command as Instr).instrType](command, context, control, stash, isPrelude)\n }\n\n // Push undefined into the stack if both control and stash is empty\n if (control.isEmpty() && stash.isEmpty()) {\n //stash.push(undefined)\n }\n command = control.peek()\n \n steps += 1\n if (!isPrelude) {\n context.runtime.envStepsTotal = steps\n }\n\n // printEnvironmentVariables(context.runtime.environments);\n\n yield { stash, control, steps }\n }\n}\n\nfunction printEnvironmentVariables(environments: Environment[]): void {\n console.info('----------------------------------------');\n environments.forEach(env => {\n console.info(`Env: ${env.name} (ID: ${env.id})`);\n \n const variables = env.head;\n const variableNames = Object.keys(variables);\n \n if (variableNames.length > 0) {\n variableNames.forEach(varName => {\n const descriptor = Object.getOwnPropertyDescriptor(env.head, varName);\n if (descriptor) {\n const value = descriptor.value.value;\n console.info('value: ', value);\n const valueStr = (typeof value === 'object' && value !== null) \n ? JSON.stringify(value, null, 2) \n : String(value);\n console.info(` ${varName}: ${valueStr}`);\n } else {\n console.info(` ${varName}: None`);\n }\n });\n } else {\n console.info(' no defined variables');\n }\n });\n}\n\nconst cmdEvaluators: { [type: string]: CmdEvaluator } = {\n /**\n * AST Nodes\n */\n\n Program: function (\n command: ControlItem,\n context: Context,\n control: Control,\n stash: Stash,\n isPrelude: boolean\n ) {\n // Clean up non-global, non-program, and non-preparation environments\n\n while (\n currentEnvironment(context).name !== 'global' &&\n currentEnvironment(context).name !== 'programEnvironment' &&\n currentEnvironment(context).name !== 'prelude'\n ) {\n popEnvironment(context)\n }\n\n if (hasDeclarations(command as es.BlockStatement) || hasImportDeclarations(command as es.BlockStatement)) {\n if (currentEnvironment(context).name != 'programEnvironment') {\n const programEnv = createProgramEnvironment(context, isPrelude)\n pushEnvironment(context, programEnv)\n }\n const environment = currentEnvironment(context)\n evaluateImports(command as unknown as es.Program, context)\n declareFunctionsAndVariables(context, command as es.BlockStatement, environment)\n }\n\n if ((command as es.Program).body.length === 1) {\n // If the program contains only a single statement, execute it immediately\n const next = (command as es.Program).body[0];\n cmdEvaluators[next.type](next, context, control, stash, isPrelude);\n } else {\n // Push the block body as a sequence of statements onto the control stack\n const seq: StatementSequence = statementSequence(\n (command as es.Program).body as es.Statement[],\n (command as es.Program).loc\n ) as unknown as StatementSequence\n control.push(seq);\n }\n },\n\n BlockStatement: function (\n command: ControlItem,\n context: Context,\n control: Control\n ) {\n const next = control.peek();\n\n // for some of the block statements, such as if, for,\n // no need to create a new environment\n\n if(!command.skipEnv){\n // If environment instructions need to be pushed\n if (\n next &&\n !(isInstr(next) && next.instrType === InstrType.ENVIRONMENT) &&\n !control.canAvoidEnvInstr()\n ) {\n control.push(instr.envInstr(currentEnvironment(context), command as es.BlockStatement));\n }\n\n // create new block environment (for function)\n const environment = createBlockEnvironment(context, 'blockEnvironment');\n declareFunctionsAndVariables(context, command as es.BlockStatement, environment);\n pushEnvironment(context, environment);\n }\n\n // Push the block body onto the control stack as a sequence of statements\n const seq: StatementSequence = statementSequence((command as es.BlockStatement).body, (command as es.BlockStatement).loc);\n control.push(seq);\n },\n\n StatementSequence: function (\n command: ControlItem,\n context: Context,\n control: Control,\n stash: Stash,\n isPrelude: boolean\n ) {\n if ((command as StatementSequence).body.length === 1) {\n // If the program contains only a single statement, execute it immediately\n const next = (command as StatementSequence).body[0];\n cmdEvaluators[next.type](next, context, control, stash, isPrelude);\n } else {\n // Split and push individual nodes\n control.push(...handleSequence((command as StatementSequence).body));\n }\n },\n\n // WhileStatement: function (\n // command: es.WhileStatement,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // if (hasBreakStatement(command.body as es.BlockStatement)) {\n // control.push(instr.breakMarkerInstr(command));\n // }\n // control.push(instr.whileInstr(command.test, command.body, command));\n // control.push(command.test);\n // control.push(ast.identifier('undefined', command.loc)); // 如果没有循环执行,返回 undefined\n // },\n\n // ForStatement: function (\n // command: es.ForStatement,\n // context: Context,\n // control: Control\n // ) {\n // const init = command.init!;\n // const test = command.test!;\n // const update = command.update!;\n\n // if (init.type === 'VariableDeclaration' && init.kind === 'let') {\n // const id = init.declarations[0].id as es.Identifier;\n // const valueExpression = init.declarations[0].init!;\n\n // control.push(\n // ast.blockStatement(\n // [\n // init,\n // ast.forStatement(\n // ast.assignmentExpression(id, valueExpression, command.loc),\n // test,\n // update,\n // ast.blockStatement(\n // [\n // ast.variableDeclaration(\n // [\n // ast.variableDeclarator(\n // ast.identifier(`_copy_of_${id.name}`, command.loc),\n // ast.identifier(id.name, command.loc),\n // command.loc\n // )\n // ],\n // command.loc\n // ),\n // ast.blockStatement(\n // [\n // ast.variableDeclaration(\n // [\n // ast.variableDeclarator(\n // ast.identifier(id.name, command.loc),\n // ast.identifier(`_copy_of_${id.name}`, command.loc),\n // command.loc\n // )\n // ],\n // command.loc\n // ),\n // command.body\n // ],\n // command.loc\n // )\n // ],\n // command.loc\n // ),\n // command.loc\n // )\n // ],\n // command.loc\n // )\n // );\n // } else {\n // if (hasBreakStatement(command.body as es.BlockStatement)) {\n // control.push(instr.breakMarkerInstr(command));\n // }\n // control.push(instr.forInstr(init, test, update, command.body, command));\n // control.push(test);\n // control.push(instr.popInstr(command)); // Pop value from init assignment\n // control.push(init);\n // control.push(ast.identifier('undefined', command.loc)); // Return undefined if there is no loop execution\n // }\n // },\n\n IfStatement: function (\n command: ControlItem, //es.IfStatement,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n control.push(...reduceConditional(command as es.IfStatement));\n },\n\n ExpressionStatement: function (\n command: ControlItem,//es.ExpressionStatement,\n context: Context,\n control: Control,\n stash: Stash,\n isPrelude: boolean\n ) {\n cmdEvaluators[(command as es.ExpressionStatement).expression.type]((command as es.ExpressionStatement).expression, context, control, stash, isPrelude);\n },\n\n // DebuggerStatement: function (\n // command: es.DebuggerStatement,\n // context: Context\n // ) {\n // context.runtime.break = true;\n // },\n\n VariableDeclaration: function (\n command: ControlItem,\n context: Context,\n control: Control\n ) {\n const declaration: es.VariableDeclarator = (command as es.VariableDeclaration).declarations[0];\n const id = declaration.id as es.Identifier;\n const init = declaration.init!;\n\n control.push(instr.popInstr(command as es.VariableDeclaration));\n control.push(instr.assmtInstr(id.name, (command as es.VariableDeclaration).kind === 'const', true, command as es.VariableDeclaration));\n control.push(init);\n },\n\n FunctionDeclaration: function (\n command: ControlItem, //es.FunctionDeclaration,\n context: Context,\n control: Control\n ) {\n const lambdaExpression: es.ArrowFunctionExpression = blockArrowFunction(\n (command as es.FunctionDeclaration).params as es.Identifier[],\n (command as es.FunctionDeclaration).body,\n (command as es.FunctionDeclaration).loc\n );\n const lambdaDeclaration: pyVariableDeclaration = constantDeclaration(\n (command as es.FunctionDeclaration).id!.name,\n lambdaExpression,\n (command as es.FunctionDeclaration).loc\n );\n control.push(lambdaDeclaration as ControlItem);\n },\n\n ReturnStatement: function (\n command: ControlItem, //as es.ReturnStatement,\n context: Context,\n control: Control\n ) {\n const next = control.peek();\n if (next && isInstr(next) && next.instrType === InstrType.MARKER) {\n control.pop();\n } else {\n control.push(instr.resetInstr(command as es.ReturnStatement));\n }\n if ((command as es.ReturnStatement).argument) {\n control.push((command as es.ReturnStatement).argument!);\n }\n },\n\n // ContinueStatement: function (\n // command: es.ContinueStatement,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // control.push(instr.contInstr(command));\n // },\n\n // BreakStatement: function (\n // command: es.BreakStatement,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // control.push(instr.breakInstr(command));\n // },\n\n ImportDeclaration: function () {},\n\n /**\n * Expressions\n */\n\n Literal: function (\n command: ControlItem, //es.Literal\n context: Context,\n control: Control,\n stash: Stash\n ) {\n const literalValue = (command as es.Literal).value;\n const bigintValue = (command as es.BigIntLiteral).bigint;\n const complexValue = ((command as unknown) as ComplexLiteral).complex;\n\n if (literalValue !== undefined) {\n let value: Value;\n if (typeof literalValue === 'number') {\n value = { type: 'number', value: literalValue };\n } else if (typeof literalValue === 'string') {\n value = { type: 'string', value: literalValue };\n } else if (typeof literalValue === 'boolean') {\n value = { type: 'bool', value: literalValue };\n //value = literalValue;\n } else {\n //handleRuntimeError(context, new CseError('Unsupported literal type'));\n return;\n }\n stash.push(value);\n } else if (bigintValue !== undefined) {\n let fixedBigintValue = bigintValue.toString().replace(/_/g, \"\");\n let value: Value;\n try {\n value = { type: 'bigint', value: BigInt(fixedBigintValue) };\n } catch (e) {\n //handleRuntimeError(context, new CseError('Invalid BigInt literal'));\n return;\n }\n stash.push(value);\n } else if (complexValue !== undefined) {\n let value: Value;\n let pyComplexNumber = new PyComplexNumber(complexValue.real, complexValue.imag);\n try {\n value = { type: 'complex', value: pyComplexNumber };\n } catch (e) {\n //handleRuntimeError(context, new CseError('Invalid BigInt literal'));\n return;\n }\n stash.push(value);\n } else {\n // TODO\n // Error\n }\n \n },\n\n NoneType: function (\n command: ControlItem, //es.Literal\n context: Context,\n control: Control,\n stash: Stash\n ) {\n stash.push({ type: 'NoneType', value: undefined });\n },\n\n // AssignmentExpression: function (\n // command: es.AssignmentExpression,\n // context: Context,\n // control: Control\n // ) {\n // if (command.left.type === 'MemberExpression') {\n // control.push(instr.arrAssmtInstr(command));\n // control.push(command.right);\n // control.push(command.left.property);\n // control.push(command.left.object);\n // } else if (command.left.type === 'Identifier') {\n // const id = command.left;\n // control.push(instr.assmtInstr(id.name, false, false, command));\n // control.push(command.right);\n // }\n // },\n\n // ArrayExpression: function (\n // command: es.ArrayExpression,\n // context: Context,\n // control: Control\n // ) {\n // const elems = command.elements as es.Expression[];\n // reverse(elems);\n // const len = elems.length;\n\n // control.push(instr.arrLitInstr(len, command));\n // for (const elem of elems) {\n // control.push(elem);\n // }\n // },\n\n // MemberExpression: function (\n // command: es.MemberExpression,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // control.push(instr.arrAccInstr(command));\n // control.push(command.property);\n // control.push(command.object);\n // },\n\n ConditionalExpression: function (\n command: ControlItem, //es.ConditionalExpression,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n control.push(...reduceConditional(command as es.ConditionalExpression));\n },\n\n Identifier: function (\n command: ControlItem,//es.Identifier,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n if (builtInConstants.has((command as es.Identifier).name)) {\n const builtinCons = builtInConstants.get((command as es.Identifier).name)!;\n try {\n stash.push(builtinCons);\n return;\n } catch (error) {\n // Error\n if (error instanceof Error) {\n throw new Error(error.message);\n } else {\n throw new Error();\n }\n // if (error instanceof RuntimeSourceError) {\n // throw error;\n // } else {\n // throw new RuntimeSourceError(`Error in builtin function ${funcName}: ${error}`);\n // }\n }\n } else {\n stash.push(getVariable(context, (command as es.Identifier).name, (command as es.Identifier)));\n }\n },\n\n UnaryExpression: function (\n command: ControlItem, //es.UnaryExpression,\n context: Context,\n control: Control\n ) {\n control.push(instr.unOpInstr((command as es.UnaryExpression).operator, command as es.UnaryExpression));\n control.push((command as es.UnaryExpression).argument);\n },\n\n BinaryExpression: function (\n command: ControlItem, //es.BinaryExpression,\n context: Context,\n control: Control\n ) {\n // currently for if statement\n\n control.push(instr.binOpInstr((command as es.BinaryExpression).operator, command as es.Node));\n control.push((command as es.BinaryExpression).right);\n control.push((command as es.BinaryExpression).left);\n },\n\n LogicalExpression: function (\n command: ControlItem, //es.LogicalExpression,\n context: Context,\n control: Control\n ) {\n if ((command as es.LogicalExpression).operator === '&&') {\n control.push(\n conditionalExpression((command as es.LogicalExpression).left, (command as es.LogicalExpression).right, literal(false), (command as es.LogicalExpression).loc)\n );\n } else {\n control.push(\n conditionalExpression((command as es.LogicalExpression).left, literal(true), (command as es.LogicalExpression).right, (command as es.LogicalExpression).loc)\n );\n }\n },\n\n ArrowFunctionExpression: function (\n command: ControlItem,//es.ArrowFunctionExpression,\n context: Context,\n control: Control,\n stash: Stash,\n isPrelude: boolean\n ) {\n const closure: Closure = Closure.makeFromArrowFunction(\n command as es.ArrowFunctionExpression,\n currentEnvironment(context),\n context,\n true,\n isPrelude\n );\n stash.push(closure);\n },\n\n CallExpression: function (\n command: ControlItem,//es.CallExpression,\n context: Context,\n control: Control\n ) {\n // add\n if (isIdentifier((command as es.CallExpression).callee)) {\n let name = ((command as es.CallExpression).callee as es.Identifier).name;\n if (name === '__py_adder' || name === '__py_minuser' || \n name === '__py_multiplier' || name === '__py_divider' || \n name === '__py_modder' || name === '__py_floorer' || \n name === '__py_powerer') {\n control.push(instr.binOpInstr((command as es.CallExpression).callee as es.Identifier, command as es.Node))\n control.push((command as es.CallExpression).arguments[1])\n control.push((command as es.CallExpression).arguments[0])\n return;\n }\n }\n\n control.push(instr.appInstr((command as es.CallExpression).arguments.length, command as es.CallExpression));\n for (let index = (command as es.CallExpression).arguments.length - 1; index >= 0; index--) {\n control.push((command as es.CallExpression).arguments[index]);\n }\n control.push((command as es.CallExpression).callee);\n },\n\n // /**\n // * Instructions\n // */\n\n [InstrType.RESET]: function (\n command: ControlItem, //Instr,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n const cmdNext: ControlItem | undefined = control.pop();\n if (cmdNext && (isNode(cmdNext) || (cmdNext as Instr).instrType !== InstrType.MARKER)) {\n control.push(instr.resetInstr((command as Instr).srcNode));\n }\n },\n\n // [InstrType.WHILE]: function (\n // command: WhileInstr,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // const test = stash.pop();\n\n // const error = rttc.checkIfStatement(command.srcNode, test, context.chapter);\n // if (error) {\n // handleRuntimeError(context, error);\n // }\n\n // if (test) {\n // control.push(command);\n // control.push(command.test);\n // if (hasContinueStatement(command.body as es.BlockStatement)) {\n // control.push(instr.contMarkerInstr(command.srcNode));\n // }\n // if (!valueProducing(command.body)) {\n // control.push(ast.identifier('undefined', command.body.loc));\n // }\n // control.push(command.body);\n // control.push(instr.popInstr(command.srcNode)); // Pop previous body value\n // }\n // },\n\n // [InstrType.FOR]: function (\n // command: ForInstr,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // const test = stash.pop();\n\n // const error = rttc.checkIfStatement(command.srcNode, test, context.chapter);\n // if (error) {\n // handleRuntimeError(context, error);\n // }\n\n // if (test) {\n // control.push(command);\n // control.push(command.test);\n // control.push(instr.popInstr(command.srcNode)); // Pop value from update\n // control.push(command.update);\n // if (hasContinueStatement(command.body as es.BlockStatement)) {\n // control.push(instr.contMarkerInstr(command.srcNode));\n // }\n // if (!valueProducing(command.body)) {\n // control.push(ast.identifier('undefined', command.body.loc));\n // }\n // control.push(command.body);\n // control.push(instr.popInstr(command.srcNode)); // Pop previous body value\n // }\n // },\n\n [InstrType.ASSIGNMENT]: function (\n command: ControlItem, //AssmtInstr,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n if ((command as AssmtInstr).declaration) {\n //if ()\n defineVariable(\n context,\n (command as AssmtInstr).symbol,\n stash.peek()!,\n (command as AssmtInstr).constant,\n (command as AssmtInstr).srcNode as es.VariableDeclaration\n );\n } else {\n // second time definition\n // setVariable(\n // context,\n // command.symbol,\n // stash.peek(),\n // command.srcNode as es.AssignmentExpression\n // );\n }\n },\n\n [InstrType.UNARY_OP]: function (\n command: ControlItem, //UnOpInstr,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n const argument = stash.pop();\n // const error = rttc.checkUnaryExpression(\n // command.srcNode,\n // command.symbol as es.UnaryOperator,\n // argument,\n // context.chapter\n // );\n // if (error) {\n // handleRuntimeError(context, error);\n // }\n stash.push(evaluateUnaryExpression((command as UnOpInstr).symbol, argument));\n },\n\n [InstrType.BINARY_OP]: function (\n command: ControlItem, //BinOpInstr,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n const right = stash.pop();\n const left = stash.pop();\n // const error = rttc.checkBinaryExpression(\n // command.srcNode,\n // command.symbol as es.BinaryOperator,\n // context.chapter,\n // left,\n // right\n // );\n // if (error) {\n // handleRuntimeError(context, error);\n // }\n\n if ((left.type === 'string' && right.type !== 'string') || \n (left.type !== 'string' && right.type === 'string')){\n handleRuntimeError(context, new error.TypeConcatenateError(command as es.Node));\n }\n \n\n stash.push(evaluateBinaryExpression(context, (command as BinOpInstr).symbol, left, right));\n \n },\n\n [InstrType.POP]: function (\n command: ControlItem,//Instr,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n stash.pop();\n },\n\n [InstrType.APPLICATION]: function (\n command: ControlItem, //AppInstr,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n checkStackOverFlow(context, control);\n const args: Value[] = [];\n for (let index = 0; index < (command as AppInstr).numOfArgs; index++) {\n args.unshift(stash.pop()!);\n }\n\n const func: Closure = stash.pop();\n\n if (!(func instanceof Closure)) {\n //error\n //handleRuntimeError(context, new errors.CallingNonFunctionValue(func, command.srcNode))\n }\n \n // continuation in python?\n\n // func instanceof Closure\n if (func instanceof Closure) {\n // Check for number of arguments mismatch error\n checkNumberOfArguments(command, context, func, args, (command as AppInstr).srcNode)\n\n const next = control.peek()\n\n // Push ENVIRONMENT instruction if needed - if next control stack item\n // exists and is not an environment instruction, OR the control only contains\n // environment indepedent items\n if (\n next &&\n !(isInstr(next) && next.instrType === InstrType.ENVIRONMENT) &&\n !control.canAvoidEnvInstr()\n ) {\n control.push(instr.envInstr(currentEnvironment(context), (command as AppInstr).srcNode))\n }\n\n // Create environment for function parameters if the function isn't nullary.\n // Name the environment if the function call expression is not anonymous\n if (args.length > 0) {\n const environment = createEnvironment(context, (func as Closure), args, (command as AppInstr).srcNode)\n pushEnvironment(context, environment)\n } else {\n context.runtime.environments.unshift((func as Closure).environment)\n }\n\n // Handle special case if function is simple\n if (isSimpleFunction((func as Closure).node)) {\n // Closures convert ArrowExpressionStatements to BlockStatements\n const block = (func as Closure).node.body as es.BlockStatement\n const returnStatement = block.body[0] as es.ReturnStatement\n control.push(returnStatement.argument ?? identifier('undefined', returnStatement.loc))\n } else {\n if (control.peek()) {\n // push marker if control not empty\n control.push(instr.markerInstr((command as AppInstr).srcNode))\n }\n control.push((func as Closure).node.body)\n\n // console.info((func as Closure).node.body);\n }\n\n return\n }\n\n // Value is a built-in function\n let function_name = (((command as AppInstr).srcNode as es.CallExpression).callee as es.Identifier).name;\n\n if (builtIns.has(function_name)) {\n const builtinFunc = builtIns.get(function_name)!;\n\n try {\n stash.push(builtinFunc(args));\n return;\n } catch (error) {\n // Error\n if (error instanceof Error) {\n throw new Error(error.message);\n } else {\n throw new Error();\n }\n // if (error instanceof RuntimeSourceError) {\n // throw error;\n // } else {\n // throw new RuntimeSourceError(`Error in builtin function ${funcName}: ${error}`);\n // }\n }\n }\n },\n\n [InstrType.BRANCH]: function (\n command: ControlItem,//BranchInstr,\n context: Context,\n control: Control,\n stash: Stash\n ) {\n const test = stash.pop();\n\n // const error = rttc.checkIfStatement(command.srcNode, test, context.chapter);\n // if (error) {\n // handleRuntimeError(context, error);\n // }\n\n if (test.value) {\n if (!valueProducing((command as BranchInstr).consequent)) {\n control.push(identifier('undefined', (command as BranchInstr).consequent.loc));\n }\n ((command as BranchInstr).consequent as ControlItem).skipEnv = true;\n control.push((command as BranchInstr).consequent);\n } else if ((command as BranchInstr).alternate) {\n if (!valueProducing((command as BranchInstr).alternate!)) {\n control.push(identifier('undefined', (command as BranchInstr).alternate!.loc));\n }\n ((command as BranchInstr).alternate as ControlItem).skipEnv = true;\n control.push((command as BranchInstr).alternate!);\n } else {\n control.push(identifier('undefined', (command as BranchInstr).srcNode.loc));\n }\n },\n\n [InstrType.ENVIRONMENT]: function (\n command: ControlItem, //EnvInstr,\n context: Context\n ) {\n while (currentEnvironment(context).id !== (command as EnvInstr).env.id) {\n popEnvironment(context);\n }\n },\n\n // [InstrType.ARRAY_LITERAL]: function (\n // command: ArrLitInstr,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // const arity = command.arity;\n // const array: any[] = [];\n // for (let i = 0; i < arity; ++i) {\n // array.unshift(stash.pop());\n // }\n // handleArrayCreation(context, array);\n // stash.push(array);\n // },\n\n // [InstrType.ARRAY_ACCESS]: function (\n // command: Instr,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // const index = stash.pop();\n // const array = stash.pop();\n // stash.push(array[index]);\n // },\n\n // [InstrType.ARRAY_ASSIGNMENT]: function (\n // command: Instr,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // const value = stash.pop();\n // const index = stash.pop();\n // const array = stash.pop();\n // array[index] = value;\n // stash.push(value);\n // },\n\n // [InstrType.CONTINUE]: function (\n // command: Instr,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // const next = control.pop() as ControlItem;\n // if (isInstr(next) && next.instrType === InstrType.CONTINUE_MARKER) {\n // } else if (isInstr(next) && next.instrType === InstrType.ENVIRONMENT) {\n // control.push(command);\n // control.push(next); \n // } else {\n // control.push(command);\n // }\n // },\n\n // [InstrType.CONTINUE_MARKER]: function () {\n // },\n\n // [InstrType.BREAK]: function (\n // command: Instr,\n // context: Context,\n // control: Control,\n // stash: Stash\n // ) {\n // const next = control.pop() as ControlItem;\n // if (isInstr(next) && next.instrType === InstrType.BREAK_MARKER) {\n // } else if (isInstr(next) && next.instrType === InstrType.ENVIRONMENT) {\n // control.push(command);\n // control.push(next);\n // } else {\n // control.push(command);\n // }\n // },\n\n // [InstrType.BREAK_MARKER]: function () {\n // }\n};\n","import { ArrowFunctionExpression } from \"estree\";\nimport { Closure } from \"./cse-machine/closure\";\nimport { Value } from \"./cse-machine/stash\";\n// npm install mathjs\nimport { gamma, lgamma, erf } from 'mathjs';\nimport { addPrint } from \"./cse-machine/interpreter\";\n\n/*\n Create a map to hold built-in constants.\n Each constant is stored with a string key and its corresponding value object.\n*/\nexport const builtInConstants = new Map();\nconst math_e = { type: 'number', value: Math.E };\nconst math_inf = { type: 'number', value: Infinity };\nconst math_nan = { type: 'number', value: NaN };\nconst math_pi = { type: 'number', value: Math.PI };\nconst math_tau = { type: 'number', value: 2 * Math.PI };\n\nbuiltInConstants.set('math_e', math_e);\nbuiltInConstants.set('math_inf', math_inf);\nbuiltInConstants.set('math_nan', math_nan);\nbuiltInConstants.set('math_pi', math_pi);\nbuiltInConstants.set('math_tau', math_tau);\n\n/*\n Create a map to hold built-in functions.\n The keys are strings (function names) and the values are functions that can take any arguments.\n*/\nexport const builtIns = new Map any>();\nbuiltIns.set('_int', _int);\nbuiltIns.set('_int_from_string', _int_from_string);\nbuiltIns.set('abs', abs);\nbuiltIns.set('char_at', char_at);\nbuiltIns.set('error', error);\nbuiltIns.set('input', input);\nbuiltIns.set('isinstance', isinstance);\nbuiltIns.set('math_acos', math_acos);\nbuiltIns.set('math_acosh', math_acosh);\nbuiltIns.set('math_asin', math_asin);\nbuiltIns.set('math_asinh', math_asinh);\nbuiltIns.set('math_atan', math_atan);\nbuiltIns.set('math_atan2', math_atan2);\nbuiltIns.set('math_atanh', math_atanh);\nbuiltIns.set('math_cbrt', math_cbrt);\nbuiltIns.set('math_ceil', math_ceil);\nbuiltIns.set('math_comb', math_comb);\nbuiltIns.set('math_copysign', math_copysign);\nbuiltIns.set('math_cos', math_cos);\nbuiltIns.set('math_cosh', math_cosh);\nbuiltIns.set('math_degrees', math_degrees);\nbuiltIns.set('math_erf', math_erf);\nbuiltIns.set('math_erfc', math_erfc);\nbuiltIns.set('math_exp', math_exp);\nbuiltIns.set('math_exp2', math_exp2);\nbuiltIns.set('math_expm1', math_expm1);\nbuiltIns.set('math_fabs', math_fabs);\nbuiltIns.set('math_factorial', math_factorial);\nbuiltIns.set('math_floor', math_floor);\nbuiltIns.set('math_fma', math_fma);\nbuiltIns.set('math_fmod', math_fmod);\nbuiltIns.set('math_gamma', math_gamma);\nbuiltIns.set('math_lgamma', math_lgamma);\nbuiltIns.set('math_gcd', math_gcd);\nbuiltIns.set('math_isfinite', math_isfinite);\nbuiltIns.set('math_isinf', math_isinf);\nbuiltIns.set('math_isnan', math_isnan);\nbuiltIns.set('math_isqrt', math_isqrt);\nbuiltIns.set('math_lcm', math_lcm);\nbuiltIns.set('math_ldexp', math_ldexp);\nbuiltIns.set('math_log', math_log);\nbuiltIns.set('math_log10', math_log10);\nbuiltIns.set('math_log1p', math_log1p);\nbuiltIns.set('math_log2', math_log2);\nbuiltIns.set('math_nextafter', math_nextafter);\nbuiltIns.set('math_perm', math_perm);\nbuiltIns.set('math_pow', math_pow);\nbuiltIns.set('math_radians', math_radians);\nbuiltIns.set('math_remainder', math_remainder);\nbuiltIns.set('math_sin', math_sin);\nbuiltIns.set('math_sinh', math_sinh);\nbuiltIns.set('math_sqrt', math_sqrt);\nbuiltIns.set('math_tan', math_tan);\nbuiltIns.set('math_tanh', math_tanh);\nbuiltIns.set('math_trunc', math_trunc);\nbuiltIns.set('math_ulp', math_ulp);\nbuiltIns.set('max', max);\nbuiltIns.set('min', min);\nbuiltIns.set('print', print);\nbuiltIns.set('random_random', random_random);\nbuiltIns.set('round', round);\nbuiltIns.set('str', str);\nbuiltIns.set('time_time', time_time);\n\nexport function _int(args: Value[]): Value {\n if (args.length === 0) {\n return { type: 'bigint', value: '0' };\n }\n if (args.length > 1) {\n throw new Error(`_int() expects at most 1 argument, but got ${args.length}`);\n }\n \n const arg = args[0];\n // If the value is a number, use Math.trunc to truncate toward zero.\n if (arg.type === 'number') {\n const truncated = Math.trunc(arg.value);\n return { type: 'bigint', value: BigInt(truncated) };\n }\n // If the value is a bigint, simply return the same value.\n if (arg.type === 'bigint') {\n return { type: 'bigint', value: arg.value };\n }\n\n throw new Error(`_int() expects a numeric argument (number or bigint), but got ${arg.type}`);\n}\n\nexport function _int_from_string(args: Value[]): Value {\n if (args.length < 1) {\n throw new Error(`_int_from_string() expects at least 1 argument, but got 0`);\n }\n if (args.length > 2) {\n throw new Error(`_int_from_string() expects at most 2 arguments, but got ${args.length}`);\n }\n \n const strVal = args[0];\n if (strVal.type !== 'string') {\n throw new Error(\n `_int_from_string: first argument must be a string, got ${strVal.type}`\n );\n }\n \n let base: number = 10;\n if (args.length === 2) {\n // The second argument must be either a bigint or a number (it will be converted to a number for uniform processing).\n const baseVal = args[1];\n if (baseVal.type === 'bigint') {\n base = Number(baseVal.value);\n } else {\n throw new Error(\n `_int_from_string: second argument must be an integer (number or bigint), got ${baseVal.type}`\n );\n }\n }\n \n // base should be in between 2 and 36\n if (base < 2 || base > 36) {\n throw new Error(`_int_from_string: base must be in [2..36], got ${base}`);\n }\n \n let str = strVal.value as string;\n str = str.trim();\n str = str.replace(/_/g, '');\n \n // Parse the sign (determine if the value is positive or negative)\n let sign: bigint = BigInt(1);\n if (str.startsWith('+')) {\n str = str.slice(1);\n } else if (str.startsWith('-')) {\n sign = BigInt(-1);\n str = str.slice(1);\n }\n \n // The remaining portion must consist of valid characters for the specified base.\n const parsedNumber = parseInt(str, base);\n if (isNaN(parsedNumber)) {\n throw new Error(`_int_from_string: cannot parse \"${strVal.value}\" with base ${base}`);\n }\n \n const result: bigint = sign * BigInt(parsedNumber);\n\n return { type: 'bigint', value: result };\n}\n \nexport function abs(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`abs expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n switch (x.type) {\n case 'bigint': {\n const intVal = x.value;\n const result: bigint = intVal < 0 ? -intVal : intVal;\n return { type: 'int', value: result };\n }\n case 'number': {\n return { type: 'number', value: Math.abs(x.value) };\n }\n case 'complex': {\n // Calculate the modulus (absolute value) of a complex number.\n const real = x.value.real;\n const imag = x.value.imag;\n const modulus = Math.sqrt(real * real + imag * imag);\n return { type: 'number', value: modulus };\n }\n default:\n throw new Error(`abs: unsupported type ${x.type}`);\n }\n}\n\nfunction toStr(val: Value): string {\n return String(val.value);\n}\n\nexport function error(args: Value[]): Value {\n const output = \"Error: \" + args.map(arg => toStr(arg)).join(' ') + '\\n';\n \n throw new Error(output);\n}\n\nexport function isinstance(args: Value[]): Value {\n if (args.length !== 2) {\n throw new Error(`isinstance expects exactly 2 arguments, but got ${args.length}`);\n }\n \n const obj = args[0];\n const classinfo = args[1];\n\n let expectedType: string;\n if (classinfo.type === 'string') {\n switch (classinfo.value) {\n case 'int':\n expectedType = 'bigint';\n break;\n case 'float':\n expectedType = 'number';\n break;\n case 'string':\n expectedType = 'string';\n break;\n case 'bool':\n expectedType = 'bool';\n break;\n case 'complex':\n expectedType = 'complex';\n break;\n case 'NoneType':\n expectedType = 'NoneType';\n break;\n default:\n throw new Error(`isinstance: unknown type '${classinfo.value}'`);\n }\n } else {\n // TODO: If the value is not in string format, additional handling can be added as needed.\n throw new Error(`isinstance: second argument must be a string representing a type, got ${classinfo.type}`);\n }\n\n const result = obj.type === expectedType;\n \n return { type: 'bool', value: result };\n}\n\nexport function math_acos(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_acos expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_acos: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n\n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n\n if (num < -1 || num > 1) {\n throw new Error(`math_acos: argument must be in the interval [-1, 1], but got ${num}`);\n }\n \n const result = Math.acos(num);\n return { type: 'number', value: result };\n}\n\nexport function math_acosh(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_acosh expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n \n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_acosh: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n\n if (num < 1) {\n throw new Error(`math_acosh: argument must be greater than or equal to 1, but got ${num}`);\n }\n \n const result = Math.acosh(num);\n return { type: 'number', value: result };\n}\n\nexport function math_asin(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_asin expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_asin: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n if (num < -1 || num > 1) {\n throw new Error(`math_asin: argument must be in the interval [-1, 1], but got ${num}`);\n }\n \n const result = Math.asin(num);\n return { type: 'number', value: result };\n}\n\nexport function math_asinh(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_asinh expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_asinh: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = Math.asinh(num);\n return { type: 'number', value: result };\n}\n\nexport function math_atan(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_atan expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'int' && x.type !== 'bigint') {\n throw new Error(`math_atan: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = Math.atan(num);\n return { type: 'number', value: result };\n}\n\nexport function math_atan2(args: Value[]): Value {\n if (args.length !== 2) {\n throw new Error(`math_atan2 expects exactly 2 arguments, but got ${args.length}`);\n }\n \n const y = args[0];\n const x = args[1];\n if (\n (y.type !== 'number' && y.type !== 'bigint') ||\n (x.type !== 'number' && x.type !== 'bigint')\n ) {\n throw new Error(`math_atan2: both arguments must be a number, int, or bigint`);\n }\n \n let yNum: number, xNum: number;\n if (y.type === 'number') {\n yNum = y.value;\n } else {\n yNum = Number(y.value);\n }\n \n if (x.type === 'number') {\n xNum = x.value;\n } else {\n xNum = Number(x.value);\n }\n \n const result = Math.atan2(yNum, xNum);\n return { type: 'number', value: result };\n}\n\nexport function math_atanh(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_atanh expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_atanh: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n if (num <= -1 || num >= 1) {\n throw new Error(`math_atanh: argument must be in the interval (-1, 1), but got ${num}`);\n }\n \n const result = Math.atanh(num);\n return { type: 'number', value: result };\n}\n\nexport function math_cos(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_cos expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_cos: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = Math.cos(num);\n return { type: 'number', value: result };\n}\n\nexport function math_cosh(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_cosh expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_cosh: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = Math.cosh(num);\n return { type: 'number', value: result };\n}\n\nexport function math_degrees(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_degrees expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_degrees: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = num * 180 / Math.PI;\n return { type: 'number', value: result };\n}\n\nexport function math_erf(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_erf expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_erf: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const erfnum = erf(num);\n \n return { type: 'number', value: erfnum };\n}\n\nexport function math_erfc(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_erfc expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_erfc: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n const erfc = 1 - math_erf(args[0]).value;\n \n return { type: 'number', value: erfc };\n}\n\nexport function char_at(args: Value[]): Value {\n if (args.length !== 2) {\n throw new Error(`char_at expects exactly 2 arguments, but got ${args.length}`);\n }\n \n const s = args[0];\n const i = args[1];\n \n if (s.type !== 'string') {\n throw new Error(`char_at: first argument must be a string, but got ${typeof s}`);\n }\n if (i.type !== 'number' && i.type !== 'bigint') {\n throw new Error(`char_at: second argument must be a number, but got ${typeof i}`);\n }\n \n const index = i.value;\n\n return { type: 'string', value: (s.value)[index]};\n}\n\nexport function math_comb(args: Value[]): Value {\n if (args.length !== 2) {\n throw new Error(`comb expects exactly 2 arguments, but got ${args.length}`);\n }\n \n const n = args[0];\n const k = args[1];\n \n if (n.type !== 'bigint' || k.type !== 'bigint') {\n throw new Error(\n `comb: both arguments must be 'bigint', but got n=${n.type}, k=${k.type}`\n );\n }\n \n const nVal = BigInt(n.value);\n const kVal = BigInt(k.value);\n \n if (nVal < 0 || kVal < 0) {\n throw new Error(`comb: n and k must be non-negative, got n=${nVal}, k=${kVal}`);\n }\n\n if (kVal > nVal) {\n return { type: 'bigint', value: BigInt(0) };\n }\n \n let result: bigint = BigInt(1);\n let kk = kVal > nVal - kVal ? nVal - kVal : kVal;\n \n for (let i: bigint = BigInt(0); i < kk; i++) {\n result = result * (nVal - i) / (i + BigInt(1));\n }\n\n return { type: 'bigint', value: result };\n}\n\nexport function math_factorial(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`factorial expects exactly 1 argument, but got ${args.length}`);\n }\n \n const n = args[0];\n \n if (n.type !== 'bigint') {\n throw new Error(`factorial: argument must be an integer (bigint), but got ${n.type}`);\n }\n \n const nVal = BigInt(n.value);\n \n if (nVal < 0) {\n throw new Error(`factorial: argument must be non-negative, but got ${nVal}`);\n }\n \n // 0! = 1\n if (nVal === BigInt(0)) {\n return { type: 'bigint', value: BigInt(1) };\n }\n \n let result: bigint = BigInt(1);\n for (let i: bigint = BigInt(1); i <= nVal; i++) {\n result *= i;\n }\n \n return { type: 'bigint', value: result };\n}\n \nexport function math_gcd(args: Value[]): Value {\n if (args.length === 0) {\n return { type: 'bigint', value: BigInt(0) };\n }\n \n const values = args.map((v, idx) => {\n if (v.type !== 'bigint') {\n throw new Error(`gcd: argument #${idx + 1} must be an integer (bigint), got ${v.type}`);\n }\n return BigInt(v.value);\n });\n \n const allZero = values.every(val => val === BigInt(0));\n if (allZero) {\n return { type: 'bigint', value: BigInt(0) };\n }\n\n let currentGcd: bigint = values[0] < 0 ? -values[0] : values[0];\n for (let i = 1; i < values.length; i++) {\n currentGcd = gcdOfTwo(currentGcd, values[i] < 0 ? -values[i] : values[i]);\n if (currentGcd === BigInt(1)) {\n break;\n }\n }\n \n return { type: 'bigint', value: currentGcd };\n}\n\nfunction gcdOfTwo(a: bigint, b: bigint): bigint {\n let x: bigint = a;\n let y: bigint = b;\n while (y !== BigInt(0)) {\n const temp = x % y;\n x = y;\n y = temp;\n }\n return x < 0 ? -x : x;\n}\n\nexport function math_isqrt(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`isqrt expects exactly 1 argument, but got ${args.length}`);\n }\n \n const nValObj = args[0];\n if (nValObj.type !== 'bigint') {\n throw new Error(`isqrt: argument must be a nonnegative integer (bigint), but got ${nValObj.type}`);\n }\n \n const n: bigint = nValObj.value;\n \n if (n < 0) {\n throw new Error(`isqrt: argument must be nonnegative, but got ${n}`);\n }\n\n if (n < 2) {\n return { type: 'bigint', value: n };\n }\n \n let low: bigint = BigInt(1);\n let high: bigint = n;\n \n while (low < high) {\n const mid = (low + high + BigInt(1)) >> BigInt(1);\n const sq = mid * mid;\n if (sq <= n) {\n low = mid;\n } else {\n high = mid - BigInt(1);\n }\n }\n\n return { type: 'bigint', value: low };\n}\n \nexport function math_lcm(args: Value[]): Value {\n if (args.length === 0) {\n return { type: 'bigint', value: BigInt(1) };\n }\n \n const values = args.map((val, idx) => {\n if (val.type !== 'bigint') {\n throw new Error(`lcm: argument #${idx + 1} must be a bigint, got ${val.type}`);\n }\n return BigInt(val.value);\n });\n\n if (values.some(v => v === BigInt(0))) {\n return { type: 'bigint', value: BigInt(0) };\n }\n \n let currentLcm: bigint = absBigInt(values[0]);\n for (let i = 1; i < values.length; i++) {\n currentLcm = lcmOfTwo(currentLcm, absBigInt(values[i]));\n if (currentLcm === BigInt(0)) {\n break;\n }\n }\n \n return { type: 'bigint', value: currentLcm };\n}\n\nfunction lcmOfTwo(a: bigint, b: bigint): bigint {\n const gcdVal: bigint = gcdOfTwo(a, b);\n return BigInt((a / gcdVal) * b);\n}\n \nfunction absBigInt(x: bigint): bigint {\n return x < 0 ? -x : x;\n}\n\nexport function math_perm(args: Value[]): Value {\n if (args.length < 1 || args.length > 2) {\n throw new Error(`perm expects 1 or 2 arguments, but got ${args.length}`);\n }\n\n const nValObj = args[0];\n if (nValObj.type !== 'bigint') {\n throw new Error(\n `perm: first argument n must be an integer (bigint), but got ${nValObj.type}`\n );\n }\n const n = BigInt(nValObj.value);\n\n let k = n;\n if (args.length === 2) {\n const kValObj = args[1];\n if (kValObj.type === 'null' || kValObj.type === 'undefined') {\n k = n;\n } else if (kValObj.type === 'bigint') {\n k = BigInt(kValObj.value);\n } else {\n throw new Error(\n `perm: second argument k must be an integer (bigint) or None, but got ${kValObj.type}`\n );\n }\n }\n \n if (n < 0 || k < 0) {\n throw new Error(`perm: n and k must be non-negative, got n=${n}, k=${k}`);\n }\n\n if (k > n) {\n return { type: 'bigint', value: BigInt(0) };\n }\n\n let result: bigint = BigInt(1);\n for (let i: bigint = BigInt(0); i < k; i++) {\n result *= (n - i);\n }\n\n return { type: 'bigint', value: result };\n}\n\nexport function math_ceil(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`ceil expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n \n if (x.type === 'bigint') {\n return x;\n }\n \n if (x.type === 'number') {\n const numVal = x.value as number;\n if (typeof numVal !== 'number') {\n throw new Error(`ceil: value must be a JavaScript number, got ${typeof numVal}`);\n }\n const ceiled: bigint = BigInt(Math.ceil(numVal));\n return { type: 'bigint', value: ceiled };\n }\n \n throw new Error(\n `ceil: unsupported type '${x.type}'. If simulating Python, implement x.__ceil__.`\n );\n}\n\nexport function math_fabs(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`fabs expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n \n if (x.type === 'bigint') {\n const bigVal: bigint = BigInt(x.value);\n const absVal: number = bigVal < 0 ? -Number(bigVal) : Number(bigVal);\n return { type: 'number', value: absVal };\n }\n \n if (x.type === 'number') {\n const numVal: number = x.value as number;\n if (typeof numVal !== 'number') {\n throw new Error(`fabs: expected a JavaScript number, got ${typeof numVal}`);\n }\n const absVal: number = Math.abs(numVal);\n return { type: 'number', value: absVal };\n }\n\n throw new Error(`fabs: unsupported type '${x.type}'. Implement x.__abs__ if needed.`);\n}\n\nexport function math_floor(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`floor expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n \n if (x.type === 'bigint') {\n return x;\n }\n\n if (x.type === 'number') {\n const numVal: number = x.value as number;\n if (typeof numVal !== 'number') {\n throw new Error(`floor: expected a JavaScript number, got ${typeof numVal}`);\n }\n const floored: bigint = BigInt(Math.floor(numVal));\n return { type: 'bigint', value: floored };\n }\n\n throw new Error(\n `floor: unsupported type '${x.type}'. Implement x.__floor__ if needed.`\n );\n}\n\n// Computes the product of a and b along with the rounding error using Dekker's algorithm.\nfunction twoProd(a: number, b: number): { prod: number; err: number } {\n const prod = a * b;\n const c = 134217729; // 2^27 + 1\n const a_hi = (a * c) - ((a * c) - a);\n const a_lo = a - a_hi;\n const b_hi = (b * c) - ((b * c) - b);\n const b_lo = b - b_hi;\n const err = a_lo * b_lo - (((prod - a_hi * b_hi) - a_lo * b_hi) - a_hi * b_lo);\n return { prod, err };\n}\n \n// Computes the sum of a and b along with the rounding error using Fast TwoSum.\nfunction twoSum(a: number, b: number): { sum: number; err: number } {\n const sum = a + b;\n const v = sum - a;\n const err = (a - (sum - v)) + (b - v);\n return { sum, err };\n}\n\n// Performs a fused multiply-add operation: computes (x * y) + z with a single rounding.\nfunction fusedMultiplyAdd(x: number, y: number, z: number): number {\n const { prod, err: prodErr } = twoProd(x, y);\n const { sum, err: sumErr } = twoSum(prod, z);\n const result = sum + (prodErr + sumErr);\n return result;\n}\n\nfunction toNumber(val: Value): number {\n if (val.type === 'bigint') {\n return Number(val.value);\n } else if (val.type === 'number') {\n return val.value as number;\n } else {\n throw new Error(`unsupported type '${val.type}'`);\n }\n}\n\nexport function math_fma(args: Value[]): Value {\n if (args.length !== 3) {\n throw new Error(`fma expects exactly 3 arguments, but got ${args.length}`);\n }\n \n const xVal = toNumber(args[0]);\n const yVal = toNumber(args[1]);\n const zVal = toNumber(args[2]);\n\n // Special-case handling: According to the IEEE 754 standard, fma(0, inf, nan)\n // and fma(inf, 0, nan) should return NaN.\n if (isNaN(xVal) || isNaN(yVal) || isNaN(zVal)) {\n return { type: 'number', value: NaN };\n }\n if (xVal === 0 && !isFinite(yVal) && isNaN(zVal)) {\n return { type: 'number', value: NaN };\n }\n if (yVal === 0 && !isFinite(xVal) && isNaN(zVal)) {\n return { type: 'number', value: NaN };\n }\n \n const result = fusedMultiplyAdd(xVal, yVal, zVal);\n return { type: 'number', value: result };\n}\n\nexport function math_fmod(args: Value[]): Value {\n if (args.length !== 2) {\n throw new Error(`fmod expects exactly 2 arguments, but got ${args.length}`);\n }\n\n // Convert inputs to numbers\n const xVal = toNumber(args[0]);\n const yVal = toNumber(args[1]);\n\n // Divisor cannot be zero\n if (yVal === 0) {\n throw new Error(\"fmod: divisor (y) must not be zero\");\n }\n\n // JavaScript's % operator behaves similarly to C's fmod\n // in that the sign of the result is the same as the sign of x.\n // For corner cases (NaN, Infinity), JavaScript remainder\n // yields results consistent with typical C library fmod behavior.\n const remainder = xVal % yVal;\n\n return { type: 'number', value: remainder };\n}\n\nfunction roundToEven(num: number): number {\n const floorVal = Math.floor(num);\n const ceilVal = Math.ceil(num);\n const diffFloor = num - floorVal;\n const diffCeil = ceilVal - num;\n if (diffFloor < diffCeil) {\n return floorVal;\n } else if (diffCeil < diffFloor) {\n return ceilVal;\n } else {\n return (floorVal % 2 === 0) ? floorVal : ceilVal;\n }\n}\n \nexport function math_remainder(args: Value[]): Value {\n if (args.length !== 2) {\n throw new Error(`remainder expects exactly 2 arguments, but got ${args.length}`);\n }\n \n const x = args[0];\n const y = args[1];\n\n let xValue: number;\n if (x.type === 'bigint') {\n xValue = Number(x.value);\n } else if (x.type === 'number') {\n xValue = x.value as number;\n } else {\n throw new Error(`remainder: unsupported type '${x.type}' for first argument`);\n }\n\n let yValue: number;\n if (y.type === 'bigint') {\n yValue = Number(y.value);\n } else if (y.type === 'number') {\n yValue = y.value as number;\n } else {\n throw new Error(`remainder: unsupported type '${y.type}' for second argument`);\n }\n\n if (yValue === 0) {\n throw new Error(`remainder: divisor y must not be zero`);\n }\n\n const quotient = xValue / yValue;\n const n = roundToEven(quotient);\n const remainder = xValue - n * yValue;\n\n return { type: 'number', value: remainder };\n}\n\nexport function math_trunc(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`trunc expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n \n if (x.type === 'bigint') {\n return x;\n }\n \n if (x.type === 'number') {\n const numVal: number = x.value as number;\n if (typeof numVal !== 'number') {\n throw new Error(`trunc: argument must be a number, got ${typeof numVal}`);\n }\n let truncated: number;\n if (numVal === 0) {\n truncated = 0;\n } else if (numVal < 0) {\n truncated = Math.ceil(numVal);\n } else {\n truncated = Math.floor(numVal);\n }\n return { type: 'bigint', value: BigInt(truncated) };\n }\n \n throw new Error(`trunc: unsupported type '${x.type}'. Implement x.__trunc__ if needed.`);\n}\n\nexport function math_copysign(args: Value[]): Value {\n if (args.length !== 2) {\n throw new Error(`copysign expects exactly 2 arguments, but got ${args.length}`);\n }\n \n const [x, y] = args;\n\n if ((x.type !== 'number' && x.type !== 'bigint') || \n (y.type !== 'number' && y.type !== 'bigint')) {\n throw new Error(`copysign: both x and y must be of type 'number'`);\n }\n \n const xVal = Number(x.value) as number;\n const yVal = Number(y.value) as number;\n\n const absVal = Math.abs(xVal);\n const isNegative = yVal < 0 || (Object.is(yVal, -0));\n const result = isNegative ? -absVal : absVal;\n \n return { type: 'number', value: Number(result) };\n}\n\nexport function math_isfinite(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`isfinite expects exactly 1 argument, but got ${args.length}`);\n }\n\n const xValObj = args[0];\n if (xValObj.type !== 'number') {\n throw new Error(`isfinite: argument must be 'number', got '${xValObj.type}'`);\n }\n \n const x = xValObj.value as number;\n const result: boolean = Number.isFinite(x);\n \n return { type: 'bool', value: result };\n}\n\nexport function math_isinf(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`isinf expects exactly 1 argument, but got ${args.length}`);\n }\n\n const xValObj = args[0];\n if (xValObj.type !== 'number') {\n throw new Error(`isinf: argument must be 'number', got '${xValObj.type}'`);\n }\n \n const x = xValObj.value as number;\n const result: boolean = (x === Infinity || x === -Infinity);\n \n return { type: 'bool', value: result };\n}\n\nexport function math_isnan(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`isnan expects exactly 1 argument, but got ${args.length}`);\n }\n \n const xValObj = args[0];\n if (xValObj.type !== 'number') {\n throw new Error(`isnan: argument must be 'number', got '${xValObj.type}'`);\n }\n \n const x = xValObj.value as number;\n const result: boolean = Number.isNaN(x);\n \n return { type: 'bool', value: result };\n}\n\nexport function math_ldexp(args: Value[]): Value {\n if (args.length !== 2) {\n throw new Error(`ldexp expects exactly 2 arguments, but got ${args.length}`);\n }\n\n const xVal = toNumber(args[0]);\n\n if (args[1].type !== 'bigint') {\n throw new Error(`ldexp: argument must be 'int', got '${args[1].type}'`);\n }\n const expVal = args[1].value;\n\n // Perform x * 2^expVal\n // In JavaScript, 2**expVal may overflow or underflow, yielding Infinity or 0 respectively.\n // That behavior parallels typical C library rules for ldexp.\n const result = xVal * Math.pow(2, Number(expVal));\n \n return { type: 'number', value: result };\n}\n \nexport function math_nextafter(args: Value[]): Value {\n // TODO: Implement math_nextafter using proper bit-level manipulation and handling special cases (NaN, Infinity, steps, etc.)\n throw new Error(\"math_nextafter not implemented\");\n}\n\nexport function math_ulp(args: Value[]): Value {\n // TODO: Implement math_ulp to return the unit in the last place (ULP) of the given floating-point number.\n throw new Error(\"math_ulp not implemented\");\n}\n\nexport function math_cbrt(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_cbrt expects exactly 1 argument, but got ${args.length}`);\n }\n\n const xVal = args[0];\n let x: number;\n\n if (xVal.type !== 'number') {\n if (xVal.type === 'bigint') {\n x = Number(xVal.value);\n } else {\n throw new Error(`math_cbrt: argument must be a number, got ${xVal.type}`);\n }\n } else {\n x = xVal.value as number;\n }\n\n const result = Math.cbrt(x);\n\n return { type: 'number', value: result };\n}\n\nexport function math_exp(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_exp expects exactly 1 argument, but got ${args.length}`);\n }\n \n const xVal = args[0];\n let x: number;\n\n if (xVal.type !== 'number') {\n if (xVal.type === 'bigint') {\n x = Number(xVal.value);\n } else {\n throw new Error(`math_cbrt: argument must be a number, got ${xVal.type}`);\n }\n } else {\n x = xVal.value as number;\n }\n\n const result = Math.exp(x);\n return { type: 'number', value: result };\n}\n\nexport function math_exp2(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_exp2 expects exactly 1 argument, but got ${args.length}`);\n }\n \n const xVal = args[0];\n let x: number;\n\n if (xVal.type !== 'number') {\n if (xVal.type === 'bigint') {\n x = Number(xVal.value);\n } else {\n throw new Error(`math_cbrt: argument must be a number, got ${xVal.type}`);\n }\n } else {\n x = xVal.value as number;\n }\n \n const result = Math.pow(2, x);\n return { type: 'number', value: result };\n}\n\nexport function math_expm1(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_expm1 expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_expm1: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = Math.expm1(num);\n return { type: 'number', value: result };\n}\n\nexport function math_gamma(args: Value[]): Value { \n if (args.length !== 1) {\n throw new Error(`gamma expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`gamma: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n\n const z = toNumber(x);\n const result = gamma(z);\n\n return { type: 'number', value: result };\n}\n\nexport function math_lgamma(args: Value[]): Value { \n if (args.length !== 1) {\n throw new Error(`gamma expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`gamma: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n\n const z = toNumber(x);\n const result = lgamma(z);\n\n return { type: 'number', value: result };\n}\n\nexport function math_log(args: Value[]): Value {\n if (args.length < 1 || args.length > 2) {\n throw new Error(`math_log expects 1 or 2 arguments, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_log: first argument must be a number, int, or bigint, but got ${x.type}`);\n }\n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n if (num <= 0) {\n throw new Error(`math_log: argument must be positive, but got ${num}`);\n }\n \n if (args.length === 1) {\n return { type: 'number', value: Math.log(num) };\n }\n \n const baseArg = args[1];\n if (baseArg.type !== 'number' && baseArg.type !== 'int' && baseArg.type !== 'bigint') {\n throw new Error(`math_log: base argument must be a number, int, or bigint, but got ${baseArg.type}`);\n }\n let baseNum: number;\n if (baseArg.type === 'number') {\n baseNum = baseArg.value;\n } else {\n baseNum = Number(baseArg.value);\n }\n if (baseNum <= 0) {\n throw new Error(`math_log: base must be positive, but got ${baseNum}`);\n }\n \n const result = Math.log(num) / Math.log(baseNum);\n return { type: 'number', value: result };\n}\n\nexport function math_log10(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_log10 expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_log10: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n if (num <= 0) {\n throw new Error(`math_log10: argument must be positive, but got ${num}`);\n }\n \n const result = Math.log10(num);\n return { type: 'number', value: result };\n}\n \nexport function math_log1p(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_log1p expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_log1p: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n if (1 + num <= 0) {\n throw new Error(`math_log1p: 1 + argument must be positive, but got 1 + ${num} = ${1 + num}`);\n }\n \n const result = Math.log1p(num);\n return { type: 'number', value: result };\n}\n \nexport function math_log2(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_log2 expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_log2: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n if (num <= 0) {\n throw new Error(`math_log2: argument must be positive, but got ${num}`);\n }\n \n const result = Math.log2(num);\n return { type: 'number', value: result };\n}\n\nexport function math_pow(args: Value[]): Value {\n if (args.length !== 2) {\n throw new Error(`math_pow expects exactly 2 arguments, but got ${args.length}`);\n }\n \n const base = args[0];\n const exp = args[1];\n \n if ((base.type !== 'number' && base.type !== 'bigint') ||\n (exp.type !== 'number' && exp.type !== 'bigint')) {\n throw new Error(`math_pow: both arguments must be a number or bigint`);\n }\n \n let baseNum: number;\n if (base.type === 'number') {\n baseNum = base.value;\n } else { // 'bigint'\n baseNum = Number(base.value);\n }\n \n let expNum: number;\n if (exp.type === 'number') {\n expNum = exp.value;\n } else {\n expNum = Number(exp.value);\n }\n \n const result = Math.pow(baseNum, expNum);\n return { type: 'number', value: result };\n}\n\nexport function math_radians(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_radians expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_radians: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let deg: number;\n if (x.type === 'number') {\n deg = x.value;\n } else { \n deg = Number(x.value);\n }\n \n const radians = deg * Math.PI / 180;\n return { type: 'number', value: radians };\n}\n\nexport function math_sin(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_sin expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_sin: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = Math.sin(num);\n return { type: 'number', value: result };\n}\n\nexport function math_sinh(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_sinh expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_sinh: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = Math.sinh(num);\n return { type: 'number', value: result };\n}\n\nexport function math_tan(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_tan expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_tan: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = Math.tan(num);\n return { type: 'number', value: result };\n}\n\nexport function math_tanh(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_tanh expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'bigint') {\n throw new Error(`math_tanh: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n const result = Math.tanh(num);\n return { type: 'number', value: result };\n}\n\nexport function math_sqrt(args: Value[]): Value {\n if (args.length !== 1) {\n throw new Error(`math_sqrt expects exactly 1 argument, but got ${args.length}`);\n }\n \n const x = args[0];\n if (x.type !== 'number' && x.type !== 'int' && x.type !== 'bigint') {\n throw new Error(`math_sqrt: argument must be a number, int, or bigint, but got ${x.type}`);\n }\n \n let num: number;\n if (x.type === 'number') {\n num = x.value;\n } else {\n num = Number(x.value);\n }\n \n if (num < 0) {\n throw new Error(`math_sqrt: argument must be non-negative, but got ${num}`);\n }\n \n const result = Math.sqrt(num);\n return { type: 'number', value: result };\n}\n\nexport function max(args: Value[]): Value {\n if (args.length < 2) {\n throw new Error(`max expects at least 2 arguments, but got ${args.length}`);\n }\n \n const numericTypes = ['bigint', 'number'];\n const firstType = args[0].type;\n let isNumeric = numericTypes.includes(firstType);\n let isString = firstType === 'string';\n \n for (let i = 1; i < args.length; i++) {\n const t = args[i].type;\n if (isNumeric && !numericTypes.includes(t)) {\n throw new Error(`max: all arguments must be mutually comparable (all numeric or all string)`);\n }\n if (isString && t !== 'string') {\n throw new Error(`max: all arguments must be mutually comparable (all numeric or all string)`);\n }\n }\n \n let useFloat = false;\n if (isNumeric) {\n for (const arg of args) {\n if (arg.type === 'number') {\n useFloat = true;\n break;\n }\n }\n }\n \n let maxIndex = 0;\n if (isNumeric) {\n if (useFloat) {\n let maxVal: number = Number(args[0].value);\n for (let i = 1; i < args.length; i++) {\n const curr: number = Number(args[i].value);\n if (curr > maxVal) {\n maxVal = curr;\n maxIndex = i;\n }\n }\n } else {\n let maxVal: bigint = args[0].value;\n for (let i = 1; i < args.length; i++) {\n const curr: bigint = args[i].value;\n if (curr > maxVal) {\n maxVal = curr;\n maxIndex = i;\n }\n }\n }\n } else if (isString) {\n let maxVal = args[0].value as string;\n for (let i = 1; i < args.length; i++) {\n const curr = args[i].value as string;\n if (curr > maxVal) {\n maxVal = curr;\n maxIndex = i;\n }\n }\n } else {\n throw new Error(`max: unsupported type ${firstType}`);\n }\n \n return args[maxIndex];\n}\n\nexport function min(args: Value[]): Value {\n if (args.length < 2) {\n throw new Error(`min expects at least 2 arguments, but got ${args.length}`);\n }\n \n const numericTypes = ['bigint', 'number'];\n const firstType = args[0].type;\n let isNumeric = numericTypes.includes(firstType);\n let isString = firstType === 'string';\n\n for (let i = 1; i < args.length; i++) {\n const t = args[i].type;\n if (isNumeric && !numericTypes.includes(t)) {\n throw new Error(`min: all arguments must be mutually comparable (all numeric or all string)`);\n }\n if (isString && t !== 'string') {\n throw new Error(`min: all arguments must be mutually comparable (all numeric or all string)`);\n }\n }\n\n let useFloat = false;\n if (isNumeric) {\n for (const arg of args) {\n if (arg.type === 'number') {\n useFloat = true;\n break;\n }\n }\n }\n\n let maxIndex = 0;\n if (isNumeric) {\n if (useFloat) {\n let maxVal: number = Number(args[0].value);\n for (let i = 1; i < args.length; i++) {\n const curr: number = Number(args[i].value);\n if (curr < maxVal) {\n maxVal = curr;\n maxIndex = i;\n }\n }\n } else {\n let maxVal: bigint = args[0].value;\n for (let i = 1; i < args.length; i++) {\n const curr: bigint = args[i].value;\n if (curr < maxVal) {\n maxVal = curr;\n maxIndex = i;\n }\n }\n }\n } else if (isString) {\n let maxVal = args[0].value as string;\n for (let i = 1; i < args.length; i++) {\n const curr = args[i].value as string;\n if (curr < maxVal) {\n maxVal = curr;\n maxIndex = i;\n }\n }\n } else {\n throw new Error(`min: unsupported type ${firstType}`);\n }\n\n return args[maxIndex];\n}\n\nexport function random_random(args: Value[]): Value {\n if (args.length !== 0) {\n throw new Error(`random_random expects exactly 0 arguments, but got ${args.length}`);\n }\n const result = Math.random();\n return { type: 'number', value: result };\n}\n\nexport function round(args: Value[]): Value {\n if (args.length < 1 || args.length > 2) {\n throw new Error(`round expects 1 or 2 arguments, but got ${args.length}`);\n }\n \n const numArg = args[0];\n if (numArg.type !== 'number' && numArg.type !== 'bigint') {\n throw new Error(`round: first argument must be a number, int, or bigint, but got ${numArg.type}`);\n }\n \n let ndigitsArg = { type: 'bigint', value: BigInt(0) }; \n if (args.length === 2 && args[1].type !== 'NoneType') {\n ndigitsArg = args[1];\n }\n\n if (numArg.type === 'number') {\n let numberValue: number = numArg.value;\n if (ndigitsArg.value > 0) {\n const shifted = Number(numberValue.toFixed(Number(ndigitsArg.value)));\n return { type: 'number', value: shifted }; \n } else if (ndigitsArg.value === BigInt(0)) {\n const shifted = Math.round(numArg.value);\n return { type: 'bigint', value: BigInt(shifted) }; \n } else {\n const shifted = Math.round(numArg.value / (10 ** (-Number(ndigitsArg.value)))) * (10 ** (-Number(ndigitsArg.value)));\n return { type: 'number', value: shifted }; \n }\n } else {\n if (ndigitsArg.value >= 0) {\n return numArg;\n } else {\n const shifted: bigint = numArg.value / (BigInt(10) ** (-ndigitsArg.value)) * (BigInt(10) ** (-ndigitsArg.value));\n return { type: 'bigint', value: shifted };\n }\n }\n}\n\nexport function time_time(args: Value[]): Value {\n if (args.length !== 0) {\n throw new Error(`time_time expects 0 arguments, but got ${args.length}`);\n }\n const currentTime = Date.now();\n return { type: 'number', value: currentTime };\n}\n\nfunction toPythonFloat(num: number): string {\n //num = Number(num);\n //console.info(typeof(num));\n if (Object.is(num, -0)) {\n return \"-0.0\";\n }\n if (num === 0) {\n return \"0.0\";\n }\n\n if (num === Infinity) {\n return \"inf\";\n }\n if (num === -Infinity) {\n return \"-inf\";\n }\n\n if (Number.isNaN(num)) {\n return \"nan\";\n }\n\n if (Math.abs(num) >= 1e16 || (num !== 0 && Math.abs(num) < 1e-4)) {\n return num.toExponential().replace(/e([+-])(\\d)$/, 'e$10$2');\n }\n if (Number.isInteger(num)) {\n return num.toFixed(1).toString();\n }\n return num.toString();\n}\n\nexport function toPythonString(obj: Value): string {\n let ret: any;\n if ((obj as Value).type === 'bigint' || (obj as Value).type === 'complex') {\n ret = (obj as Value).value.toString();\n } else if ((obj as Value).type === 'number') {\n ret = toPythonFloat((obj as Value).value);\n } else if ((obj as Value).type === 'bool') {\n if ((obj as Value).value === true) {\n return \"True\";\n } else {\n return \"False\";\n }\n } else if ((obj as Value).type === 'error') {\n return (obj as Value).message;\n } else if ((obj as unknown as Closure).node) {\n for (let name in (obj as unknown as Closure).environment!.head) {\n if ((obj as unknown as Closure).environment!.head[name] === obj) {\n return '';\n }\n }\n } else if ((obj as Value) === undefined || (obj as Value).value === undefined) {\n ret = 'None';\n } else {\n ret = (obj as Value).value.toString();\n }\n return ret;\n}\n\nexport function str(args: Value[]): Value {\n if (args.length === 0) {\n return { type: 'string', value: \"\" };\n }\n const obj = args[0];\n const result = toPythonString(obj);\n return { type: 'string', value: result };\n}\n\nexport function input(args: Value[]): Value {\n // TODO: \n // nodejs\n // readline\n // distinguish between browser and commandline\n}\n\nexport function print(args: Value[]) {\n // Convert each argument using toPythonString (an assumed helper function).\n const pieces = args.map(arg => toPythonString(arg));\n // Join them with spaces.\n const output = pieces.join(' ');\n // Actually print to console (you can replace this with any desired output).\n // console.info(output);\n addPrint(output);\n //return { type: 'string', value: output };\n}\n ","import * as es from 'estree'\nimport { str, toPythonString } from './stdlib'\nimport { Value } from './cse-machine/stash'\nimport { Context } from './cse-machine/context'\nimport { ModuleFunctions } from './modules/moduleTypes'\n\nexport class CSEBreak {}\n\n// export class CseError {\n// constructor(public readonly error: any) {}\n// }\n\nexport enum ErrorType {\n IMPORT = 'Import',\n RUNTIME = 'Runtime',\n SYNTAX = 'Syntax',\n TYPE = 'Type'\n}\n\nexport enum ErrorSeverity {\n WARNING = 'Warning',\n ERROR = 'Error'\n}\n\n// any and all errors ultimately implement this interface. as such, changes to this will affect every type of error.\nexport interface SourceError {\n type: ErrorType\n severity: ErrorSeverity\n location: es.SourceLocation\n explain(): string\n elaborate(): string\n}\n\nexport class PyComplexNumber {\n public real: number;\n public imag: number;\n\n constructor(real: number, imag: number) {\n this.real = real;\n this.imag = imag;\n }\n\n public static fromNumber(value: number): PyComplexNumber {\n return new PyComplexNumber(value, 0);\n }\n\n public static fromBigInt(value: bigint): PyComplexNumber {\n return new PyComplexNumber(Number(value), 0);\n }\n\n public static fromString(str: string): PyComplexNumber {\n if (!/[jJ]/.test(str)) {\n const realVal = Number(str);\n if (isNaN(realVal)) {\n throw new Error(`Invalid complex string: ${str}`);\n }\n return new PyComplexNumber(realVal, 0);\n }\n\n const lower = str.toLowerCase();\n if (lower.endsWith('j')) {\n const numericPart = str.substring(0, str.length - 1);\n if (numericPart === '' || numericPart === '+' || numericPart === '-') {\n const sign = (numericPart === '-') ? -1 : 1;\n return new PyComplexNumber(0, sign * 1);\n }\n\n const imagVal = Number(numericPart);\n if (isNaN(imagVal)) {\n throw new Error(`Invalid complex string: ${str}`);\n }\n return new PyComplexNumber(0, imagVal);\n }\n\n const match = str.match(/^([\\+\\-]?\\d+(\\.\\d+)?([eE][+\\-]?\\d+)?)([\\+\\-]\\d+(\\.\\d+)?([eE][+\\-]?\\d+)?)?[jJ]?$/);\n if (!match) {\n throw new Error(`Invalid complex string: ${str}`);\n }\n\n const realPart = Number(match[1]);\n let imagPart = 0;\n\n if (match[4]) {\n imagPart = Number(match[4]);\n }\n\n return new PyComplexNumber(realPart, imagPart);\n }\n\n public static fromValue(value: number | bigint | string | PyComplexNumber): PyComplexNumber {\n if (value instanceof PyComplexNumber) {\n return new PyComplexNumber(value.real, value.imag);\n }\n if (typeof value === \"number\") {\n return PyComplexNumber.fromNumber(value);\n }\n if (typeof value === \"bigint\") {\n return PyComplexNumber.fromBigInt(value);\n }\n return PyComplexNumber.fromString(value);\n }\n\n /**\n * operations\n */\n public add(other: PyComplexNumber): PyComplexNumber {\n return new PyComplexNumber(this.real + other.real, this.imag + other.imag);\n }\n\n public sub(other: PyComplexNumber): PyComplexNumber {\n return new PyComplexNumber(this.real - other.real, this.imag - other.imag);\n }\n\n public mul(other: PyComplexNumber): PyComplexNumber {\n // (a+bi)*(c+di) = (ac - bd) + (bc + ad)i\n const realPart = this.real * other.real - this.imag * other.imag;\n const imagPart = this.real * other.imag + this.imag * other.real;\n return new PyComplexNumber(realPart, imagPart);\n }\n\n // https://github.com/python/cpython/blob/main/Objects/complexobject.c#L986\n // In the CPython source code, a branch algorithm is used for complex division.\n // It first compares the magnitudes of the dividend and divisor, and if some components are too large or too small, \n // appropriate scaling is applied before performing the operation. \n // This approach can significantly reduce overflow or underflow, thereby ensuring that the results remain more consistent with Python.\n public div(other: PyComplexNumber): PyComplexNumber {\n // (a+bi)/(c+di) = ((a+bi)*(c-di)) / (c^2 + d^2)\n const denominator = other.real * other.real + other.imag * other.imag;\n if (denominator === 0) {\n throw new Error(`Division by zero in complex number.`);\n }\n\n const a = this.real;\n const b = this.imag;\n const c = other.real;\n const d = other.imag;\n\n const absC = Math.abs(c);\n const absD = Math.abs(d);\n\n let real: number;\n let imag: number;\n if (absD < absC) {\n const ratio = d / c;\n const denom = c + d * ratio; // c + d*(d/c) = c + d^2/c\n real = (a + b * ratio) / denom;\n imag = (b - a * ratio) / denom;\n } else {\n const ratio = c / d;\n const denom = d + c * ratio; // d + c*(c/d) = d + c^2/d\n real = (a * ratio + b) / denom;\n imag = (b * ratio - a) / denom;\n }\n \n return new PyComplexNumber(real, imag);\n\n //const numerator = this.mul(new PyComplexNumber(other.real, -other.imag));\n //return new PyComplexNumber(numerator.real / denominator, numerator.imag / denominator);\n }\n\n public pow(other: PyComplexNumber): PyComplexNumber {\n // z = this (a+bi), w = other (A+Bi)\n const a = this.real;\n const b = this.imag;\n const A = other.real;\n const B = other.imag;\n \n const r = Math.sqrt(a * a + b * b);\n const theta = Math.atan2(b, a);\n \n if (r === 0) {\n // In Python, raising 0 to a negative or complex power raises an error.\n // For example, 0**(1j) in CPython directly raises ValueError: complex power.\n if (A < 0 || B !== 0) {\n throw new Error('0 cannot be raised to a negative or complex power');\n }\n // Otherwise, 0**(positive number) = 0.\n return new PyComplexNumber(0, 0);\n }\n \n const logR = Math.log(r);\n \n // realExpPart = A*ln(r) - B*theta\n // imagExpPart = B*ln(r) + A*theta\n const realExpPart = A * logR - B * theta;\n const imagExpPart = B * logR + A * theta;\n \n // e^(x + i y) = e^x [cos(y) + i sin(y)]\n const expOfReal = Math.exp(realExpPart);\n const c = expOfReal * Math.cos(imagExpPart);\n const d = expOfReal * Math.sin(imagExpPart);\n \n return new PyComplexNumber(c, d);\n }\n \n public toString(): string {\n if (this.real === 0) {\n return `${this.imag}j`;\n }\n // if (this.imag === 0) {\n // return `${this.real}`;\n // }\n \n const sign = (this.imag >= 0) ? \"+\" : \"\";\n\n // return `(${this.real}${sign}${this.imag}j)`;\n return `(${this.toPythonComplexFloat(this.real)}${sign}${this.toPythonComplexFloat(this.imag)}j)`;\n }\n\n private toPythonComplexFloat(num: number){\n if (num === Infinity) {\n return \"inf\";\n }\n if (num === -Infinity) {\n return \"-inf\";\n }\n \n if (Math.abs(num) >= 1e16 || (num !== 0 && Math.abs(num) < 1e-4)) {\n return num.toExponential().replace(/e([+-])(\\d)$/, 'e$10$2');\n }\n return num.toString();\n }\n\n public equals(other: PyComplexNumber): boolean {\n return (Number(this.real) === Number(other.real) && Number(this.imag) === Number(other.imag));\n }\n}\n\nexport interface None extends es.BaseNode {\n type: 'NoneType';\n loc?: es.SourceLocation;\n}\n\nexport interface ComplexLiteral extends es.BaseNode {\n type: 'Literal';\n complex: {\n real: number;\n imag: number;\n }\n loc?: es.SourceLocation;\n}\n\n/**\n * Helper type to recursively make properties that are also objects\n * partial\n *\n * By default, `Partial>` is equivalent to `Array`. For this type, `Array` will be\n * transformed to Array> instead\n */\nexport type RecursivePartial =\n T extends Array\n ? Array>\n : T extends Record\n ? Partial<{\n [K in keyof T]: RecursivePartial\n }>\n : T\n\nexport type Result = Finished | Error | SuspendedCseEval // | Suspended\n\n// TODO: should allow debug\n// export interface Suspended {\n// status: 'suspended'\n// it: IterableIterator\n// scheduler: Scheduler\n// context: Context\n// }\n \nexport interface SuspendedCseEval {\n status: 'suspended-cse-eval'\n context: Context\n}\n\nexport interface Finished {\n status: 'finished'\n context: Context\n value: Value\n representation: Representation // if the returned value needs a unique representation,\n // (for example if the language used is not JS),\n // the display of the result will use the representation\n // field instead\n}\n\n// export class Representation {\n// constructor(public representation: string) {}\n// toString() {\n// return this.representation\n// }\n// }\n\nexport class Representation {\n constructor(public representation: string) {}\n \n toString(value: any): string {\n // call str(value) in stdlib\n // TODO: mapping\n const result = toPythonString(value);\n return result;\n }\n}\n\nexport interface NativeStorage {\n builtins: Map\n previousProgramsIdentifiers: Set\n operators: Map Value>\n maxExecTime: number\n evaller: null | ((program: string) => Value)\n /*\n the first time evaller is used, it must be used directly like `eval(code)` to inherit\n surrounding scope, so we cannot set evaller to `eval` directly. subsequent assignments to evaller will\n close in the surrounding values, so no problem\n */\n loadedModules: Record\n loadedModuleTypes: Record>\n}\n","// This file is autogenerated by generate-ast.ts. DO NOT EDIT THIS FILE DIRECTLY.\nimport {Token} from \"./tokenizer\";\nimport { PyComplexNumber } from \"./types\";\n\nexport namespace ExprNS {\n export interface Visitor {\n visitBigIntLiteralExpr(expr: BigIntLiteral): T\n visitBinaryExpr(expr: Binary): T\n visitCompareExpr(expr: Compare): T\n visitBoolOpExpr(expr: BoolOp): T\n visitGroupingExpr(expr: Grouping): T\n visitLiteralExpr(expr: Literal): T\n visitUnaryExpr(expr: Unary): T\n visitTernaryExpr(expr: Ternary): T\n visitLambdaExpr(expr: Lambda): T\n visitMultiLambdaExpr(expr: MultiLambda): T\n visitVariableExpr(expr: Variable): T\n visitCallExpr(expr: Call): T\n visitComplexExpr(expr: Complex): T\n visitNoneExpr(expr: None): T\n }\n export abstract class Expr {\n startToken: Token;\n endToken: Token;\n protected constructor(startToken: Token, endToken: Token) {\n this.startToken = startToken;\n this.endToken = endToken;\n }\n abstract accept(visitor: Visitor): any;\n }\n export class None extends Expr { \n constructor(startToken: Token, endToken: Token, value: string = \"None\") {\n super(startToken, endToken);\n }\n override accept(visitor: Visitor): any {\n return visitor.visitNoneExpr(this);\n }\n }\n export class BigIntLiteral extends Expr {\n value: string;\n constructor(startToken: Token, endToken: Token, value: string){\n super(startToken, endToken)\n this.value = value;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitBigIntLiteralExpr(this)\n }\n }\n export class Complex extends Expr {\n value: PyComplexNumber;\n constructor(startToken: Token, endToken: Token, value: string) {\n super(startToken, endToken);\n this.value = PyComplexNumber.fromString(value);;\n }\n override accept(visitor: Visitor): T {\n return visitor.visitComplexExpr(this);\n }\n }\n export class Binary extends Expr {\n left: Expr;\n operator: Token;\n right: Expr;\n constructor(startToken: Token, endToken: Token, left: Expr, operator: Token, right: Expr){\n super(startToken, endToken)\n this.left = left;\n this.operator = operator;\n this.right = right;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitBinaryExpr(this)\n }\n }\n export class Compare extends Expr {\n left: Expr;\n operator: Token;\n right: Expr;\n constructor(startToken: Token, endToken: Token, left: Expr, operator: Token, right: Expr){\n super(startToken, endToken)\n this.left = left;\n this.operator = operator;\n this.right = right;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitCompareExpr(this)\n }\n }\n export class BoolOp extends Expr {\n left: Expr;\n operator: Token;\n right: Expr;\n constructor(startToken: Token, endToken: Token, left: Expr, operator: Token, right: Expr){\n super(startToken, endToken)\n this.left = left;\n this.operator = operator;\n this.right = right;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitBoolOpExpr(this)\n }\n }\n export class Grouping extends Expr {\n expression: Expr;\n constructor(startToken: Token, endToken: Token, expression: Expr){\n super(startToken, endToken)\n this.expression = expression;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitGroupingExpr(this)\n }\n }\n export class Literal extends Expr {\n value: true | false | number | string;\n constructor(startToken: Token, endToken: Token, value: true | false | number | string){\n super(startToken, endToken)\n this.value = value;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitLiteralExpr(this)\n }\n }\n export class Unary extends Expr {\n operator: Token;\n right: Expr;\n constructor(startToken: Token, endToken: Token, operator: Token, right: Expr){\n super(startToken, endToken)\n this.operator = operator;\n this.right = right;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitUnaryExpr(this)\n }\n }\n export class Ternary extends Expr {\n predicate: Expr;\n consequent: Expr;\n alternative: Expr;\n constructor(startToken: Token, endToken: Token, predicate: Expr, consequent: Expr, alternative: Expr){\n super(startToken, endToken)\n this.predicate = predicate;\n this.consequent = consequent;\n this.alternative = alternative;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitTernaryExpr(this)\n }\n }\n export class Lambda extends Expr {\n parameters: Token[];\n body: Expr;\n constructor(startToken: Token, endToken: Token, parameters: Token[], body: Expr){\n super(startToken, endToken)\n this.parameters = parameters;\n this.body = body;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitLambdaExpr(this)\n }\n }\n export class MultiLambda extends Expr {\n parameters: Token[];\n body: StmtNS.Stmt[];\n varDecls: Token[];\n constructor(startToken: Token, endToken: Token, parameters: Token[], body: StmtNS.Stmt[], varDecls: Token[]){\n super(startToken, endToken)\n this.parameters = parameters;\n this.body = body;\n this.varDecls = varDecls;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitMultiLambdaExpr(this)\n }\n }\n export class Variable extends Expr {\n name: Token;\n constructor(startToken: Token, endToken: Token, name: Token){\n super(startToken, endToken)\n this.name = name;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitVariableExpr(this)\n }\n }\n export class Call extends Expr {\n callee: Expr;\n args: Expr[];\n constructor(startToken: Token, endToken: Token, callee: Expr, args: Expr[]){\n super(startToken, endToken)\n this.callee = callee;\n this.args = args;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitCallExpr(this)\n }\n }\n \n \n}\nexport namespace StmtNS {\n export interface Visitor {\n visitIndentCreation(stmt: Indent): T\n visitDedentCreation(stmt: Dedent): T\n visitPassStmt(stmt: Pass): T\n visitAssignStmt(stmt: Assign): T\n visitAnnAssignStmt(stmt: AnnAssign): T\n visitBreakStmt(stmt: Break): T\n visitContinueStmt(stmt: Continue): T\n visitReturnStmt(stmt: Return): T\n visitFromImportStmt(stmt: FromImport): T\n visitGlobalStmt(stmt: Global): T\n visitNonLocalStmt(stmt: NonLocal): T\n visitAssertStmt(stmt: Assert): T\n visitIfStmt(stmt: If): T\n visitWhileStmt(stmt: While): T\n visitForStmt(stmt: For): T\n visitFunctionDefStmt(stmt: FunctionDef): T\n visitSimpleExprStmt(stmt: SimpleExpr): T\n visitFileInputStmt(stmt: FileInput): T\n }\n export abstract class Stmt {\n startToken: Token;\n endToken: Token;\n protected constructor(startToken: Token, endToken: Token) {\n this.startToken = startToken;\n this.endToken = endToken;\n }\n abstract accept(visitor: Visitor): any;\n }\n export class Indent extends Stmt {\n constructor(startToken: Token, endToken: Token){\n super(startToken, endToken)\n }\n override accept(visitor: Visitor): any {\n return visitor.visitIndentCreation(this)\n }\n }\n export class Dedent extends Stmt {\n constructor(startToken: Token, endToken: Token){\n super(startToken, endToken)\n }\n override accept(visitor: Visitor): any {\n return visitor.visitDedentCreation(this)\n }\n }\n export class Pass extends Stmt {\n constructor(startToken: Token, endToken: Token){\n super(startToken, endToken)\n }\n override accept(visitor: Visitor): any {\n return visitor.visitPassStmt(this)\n }\n }\n export class Assign extends Stmt {\n name: Token;\n value: ExprNS.Expr;\n constructor(startToken: Token, endToken: Token, name: Token, value: ExprNS.Expr){\n super(startToken, endToken)\n this.name = name;\n this.value = value;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitAssignStmt(this)\n }\n }\n export class AnnAssign extends Stmt {\n name: Token;\n value: ExprNS.Expr;\n ann: ExprNS.Expr;\n constructor(startToken: Token, endToken: Token, name: Token, value: ExprNS.Expr, ann: ExprNS.Expr){\n super(startToken, endToken)\n this.name = name;\n this.value = value;\n this.ann = ann;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitAnnAssignStmt(this)\n }\n }\n export class Break extends Stmt {\n constructor(startToken: Token, endToken: Token){\n super(startToken, endToken)\n }\n override accept(visitor: Visitor): any {\n return visitor.visitBreakStmt(this)\n }\n }\n export class Continue extends Stmt {\n constructor(startToken: Token, endToken: Token){\n super(startToken, endToken)\n }\n override accept(visitor: Visitor): any {\n return visitor.visitContinueStmt(this)\n }\n }\n export class Return extends Stmt {\n value: ExprNS.Expr | null;\n constructor(startToken: Token, endToken: Token, value: ExprNS.Expr | null){\n super(startToken, endToken)\n this.value = value;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitReturnStmt(this)\n }\n }\n export class FromImport extends Stmt {\n module: Token;\n names: Token[];\n constructor(startToken: Token, endToken: Token, module: Token, names: Token[]){\n super(startToken, endToken)\n this.module = module;\n this.names = names;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitFromImportStmt(this)\n }\n }\n export class Global extends Stmt {\n name: Token;\n constructor(startToken: Token, endToken: Token, name: Token){\n super(startToken, endToken)\n this.name = name;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitGlobalStmt(this)\n }\n }\n export class NonLocal extends Stmt {\n name: Token;\n constructor(startToken: Token, endToken: Token, name: Token){\n super(startToken, endToken)\n this.name = name;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitNonLocalStmt(this)\n }\n }\n export class Assert extends Stmt {\n value: ExprNS.Expr;\n constructor(startToken: Token, endToken: Token, value: ExprNS.Expr){\n super(startToken, endToken)\n this.value = value;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitAssertStmt(this)\n }\n }\n export class If extends Stmt {\n condition: ExprNS.Expr;\n body: Stmt[];\n elseBlock: Stmt[] | null;\n constructor(startToken: Token, endToken: Token, condition: ExprNS.Expr, body: Stmt[], elseBlock: Stmt[] | null){\n super(startToken, endToken)\n this.condition = condition;\n this.body = body;\n this.elseBlock = elseBlock;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitIfStmt(this)\n }\n }\n export class While extends Stmt {\n condition: ExprNS.Expr;\n body: Stmt[];\n constructor(startToken: Token, endToken: Token, condition: ExprNS.Expr, body: Stmt[]){\n super(startToken, endToken)\n this.condition = condition;\n this.body = body;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitWhileStmt(this)\n }\n }\n export class For extends Stmt {\n target: Token;\n iter: ExprNS.Expr;\n body: Stmt[];\n constructor(startToken: Token, endToken: Token, target: Token, iter: ExprNS.Expr, body: Stmt[]){\n super(startToken, endToken)\n this.target = target;\n this.iter = iter;\n this.body = body;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitForStmt(this)\n }\n }\n export class FunctionDef extends Stmt {\n name: Token;\n parameters: Token[];\n body: Stmt[];\n varDecls: Token[];\n constructor(startToken: Token, endToken: Token, name: Token, parameters: Token[], body: Stmt[], varDecls: Token[]){\n super(startToken, endToken)\n this.name = name;\n this.parameters = parameters;\n this.body = body;\n this.varDecls = varDecls;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitFunctionDefStmt(this)\n }\n }\n export class SimpleExpr extends Stmt {\n expression: ExprNS.Expr;\n constructor(startToken: Token, endToken: Token, expression: ExprNS.Expr){\n super(startToken, endToken)\n this.expression = expression;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitSimpleExprStmt(this)\n }\n }\n export class FileInput extends Stmt {\n statements: Stmt[];\n varDecls: Token[];\n constructor(startToken: Token, endToken: Token, statements: Stmt[], varDecls: Token[]){\n super(startToken, endToken)\n this.statements = statements;\n this.varDecls = varDecls;\n }\n override accept(visitor: Visitor): any {\n return visitor.visitFileInputStmt(this)\n }\n }\n \n \n}\n","/*\n* Full disclosure: some of the functions and general layout of the file is\n* from my own implementation of a parser\n* in Rust.\n* https://github.com/Fidget-Spinner/crafting_interpreters/blob/main/rust/src/parser.rs\n*\n* That is in turn an implementation of the book \"Crafting Interpreters\" by\n* Robert Nystrom, which implements an interpreter in Java.\n* https://craftinginterpreters.com/parsing-expressions.html.\n* I've included the MIT license that code snippets from\n* the book is licensed under down below. See\n* https://github.com/munificent/craftinginterpreters/blob/master/LICENSE\n*\n*\n* My changes:\n* - The book was written in Java. I have written this in TypeScript.\n* - My Rust implementation uses pattern matching, but the visitor pattern is\n* used here.\n* - Additionally, the production rules are completely different\n* from the book as a whole different language is being parsed.\n*\n*\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to\n deal in the Software without restriction, including without limitation the\n rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n sell copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n IN THE SOFTWARE.\n**/\n\nimport { SPECIAL_IDENTIFIER_TOKENS, Token } from \"./tokenizer\";\nimport { TokenType } from \"./tokens\";\nimport { ExprNS, StmtNS } from \"./ast-types\";\nimport { ParserErrors } from \"./errors\";\n\ntype Expr = ExprNS.Expr;\ntype Stmt = StmtNS.Stmt;\n\nconst PSEUD_NAMES = [\n TokenType.TRUE,\n TokenType.FALSE,\n TokenType.NONE,\n]\n\nexport class Parser {\n private readonly source: string;\n private readonly tokens: Token[];\n private current: number;\n\n constructor(source: string, tokens: Token[]) {\n this.source = source;\n this.tokens = tokens;\n this.current = 0;\n }\n\n // Consumes tokens while tokenTypes matches.\n private match(...tokenTypes: TokenType[]): boolean {\n for (const tokenType of tokenTypes) {\n if (this.check(tokenType)) {\n this.advance();\n return true;\n }\n }\n return false;\n }\n\n private check(...type: TokenType[]): boolean {\n if (this.isAtEnd()) {\n return false;\n }\n for (const tokenType of type) {\n if (this.peek().type === tokenType) {\n return true;\n }\n }\n return false;\n }\n\n private advance(): Token {\n if (!this.isAtEnd()) {\n this.current += 1;\n }\n return this.previous();\n }\n\n private isAtEnd(): boolean {\n return this.peek().type === TokenType.ENDMARKER;\n }\n\n\n private peek(): Token {\n return this.tokens[this.current];\n }\n\n private previous(): Token {\n return this.tokens[this.current - 1];\n }\n\n private consume(type: TokenType, message: string): Token {\n if (this.check(type)) return this.advance();\n const token = this.tokens[this.current];\n throw new ParserErrors.ExpectedTokenError(this.source, token, message);\n }\n\n private synchronize() {\n this.advance();\n while (!this.isAtEnd()) {\n if (this.match(TokenType.NEWLINE)) {\n return false;\n }\n if (this.match(TokenType.FOR,\n TokenType.WHILE, TokenType.DEF,\n TokenType.IF, TokenType.ELIF,\n TokenType.ELSE, TokenType.RETURN)) {\n return true;\n }\n this.advance();\n }\n return false;\n }\n\n parse(): Stmt {\n return this.file_input();\n // return this.expression();\n }\n\n //// THE NAMES OF THE FOLLOWING FUNCTIONS FOLLOW THE PRODUCTION RULES IN THE GRAMMAR.\n //// HENCE THEIR NAMES MIGHT NOT BE COMPLIANT WITH CAMELCASE\n private file_input(): Stmt {\n const startToken = this.peek();\n const statements: Stmt[] = [];\n while (!this.isAtEnd()) {\n if (this.match(TokenType.NEWLINE) || this.match(TokenType.DEDENT)) {\n continue;\n }\n statements.push(this.stmt());\n }\n const endToken = this.peek();\n return new StmtNS.FileInput(startToken, endToken, statements, []);\n }\n\n private stmt(): Stmt {\n if (this.check(TokenType.DEF, TokenType.FOR, TokenType.IF, TokenType.WHILE)) {\n return this.compound_stmt();\n } else if (this.check(TokenType.NAME, ...PSEUD_NAMES, TokenType.NUMBER,\n TokenType.PASS, TokenType.BREAK, TokenType.CONTINUE, TokenType.MINUS, TokenType.PLUS, TokenType.INDENT, TokenType.DEDENT,\n TokenType.RETURN, TokenType.FROM, TokenType.GLOBAL, TokenType.NONLOCAL,\n TokenType.ASSERT, TokenType.LPAR, TokenType.STRING, TokenType.BIGINT, ...SPECIAL_IDENTIFIER_TOKENS)) {\n return this.simple_stmt();\n }\n const startToken = this.peek();\n const endToken = this.synchronize() ? this.previous() : this.peek();\n try {\n this.parse_invalid(startToken, endToken);\n } catch (e) {\n if (e instanceof ParserErrors.BaseParserError) {\n throw (e)\n }\n }\n throw new ParserErrors.GenericUnexpectedSyntaxError(startToken.line, startToken.col, this.source,\n startToken.indexInSource, endToken.indexInSource);\n }\n\n private compound_stmt(): Stmt {\n if (this.match(TokenType.IF)) {\n return this.if_stmt();\n } else if (this.match(TokenType.WHILE)) {\n return this.while_stmt();\n } else if (this.match(TokenType.FOR)) {\n return this.for_stmt();\n } else if (this.match(TokenType.DEF)) {\n return this.funcdef();\n }\n throw new Error(\"Unreachable code path\");\n }\n\n private if_stmt(): Stmt {\n const startToken = this.previous();\n let start = this.previous();\n let cond = this.test();\n this.consume(TokenType.COLON, \"Expected ':' after if\");\n let block = this.suite();\n let elseStmt = null;\n if (this.match(TokenType.ELIF)) {\n elseStmt = [this.if_stmt()];\n } else if (this.match(TokenType.ELSE)) {\n this.consume(TokenType.COLON, \"Expect ':' after else\");\n elseStmt = this.suite();\n } else {\n throw new ParserErrors.NoElseBlockError(this.source, start);\n }\n const endToken = this.previous();\n return new StmtNS.If(startToken, endToken, cond, block, elseStmt);\n }\n\n private while_stmt(): Stmt {\n const startToken = this.peek();\n let cond = this.test();\n this.consume(TokenType.COLON, \"Expected ':' after while\");\n let block = this.suite();\n const endToken = this.previous();\n return new StmtNS.While(startToken, endToken, cond, block);\n }\n\n private for_stmt(): Stmt {\n const startToken = this.peek();\n let target = this.advance();\n this.consume(TokenType.IN, \"Expected in after for\");\n let iter = this.test();\n this.consume(TokenType.COLON, \"Expected ':' after for\");\n let block = this.suite();\n const endToken = this.previous();\n return new StmtNS.For(startToken, endToken, target, iter, block);\n }\n\n private funcdef(): Stmt {\n const startToken = this.peek();\n let name = this.advance();\n let args = this.parameters();\n this.consume(TokenType.COLON, \"Expected ':' after def\");\n let block = this.suite();\n const endToken = this.previous();\n return new StmtNS.FunctionDef(startToken, endToken, name, args, block, []);\n }\n\n private simple_stmt(): Stmt {\n const startToken = this.peek();\n let res = null;\n if (this.match(TokenType.NAME)) {\n res = this.assign_stmt();\n } else if (this.match(TokenType.INDENT)) {\n res = new StmtNS.Indent(startToken, startToken);\n } else if (this.match(TokenType.DEDENT)) {\n res = new StmtNS.Dedent(startToken, startToken);\n } else if (this.match(TokenType.PASS)) {\n res = new StmtNS.Pass(startToken, startToken);\n } else if (this.match(TokenType.BREAK)) {\n res = new StmtNS.Break(startToken, startToken);\n } else if (this.match(TokenType.CONTINUE)) {\n res = new StmtNS.Continue(startToken, startToken);\n } else if (this.match(TokenType.RETURN)) {\n res = new StmtNS.Return(startToken, startToken, this.check(TokenType.NEWLINE) ? null : this.test());\n } else if (this.match(TokenType.FROM)) {\n res = this.import_from();\n } else if (this.match(TokenType.GLOBAL)) {\n res = new StmtNS.Global(startToken, startToken, this.advance());\n } else if (this.match(TokenType.NONLOCAL)) {\n res = new StmtNS.NonLocal(startToken, startToken, this.advance());\n } else if (this.match(TokenType.ASSERT)) {\n res = new StmtNS.Assert(startToken, startToken, this.test());\n } else if (this.check(TokenType.LPAR, TokenType.NUMBER, TokenType.STRING,\n TokenType.BIGINT, TokenType.MINUS, TokenType.PLUS, ...SPECIAL_IDENTIFIER_TOKENS)) {\n res = new StmtNS.SimpleExpr(startToken, startToken, this.test());\n } else {\n throw new Error(\"Unreachable code path\");\n }\n this.consume(TokenType.NEWLINE, \"Expected newline\");\n return res;\n }\n\n private assign_stmt(): Stmt {\n const startToken = this.previous();\n const name = this.previous();\n if (this.check(TokenType.COLON)) {\n const ann = this.test();\n this.consume(TokenType.EQUAL, \"Expect equal in assignment\");\n const expr = this.test();\n return new StmtNS.AnnAssign(startToken, this.previous(), name, expr, ann);\n } else if (this.check(TokenType.EQUAL)) {\n this.advance();\n const expr = this.test();\n return new StmtNS.Assign(startToken, this.previous(), name, expr);\n } else {\n this.current--;\n const expr = this.test();\n return new StmtNS.SimpleExpr(startToken, this.previous(), expr);\n }\n }\n\n private import_from(): Stmt {\n const startToken = this.previous();\n const module = this.advance();\n this.consume(TokenType.IMPORT, \"Expected import keyword\");\n let params;\n if (this.check(TokenType.NAME)) {\n params = [this.advance()];\n } else {\n params = this.parameters();\n }\n return new StmtNS.FromImport(startToken, this.previous(), module, params);\n }\n\n private parameters(): Token[] {\n this.consume(TokenType.LPAR, \"Expected opening parentheses\");\n let res = this.varparamslist();\n this.consume(TokenType.RPAR, \"Expected closing parentheses\");\n return res;\n }\n\n private test(): Expr {\n if (this.match(TokenType.LAMBDA)) {\n return this.lambdef();\n } else {\n const startToken = this.peek();\n let consequent = this.or_test();\n if (this.match(TokenType.IF)) {\n const predicate = this.or_test();\n this.consume(TokenType.ELSE, \"Expected else\")\n const alternative = this.test();\n return new ExprNS.Ternary(startToken, this.previous(), predicate, consequent, alternative);\n }\n return consequent;\n }\n }\n\n private lambdef(): Expr {\n const startToken = this.previous();\n let args = this.varparamslist();\n if (this.match(TokenType.COLON)) {\n let test = this.test();\n return new ExprNS.Lambda(startToken, this.previous(), args, test);\n } else if (this.match(TokenType.DOUBLECOLON)) {\n let block = this.suite();\n return new ExprNS.MultiLambda(startToken, this.previous(), args, block, []);\n }\n this.consume(TokenType.COLON, \"Expected ':' after lambda\");\n throw new Error(\"unreachable code path\");\n }\n\n private suite(): Stmt[] {\n let stmts = [];\n if (this.match(TokenType.NEWLINE)) {\n this.consume(TokenType.INDENT, \"Expected indent\");\n while (!this.match(TokenType.DEDENT)) {\n stmts.push(this.stmt());\n }\n }\n return stmts;\n }\n\n private varparamslist(): Token[] {\n let params = [];\n while (!this.check(TokenType.COLON) && !this.check(TokenType.RPAR)) {\n let name = this.consume(TokenType.NAME, \"Expected a proper identifier in parameter\");\n params.push(name);\n if (!this.match(TokenType.COMMA)) {\n break;\n }\n }\n return params;\n }\n\n private or_test(): Expr {\n const startToken = this.peek();\n let expr = this.and_test();\n while (this.match(TokenType.OR)) {\n const operator = this.previous();\n const right = this.and_test();\n expr = new ExprNS.BoolOp(startToken, this.previous(), expr, operator, right);\n }\n return expr;\n }\n\n private and_test(): Expr {\n const startToken = this.peek();\n let expr = this.not_test();\n while (this.match(TokenType.AND)) {\n const operator = this.previous();\n const right = this.not_test();\n expr = new ExprNS.BoolOp(startToken, this.previous(), expr, operator, right);\n }\n return expr;\n }\n\n private not_test(): Expr {\n const startToken = this.peek();\n if (this.match(TokenType.NOT, TokenType.BANG)) {\n const operator = this.previous();\n return new ExprNS.Unary(startToken, this.previous(), operator, this.not_test());\n }\n return this.comparison();\n }\n\n private comparison(): Expr {\n const startToken = this.peek();\n let expr = this.arith_expr();\n // @TODO: Add the rest of the comparisons\n while (this.match(\n TokenType.LESS,\n TokenType.GREATER,\n TokenType.DOUBLEEQUAL,\n TokenType.GREATEREQUAL,\n TokenType.LESSEQUAL,\n TokenType.NOTEQUAL,\n TokenType.IS,\n TokenType.ISNOT,\n TokenType.IN,\n TokenType.NOTIN,\n )) {\n const operator = this.previous();\n const right = this.arith_expr();\n expr = new ExprNS.Compare(startToken, this.previous(), expr, operator, right);\n }\n return expr;\n }\n\n private arith_expr(): Expr {\n const startToken = this.peek();\n let expr = this.term();\n while (this.match(TokenType.PLUS, TokenType.MINUS)) {\n const token = this.previous();\n const right = this.term();\n expr = new ExprNS.Binary(startToken, this.previous(), expr, token, right);\n }\n return expr;\n }\n\n private term(): Expr {\n const startToken = this.peek();\n let expr = this.factor();\n while (this.match(TokenType.STAR, TokenType.SLASH, TokenType.PERCENT, TokenType.DOUBLESLASH)) {\n const token = this.previous();\n const right = this.factor();\n expr = new ExprNS.Binary(startToken, this.previous(), expr, token, right);\n }\n return expr;\n }\n\n private factor(): Expr {\n const startToken = this.peek();\n if (this.match(TokenType.PLUS, TokenType.MINUS)) {\n const op = this.previous();\n const factor = this.factor();\n const endToken = this.previous();\n return new ExprNS.Unary(startToken, endToken, op, factor);\n }\n return this.power();\n }\n\n private power(): Expr {\n const startToken = this.peek();\n let expr = this.atom_expr();\n if (this.match(TokenType.DOUBLESTAR)) {\n const token = this.previous();\n const right = this.factor();\n const endToken = this.previous();\n return new ExprNS.Binary(startToken, endToken, expr, token, right);\n }\n return expr;\n }\n\n\n private atom_expr(): Expr {\n let startToken = this.peek();\n let ato = this.atom();\n let res;\n if (this.match(TokenType.LPAR)) {\n let args = this.arglist();\n const endToken = this.previous();\n res = new ExprNS.Call(startToken, endToken, ato, args);\n } else {\n return ato;\n }\n // To handle things like x()()()\n startToken = this.peek();\n while (this.match(TokenType.LPAR)) {\n let args = this.arglist();\n res = new ExprNS.Call(startToken, this.previous(), res, args);\n startToken = this.peek();\n }\n return res;\n }\n\n private arglist(): Expr[] {\n let args = [];\n while (!this.check(TokenType.RPAR)) {\n let arg = this.test();\n args.push(arg);\n if (!this.match(TokenType.COMMA)) {\n break;\n }\n }\n this.consume(TokenType.RPAR, \"Expected closing ')' after function application\");\n return args;\n }\n\n private atom(): Expr {\n const startToken = this.peek();\n if (this.match(TokenType.TRUE)) return new ExprNS.Literal(startToken, this.previous(), true);\n if (this.match(TokenType.FALSE)) return new ExprNS.Literal(startToken, this.previous(), false);\n if (this.match(TokenType.NONE)) return new ExprNS.None(startToken, this.previous());\n if (this.match(TokenType.STRING)) {\n return new ExprNS.Literal(startToken, this.previous(), this.previous().lexeme);\n }\n if (this.match(TokenType.NUMBER)) {\n return new ExprNS.Literal(startToken, this.previous(), Number(this.previous().lexeme.replace(/_/g, \"\")));\n }\n if (this.match(TokenType.BIGINT)) {\n return new ExprNS.BigIntLiteral(startToken, this.previous(), this.previous().lexeme);\n }\n if (this.match(TokenType.COMPLEX)) {\n return new ExprNS.Complex(startToken, this.previous(), this.previous().lexeme);\n }\n\n if (this.match(TokenType.NAME, ...PSEUD_NAMES)) {\n return new ExprNS.Variable(startToken, this.previous(), this.previous());\n }\n\n if (this.match(TokenType.LPAR)) {\n let expr = this.test();\n this.consume(TokenType.RPAR, \"Expected closing ')'\");\n return new ExprNS.Grouping(startToken, this.previous(), expr);\n }\n const startTokenInvalid = this.peek();\n this.synchronize();\n const endTokenInvalid = this.peek();\n throw new ParserErrors.GenericUnexpectedSyntaxError(startToken.line, startToken.col, this.source,\n startTokenInvalid.indexInSource, endTokenInvalid.indexInSource);\n }\n\n //// INVALID RULES\n private parse_invalid(startToken: Token, endToken: Token) {\n // @TODO invalid rules\n\n }\n}\n\n","/*\n* Translate our AST to estree AST (Source's AST)\n* */\n\nimport { StmtNS, ExprNS } from \"./ast-types\";\n\ntype Expr = ExprNS.Expr;\ntype Stmt = StmtNS.Stmt;\nimport { Token } from \"./tokenizer\";\nimport { TokenType } from \"./tokens\";\n\nimport {\n ArrowFunctionExpression,\n AssignmentExpression,\n BaseNode,\n BigIntLiteral,\n BinaryExpression,\n BinaryOperator,\n BlockStatement,\n BreakStatement,\n CallExpression,\n ConditionalExpression,\n ContinueStatement,\n EmptyStatement,\n Expression,\n ExpressionStatement,\n FunctionDeclaration,\n Identifier,\n IfStatement,\n ImportDeclaration, ImportSpecifier,\n LogicalExpression,\n LogicalOperator,\n Program,\n ReturnStatement,\n SimpleLiteral,\n Statement,\n UnaryExpression,\n UnaryOperator,\n VariableDeclaration,\n VariableDeclarator,\n WhileStatement\n} from \"estree\";\nimport { TranslatorErrors } from \"./errors\";\nimport { ComplexLiteral, None } from \"./types\";\n// import { isEmpty } from \"lodash\";\n\nexport interface EstreePosition {\n line: number;\n column: number;\n}\n\nexport interface EstreeLocation {\n source: string,\n start: EstreePosition;\n end: EstreePosition;\n}\n\nexport class Translator implements StmtNS.Visitor, ExprNS.Visitor {\n private readonly source: string\n\n constructor(source: string) {\n this.source = source;\n }\n\n private tokenToEstreeLocation(token: Token): EstreeLocation {\n // Convert zero-based to one-based.\n const line = token.line + 1;\n const start: EstreePosition = {\n line,\n column: token.col - token.lexeme.length\n };\n const end: EstreePosition = {\n line,\n column: token.col\n }\n const source: string = token.lexeme;\n return { source, start, end };\n }\n\n private toEstreeLocation(stmt: Stmt | Expr): EstreeLocation {\n const start: EstreePosition = {\n // Convert zero-based to one-based.\n line: stmt.startToken.line + 1,\n column: stmt.startToken.col - stmt.startToken.lexeme.length\n };\n const end: EstreePosition = {\n // Convert zero-based to one-based.\n line: stmt.endToken.line + 1,\n column: stmt.endToken.col\n }\n const source: string = this.source.slice(stmt.startToken.indexInSource,\n stmt.endToken.indexInSource + stmt.endToken.lexeme.length);\n return { source, start, end };\n }\n\n resolve(stmt: Stmt | Expr): Statement | Expression {\n return stmt.accept(this);\n }\n\n // Ugly, but just to support proper typing\n resolveStmt(stmt: Stmt) {\n return stmt.accept(this);\n }\n\n resolveManyStmt(stmts: Stmt[]): Statement[] {\n const res = [];\n for (const stmt of stmts) {\n res.push(this.resolveStmt(stmt))\n }\n return res;\n }\n\n resolveExpr(expr: Expr) {\n return expr.accept(this);\n }\n\n resolveManyExpr(exprs: Expr[]) {\n const res = [];\n for (const expr of exprs) {\n res.push(this.resolveExpr(expr))\n }\n return res;\n }\n\n\n // Converts our internal identifier to estree identifier.\n private rawStringToIdentifier(name: string, stmtOrExpr: Stmt | Expr): Identifier {\n const keywords = new Set(['abstract', 'arguments', 'await', 'boolean', 'byte',\n 'case', 'catch', 'char', 'const', 'debugger', 'default', 'delete', 'do', 'double', 'enum',\n 'eval', 'export', 'extends', 'false', 'final', 'float', 'function', 'goto', 'implements',\n 'instanceof', 'int', 'interface', 'let', 'long', 'native', 'new', 'null', 'package',\n 'private', 'protected', 'public', 'short', 'static', 'super', 'switch', 'synchronized', 'this',\n 'throw', 'throws', 'transient', 'true', 'typeof', 'var', 'void', 'volatile'])\n\n return {\n type: 'Identifier',\n name: keywords.has(name) ? '$' + name : name,\n loc: this.toEstreeLocation(stmtOrExpr),\n };\n }\n\n // Token to estree identifier.\n private convertToIdentifier(name: Token): Identifier {\n const keywords = new Set(['abstract', 'arguments', 'await', 'boolean', 'byte',\n 'case', 'catch', 'char', 'const', 'debugger', 'default', 'delete', 'do', 'double', 'enum',\n 'eval', 'export', 'extends', 'false', 'final', 'float', 'function', 'goto', 'implements',\n 'instanceof', 'int', 'interface', 'let', 'long', 'native', 'new', 'null', 'package',\n 'private', 'protected', 'public', 'short', 'static', 'super', 'switch', 'synchronized', 'this',\n 'throw', 'throws', 'transient', 'true', 'typeof', 'var', 'void', 'volatile'])\n\n return {\n type: 'Identifier',\n name: keywords.has(name.lexeme) ? '$' + name.lexeme : name.lexeme,\n loc: this.tokenToEstreeLocation(name),\n };\n }\n\n private convertToIdentifiers(names: Token[]): Identifier[] {\n return names.map(name => this.convertToIdentifier(name));\n }\n\n // private convertToExpressionStatement(expr: Expression): ExpressionStatement {\n // return {\n // type: 'ExpressionStatement',\n // expression: expr,\n // // loc: this.toEstreeLocation(),\n // }\n // }\n\n // private converTokenstoDecls(varDecls: Token[]): VariableDeclaration {\n // return {\n // type: 'VariableDeclaration',\n // declarations: varDecls?.map((token): VariableDeclarator => {\n // return {\n // type: 'VariableDeclarator',\n // id: this.convertToIdentifier(token),\n // loc: this.tokenToEstreeLocation(token),\n // }\n // }),\n // kind: 'var',\n // loc: this.toEstreeLocation(),\n // };\n // }\n\n // Wraps an array of statements to a block.\n // WARNING: THIS CREATES A NEW BLOCK IN\n // JS AST. THIS ALSO MEANS A NEW NAMESPACE. BE CAREFUL!\n private wrapInBlock(stmt: Stmt, stmts: StmtNS.Stmt[]): BlockStatement {\n return {\n type: 'BlockStatement',\n body: this.resolveManyStmt(stmts),\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n //// STATEMENTS\n\n visitFileInputStmt(stmt: StmtNS.FileInput): Program {\n const newBody = this.resolveManyStmt(stmt.statements);\n // if (stmt.varDecls !== null && stmt.varDecls.length > 0) {\n // const decls = this.converTokenstoDecls(stmt.varDecls);\n // newBody.unshift(decls);\n // }\n return {\n type: 'Program',\n sourceType: 'module',\n body: newBody,\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n visitIndentCreation(stmt: StmtNS.Indent): EmptyStatement {\n return {\n type: 'EmptyStatement',\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n visitDedentCreation(stmt: StmtNS.Dedent): EmptyStatement {\n return {\n type: 'EmptyStatement',\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n visitFunctionDefStmt(stmt: StmtNS.FunctionDef): FunctionDeclaration {\n const newBody = this.resolveManyStmt(stmt.body);\n // if (stmt.varDecls !== null && stmt.varDecls.length > 0) {\n // const decls = this.converTokenstoDecls(stmt.varDecls);\n // newBody.unshift(decls);\n // }\n return {\n type: 'FunctionDeclaration',\n id: this.convertToIdentifier(stmt.name),\n params: this.convertToIdentifiers(stmt.parameters),\n body: {\n type: 'BlockStatement',\n body: newBody,\n },\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n visitAnnAssignStmt(stmt: StmtNS.AnnAssign): AssignmentExpression {\n return {\n type: 'AssignmentExpression',\n // We only have one type of assignment in restricted Python.\n operator: '=',\n left: this.convertToIdentifier(stmt.name),\n right: this.resolveExpr(stmt.value),\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n // Note: assignments are expressions in JS.\n visitAssignStmt(stmt: StmtNS.Assign): VariableDeclaration {\n // return this.convertToExpressionStatement({\n // type: 'AssignmentExpression',\n // // We only have one type of assignment in restricted Python.\n // operator: '=',\n // left: this.convertToIdentifier(stmt.name),\n // right: this.resolveExpr(stmt.value),\n // loc: this.toEstreeLocation(stmt),\n // })\n const declaration: VariableDeclarator = {\n type: 'VariableDeclarator',\n id: this.convertToIdentifier(stmt.name),\n loc: this.tokenToEstreeLocation(stmt.name),\n init: this.resolveExpr(stmt.value),\n }\n return {\n type: 'VariableDeclaration',\n declarations: [declaration],\n // Note: we abuse the fact that var is function and module scoped\n // which is exactly the same as how Python assignments are scoped!\n kind: 'var',\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n // Convert to source's built-in assert function.\n visitAssertStmt(stmt: StmtNS.Assert): CallExpression {\n return {\n type: 'CallExpression',\n optional: false,\n callee: this.rawStringToIdentifier('assert', stmt),\n arguments: [this.resolveExpr(stmt.value)],\n // @TODO, this needs to come after callee\n loc: this.toEstreeLocation(stmt),\n }\n }\n\n // @TODO decide how to do for loops\n // For now, empty block\n visitForStmt(stmt: StmtNS.For): EmptyStatement {\n return {\n type: 'EmptyStatement',\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n visitIfStmt(stmt: StmtNS.If): IfStatement {\n return {\n type: 'IfStatement',\n test: this.resolveExpr(stmt.condition),\n consequent: this.wrapInBlock(stmt, stmt.body),\n alternate: stmt.elseBlock !== null ? this.wrapInBlock(stmt, stmt.elseBlock) : null,\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n visitGlobalStmt(stmt: StmtNS.Global): EmptyStatement {\n return {\n type: 'EmptyStatement',\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n visitNonLocalStmt(stmt: StmtNS.NonLocal): EmptyStatement {\n return {\n type: 'EmptyStatement',\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n visitReturnStmt(stmt: StmtNS.Return): ReturnStatement {\n return {\n type: 'ReturnStatement',\n argument: stmt.value == null ? null : this.resolveExpr(stmt.value),\n loc: this.toEstreeLocation(stmt),\n };\n }\n\n visitWhileStmt(stmt: StmtNS.While): WhileStatement {\n return {\n type: 'WhileStatement',\n test: this.resolveExpr(stmt.condition),\n body: this.wrapInBlock(stmt, stmt.body),\n loc: this.toEstreeLocation(stmt),\n }\n }\n\n visitSimpleExprStmt(stmt: StmtNS.SimpleExpr): ExpressionStatement {\n return {\n type: 'ExpressionStatement',\n expression: this.resolveExpr(stmt.expression),\n loc: this.toEstreeLocation(stmt),\n }\n }\n\n // @TODO\n visitFromImportStmt(stmt: StmtNS.FromImport): ImportDeclaration {\n const specifiers: ImportSpecifier[] = stmt.names.map(name => {\n const ident = this.convertToIdentifier(name);\n return {\n type: 'ImportSpecifier',\n imported: ident,\n local: ident,\n }\n });\n return {\n type: 'ImportDeclaration',\n specifiers: specifiers,\n source: {\n type: 'Literal',\n value: stmt.module.lexeme,\n loc: this.tokenToEstreeLocation(stmt.module)\n },\n attributes: []\n }\n }\n\n visitContinueStmt(stmt: StmtNS.Continue): ContinueStatement {\n return {\n type: 'ContinueStatement',\n loc: this.toEstreeLocation(stmt),\n }\n }\n\n visitBreakStmt(stmt: StmtNS.Break): BreakStatement {\n return {\n type: 'BreakStatement',\n loc: this.toEstreeLocation(stmt),\n }\n }\n\n visitPassStmt(stmt: StmtNS.Pass): EmptyStatement {\n return {\n type: 'EmptyStatement',\n loc: this.toEstreeLocation(stmt),\n }\n }\n\n\n //// EXPRESSIONS\n visitVariableExpr(expr: ExprNS.Variable): Identifier {\n return this.convertToIdentifier(expr.name);\n }\n\n visitLambdaExpr(expr: ExprNS.Lambda): ArrowFunctionExpression {\n return {\n type: 'ArrowFunctionExpression',\n expression: true,\n params: this.convertToIdentifiers(expr.parameters),\n body: this.resolveExpr(expr.body),\n loc: this.toEstreeLocation(expr),\n }\n }\n\n // disabled for now\n visitMultiLambdaExpr(expr: ExprNS.MultiLambda): EmptyStatement {\n return {\n type: 'EmptyStatement',\n loc: this.toEstreeLocation(expr),\n }\n }\n\n visitUnaryExpr(expr: ExprNS.Unary): UnaryExpression | CallExpression {\n const op = expr.operator.type;\n let res: UnaryOperator = '-';\n let plus = false;\n switch (op) {\n case TokenType.NOT:\n res = '!'\n break;\n case TokenType.PLUS:\n res = '+';\n plus = true;\n break;\n case TokenType.MINUS:\n res = '-'\n break;\n default:\n throw new Error(\"Unreachable code path in translator\");\n }\n if (plus) {\n return {\n type: 'CallExpression',\n optional: false,\n callee: {\n type: 'Identifier',\n name: '__py_unary_plus',\n loc: this.toEstreeLocation(expr),\n },\n arguments: [this.resolveExpr(expr.right)],\n loc: this.toEstreeLocation(expr),\n }\n }\n return {\n type: 'UnaryExpression',\n // To satisfy the type checker.\n operator: res,\n prefix: true,\n argument: this.resolveExpr(expr.right),\n loc: this.toEstreeLocation(expr),\n }\n }\n\n visitGroupingExpr(expr: ExprNS.Grouping): Expression {\n return this.resolveExpr(expr.expression);\n }\n\n visitBinaryExpr(expr: ExprNS.Binary): CallExpression {\n const op = expr.operator.type;\n let res = '';\n // To make the type checker happy.\n switch (op) {\n case TokenType.PLUS:\n res = '__py_adder';\n break;\n case TokenType.MINUS:\n res = '__py_minuser';\n break;\n case TokenType.STAR:\n res = '__py_multiplier';\n break;\n case TokenType.SLASH:\n res = '__py_divider';\n break;\n case TokenType.PERCENT:\n res = '__py_modder';\n break;\n // @TODO double slash and power needs to convert to math exponent/floor divide\n case TokenType.DOUBLESLASH:\n res = '__py_floorer';\n break;\n case TokenType.DOUBLESTAR:\n res = '__py_powerer';\n break;\n default:\n throw new Error(\"Unreachable binary code path in translator\");\n }\n return {\n type: 'CallExpression',\n optional: false,\n callee: {\n type: 'Identifier',\n name: res,\n loc: this.toEstreeLocation(expr),\n },\n arguments: [this.resolveExpr(expr.left), this.resolveExpr(expr.right)],\n loc: this.toEstreeLocation(expr),\n }\n }\n\n visitCompareExpr(expr: ExprNS.Compare): BinaryExpression {\n const op = expr.operator.type;\n let res: BinaryOperator = '+';\n // To make the type checker happy.\n switch (op) {\n case TokenType.LESS:\n res = '<';\n break;\n case TokenType.GREATER:\n res = '>';\n break;\n case TokenType.DOUBLEEQUAL:\n res = '===';\n break;\n case TokenType.GREATEREQUAL:\n res = '>=';\n break;\n case TokenType.LESSEQUAL:\n res = '<=';\n break;\n case TokenType.NOTEQUAL:\n res = '!==';\n break;\n // @TODO we need to convert these to builtin function applications.\n case TokenType.IS:\n case TokenType.ISNOT:\n case TokenType.IN:\n case TokenType.NOTIN:\n throw new TranslatorErrors.UnsupportedOperator(expr.operator.line, expr.operator.col, this.source, expr.operator.indexInSource);\n default:\n throw new Error(\"Unreachable binary code path in translator\");\n }\n return {\n type: 'BinaryExpression',\n operator: res,\n left: this.resolveExpr(expr.left),\n right: this.resolveExpr(expr.right),\n loc: this.toEstreeLocation(expr),\n }\n }\n\n visitBoolOpExpr(expr: ExprNS.BoolOp): LogicalExpression {\n const op = expr.operator.type;\n let res: LogicalOperator = '||';\n // To make the type checker happy.\n switch (op) {\n case TokenType.AND:\n res = '&&';\n break;\n case TokenType.OR:\n res = '||';\n break;\n default:\n throw new Error(\"Unreachable binary code path in translator\");\n }\n return {\n type: 'LogicalExpression',\n operator: res,\n left: this.resolveExpr(expr.left),\n right: this.resolveExpr(expr.right),\n loc: this.toEstreeLocation(expr),\n }\n }\n\n visitCallExpr(expr: ExprNS.Call): CallExpression {\n return {\n type: 'CallExpression',\n optional: false,\n callee: this.resolveExpr(expr.callee),\n arguments: this.resolveManyExpr(expr.args),\n loc: this.toEstreeLocation(expr),\n }\n }\n\n visitTernaryExpr(expr: ExprNS.Ternary): ConditionalExpression {\n return {\n type: 'ConditionalExpression',\n test: this.resolveExpr(expr.predicate),\n alternate: this.resolveExpr(expr.alternative),\n consequent: this.resolveExpr(expr.consequent),\n loc: this.toEstreeLocation(expr),\n }\n }\n\n visitLiteralExpr(expr: ExprNS.Literal): SimpleLiteral {\n return {\n type: 'Literal',\n value: expr.value,\n loc: this.toEstreeLocation(expr),\n }\n }\n\n visitBigIntLiteralExpr(expr: ExprNS.BigIntLiteral): BigIntLiteral {\n return {\n type: 'Literal',\n bigint: expr.value,\n loc: this.toEstreeLocation(expr),\n }\n }\n\n visitNoneExpr(expr: ExprNS.None): None {\n return {\n type: 'NoneType',\n loc: this.toEstreeLocation(expr)\n }\n }\n\n visitComplexExpr(expr: ExprNS.Complex): ComplexLiteral {\n return {\n type: 'Literal',\n \n complex: {\n real: expr.value.real,\n imag: expr.value.imag\n },\n \n loc: this.toEstreeLocation(expr),\n }\n }\n}\n","const peq = new Uint32Array(0x10000);\nconst myers_32 = (a, b) => {\n const n = a.length;\n const m = b.length;\n const lst = 1 << (n - 1);\n let pv = -1;\n let mv = 0;\n let sc = n;\n let i = n;\n while (i--) {\n peq[a.charCodeAt(i)] |= 1 << i;\n }\n for (i = 0; i < m; i++) {\n let eq = peq[b.charCodeAt(i)];\n const xv = eq | mv;\n eq |= ((eq & pv) + pv) ^ pv;\n mv |= ~(eq | pv);\n pv &= eq;\n if (mv & lst) {\n sc++;\n }\n if (pv & lst) {\n sc--;\n }\n mv = (mv << 1) | 1;\n pv = (pv << 1) | ~(xv | mv);\n mv &= xv;\n }\n i = n;\n while (i--) {\n peq[a.charCodeAt(i)] = 0;\n }\n return sc;\n};\nconst myers_x = (b, a) => {\n const n = a.length;\n const m = b.length;\n const mhc = [];\n const phc = [];\n const hsize = Math.ceil(n / 32);\n const vsize = Math.ceil(m / 32);\n for (let i = 0; i < hsize; i++) {\n phc[i] = -1;\n mhc[i] = 0;\n }\n let j = 0;\n for (; j < vsize - 1; j++) {\n let mv = 0;\n let pv = -1;\n const start = j * 32;\n const vlen = Math.min(32, m) + start;\n for (let k = start; k < vlen; k++) {\n peq[b.charCodeAt(k)] |= 1 << k;\n }\n for (let i = 0; i < n; i++) {\n const eq = peq[a.charCodeAt(i)];\n const pb = (phc[(i / 32) | 0] >>> i) & 1;\n const mb = (mhc[(i / 32) | 0] >>> i) & 1;\n const xv = eq | mv;\n const xh = ((((eq | mb) & pv) + pv) ^ pv) | eq | mb;\n let ph = mv | ~(xh | pv);\n let mh = pv & xh;\n if ((ph >>> 31) ^ pb) {\n phc[(i / 32) | 0] ^= 1 << i;\n }\n if ((mh >>> 31) ^ mb) {\n mhc[(i / 32) | 0] ^= 1 << i;\n }\n ph = (ph << 1) | pb;\n mh = (mh << 1) | mb;\n pv = mh | ~(xv | ph);\n mv = ph & xv;\n }\n for (let k = start; k < vlen; k++) {\n peq[b.charCodeAt(k)] = 0;\n }\n }\n let mv = 0;\n let pv = -1;\n const start = j * 32;\n const vlen = Math.min(32, m - start) + start;\n for (let k = start; k < vlen; k++) {\n peq[b.charCodeAt(k)] |= 1 << k;\n }\n let score = m;\n for (let i = 0; i < n; i++) {\n const eq = peq[a.charCodeAt(i)];\n const pb = (phc[(i / 32) | 0] >>> i) & 1;\n const mb = (mhc[(i / 32) | 0] >>> i) & 1;\n const xv = eq | mv;\n const xh = ((((eq | mb) & pv) + pv) ^ pv) | eq | mb;\n let ph = mv | ~(xh | pv);\n let mh = pv & xh;\n score += (ph >>> (m - 1)) & 1;\n score -= (mh >>> (m - 1)) & 1;\n if ((ph >>> 31) ^ pb) {\n phc[(i / 32) | 0] ^= 1 << i;\n }\n if ((mh >>> 31) ^ mb) {\n mhc[(i / 32) | 0] ^= 1 << i;\n }\n ph = (ph << 1) | pb;\n mh = (mh << 1) | mb;\n pv = mh | ~(xv | ph);\n mv = ph & xv;\n }\n for (let k = start; k < vlen; k++) {\n peq[b.charCodeAt(k)] = 0;\n }\n return score;\n};\nconst distance = (a, b) => {\n if (a.length < b.length) {\n const tmp = b;\n b = a;\n a = tmp;\n }\n if (b.length === 0) {\n return a.length;\n }\n if (a.length <= 32) {\n return myers_32(a, b);\n }\n return myers_x(a, b);\n};\nconst closest = (str, arr) => {\n let min_distance = Infinity;\n let min_index = 0;\n for (let i = 0; i < arr.length; i++) {\n const dist = distance(str, arr[i]);\n if (dist < min_distance) {\n min_distance = dist;\n min_index = i;\n }\n }\n return arr[min_index];\n};\nexport { closest, distance };\n","(function() {\n 'use strict';\n \n var collator;\n try {\n collator = (typeof Intl !== \"undefined\" && typeof Intl.Collator !== \"undefined\") ? Intl.Collator(\"generic\", { sensitivity: \"base\" }) : null;\n } catch (err){\n console.log(\"Collator could not be initialized and wouldn't be used\");\n }\n\n var levenshtein = require('fastest-levenshtein');\n\n // arrays to re-use\n var prevRow = [],\n str2Char = [];\n \n /**\n * Based on the algorithm at http://en.wikipedia.org/wiki/Levenshtein_distance.\n */\n var Levenshtein = {\n /**\n * Calculate levenshtein distance of the two strings.\n *\n * @param str1 String the first string.\n * @param str2 String the second string.\n * @param [options] Additional options.\n * @param [options.useCollator] Use `Intl.Collator` for locale-sensitive string comparison.\n * @return Integer the levenshtein distance (0 and above).\n */\n get: function(str1, str2, options) {\n var useCollator = (options && collator && options.useCollator);\n \n if (useCollator) {\n var str1Len = str1.length,\n str2Len = str2.length;\n \n // base cases\n if (str1Len === 0) return str2Len;\n if (str2Len === 0) return str1Len;\n\n // two rows\n var curCol, nextCol, i, j, tmp;\n\n // initialise previous row\n for (i=0; i tmp) {\n nextCol = tmp;\n }\n // deletion\n tmp = prevRow[j + 1] + 1;\n if (nextCol > tmp) {\n nextCol = tmp;\n }\n\n // copy current col value into previous (in preparation for next iteration)\n prevRow[j] = curCol;\n }\n\n // copy last col value into previous (in preparation for next iteration)\n prevRow[j] = nextCol;\n }\n return nextCol;\n }\n return levenshtein.distance(str1, str2);\n }\n\n };\n\n // amd\n if (typeof define !== \"undefined\" && define !== null && define.amd) {\n define(function() {\n return Levenshtein;\n });\n }\n // commonjs\n else if (typeof module !== \"undefined\" && module !== null && typeof exports !== \"undefined\" && module.exports === exports) {\n module.exports = Levenshtein;\n }\n // web worker\n else if (typeof self !== \"undefined\" && typeof self.postMessage === 'function' && typeof self.importScripts === 'function') {\n self.Levenshtein = Levenshtein;\n }\n // browser main thread\n else if (typeof window !== \"undefined\" && window !== null) {\n window.Levenshtein = Levenshtein;\n }\n}());\n","import { StmtNS, ExprNS } from \"./ast-types\";\ntype Expr = ExprNS.Expr;\ntype Stmt = StmtNS.Stmt;\nimport { Token } from \"./tokenizer\";\nimport { TokenType } from \"./tokens\";\nimport { ResolverErrors } from \"./errors\";\n\nimport levenshtein from 'fast-levenshtein';\n// const levenshtein = require('fast-levenshtein');\n\nconst RedefineableTokenSentinel = new Token(TokenType.AT, \"\", 0, 0, 0);\n\nclass Environment {\n source: string;\n // The parent of this environment\n enclosing: Environment | null;\n names: Map;\n // Function names in the environment.\n functions: Set;\n // Names that are from import bindings, like 'y' in `from x import y`.\n // This only set at the top level environment. Child environments do not\n // copy this field.\n moduleBindings: Set;\n constructor(source: string, enclosing: Environment | null, names: Map) {\n this.source = source;\n this.enclosing = enclosing;\n this.names = names;\n this.functions = new Set();\n this.moduleBindings = new Set();\n }\n\n /*\n * Does a full lookup up the environment chain for a name.\n * Returns the distance of the name from the current environment.\n * If name isn't found, return -1.\n * */\n lookupName(identifier: Token): number {\n const name = identifier.lexeme;\n let distance = 0;\n let curr: Environment | null = this;\n while (curr !== null) {\n if (curr.names.has(name)) {\n break;\n }\n distance += 1;\n curr = curr.enclosing;\n }\n return (curr === null) ? -1 : distance;\n }\n\n /* Looks up the name but only for the current environment. */\n lookupNameCurrentEnv(identifier: Token): Token | undefined {\n return this.names.get(identifier.lexeme);\n }\n lookupNameCurrentEnvWithError(identifier: Token) {\n if (this.lookupName(identifier) < 0) {\n throw new ResolverErrors.NameNotFoundError(identifier.line, identifier.col,\n this.source,\n identifier.indexInSource,\n identifier.indexInSource + identifier.lexeme.length,\n this.suggestName(identifier));\n }\n }\n lookupNameParentEnvWithError(identifier: Token) {\n const name = identifier.lexeme;\n let parent = this.enclosing;\n if (parent === null || !parent.names.has(name)) {\n throw new ResolverErrors.NameNotFoundError(identifier.line, identifier.col,\n this.source,\n identifier.indexInSource,\n identifier.indexInSource + name.length,\n this.suggestName(identifier));\n }\n\n }\n declareName(identifier: Token) {\n const lookup = this.lookupNameCurrentEnv(identifier);\n if (lookup !== undefined && lookup !== RedefineableTokenSentinel) {\n throw new ResolverErrors.NameReassignmentError(identifier.line, identifier.col,\n this.source,\n identifier.indexInSource,\n identifier.indexInSource + identifier.lexeme.length,\n lookup);\n\n }\n this.names.set(identifier.lexeme, identifier);\n }\n // Same as declareName but allowed to re-declare later.\n declarePlaceholderName(identifier: Token) {\n const lookup = this.lookupNameCurrentEnv(identifier);\n if (lookup !== undefined) {\n throw new ResolverErrors.NameReassignmentError(identifier.line, identifier.col,\n this.source,\n identifier.indexInSource,\n identifier.indexInSource + identifier.lexeme.length,\n lookup);\n\n }\n this.names.set(identifier.lexeme, RedefineableTokenSentinel);\n } \n suggestNameCurrentEnv(identifier: Token): string | null {\n const name = identifier.lexeme;\n let minDistance = Infinity;\n let minName = null;\n for (const declName of this.names.keys()) {\n const dist = levenshtein.get(name, declName);\n if (dist < minDistance) {\n minDistance = dist;\n minName = declName;\n }\n }\n return minName;\n }\n /*\n * Finds name closest to name in all environments up to builtin environment.\n * Calculated using min levenshtein distance.\n * */\n suggestName(identifier: Token): string | null {\n const name = identifier.lexeme;\n let minDistance = Infinity;\n let minName = null;\n let curr: Environment | null = this;\n while (curr !== null) {\n for (const declName of curr.names.keys()) {\n const dist = levenshtein.get(name, declName);\n if (dist < minDistance) {\n minDistance = dist;\n minName = declName;\n }\n }\n curr = curr.enclosing;\n }\n if (minDistance >= 4) {\n // This is pretty far, so just return null\n return null;\n }\n return minName;\n }\n\n}\nexport class Resolver implements StmtNS.Visitor, ExprNS.Visitor {\n source: string;\n ast: Stmt;\n // change the environment to be suite scope as in python\n environment: Environment | null;\n functionScope: Environment | null;\n constructor(source: string, ast: Stmt) {\n this.source = source;\n this.ast = ast;\n // The global environment\n this.environment = new Environment(source, null, new Map([\n // misc library\n [\"_int\", new Token(TokenType.NAME, \"_int\", 0, 0, 0)],\n [\"_int_from_string\", new Token(TokenType.NAME, \"_int_from_string\", 0, 0, 0)],\n [\"abs\", new Token(TokenType.NAME, \"abs\", 0, 0, 0)],\n [\"char_at\", new Token(TokenType.NAME, \"char_at\", 0, 0, 0)],\n [\"error\", new Token(TokenType.NAME, \"error\", 0, 0, 0)],\n [\"input\", new Token(TokenType.NAME, \"input\", 0, 0, 0)],\n [\"isinstance\", new Token(TokenType.NAME, \"isinstance\", 0, 0, 0)],\n [\"max\", new Token(TokenType.NAME, \"max\", 0, 0, 0)],\n [\"min\", new Token(TokenType.NAME, \"min\", 0, 0, 0)],\n [\"print\", new Token(TokenType.NAME, \"print\", 0, 0, 0)],\n [\"random_random\", new Token(TokenType.NAME, \"random_random\", 0, 0, 0)],\n [\"round\", new Token(TokenType.NAME, \"round\", 0, 0, 0)],\n [\"str\", new Token(TokenType.NAME, \"str\", 0, 0, 0)],\n [\"time_time\", new Token(TokenType.NAME, \"time_time\", 0, 0, 0)], \n \n // math constants\n [\"math_pi\", new Token(TokenType.NAME, \"math_pi\", 0, 0, 0)],\n [\"math_e\", new Token(TokenType.NAME, \"math_e\", 0, 0, 0)],\n [\"math_inf\", new Token(TokenType.NAME, \"math_inf\", 0, 0, 0)],\n [\"math_nan\", new Token(TokenType.NAME, \"math_nan\", 0, 0, 0)],\n [\"math_tau\", new Token(TokenType.NAME, \"math_tau\", 0, 0, 0)],\n \n // math library\n [\"math_acos\", new Token(TokenType.NAME, \"math_acos\", 0, 0, 0)],\n [\"math_acosh\", new Token(TokenType.NAME, \"math_acosh\", 0, 0, 0)],\n [\"math_asin\", new Token(TokenType.NAME, \"math_asin\", 0, 0, 0)],\n [\"math_asinh\", new Token(TokenType.NAME, \"math_asinh\", 0, 0, 0)],\n [\"math_atan\", new Token(TokenType.NAME, \"math_atan\", 0, 0, 0)],\n [\"math_atan2\", new Token(TokenType.NAME, \"math_atan2\", 0, 0, 0)],\n [\"math_atanh\", new Token(TokenType.NAME, \"math_atanh\", 0, 0, 0)],\n [\"math_cbrt\", new Token(TokenType.NAME, \"math_cbrt\", 0, 0, 0)],\n [\"math_ceil\", new Token(TokenType.NAME, \"math_ceil\", 0, 0, 0)],\n [\"math_comb\", new Token(TokenType.NAME, \"math_comb\", 0, 0, 0)],\n [\"math_copysign\", new Token(TokenType.NAME, \"math_copysign\", 0, 0, 0)],\n [\"math_cos\", new Token(TokenType.NAME, \"math_cos\", 0, 0, 0)],\n [\"math_cosh\", new Token(TokenType.NAME, \"math_cosh\", 0, 0, 0)],\n [\"math_degrees\", new Token(TokenType.NAME, \"math_degrees\", 0, 0, 0)],\n [\"math_erf\", new Token(TokenType.NAME, \"math_erf\", 0, 0, 0)],\n [\"math_erfc\", new Token(TokenType.NAME, \"math_erfc\", 0, 0, 0)],\n [\"math_exp\", new Token(TokenType.NAME, \"math_exp\", 0, 0, 0)],\n [\"math_exp2\", new Token(TokenType.NAME, \"math_exp2\", 0, 0, 0)],\n [\"math_expm1\", new Token(TokenType.NAME, \"math_expm1\", 0, 0, 0)],\n [\"math_fabs\", new Token(TokenType.NAME, \"math_fabs\", 0, 0, 0)],\n [\"math_factorial\", new Token(TokenType.NAME, \"math_factorial\", 0, 0, 0)],\n [\"math_floor\", new Token(TokenType.NAME, \"math_floor\", 0, 0, 0)],\n [\"math_fma\", new Token(TokenType.NAME, \"math_fma\", 0, 0, 0)],\n [\"math_fmod\", new Token(TokenType.NAME, \"math_fmod\", 0, 0, 0)],\n [\"math_gamma\", new Token(TokenType.NAME, \"math_gamma\", 0, 0, 0)],\n [\"math_gcd\", new Token(TokenType.NAME, \"math_gcd\", 0, 0, 0)],\n [\"math_isfinite\", new Token(TokenType.NAME, \"math_isfinite\", 0, 0, 0)],\n [\"math_isinf\", new Token(TokenType.NAME, \"math_isinf\", 0, 0, 0)],\n [\"math_isnan\", new Token(TokenType.NAME, \"math_isnan\", 0, 0, 0)],\n [\"math_isqrt\", new Token(TokenType.NAME, \"math_isqrt\", 0, 0, 0)],\n [\"math_lcm\", new Token(TokenType.NAME, \"math_lcm\", 0, 0, 0)],\n [\"math_ldexp\", new Token(TokenType.NAME, \"math_ldexp\", 0, 0, 0)],\n [\"math_lgamma\", new Token(TokenType.NAME, \"math_lgamma\", 0, 0, 0)],\n [\"math_log\", new Token(TokenType.NAME, \"math_log\", 0, 0, 0)],\n [\"math_log10\", new Token(TokenType.NAME, \"math_log10\", 0, 0, 0)],\n [\"math_log1p\", new Token(TokenType.NAME, \"math_log1p\", 0, 0, 0)],\n [\"math_log2\", new Token(TokenType.NAME, \"math_log2\", 0, 0, 0)],\n [\"math_nextafter\", new Token(TokenType.NAME, \"math_nextafter\", 0, 0, 0)],\n [\"math_perm\", new Token(TokenType.NAME, \"math_perm\", 0, 0, 0)],\n [\"math_pow\", new Token(TokenType.NAME, \"math_pow\", 0, 0, 0)],\n [\"math_radians\", new Token(TokenType.NAME, \"math_radians\", 0, 0, 0)],\n [\"math_remainder\", new Token(TokenType.NAME, \"math_remainder\", 0, 0, 0)],\n [\"math_sin\", new Token(TokenType.NAME, \"math_sin\", 0, 0, 0)],\n [\"math_sinh\", new Token(TokenType.NAME, \"math_sinh\", 0, 0, 0)],\n [\"math_sqrt\", new Token(TokenType.NAME, \"math_sqrt\", 0, 0, 0)],\n [\"math_tan\", new Token(TokenType.NAME, \"math_tan\", 0, 0, 0)],\n [\"math_tanh\", new Token(TokenType.NAME, \"math_tanh\", 0, 0, 0)],\n [\"math_trunc\", new Token(TokenType.NAME, \"math_trunc\", 0, 0, 0)],\n [\"math_ulp\", new Token(TokenType.NAME, \"math_ulp\", 0, 0, 0)] \n ]));\n this.functionScope = null;\n }\n resolve(stmt: Stmt[] | Stmt | Expr[] | Expr | null) {\n if (stmt === null) {\n return;\n }\n if (stmt instanceof Array) {\n // Resolve all top-level functions first. Python allows functions declared after\n // another function to be used in that function.\n for (const st of stmt) {\n if (st instanceof StmtNS.FunctionDef) {\n this.environment?.declarePlaceholderName(st.name);\n }\n }\n for (const st of stmt) {\n st.accept(this);\n }\n } else {\n stmt.accept(this);\n }\n }\n\n varDeclNames(names: Map): Token[] | null {\n const res = Array.from(names.values())\n .filter(name => (\n // Filter out functions and module bindings.\n // Those will be handled separately, so they don't\n // need to be hoisted.\n !this.environment?.functions.has(name.lexeme)\n && !this.environment?.moduleBindings.has(name.lexeme)\n ));\n return res.length === 0 ? null : res;\n }\n\n functionVarConstraint(identifier: Token): void {\n if (this.functionScope == null) {\n return;\n }\n let curr = this.environment;\n while (curr !== this.functionScope) {\n if (curr !== null && curr.names.has(identifier.lexeme)) {\n const token = curr.names.get(identifier.lexeme);\n if (token === undefined) {\n throw new Error(\"placeholder error\")\n }\n throw new ResolverErrors.NameReassignmentError(identifier.line, identifier.col,\n this.source,\n identifier.indexInSource,\n identifier.indexInSource + identifier.lexeme.length,\n token);\n }\n curr = curr?.enclosing ?? null;\n }\n }\n\n //// STATEMENTS\n visitFileInputStmt(stmt: StmtNS.FileInput): void {\n // Create a new environment.\n const oldEnv = this.environment;\n this.environment = new Environment(this.source, this.environment, new Map());\n this.resolve(stmt.statements);\n // Grab identifiers from that new environment. That are NOT functions.\n // stmt.varDecls = this.varDeclNames(this.environment.names)\n this.environment = oldEnv;\n }\n\n visitIndentCreation(stmt: StmtNS.Indent): void {\n // Create a new environment\n this.environment = new Environment(this.source, this.environment, new Map());\n }\n\n visitDedentCreation(stmt: StmtNS.Dedent): void {\n // Switch to the previous environment.\n if (this.environment?.enclosing !== undefined) {\n this.environment = this.environment.enclosing;\n }\n }\n\n visitFunctionDefStmt(stmt: StmtNS.FunctionDef) {\n this.environment?.declareName(stmt.name);\n this.environment?.functions.add(stmt.name.lexeme);\n // Create a new environment.\n // const oldEnv = this.environment;\n // Assign the parameters to the new environment.\n const newEnv = new Map(\n stmt.parameters.map(param => [param.lexeme, param])\n );\n this.environment = new Environment(this.source, this.environment, newEnv);\n // const params = new Map(\n // stmt.parameters.map(param => [param.lexeme, param])\n // );\n // if (this.environment !== null) {\n // this.environment.names = params;\n // }\n this.functionScope = this.environment;\n this.resolve(stmt.body);\n // Grab identifiers from that new environment. That are NOT functions.\n // stmt.varDecls = this.varDeclNames(this.environment.names)\n // Restore old environment\n // this.environment = oldEnv;\n }\n\n visitAnnAssignStmt(stmt: StmtNS.AnnAssign): void {\n this.resolve(stmt.ann);\n this.resolve(stmt.value);\n this.functionVarConstraint(stmt.name);\n this.environment?.declareName(stmt.name);\n }\n\n visitAssignStmt(stmt: StmtNS.Assign): void {\n this.resolve(stmt.value);\n this.functionVarConstraint(stmt.name);\n this.environment?.declareName(stmt.name);\n }\n\n visitAssertStmt(stmt: StmtNS.Assert): void {\n this.resolve(stmt.value);\n }\n visitForStmt(stmt: StmtNS.For): void {\n this.environment?.declareName(stmt.target);\n this.resolve(stmt.iter);\n this.resolve(stmt.body);\n }\n\n visitIfStmt(stmt: StmtNS.If): void {\n this.resolve(stmt.condition);\n this.resolve(stmt.body);\n this.resolve(stmt.elseBlock);\n }\n // @TODO we need to treat all global statements as variable declarations in the global\n // scope.\n visitGlobalStmt(stmt: StmtNS.Global): void {\n // Do nothing because global can also be declared in our\n // own scope.\n }\n // @TODO nonlocals mean that any variable following that name in the current env\n // should not create a variable declaration, but instead point to an outer variable.\n visitNonLocalStmt(stmt: StmtNS.NonLocal): void {\n this.environment?.lookupNameParentEnvWithError(stmt.name);\n }\n\n visitReturnStmt(stmt: StmtNS.Return): void {\n if (stmt.value !== null) {\n this.resolve(stmt.value);\n }\n }\n\n visitWhileStmt(stmt: StmtNS.While): void {\n this.resolve(stmt.condition);\n this.resolve(stmt.body);\n }\n visitSimpleExprStmt(stmt: StmtNS.SimpleExpr): void {\n this.resolve(stmt.expression);\n }\n\n visitFromImportStmt(stmt: StmtNS.FromImport): void {\n for (const name of stmt.names) {\n this.environment?.declareName(name);\n this.environment?.moduleBindings.add(name.lexeme);\n }\n }\n\n visitContinueStmt(stmt: StmtNS.Continue): void {\n }\n visitBreakStmt(stmt: StmtNS.Break): void {\n }\n visitPassStmt(stmt: StmtNS.Pass): void {\n }\n\n\n\n\n\n //// EXPRESSIONS\n visitVariableExpr(expr: ExprNS.Variable): void {\n this.environment?.lookupNameCurrentEnvWithError(expr.name);\n }\n visitLambdaExpr(expr: ExprNS.Lambda): void {\n // Create a new environment.\n const oldEnv = this.environment;\n // Assign the parameters to the new environment.\n const newEnv = new Map(\n expr.parameters.map(param => [param.lexeme, param])\n );\n this.environment = new Environment(this.source, this.environment, newEnv);\n this.resolve(expr.body);\n // Restore old environment\n this.environment = oldEnv;\n }\n visitMultiLambdaExpr(expr: ExprNS.MultiLambda): void {\n // Create a new environment.\n const oldEnv = this.environment;\n // Assign the parameters to the new environment.\n const newEnv = new Map(\n expr.parameters.map(param => [param.lexeme, param])\n );\n this.environment = new Environment(this.source, this.environment, newEnv);\n this.resolve(expr.body);\n // Grab identifiers from that new environment.\n expr.varDecls = Array.from(this.environment.names.values());\n // Restore old environment\n this.environment = oldEnv;\n }\n visitUnaryExpr(expr: ExprNS.Unary): void {\n this.resolve(expr.right);\n }\n visitGroupingExpr(expr: ExprNS.Grouping): void {\n this.resolve(expr.expression);\n }\n visitBinaryExpr(expr: ExprNS.Binary): void {\n this.resolve(expr.left);\n this.resolve(expr.right);\n }\n visitBoolOpExpr(expr: ExprNS.BoolOp): void {\n this.resolve(expr.left);\n this.resolve(expr.right);\n }\n visitCompareExpr(expr: ExprNS.Compare): void {\n this.resolve(expr.left);\n this.resolve(expr.right);\n }\n\n visitCallExpr(expr: ExprNS.Call): void {\n this.resolve(expr.callee);\n this.resolve(expr.args);\n }\n visitTernaryExpr(expr: ExprNS.Ternary): void {\n this.resolve(expr.predicate);\n this.resolve(expr.consequent);\n this.resolve(expr.alternative);\n }\n visitNoneExpr(expr: ExprNS.None): void {\n }\n visitLiteralExpr(expr: ExprNS.Literal): void {\n }\n visitBigIntLiteralExpr(expr: ExprNS.BigIntLiteral): void {\n }\n visitComplexExpr(expr: ExprNS.Complex): void {\n }\n\n}\n","import { IOptions } from \"..\"\nimport { Context } from \"../cse-machine/context\"\nimport { CSEResultPromise, evaluate } from \"../cse-machine/interpreter\"\nimport { RecursivePartial, Result } from \"../types\"\nimport * as es from 'estree'\n\nexport function runCSEMachine(program: es.Program, context: Context, options: RecursivePartial = {}): Promise {\n const result = evaluate(program, context, options);\n return CSEResultPromise(context, result);\n}","import { ErrorType } from \"./ErrorType\";\n\n/**\n * Generic Conductor Error.\n */\nexport class ConductorError extends Error {\n override name = \"ConductorError\";\n readonly errorType: ErrorType | string = ErrorType.UNKNOWN;\n \n constructor(message: string) {\n super(message);\n }\n}\n","import { ConductorError } from \"./ConductorError\";\nimport { ErrorType } from \"./ErrorType\";\n\n/**\n * Conductor internal error, probably caused by developer oversight.\n */\nexport class ConductorInternalError extends ConductorError {\n override name = \"ConductorInternalError\";\n override readonly errorType: ErrorType | string = ErrorType.INTERNAL;\n \n constructor(message: string) {\n super(message);\n }\n}\n","import { ConductorInternalError } from \"../../common/errors\";\nimport { IEvaluator, IRunnerPlugin } from \"./types\";\n\nexport abstract class BasicEvaluator implements IEvaluator {\n readonly conductor: IRunnerPlugin;\n\n async startEvaluator(entryPoint: string): Promise {\n const initialChunk = await this.conductor.requestFile(entryPoint);\n if (!initialChunk) throw new ConductorInternalError(\"Cannot load entrypoint file\");\n await this.evaluateFile(entryPoint, initialChunk);\n while (true) {\n const chunk = await this.conductor.requestChunk();\n await this.evaluateChunk(chunk);\n }\n }\n\n /**\n * Evaluates a file.\n * @param fileName The name of the file to be evaluated.\n * @param fileContent The content of the file to be evaluated.\n * @returns A promise that resolves when the evaluation is complete.\n */\n async evaluateFile(fileName: string, fileContent: string): Promise {\n return this.evaluateChunk(fileContent);\n }\n\n /**\n * Evaluates a chunk.\n * @param chunk The chunk to be evaluated.\n * @returns A promise that resolves when the evaluation is complete.\n */\n abstract evaluateChunk(chunk: string): Promise;\n\n constructor(conductor: IRunnerPlugin) {\n this.conductor = conductor;\n }\n}\n","import { PluginClass } from \"../../conduit/types\";\n\n/**\n * Imports an external plugin from a given location.\n * @param location Where to find the external plugin.\n * @returns A promise resolving to the imported plugin.\n */\nexport async function importExternalPlugin(location: string): Promise {\n const plugin = (await import(/* webpackIgnore: true */ location)).plugin as PluginClass;\n // TODO: verify it is actually a plugin\n return plugin;\n}\n","import type { IModulePlugin } from \"../../conductor/module\";\nimport { PluginClass } from \"../../conduit/types\";\nimport { importExternalPlugin } from \"./importExternalPlugin\";\n\n/**\n * Imports an external module from a given location.\n * @param location Where to find the external module.\n * @returns A promise resolving to the imported module.\n */\nexport async function importExternalModule(location: string): Promise> {\n const plugin = await importExternalPlugin(location) as PluginClass;\n // TODO: additional verification it is a module\n return plugin;\n}\n","import { ConductorInternalError } from \"../common/errors/ConductorInternalError\";\nimport { IChannel, Subscriber } from \"./types\";\n\nexport class Channel implements IChannel {\n readonly name: string;\n\n /** The underlying MessagePort of this Channel. */\n private __port!: MessagePort; // replacePort assigns this in the constructor\n\n /** The callbacks subscribed to this Channel. */\n private readonly __subscribers: Set> = new Set(); // TODO: use WeakRef? but callbacks tend to be thrown away and leaking is better than incorrect behaviour\n\n /** Is the Channel allowed to be used? */\n private __isAlive: boolean = true;\n\n private __waitingMessages?: T[] = [];\n\n send(message: T, transfer?: Transferable[]): void {\n this.__verifyAlive();\n this.__port.postMessage(message, transfer ?? []);\n }\n subscribe(subscriber: Subscriber): void {\n this.__verifyAlive();\n this.__subscribers.add(subscriber);\n if (this.__waitingMessages) {\n for (const data of this.__waitingMessages) {\n subscriber(data);\n }\n delete this.__waitingMessages;\n }\n }\n unsubscribe(subscriber: Subscriber): void {\n this.__verifyAlive();\n this.__subscribers.delete(subscriber);\n }\n close(): void {\n this.__verifyAlive();\n this.__isAlive = false;\n this.__port?.close();\n }\n\n /**\n * Check if this Channel is allowed to be used.\n * @throws Throws an error if the Channel has been closed.\n */\n private __verifyAlive() {\n if (!this.__isAlive) throw new ConductorInternalError(`Channel ${this.name} has been closed`);\n }\n\n /**\n * Dispatch some data to subscribers.\n * @param data The data to be dispatched to subscribers.\n */\n private __dispatch(data: T): void {\n this.__verifyAlive();\n if (this.__waitingMessages) {\n this.__waitingMessages.push(data);\n } else {\n for (const subscriber of this.__subscribers) {\n subscriber(data);\n }\n }\n }\n\n /**\n * Listens to the port's message event, and starts the port.\n * Messages will be buffered until the first subscriber listens to the Channel.\n * @param port The MessagePort to listen to.\n */\n listenToPort(port: MessagePort): void {\n port.addEventListener(\"message\", e => this.__dispatch(e.data));\n port.start();\n }\n\n /**\n * Replaces the underlying MessagePort of this Channel and closes it, and starts the new port.\n * @param port The new port to use.\n */\n replacePort(port: MessagePort): void {\n this.__verifyAlive();\n this.__port?.close();\n this.__port = port;\n this.listenToPort(port);\n }\n\n constructor(name: string, port: MessagePort) {\n this.name = name;\n this.replacePort(port);\n }\n}\n","/**\n * A stack-based queue implementation.\n * `push` and `pop` run in amortized constant time.\n */\nexport class Queue {\n /** The output stack. */\n private __s1: T[] = [];\n /** The input stack. */\n private __s2: T[] = [];\n\n /**\n * Adds an item to the queue.\n * @param item The item to be added to the queue.\n */\n push(item: T) {\n this.__s2.push(item);\n }\n\n /**\n * Removes an item from the queue.\n * @returns The item removed from the queue.\n * @throws If the queue is empty.\n */\n pop(): T {\n if (this.__s1.length === 0) {\n if (this.__s2.length === 0) throw new Error(\"queue is empty\");\n let temp = this.__s1;\n this.__s1 = this.__s2.reverse();\n this.__s2 = temp;\n }\n return this.__s1.pop()!; // as the length is nonzero\n }\n\n /**\n * The length of the queue.\n */\n get length() {\n return this.__s1.length + this.__s2.length;\n }\n\n /**\n * Makes a copy of the queue.\n * @returns A copy of the queue.\n */\n clone(): Queue {\n const newQueue = new Queue();\n newQueue.__s1 = [...this.__s1];\n newQueue.__s2 = [...this.__s2];\n return newQueue;\n }\n}\n","import { Queue } from \"./Queue\";\n\nexport class MessageQueue {\n private readonly __inputQueue: Queue = new Queue();\n private readonly __promiseQueue: Queue = new Queue();\n\n push(item: T) {\n if (this.__promiseQueue.length !== 0) this.__promiseQueue.pop()(item);\n else this.__inputQueue.push(item);\n }\n\n async pop(): Promise {\n if (this.__inputQueue.length !== 0) return this.__inputQueue.pop();\n return new Promise((resolve, _reject) => {\n this.__promiseQueue.push(resolve);\n });\n }\n\n tryPop(): T | undefined {\n if (this.__inputQueue.length !== 0) return this.__inputQueue.pop();\n return undefined;\n }\n\n constructor() {\n this.push = this.push.bind(this);\n }\n}\n","import { MessageQueue } from \"../common/ds\";\nimport { IChannelQueue, IChannel } from \"./types\";\n\nexport class ChannelQueue implements IChannelQueue {\n readonly name: string;\n private __channel: IChannel;\n private __messageQueue: MessageQueue = new MessageQueue();\n\n async receive(): Promise {\n return this.__messageQueue.pop();\n }\n tryReceive(): T | undefined {\n return this.__messageQueue.tryPop();\n }\n send(message: T, transfer?: Transferable[]): void {\n this.__channel.send(message, transfer);\n }\n close(): void {\n this.__channel.unsubscribe(this.__messageQueue.push);\n }\n constructor(channel: IChannel) {\n this.name = channel.name;\n this.__channel = channel;\n this.__channel.subscribe(this.__messageQueue.push);\n }\n}\n","import { ConductorInternalError } from \"../common/errors/ConductorInternalError\";\nimport { Channel } from \"./Channel\";\nimport { IConduit, ILink, IPlugin, IChannel, PluginClass } from \"./types\";\n\nexport class Conduit implements IConduit {\n private __alive: boolean = true;\n private readonly __link: ILink;\n private readonly __parent: boolean;\n private readonly __channels: Map> = new Map();\n private readonly __pluginMap: Map = new Map();\n private readonly __plugins: IPlugin[] = [];\n private __negotiateChannel(channelName: string): void {\n const { port1, port2 } = new MessageChannel();\n const channel = new Channel(channelName, port1);\n this.__link.postMessage([channelName, port2], [port2]); // TODO: update communication protocol?\n this.__channels.set(channelName, channel);\n }\n private __verifyAlive() {\n if (!this.__alive) throw new ConductorInternalError(\"Conduit already terminated\");\n }\n registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer {\n this.__verifyAlive();\n const attachedChannels: IChannel[] = [];\n for (const channelName of pluginClass.channelAttach) {\n if (!this.__channels.has(channelName)) this.__negotiateChannel(channelName);\n attachedChannels.push(this.__channels.get(channelName)!); // as the Channel has been negotiated\n }\n const plugin = new pluginClass(this, attachedChannels, ...arg);\n\n if (plugin.name !== undefined) {\n if (this.__pluginMap.has(plugin.name)) throw new ConductorInternalError(`Plugin ${plugin.name} already registered`);\n this.__pluginMap.set(plugin.name, plugin);\n }\n\n this.__plugins.push(plugin);\n\n return plugin;\n }\n unregisterPlugin(plugin: IPlugin): void {\n this.__verifyAlive();\n let p = 0;\n for (let i = 0; i < this.__plugins.length; ++i) {\n if (this.__plugins[p] === plugin) ++p;\n this.__plugins[i] = this.__plugins[i + p];\n }\n for (let i = this.__plugins.length - 1, e = this.__plugins.length - p; i >= e; --i) {\n delete this.__plugins[i];\n }\n if (plugin.name) {\n this.__pluginMap.delete(plugin.name);\n }\n plugin.destroy?.();\n }\n lookupPlugin(pluginName: string): IPlugin {\n this.__verifyAlive();\n if (!this.__pluginMap.has(pluginName)) throw new ConductorInternalError(`Plugin ${pluginName} not registered`);\n return this.__pluginMap.get(pluginName)!; // as the map has been checked\n }\n terminate(): void {\n this.__verifyAlive();\n for (const plugin of this.__plugins) {\n //this.unregisterPlugin(plugin);\n plugin.destroy?.();\n }\n this.__link.terminate?.();\n this.__alive = false;\n }\n private __handlePort(data: [string, MessagePort]) { // TODO: update communication protocol?\n const [channelName, port] = data;\n if (this.__channels.has(channelName)) { // uh-oh, we already have a port for this channel\n const channel = this.__channels.get(channelName)!; // as the map has been checked\n if (this.__parent) { // extract the data and discard the messageport; child's Channel will close it\n channel.listenToPort(port);\n } else { // replace our messageport; Channel will close it\n channel.replacePort(port);\n }\n } else { // register the new channel\n const channel = new Channel(channelName, port);\n this.__channels.set(channelName, channel);\n }\n }\n constructor(link: ILink, parent: boolean = false) {\n this.__link = link;\n link.addEventListener(\"message\", e => this.__handlePort(e.data));\n this.__parent = parent;\n }\n}\n","import type { IRpcMessage } from \"./IRpcMessage\";\nimport { RpcMessageType } from \"./RpcMessageType\";\n\nexport class RpcCallMessage implements IRpcMessage {\n type = RpcMessageType.CALL;\n readonly data: {fn: string | symbol, args: any[], invokeId: number};\n\n constructor(fn: string | symbol, args: any[], invokeId: number) {\n this.data = {fn, args, invokeId};\n }\n}\n","import type { IRpcMessage } from \"./IRpcMessage\";\nimport { RpcMessageType } from \"./RpcMessageType\";\n\nexport class RpcErrorMessage implements IRpcMessage {\n type = RpcMessageType.RETURN_ERR;\n readonly data: {invokeId: number, err: any};\n\n constructor(invokeId: number, err: any) {\n this.data = {invokeId, err};\n }\n}\n","import type { IRpcMessage } from \"./IRpcMessage\";\nimport { RpcMessageType } from \"./RpcMessageType\";\n\nexport class RpcReturnMessage implements IRpcMessage {\n type = RpcMessageType.RETURN;\n readonly data: {invokeId: number, res: any};\n\n constructor(invokeId: number, res: any) {\n this.data = {invokeId, res};\n }\n}\n","import { IChannel } from \"../types\";\nimport { IRpcMessage, Remote, RpcCallMessage, RpcErrorMessage, RpcMessageType, RpcReturnMessage } from \"./types\";\n\nexport function makeRpc(channel: IChannel, self: ISelf): Remote {\n const waiting: [Function, Function][] = [];\n let invocations = 0;\n const otherCallbacks: Partial Promise>> = {};\n\n channel.subscribe(async rpcMessage => {\n switch (rpcMessage.type) {\n case RpcMessageType.CALL:\n {\n const {fn, args, invokeId} = (rpcMessage as RpcCallMessage).data;\n try {\n // @ts-expect-error\n const res = await self[fn as keyof ISelf](...args);\n if (invokeId > 0) channel.send(new RpcReturnMessage(invokeId, res));\n } catch (err) {\n if (invokeId > 0) channel.send(new RpcErrorMessage(invokeId, err));\n }\n break;\n }\n case RpcMessageType.RETURN:\n {\n const {invokeId, res} = (rpcMessage as RpcReturnMessage).data;\n waiting[invokeId]?.[0]?.(res);\n delete waiting[invokeId];\n break;\n }\n case RpcMessageType.RETURN_ERR:\n {\n const {invokeId, err} = (rpcMessage as RpcErrorMessage).data;\n waiting[invokeId]?.[1]?.(err);\n delete waiting[invokeId];\n break;\n }\n }\n });\n\n return new Proxy(otherCallbacks, { // TODO: transferring functions\n get(target, p, receiver) {\n const cb = Reflect.get(target, p, receiver);\n if (cb) return cb;\n const newCallback = typeof p === \"string\" && p.charAt(0) === \"$\"\n ? (...args: any[]) => {\n channel.send(new RpcCallMessage(p, args, 0));\n }\n : (...args: any[]) => {\n const invokeId = ++invocations;\n channel.send(new RpcCallMessage(p, args, invokeId));\n return new Promise((resolve, reject) => {\n waiting[invokeId] = [resolve, reject];\n });\n }\n Reflect.set(target, p, newCallback, receiver);\n return newCallback;\n },\n }) as Remote;\n}\n","import { IPlugin } from \"..\";\nimport { AbstractPluginClass, PluginClass } from \"../types\";\n\n/**\n * Typechecking utility decorator.\n * It is recommended that usage of this decorator is removed\n * before or during the build process, as some tools\n * (e.g. terser) do not have good support for class decorators.\n * @param _pluginClass The Class to be typechecked.\n */\nexport function checkIsPluginClass(_pluginClass: PluginClass | AbstractPluginClass) {\n}\n","export enum DataType {\n /** The return type of functions with no returned value. As a convention, the associated JS value is undefined. */\n VOID = 0,\n\n /** A Boolean value. */\n BOOLEAN = 1,\n\n /** A numerical value. */\n NUMBER = 2,\n\n /** An immutable string of characters. */\n CONST_STRING = 3,\n\n /** The empty list. As a convention, the associated JS value is null. */\n EMPTY_LIST = 4,\n\n /** A pair of values. Reference type. */\n PAIR = 5,\n\n /** An array of values of a single type. Reference type. */\n ARRAY = 6,\n\n /** A value that can be called with fixed arity. Reference type. */\n CLOSURE = 7,\n\n /** An opaque value that cannot be manipulated from user code. */\n OPAQUE = 8,\n\n /** A list (either a pair or the empty list). */\n LIST = 9,\n};\n","import type { IServiceMessage } from \"../IServiceMessage\";\nimport { ServiceMessageType } from \"../ServiceMessageType\";\n\nexport class AbortServiceMessage implements IServiceMessage {\n readonly type = ServiceMessageType.ABORT;\n readonly data: {minVersion: number};\n constructor(minVersion: number) {\n this.data = {minVersion: minVersion};\n }\n}\n","import { Constant } from \"../../../common/Constant\";\nimport type { IServiceMessage } from \"../IServiceMessage\";\nimport { ServiceMessageType } from \"../ServiceMessageType\";\n\nexport class HelloServiceMessage implements IServiceMessage {\n readonly type = ServiceMessageType.HELLO;\n readonly data = { version: Constant.PROTOCOL_VERSION };\n}\n","import type { IServiceMessage } from \"../IServiceMessage\";\nimport { ServiceMessageType } from \"../ServiceMessageType\";\n\nexport class PluginServiceMessage implements IServiceMessage {\n readonly type = ServiceMessageType.PLUGIN;\n readonly data: string;\n constructor(pluginName: string) {\n this.data = pluginName;\n }\n}\n","import { Constant } from \"../../common/Constant\";\nimport type { ConductorError } from \"../../common/errors\";\nimport { ConductorInternalError } from \"../../common/errors/ConductorInternalError\";\nimport { importExternalModule, importExternalPlugin } from \"../../common/util\";\nimport { IConduit, IChannelQueue, IChannel, ChannelQueue, IPlugin } from \"../../conduit\";\nimport { makeRpc } from \"../../conduit/rpc\";\nimport { Remote } from \"../../conduit/rpc/types\";\nimport { PluginClass } from \"../../conduit/types\";\nimport { checkIsPluginClass } from \"../../conduit/util\";\nimport { IHostFileRpc } from \"../host/types\";\nimport { IModulePlugin } from \"../module\";\nimport { ModuleClass } from \"../module/types/ModuleClass\";\nimport { InternalChannelName, InternalPluginName } from \"../strings\";\nimport { Chunk, IChunkMessage, IServiceMessage, IIOMessage, IStatusMessage, RunnerStatus, ServiceMessageType, HelloServiceMessage, AbortServiceMessage, type EntryServiceMessage, IErrorMessage, PluginServiceMessage } from \"../types\";\nimport { IRunnerPlugin, IEvaluator, IInterfacableEvaluator, EvaluatorClass } from \"./types\";\n\n@checkIsPluginClass\nexport class RunnerPlugin implements IRunnerPlugin {\n name = InternalPluginName.RUNNER_MAIN;\n\n private readonly __evaluator: IEvaluator | IInterfacableEvaluator;\n private readonly __isCompatibleWithModules: boolean;\n private readonly __conduit: IConduit;\n private readonly __fileRpc: Remote;\n private readonly __chunkQueue: IChannelQueue;\n private readonly __serviceChannel: IChannel;\n private readonly __ioQueue: IChannelQueue;\n private readonly __errorChannel: IChannel;\n private readonly __statusChannel: IChannel;\n\n // @ts-expect-error TODO: figure proper way to typecheck this\n private readonly __serviceHandlers = new Map void>([\n [ServiceMessageType.HELLO, function helloServiceHandler(this: RunnerPlugin, message: HelloServiceMessage) {\n if (message.data.version < Constant.PROTOCOL_MIN_VERSION) {\n this.__serviceChannel.send(new AbortServiceMessage(Constant.PROTOCOL_MIN_VERSION));\n console.error(`Host's protocol version (${message.data.version}) must be at least ${Constant.PROTOCOL_MIN_VERSION}`);\n } else {\n console.log(`Host is using protocol version ${message.data.version}`);\n }\n }],\n [ServiceMessageType.ABORT, function abortServiceHandler(this: RunnerPlugin, message: AbortServiceMessage) {\n console.error(`Host expects at least protocol version ${message.data.minVersion}, but we are on version ${Constant.PROTOCOL_VERSION}`);\n this.__conduit.terminate();\n }],\n [ServiceMessageType.ENTRY, function entryServiceHandler(this: RunnerPlugin, message: EntryServiceMessage) {\n this.__evaluator.startEvaluator(message.data);\n }]\n ]);\n\n requestFile(fileName: string): Promise {\n return this.__fileRpc.requestFile(fileName);\n }\n\n async requestChunk(): Promise {\n return (await this.__chunkQueue.receive()).chunk;\n }\n\n async requestInput(): Promise {\n const { message } = await this.__ioQueue.receive();\n return message;\n }\n\n tryRequestInput(): string | undefined {\n const out = this.__ioQueue.tryReceive();\n return out?.message;\n }\n\n sendOutput(message: string): void {\n this.__ioQueue.send({ message });\n }\n\n sendError(error: ConductorError): void {\n this.__errorChannel.send({ error });\n }\n\n updateStatus(status: RunnerStatus, isActive: boolean): void {\n this.__statusChannel.send({ status, isActive });\n }\n\n hostLoadPlugin(pluginName: string): void {\n this.__serviceChannel.send(new PluginServiceMessage(pluginName));\n }\n\n registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer {\n return this.__conduit.registerPlugin(pluginClass, ...arg);\n }\n\n unregisterPlugin(plugin: IPlugin): void {\n this.__conduit.unregisterPlugin(plugin);\n }\n\n registerModule(moduleClass: ModuleClass): NoInfer {\n if (!this.__isCompatibleWithModules) throw new ConductorInternalError(\"Evaluator has no data interface\");\n return this.registerPlugin(moduleClass, this.__evaluator as IInterfacableEvaluator);\n }\n\n unregisterModule(module: IModulePlugin): void {\n this.unregisterPlugin(module);\n }\n\n async importAndRegisterExternalPlugin(location: string, ...arg: any[]): Promise {\n const pluginClass = await importExternalPlugin(location);\n return this.registerPlugin(pluginClass as any, ...arg);\n }\n\n async importAndRegisterExternalModule(location: string): Promise {\n const moduleClass = await importExternalModule(location);\n return this.registerModule(moduleClass);\n }\n\n static readonly channelAttach = [InternalChannelName.FILE, InternalChannelName.CHUNK, InternalChannelName.SERVICE, InternalChannelName.STANDARD_IO, InternalChannelName.ERROR, InternalChannelName.STATUS];\n constructor(\n conduit: IConduit,\n [fileChannel, chunkChannel, serviceChannel, ioChannel, errorChannel, statusChannel]: IChannel[],\n evaluatorClass: EvaluatorClass\n ) {\n this.__conduit = conduit;\n this.__fileRpc = makeRpc<{}, IHostFileRpc>(fileChannel, {});\n this.__chunkQueue = new ChannelQueue(chunkChannel);\n this.__serviceChannel = serviceChannel;\n this.__ioQueue = new ChannelQueue(ioChannel);\n this.__errorChannel = errorChannel;\n this.__statusChannel = statusChannel;\n\n this.__serviceChannel.send(new HelloServiceMessage());\n this.__serviceChannel.subscribe(message => {\n this.__serviceHandlers.get(message.type)?.call(this, message);\n });\n\n this.__evaluator = new evaluatorClass(this);\n this.__isCompatibleWithModules = (this.__evaluator as IInterfacableEvaluator).hasDataInterface ?? false;\n }\n}\n","import { RunnerPlugin } from \"..\";\nimport { Conduit, IConduit, ILink } from \"../../../conduit\";\nimport { EvaluatorClass, IRunnerPlugin } from \"../types\";\n\n/**\n * Initialise this runner with the evaluator to be used.\n * @param evaluatorClass The Evaluator to be used on this runner.\n * @param link The underlying communication link.\n * @returns The initialised `runnerPlugin` and `conduit`.\n */\nexport function initialise(evaluatorClass: EvaluatorClass, link: ILink = self as ILink): { runnerPlugin: IRunnerPlugin, conduit: IConduit } {\n const conduit = new Conduit(link, false);\n const runnerPlugin = conduit.registerPlugin(RunnerPlugin, evaluatorClass);\n return { runnerPlugin, conduit };\n}\n","import * as es from 'estree';\nimport { Stash, Value } from './stash';\nimport { Control, ControlItem } from './control';\nimport { createSimpleEnvironment, createProgramEnvironment, Environment } from './environment';\nimport { CseError } from './error';\nimport { Heap } from './heap';\nimport {\n AppInstr,\n Instr,\n InstrType,\n BranchInstr,\n WhileInstr,\n ForInstr,\n Node,\n StatementSequence\n} from './types'\nimport { NativeStorage } from '../types';\n\nexport class Context {\n public control: Control;\n public stash: Stash;\n //public environment: Environment;\n public errors: CseError[] = [];\n\n runtime: {\n break: boolean\n debuggerOn: boolean\n isRunning: boolean\n environmentTree: EnvTree\n environments: Environment[]\n nodes: Node[]\n control: Control | null\n stash: Stash | null\n objectCount: number\n envStepsTotal: number\n breakpointSteps: number[]\n changepointSteps: number[]\n }\n \n /**\n * Used for storing the native context and other values\n */\n nativeStorage: NativeStorage\n\n constructor(program?: es.Program | StatementSequence, context?: Context) {\n this.control = new Control(program);\n this.stash = new Stash();\n this.runtime = this.createEmptyRuntime();\n //this.environment = createProgramEnvironment(context || this, false);\n if (this.runtime.environments.length === 0) {\n const globalEnvironment = this.createGlobalEnvironment()\n this.runtime.environments.push(globalEnvironment)\n this.runtime.environmentTree.insert(globalEnvironment)\n }\n this.nativeStorage = {\n builtins: new Map(),\n previousProgramsIdentifiers: new Set(),\n operators: new Map Value>(),\n maxExecTime: 1000,\n evaller: null,\n loadedModules: {},\n loadedModuleTypes: {}\n }\n }\n\n createGlobalEnvironment = (): Environment => ({\n tail: null,\n name: 'global',\n head: {},\n heap: new Heap(),\n id: '-1'\n })\n\n createEmptyRuntime = () => ({\n break: false,\n debuggerOn: true,\n isRunning: false,\n environmentTree: new EnvTree(),\n environments: [],\n value: undefined,\n nodes: [],\n control: null,\n stash: null,\n objectCount: 0,\n envSteps: -1,\n envStepsTotal: 0,\n breakpointSteps: [],\n changepointSteps: []\n })\n\n public reset(program?: es.Program | StatementSequence): void {\n this.control = new Control(program);\n this.stash = new Stash();\n //this.environment = createProgramEnvironment(this, false);\n this.errors = []; \n }\n\n public copy(): Context {\n const newContext = new Context();\n newContext.control = this.control.copy();\n newContext.stash = this.stash.copy();\n //newContext.environments = this.copyEnvironment(this.environments);\n return newContext;\n }\n\n private copyEnvironment(env: Environment): Environment {\n const newTail = env.tail ? this.copyEnvironment(env.tail) : null;\n const newEnv: Environment = {\n id: env.id, \n name: env.name,\n tail: newTail,\n head: { ...env.head },\n heap: new Heap(),\n callExpression: env.callExpression, \n thisContext: env.thisContext\n };\n return newEnv;\n }\n}\n\nexport class EnvTree {\n private _root: EnvTreeNode | null = null\n private map = new Map()\n\n get root(): EnvTreeNode | null {\n return this._root\n }\n\n public insert(environment: Environment): void {\n const tailEnvironment = environment.tail\n if (tailEnvironment === null) {\n if (this._root === null) {\n this._root = new EnvTreeNode(environment, null)\n this.map.set(environment, this._root)\n }\n } else {\n const parentNode = this.map.get(tailEnvironment)\n if (parentNode) {\n const childNode = new EnvTreeNode(environment, parentNode)\n parentNode.addChild(childNode)\n this.map.set(environment, childNode)\n }\n }\n }\n\n public getTreeNode(environment: Environment): EnvTreeNode | undefined {\n return this.map.get(environment)\n }\n}\n\nexport class EnvTreeNode {\n private _children: EnvTreeNode[] = []\n\n constructor(readonly environment: Environment, public parent: EnvTreeNode | null) {}\n\n get children(): EnvTreeNode[] {\n return this._children\n }\n\n public resetChildren(newChildren: EnvTreeNode[]): void {\n this.clearChildren()\n this.addChildren(newChildren)\n newChildren.forEach(c => (c.parent = this))\n }\n\n private clearChildren(): void {\n this._children = []\n }\n\n private addChildren(newChildren: EnvTreeNode[]): void {\n this._children.push(...newChildren)\n }\n\n public addChild(newChild: EnvTreeNode): EnvTreeNode {\n this._children.push(newChild)\n return newChild\n }\n}\n","import { runInContext } from \"../../../\";\nimport { Context } from \"../../../cse-machine/context\";\nimport { BasicEvaluator } from \"../BasicEvaluator\";\nimport { IRunnerPlugin } from \"./IRunnerPlugin\";\nimport { IOptions } from \"../../../\";\nimport { Finished } from \"../../../types\";\n\nconst defaultContext = new Context();\nconst defaultOptions: IOptions = {\n isPrelude: false,\n envSteps: 100000,\n stepLimit: 100000\n};\n\nexport class PyEvaluator extends BasicEvaluator {\n private context: Context;\n private options: IOptions;\n \n constructor(conductor: IRunnerPlugin) {\n super(conductor);\n this.context = defaultContext;\n this.options = defaultOptions;\n }\n \n async evaluateChunk(chunk: string): Promise {\n try {\n const result = await runInContext(\n chunk, // Code\n this.context,\n this.options\n );\n this.conductor.sendOutput(`${(result as Finished).representation.toString((result as Finished).value)}`);\n } catch (error) {\n this.conductor.sendOutput(`Error: ${error instanceof Error ? error.message : error}`);\n }\n }\n}\n\n// runInContext\n// IOptions\n// Context\n// BasicEvaluator;\n// IRunnerPlugin","/* Use as a command line script */\n/* npm run start:dev -- test.py */\n/* npm run start:dev -- test.py tsc --maxErrors 1 */\n\nimport { Tokenizer } from \"./tokenizer\";\nimport { Parser } from \"./parser\";\nimport { Translator } from \"./translator\";\nimport { Program } from \"estree\";\nimport { Resolver } from \"./resolver\";\nimport { Context } from './cse-machine/context';\nimport { evaluate } from './cse-machine/interpreter';\nexport * from './errors';\nimport fs from \"fs\";\nimport { ParserErrors, ResolverErrors, TokenizerErrors } from \"./errors\";\nimport { Value } from \"./cse-machine/stash\";\nimport { Finished, RecursivePartial, Result } from \"./types\";\nimport { runCSEMachine } from \"./runner/pyRunner\";\nimport { initialise } from \"./conductor/runner/util/initialise\";\nimport { PyEvaluator } from \"./conductor/runner/types/PyEvaluator\";\nimport path from \"path\";\n\nexport function parsePythonToEstreeAst(code: string,\n variant: number = 1,\n doValidate: boolean = false): Program {\n const script = code + '\\n'\n const tokenizer = new Tokenizer(script)\n const tokens = tokenizer.scanEverything()\n const pyParser = new Parser(script, tokens)\n const ast = pyParser.parse()\n if (doValidate) {\n new Resolver(script, ast).resolve(ast);\n }\n const translator = new Translator(script)\n return translator.resolve(ast) as unknown as Program\n}\n\n// import {ParserErrors, ResolverErrors, TokenizerErrors} from \"./errors\";\n// import fs from \"fs\";\n// const BaseParserError = ParserErrors.BaseParserError;\n// const BaseTokenizerError = TokenizerErrors.BaseTokenizerError;\n// const BaseResolverError = ResolverErrors.BaseResolverError;\n// if (process.argv.length > 2) {\n// try {\n// let text = fs.readFileSync(process.argv[2], 'utf8');\n// // Add a new line just in case\n// text += '\\n';\n// const tokenizer = new Tokenizer(text);\n// const tokens = tokenizer.scanEverything();\n// tokenizer.printTokens();\n// const parser = new Parser(text, tokens);\n// const ast = parser.parse();\n// // const resolver = new Resolver(text, ast);\n// // resolver.resolve(ast);\n// console.dir(ast, { depth: null });\n// const translator = new Translator(text);\n// const estreeAst = translator.resolve(ast);\n// console.dir(estreeAst, { depth: null });\n// } catch (e) {\n// if (e instanceof BaseTokenizerError\n// || e instanceof BaseParserError\n// || e instanceof BaseResolverError) {\n// console.error(e.message);\n// } else {\n// throw e;\n// }\n// }\n// }\n\n// if (require.main === module) {\n// if (process.argv.length < 3) {\n// console.error(\"Usage: npm run start:dev -- \");\n// process.exit(1);\n// }\n\n// const filePath = process.argv[2];\n\n// try {\n// const code = fs.readFileSync(filePath, \"utf8\") + \"\\n\";\n\n// console.log(`Parsing Python file: ${filePath}`);\n\n// // Test for parsePythonToEstreeAst\n// const estreeAst = parsePythonToEstreeAst(code, 1, true);\n\n// console.log(\"Generated ESTree AST:\");\n// console.dir(estreeAst, { depth: null });\n \n// const result = evaluate(estreeAst, context, options);\n// console.info('\\n\\n');\n// console.info(result);\n// console.info(result.value);\n// console.info((result as Value).value.toString());\n// console.info('done');\n \n\n// //console.log(\"Syntax and semantic check passed.\");\n \n// // const rootNode = {\n// // type: estreeAst.type,\n// // sourceType: estreeAst.sourceType,\n// // loc: estreeAst.loc\n// // };\n \n// // console.log('AST 根节点:', rootNode);\n// } catch (e) {\n// if (\n// e instanceof BaseTokenizerError ||\n// e instanceof BaseParserError ||\n// e instanceof BaseResolverError\n// ) {\n// console.error(\"Parsing Error:\", e.message);\n// }\n// }\n// console.log(process.versions.v8);\n\n// }\n\nexport interface IOptions {\n isPrelude: boolean,\n envSteps: number,\n stepLimit: number\n};\n\nexport async function runInContext(\n code: string,\n context: Context,\n options: RecursivePartial = {}\n): Promise {\n const estreeAst = parsePythonToEstreeAst(code, 1, true);\n const result = runCSEMachine(estreeAst, context, options);\n return result;\n}\n\n//local test only\n// const context = new Context();\n// const options: IOptions = {\n// isPrelude: false,\n// envSteps: 100000,\n// stepLimit: 100000\n// };\n// import { promises as fs1 } from 'fs';\n// import * as os from 'os';\n// async function loadModulesFromServer(context: Context, baseURL: string): Promise {\n// // 先获取 modules.json 文件\n// const modulesJsonUrl = `${baseURL}/modules.json`;\n// const response = await fetch(modulesJsonUrl);\n// if (!response.ok) {\n// throw new Error(`Failed to load modules.json from ${modulesJsonUrl}`);\n// }\n// const modulesData: Record = await response.json();\n \n// // modulesData 假定格式为 { moduleName1: {...}, moduleName2: {...}, ... }\n// // 遍历每个模块名,加载对应模块\n// for (const moduleName in modulesData) {\n// // 构造模块文件的 URL,假设文件名与模块名相同,并以 .js 结尾\n// const moduleUrl = `${baseURL}/bundles/${moduleName}.js`;\n// const moduleResponse = await fetch(moduleUrl);\n// if (!moduleResponse.ok) {\n// console.warn(`Failed to load module ${moduleName} from ${moduleUrl}`);\n// continue;\n// }\n// const moduleSource = await moduleResponse.text();\n \n// // 评估模块文件,获取其导出对象\n// // 注意:这里使用 eval 仅作为示例,实际项目中应考虑安全和沙箱策略\n// // let moduleExports;\n// // try {\n// // moduleExports = eval(moduleSource);\n// // } catch (e) {\n// // console.error(`Error evaluating module ${moduleName}:`, e);\n// // continue;\n// // }\n \n// const tmpFile = path.join(os.tmpdir(), path.basename(moduleUrl));\n// fs1.writeFile(tmpFile, moduleSource);\n// // 动态 import 使用 file:// 协议\n// const moduleExports = await import('file://' + tmpFile);\n// // 将模块导出对象存入 nativeStorage.loadedModules\n// context.nativeStorage.loadedModules[moduleName] = moduleExports;\n// }\n// console.info(context.nativeStorage);\n// }\n\n// const BaseParserError = ParserErrors.BaseParserError;\n// const BaseTokenizerError = TokenizerErrors.BaseTokenizerError;\n// const BaseResolverError = ResolverErrors.BaseResolverError;\n// async function getResult(code: string,\n// context: Context,\n// options: RecursivePartial = {}): Promise {\n// const result = ;\n// return result;\n// }\n\n// if (require.main === module) {\n// if (process.argv.length < 3) {\n// console.error(\"Usage: npm run start:dev -- \");\n// process.exit(1);\n// }\n\n// const filePath = process.argv[2];\n\n// try {\n// const code = fs.readFileSync(filePath, \"utf8\") + \"\\n\";\n// console.log(`Parsing Python file: ${filePath}`);\n// const result = await runInContext(code, context, options);\n// console.info(result);\n// } catch (e) {\n \n// }\n// //console.log(process.versions.v8);\n\n// }\n\n// if (require.main === module) {\n// (async () => {\n// if (process.argv.length < 3) {\n// console.error(\"Usage: npm run start:dev -- \");\n// process.exit(1);\n// }\n \n// const filePath = process.argv[2];\n \n// try {\n// //await loadModulesFromServer(context, \"http://localhost:8022\");\n\n// const code = fs.readFileSync(filePath, \"utf8\") + \"\\n\";\n// console.log(`Parsing Python file: ${filePath}`);\n \n// const result = await runInContext(code, context, options);\n// console.info(result);\n// console.info((result as Finished).value);\n// console.info((result as Finished).representation.toString((result as Finished).value));\n \n// } catch (e) {\n// console.error(\"Error:\", e);\n// }\n\n// })();\n// }\n\nconst {runnerPlugin, conduit} = initialise(PyEvaluator);\n\n"],"names":["TokenizerErrors","ParserErrors","ResolverErrors","TranslatorErrors","isNode","clone","config","sign","format","toFixed","toExponential","toEngineering","_toNumberOrDefault","nearlyEqual","dependencies","P","abs","cosh","hypot","max","min","mod","pow","round","sinh","trunc","name","parse","Complex","Fraction","formatNumber","formatBigNumber","product","deepMap","typed","_typeOf","arrayDeepMap","bigNearlyEqual","size","isStatementSequence","instr.popInstr","instr.branchInstr","runCSEMachine","instr.envInstr","instr.assmtInstr","instr.resetInstr","instr.unOpInstr","instr.binOpInstr","instr.appInstr","error.TypeConcatenateError","instr.markerInstr"],"mappings":";;;;;;IAAA;IACA;AACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AACA;AAiDA;IACO,SAAS,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE;IACzG,IAAI,SAAS,MAAM,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,MAAM,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE,MAAM,IAAI,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE;IAC3H,IAAI,IAAI,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,KAAK,QAAQ,GAAG,KAAK,GAAG,IAAI,KAAK,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;IACrG,IAAI,IAAI,MAAM,GAAG,CAAC,YAAY,IAAI,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC5F,IAAI,IAAI,UAAU,GAAG,YAAY,KAAK,MAAM,GAAG,MAAM,CAAC,wBAAwB,CAAC,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AG,EAAE,GAAG,EAAE;IAC5B,EAAE,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE;IACxB,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;IACrB,IAAI,OAAO,IAAI,CAAC;IAChB,GAAG;IACH,CAAC;AACD;AACA;IACA;AACA;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AACA;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAASC,KAAG,CAAC,CAAC,EAAE;IAChB,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAC3B,CAAC;AACD;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAAS,IAAI,CAAC,CAAC,EAAE;IACjB,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;AACD;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAAS,KAAK,CAAC,CAAC,EAAE;IAClB,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;AACD;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE;IACnB,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;AACD;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAAS,IAAI,CAAC,CAAC,EAAE;IACjB,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC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A;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IAEA;IACA;IAEA;IACA;IACA;IACA;IAEA;IACA;IACA;IAEA;IACA;IAEgC,UAAU,CAAC,WAAW;;;;;;;;;","x_google_ignoreList":[0,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,87,88]} \ No newline at end of file diff --git a/dist/modules/moduleTypes.d.ts b/dist/modules/moduleTypes.d.ts new file mode 100644 index 0000000..0831673 --- /dev/null +++ b/dist/modules/moduleTypes.d.ts @@ -0,0 +1,3 @@ +export type ModuleFunctions = { + [name: string]: any; +}; diff --git a/dist/parser.d.ts b/dist/parser.d.ts new file mode 100644 index 0000000..79d04d3 --- /dev/null +++ b/dist/parser.d.ts @@ -0,0 +1,46 @@ +import { Token } from "./tokenizer"; +import { StmtNS } from "./ast-types"; +type Stmt = StmtNS.Stmt; +export declare class Parser { + private readonly source; + private readonly tokens; + private current; + constructor(source: string, tokens: Token[]); + private match; + private check; + private advance; + private isAtEnd; + private peek; + private previous; + private consume; + private synchronize; + parse(): Stmt; + private file_input; + private stmt; + private compound_stmt; + private if_stmt; + private while_stmt; + private for_stmt; + private funcdef; + private simple_stmt; + private assign_stmt; + private import_from; + private parameters; + private test; + private lambdef; + private suite; + private varparamslist; + private or_test; + private and_test; + private not_test; + private comparison; + private arith_expr; + private term; + private factor; + private power; + private atom_expr; + private arglist; + private atom; + private parse_invalid; +} +export {}; diff --git a/dist/resolver.d.ts b/dist/resolver.d.ts new file mode 100644 index 0000000..cc1fcce --- /dev/null +++ b/dist/resolver.d.ts @@ -0,0 +1,63 @@ +import { StmtNS, ExprNS } from "./ast-types"; +type Expr = ExprNS.Expr; +type Stmt = StmtNS.Stmt; +import { Token } from "./tokenizer"; +declare class Environment { + source: string; + enclosing: Environment | null; + names: Map; + functions: Set; + moduleBindings: Set; + constructor(source: string, enclosing: Environment | null, names: Map); + lookupName(identifier: Token): number; + lookupNameCurrentEnv(identifier: Token): Token | undefined; + lookupNameCurrentEnvWithError(identifier: Token): void; + lookupNameParentEnvWithError(identifier: Token): void; + declareName(identifier: Token): void; + declarePlaceholderName(identifier: Token): void; + suggestNameCurrentEnv(identifier: Token): string | null; + suggestName(identifier: Token): string | null; +} +export declare class Resolver implements StmtNS.Visitor, ExprNS.Visitor { + source: string; + ast: Stmt; + environment: Environment | null; + functionScope: Environment | null; + constructor(source: string, ast: Stmt); + resolve(stmt: Stmt[] | Stmt | Expr[] | Expr | null): void; + varDeclNames(names: Map): Token[] | null; + functionVarConstraint(identifier: Token): void; + visitFileInputStmt(stmt: StmtNS.FileInput): void; + visitIndentCreation(stmt: StmtNS.Indent): void; + visitDedentCreation(stmt: StmtNS.Dedent): void; + visitFunctionDefStmt(stmt: StmtNS.FunctionDef): void; + visitAnnAssignStmt(stmt: StmtNS.AnnAssign): void; + visitAssignStmt(stmt: StmtNS.Assign): void; + visitAssertStmt(stmt: StmtNS.Assert): void; + visitForStmt(stmt: StmtNS.For): void; + visitIfStmt(stmt: StmtNS.If): void; + visitGlobalStmt(stmt: StmtNS.Global): void; + visitNonLocalStmt(stmt: StmtNS.NonLocal): void; + visitReturnStmt(stmt: StmtNS.Return): void; + visitWhileStmt(stmt: StmtNS.While): void; + visitSimpleExprStmt(stmt: StmtNS.SimpleExpr): void; + visitFromImportStmt(stmt: StmtNS.FromImport): void; + visitContinueStmt(stmt: StmtNS.Continue): void; + visitBreakStmt(stmt: StmtNS.Break): void; + visitPassStmt(stmt: StmtNS.Pass): void; + visitVariableExpr(expr: ExprNS.Variable): void; + visitLambdaExpr(expr: ExprNS.Lambda): void; + visitMultiLambdaExpr(expr: ExprNS.MultiLambda): void; + visitUnaryExpr(expr: ExprNS.Unary): void; + visitGroupingExpr(expr: ExprNS.Grouping): void; + visitBinaryExpr(expr: ExprNS.Binary): void; + visitBoolOpExpr(expr: ExprNS.BoolOp): void; + visitCompareExpr(expr: ExprNS.Compare): void; + visitCallExpr(expr: ExprNS.Call): void; + visitTernaryExpr(expr: ExprNS.Ternary): void; + visitNoneExpr(expr: ExprNS.None): void; + visitLiteralExpr(expr: ExprNS.Literal): void; + visitBigIntLiteralExpr(expr: ExprNS.BigIntLiteral): void; + visitComplexExpr(expr: ExprNS.Complex): void; +} +export {}; diff --git a/dist/runner/pyRunner.d.ts b/dist/runner/pyRunner.d.ts new file mode 100644 index 0000000..950b678 --- /dev/null +++ b/dist/runner/pyRunner.d.ts @@ -0,0 +1,5 @@ +import { IOptions } from ".."; +import { Context } from "../cse-machine/context"; +import { RecursivePartial, Result } from "../types"; +import * as es from 'estree'; +export declare function runCSEMachine(program: es.Program, context: Context, options?: RecursivePartial): Promise; diff --git a/dist/stdlib.d.ts b/dist/stdlib.d.ts new file mode 100644 index 0000000..c2d6bfe --- /dev/null +++ b/dist/stdlib.d.ts @@ -0,0 +1,67 @@ +import { Value } from "./cse-machine/stash"; +export declare const builtInConstants: Map; +export declare const builtIns: Map any>; +export declare function _int(args: Value[]): Value; +export declare function _int_from_string(args: Value[]): Value; +export declare function abs(args: Value[]): Value; +export declare function error(args: Value[]): Value; +export declare function isinstance(args: Value[]): Value; +export declare function math_acos(args: Value[]): Value; +export declare function math_acosh(args: Value[]): Value; +export declare function math_asin(args: Value[]): Value; +export declare function math_asinh(args: Value[]): Value; +export declare function math_atan(args: Value[]): Value; +export declare function math_atan2(args: Value[]): Value; +export declare function math_atanh(args: Value[]): Value; +export declare function math_cos(args: Value[]): Value; +export declare function math_cosh(args: Value[]): Value; +export declare function math_degrees(args: Value[]): Value; +export declare function math_erf(args: Value[]): Value; +export declare function math_erfc(args: Value[]): Value; +export declare function char_at(args: Value[]): Value; +export declare function math_comb(args: Value[]): Value; +export declare function math_factorial(args: Value[]): Value; +export declare function math_gcd(args: Value[]): Value; +export declare function math_isqrt(args: Value[]): Value; +export declare function math_lcm(args: Value[]): Value; +export declare function math_perm(args: Value[]): Value; +export declare function math_ceil(args: Value[]): Value; +export declare function math_fabs(args: Value[]): Value; +export declare function math_floor(args: Value[]): Value; +export declare function math_fma(args: Value[]): Value; +export declare function math_fmod(args: Value[]): Value; +export declare function math_remainder(args: Value[]): Value; +export declare function math_trunc(args: Value[]): Value; +export declare function math_copysign(args: Value[]): Value; +export declare function math_isfinite(args: Value[]): Value; +export declare function math_isinf(args: Value[]): Value; +export declare function math_isnan(args: Value[]): Value; +export declare function math_ldexp(args: Value[]): Value; +export declare function math_nextafter(args: Value[]): Value; +export declare function math_ulp(args: Value[]): Value; +export declare function math_cbrt(args: Value[]): Value; +export declare function math_exp(args: Value[]): Value; +export declare function math_exp2(args: Value[]): Value; +export declare function math_expm1(args: Value[]): Value; +export declare function math_gamma(args: Value[]): Value; +export declare function math_lgamma(args: Value[]): Value; +export declare function math_log(args: Value[]): Value; +export declare function math_log10(args: Value[]): Value; +export declare function math_log1p(args: Value[]): Value; +export declare function math_log2(args: Value[]): Value; +export declare function math_pow(args: Value[]): Value; +export declare function math_radians(args: Value[]): Value; +export declare function math_sin(args: Value[]): Value; +export declare function math_sinh(args: Value[]): Value; +export declare function math_tan(args: Value[]): Value; +export declare function math_tanh(args: Value[]): Value; +export declare function math_sqrt(args: Value[]): Value; +export declare function max(args: Value[]): Value; +export declare function min(args: Value[]): Value; +export declare function random_random(args: Value[]): Value; +export declare function round(args: Value[]): Value; +export declare function time_time(args: Value[]): Value; +export declare function toPythonString(obj: Value): string; +export declare function str(args: Value[]): Value; +export declare function input(args: Value[]): Value; +export declare function print(args: Value[]): void; diff --git a/dist/tokenizer.d.ts b/dist/tokenizer.d.ts new file mode 100644 index 0000000..66944fc --- /dev/null +++ b/dist/tokenizer.d.ts @@ -0,0 +1,52 @@ +import { TokenType } from "./tokens"; +export declare class Token { + type: TokenType; + lexeme: string; + line: number; + col: number; + indexInSource: number; + constructor(type: TokenType, lexeme: string, line: number, col: number, indexInSource: number); +} +export declare const SPECIAL_IDENTIFIER_TOKENS: TokenType[]; +export declare class Tokenizer { + private readonly source; + private readonly tokens; + private start; + private current; + private line; + private col; + private readonly indentStack; + private specialIdentifiers; + private forbiddenIdentifiers; + private parenthesesLevel; + constructor(source: string); + private isAtEnd; + private advance; + private lexemeBuffer; + private advanceString; + private getBuffer; + private addBuffer; + private subtractBufferForThreeQuoteString; + private peek; + private overwriteToken; + private addToken; + private addStringToken; + private addMultiLineStringToken; + private matches; + private isLegalUnicode; + private isAlpha; + private isDigit; + private isHexa; + private isOcta; + private isBinary; + private isIdentifier; + private isDelimiter; + private baseNumber; + private number; + private name; + private scanToken; + private matchForbiddenOperator; + scanEverything(): Token[]; + printTokens(): void; + private raiseForbiddenOperator; +} diff --git a/dist/tokens.d.ts b/dist/tokens.d.ts new file mode 100644 index 0000000..a61cd09 --- /dev/null +++ b/dist/tokens.d.ts @@ -0,0 +1,98 @@ +export declare enum TokenType { + ENDMARKER = 0, + NAME = 1, + NUMBER = 2, + BIGINT = 3, + STRING = 4, + NEWLINE = 5, + INDENT = 6, + DEDENT = 7, + LPAR = 8, + RPAR = 9, + COLON = 10, + DOUBLECOLON = 11, + COMMA = 12, + PLUS = 13, + MINUS = 14, + BANG = 15, + STAR = 16, + SLASH = 17, + VBAR = 18, + AMPER = 19, + LESS = 20, + GREATER = 21, + EQUAL = 22, + PERCENT = 23, + DOUBLEEQUAL = 24, + NOTEQUAL = 25, + LESSEQUAL = 26, + GREATEREQUAL = 27, + DOUBLESTAR = 28, + COMPLEX = 29, + AND = 30, + OR = 31, + FOR = 32, + WHILE = 33, + NONE = 34, + TRUE = 35, + FALSE = 36, + IS = 37, + NOT = 38, + ISNOT = 39, + PASS = 40, + DEF = 41, + LAMBDA = 42, + FROM = 43, + DOUBLESLASH = 44, + BREAK = 45, + CONTINUE = 46, + RETURN = 47, + ASSERT = 48, + IMPORT = 49, + GLOBAL = 50, + NONLOCAL = 51, + IF = 52, + ELSE = 53, + ELIF = 54, + IN = 55, + NOTIN = 56, + RSQB = 57, + LSQB = 58, + ELLIPSIS = 59, + SEMI = 60, + DOT = 61, + LBRACE = 62, + RBRACE = 63, + TILDE = 64, + CIRCUMFLEX = 65, + LEFTSHIFT = 66, + RIGHTSHIFT = 67, + PLUSEQUAL = 68, + MINEQUAL = 69, + STAREQUAL = 70, + SLASHEQUAL = 71, + PERCENTEQUAL = 72, + AMPEREQUAL = 73, + VBAREQUAL = 74, + CIRCUMFLEXEQUAL = 75, + LEFTSHIFTEQUAL = 76, + RIGHTSHIFTEQUAL = 77, + DOUBLESTAREQUAL = 78, + DOUBLESLASHEQUAL = 79, + AT = 80, + ATEQUAL = 81, + RARROW = 82, + COLONEQUAL = 83, + OP = 84, + AWAIT = 85, + ASYNC = 86, + TYPE_IGNORE = 87, + TYPE_COMMENT = 88, + YIELD = 89, + WITH = 90, + DEL = 91, + TRY = 92, + EXCEPT = 93, + FINALLY = 94, + RAISE = 95 +} diff --git a/dist/translator.d.ts b/dist/translator.d.ts new file mode 100644 index 0000000..52560cb --- /dev/null +++ b/dist/translator.d.ts @@ -0,0 +1,62 @@ +import { StmtNS, ExprNS } from "./ast-types"; +type Expr = ExprNS.Expr; +type Stmt = StmtNS.Stmt; +import { ArrowFunctionExpression, AssignmentExpression, BaseNode, BigIntLiteral, BinaryExpression, BreakStatement, CallExpression, ConditionalExpression, ContinueStatement, EmptyStatement, Expression, ExpressionStatement, FunctionDeclaration, Identifier, IfStatement, ImportDeclaration, LogicalExpression, Program, ReturnStatement, SimpleLiteral, Statement, UnaryExpression, VariableDeclaration, WhileStatement } from "estree"; +import { ComplexLiteral, None } from "./types"; +export interface EstreePosition { + line: number; + column: number; +} +export interface EstreeLocation { + source: string; + start: EstreePosition; + end: EstreePosition; +} +export declare class Translator implements StmtNS.Visitor, ExprNS.Visitor { + private readonly source; + constructor(source: string); + private tokenToEstreeLocation; + private toEstreeLocation; + resolve(stmt: Stmt | Expr): Statement | Expression; + resolveStmt(stmt: Stmt): any; + resolveManyStmt(stmts: Stmt[]): Statement[]; + resolveExpr(expr: Expr): any; + resolveManyExpr(exprs: Expr[]): any[]; + private rawStringToIdentifier; + private convertToIdentifier; + private convertToIdentifiers; + private wrapInBlock; + visitFileInputStmt(stmt: StmtNS.FileInput): Program; + visitIndentCreation(stmt: StmtNS.Indent): EmptyStatement; + visitDedentCreation(stmt: StmtNS.Dedent): EmptyStatement; + visitFunctionDefStmt(stmt: StmtNS.FunctionDef): FunctionDeclaration; + visitAnnAssignStmt(stmt: StmtNS.AnnAssign): AssignmentExpression; + visitAssignStmt(stmt: StmtNS.Assign): VariableDeclaration; + visitAssertStmt(stmt: StmtNS.Assert): CallExpression; + visitForStmt(stmt: StmtNS.For): EmptyStatement; + visitIfStmt(stmt: StmtNS.If): IfStatement; + visitGlobalStmt(stmt: StmtNS.Global): EmptyStatement; + visitNonLocalStmt(stmt: StmtNS.NonLocal): EmptyStatement; + visitReturnStmt(stmt: StmtNS.Return): ReturnStatement; + visitWhileStmt(stmt: StmtNS.While): WhileStatement; + visitSimpleExprStmt(stmt: StmtNS.SimpleExpr): ExpressionStatement; + visitFromImportStmt(stmt: StmtNS.FromImport): ImportDeclaration; + visitContinueStmt(stmt: StmtNS.Continue): ContinueStatement; + visitBreakStmt(stmt: StmtNS.Break): BreakStatement; + visitPassStmt(stmt: StmtNS.Pass): EmptyStatement; + visitVariableExpr(expr: ExprNS.Variable): Identifier; + visitLambdaExpr(expr: ExprNS.Lambda): ArrowFunctionExpression; + visitMultiLambdaExpr(expr: ExprNS.MultiLambda): EmptyStatement; + visitUnaryExpr(expr: ExprNS.Unary): UnaryExpression | CallExpression; + visitGroupingExpr(expr: ExprNS.Grouping): Expression; + visitBinaryExpr(expr: ExprNS.Binary): CallExpression; + visitCompareExpr(expr: ExprNS.Compare): BinaryExpression; + visitBoolOpExpr(expr: ExprNS.BoolOp): LogicalExpression; + visitCallExpr(expr: ExprNS.Call): CallExpression; + visitTernaryExpr(expr: ExprNS.Ternary): ConditionalExpression; + visitLiteralExpr(expr: ExprNS.Literal): SimpleLiteral; + visitBigIntLiteralExpr(expr: ExprNS.BigIntLiteral): BigIntLiteral; + visitNoneExpr(expr: ExprNS.None): None; + visitComplexExpr(expr: ExprNS.Complex): ComplexLiteral; +} +export {}; diff --git a/dist/types.d.ts b/dist/types.d.ts new file mode 100644 index 0000000..f4da5ba --- /dev/null +++ b/dist/types.d.ts @@ -0,0 +1,90 @@ +import * as es from 'estree'; +import { Value } from './cse-machine/stash'; +import { Context } from './cse-machine/context'; +import { ModuleFunctions } from './modules/moduleTypes'; +export declare class CSEBreak { +} +export declare enum ErrorType { + IMPORT = "Import", + RUNTIME = "Runtime", + SYNTAX = "Syntax", + TYPE = "Type" +} +export declare enum ErrorSeverity { + WARNING = "Warning", + ERROR = "Error" +} +export interface SourceError { + type: ErrorType; + severity: ErrorSeverity; + location: es.SourceLocation; + explain(): string; + elaborate(): string; +} +export declare class PyComplexNumber { + real: number; + imag: number; + constructor(real: number, imag: number); + static fromNumber(value: number): PyComplexNumber; + static fromBigInt(value: bigint): PyComplexNumber; + static fromString(str: string): PyComplexNumber; + static fromValue(value: number | bigint | string | PyComplexNumber): PyComplexNumber; + /** + * operations + */ + add(other: PyComplexNumber): PyComplexNumber; + sub(other: PyComplexNumber): PyComplexNumber; + mul(other: PyComplexNumber): PyComplexNumber; + div(other: PyComplexNumber): PyComplexNumber; + pow(other: PyComplexNumber): PyComplexNumber; + toString(): string; + private toPythonComplexFloat; + equals(other: PyComplexNumber): boolean; +} +export interface None extends es.BaseNode { + type: 'NoneType'; + loc?: es.SourceLocation; +} +export interface ComplexLiteral extends es.BaseNode { + type: 'Literal'; + complex: { + real: number; + imag: number; + }; + loc?: es.SourceLocation; +} +/** + * Helper type to recursively make properties that are also objects + * partial + * + * By default, `Partial>` is equivalent to `Array`. For this type, `Array` will be + * transformed to Array> instead + */ +export type RecursivePartial = T extends Array ? Array> : T extends Record ? Partial<{ + [K in keyof T]: RecursivePartial; +}> : T; +export type Result = Finished | Error | SuspendedCseEval; +export interface SuspendedCseEval { + status: 'suspended-cse-eval'; + context: Context; +} +export interface Finished { + status: 'finished'; + context: Context; + value: Value; + representation: Representation; +} +export declare class Representation { + representation: string; + constructor(representation: string); + toString(value: any): string; +} +export interface NativeStorage { + builtins: Map; + previousProgramsIdentifiers: Set; + operators: Map Value>; + maxExecTime: number; + evaller: null | ((program: string) => Value); + loadedModules: Record; + loadedModuleTypes: Record>; +} diff --git a/docs/jsdoc/conf.json b/docs/jsdoc/conf.json new file mode 100644 index 0000000..c60dbe8 --- /dev/null +++ b/docs/jsdoc/conf.json @@ -0,0 +1,9 @@ +{ + "templates": { + "cleverLinks": false, + "monospaceLinks": false, + "default": { + "outputSourceFiles": false + } + } +} diff --git a/docs/jsdoc/templates/template/README.md b/docs/jsdoc/templates/template/README.md new file mode 100644 index 0000000..e7a1bc5 --- /dev/null +++ b/docs/jsdoc/templates/template/README.md @@ -0,0 +1,27 @@ +The default template for JSDoc 3 uses: [the Taffy Database library](http://taffydb.com/) and the [Underscore Template library](http://underscorejs.org/). + + +## Generating Typeface Fonts + +The default template uses the [OpenSans](https://www.google.com/fonts/specimen/Open+Sans) typeface. The font files can be regenerated as follows: + +1. Open the [OpenSans page at Font Squirrel](). +2. Click on the 'Webfont Kit' tab. +3. Either leave the subset drop-down as 'Western Latin (Default)', or, if we decide we need more glyphs, than change it to 'No Subsetting'. +4. Click the 'DOWNLOAD @FONT-FACE KIT' button. +5. For each typeface variant we plan to use, copy the 'eot', 'svg' and 'woff' files into the 'templates/default/static/fonts' directory. + +## Changelog compared to default template + +``` +publish.js: +// changed from default template by MH on 1/7/2019, see "MH" below +``` + +``` +folder tmpl: see tmpl/README.md +``` + +``` +folder static: see static/README.md +``` diff --git a/docs/jsdoc/templates/template/publish.d.ts b/docs/jsdoc/templates/template/publish.d.ts new file mode 100644 index 0000000..70107fd --- /dev/null +++ b/docs/jsdoc/templates/template/publish.d.ts @@ -0,0 +1 @@ +export function publish(taffyData: TAFFY, opts: object, tutorials: Tutorial): void; diff --git a/docs/jsdoc/templates/template/publish.js b/docs/jsdoc/templates/template/publish.js new file mode 100644 index 0000000..0c42760 --- /dev/null +++ b/docs/jsdoc/templates/template/publish.js @@ -0,0 +1,722 @@ +// changed from default template by MH on 1/7/2019, see "MH" below +// changed from previous template by JC on 29/3/2020, see "JC" below + +const doop = require('jsdoc/util/doop'); +const env = require('jsdoc/env'); +const fs = require('jsdoc/fs'); +const helper = require('jsdoc/util/templateHelper'); +const logger = require('jsdoc/util/logger'); +const path = require('jsdoc/path'); +const taffy = require('taffydb').taffy; +const template = require('jsdoc/template'); +const util = require('util'); + +const htmlsafe = helper.htmlsafe; +const linkto = helper.linkto; +const resolveAuthorLinks = helper.resolveAuthorLinks; +const hasOwnProp = Object.prototype.hasOwnProperty; + +let data; +let view; + +let outdir = path.normalize(env.opts.destination); + +function find(spec) { + return helper.find(data, spec); +} + +function tutoriallink(tutorial) { + return helper.toTutorial(tutorial, null, { + tag: 'em', + classname: 'disabled', + prefix: 'Tutorial: ' + }); +} + +function getAncestorLinks(doclet) { + return helper.getAncestorLinks(data, doclet); +} + +function hashToLink(doclet, hash) { + let url; + + if ( !/^(#.+)/.test(hash) ) { + return hash; + } + + url = helper.createLink(doclet); + url = url.replace(/(#.+|$)/, hash); + + return `${hash}`; +} + +function needsSignature({kind, type, meta}) { + let needsSig = false; + + // function and class definitions always get a signature + if (kind === 'function' || kind === 'class') { + needsSig = true; + } + // typedefs that contain functions get a signature, too + else if (kind === 'typedef' && type && type.names && + type.names.length) { + for (let i = 0, l = type.names.length; i < l; i++) { + if (type.names[i].toLowerCase() === 'function') { + needsSig = true; + break; + } + } + } + // and namespaces that are functions get a signature (but finding them is a + // bit messy) + else if (kind === 'namespace' && meta && meta.code && + meta.code.type && meta.code.type.match(/[Ff]unction/)) { + needsSig = true; + } + + return needsSig; +} + +function getSignatureAttributes({optional, nullable}) { + const attributes = []; + + if (optional) { + attributes.push('opt'); + } + + if (nullable === true) { + attributes.push('nullable'); + } + else if (nullable === false) { + attributes.push('non-null'); + } + + return attributes; +} + +function updateItemName(item) { + const attributes = getSignatureAttributes(item); + let itemName = item.name || ''; + + if (item.variable) { + itemName = `…${itemName}`; + } + + if (attributes && attributes.length) { + itemName = util.format( '%s%s', itemName, + attributes.join(', ') ); + } + + return itemName; +} + +function addParamAttributes(params) { + return params.filter(({name}) => name && !name.includes('.')).map(updateItemName); +} + +function buildItemTypeStrings(item) { + const types = []; + + if (item && item.type && item.type.names) { + item.type.names.forEach(name => { + types.push( linkto(name, htmlsafe(name)) ); + }); + } + + return types; +} + +function buildAttribsString(attribs) { + let attribsString = ''; + + if (attribs && attribs.length) { + attribsString = htmlsafe( util.format('(%s) ', attribs.join(', ')) ); + } + + return attribsString; +} + +function addNonParamAttributes(items) { + let types = []; + + items.forEach(item => { + types = types.concat( buildItemTypeStrings(item) ); + }); + + return types; +} + +function addSignatureParams(f) { + const params = f.params ? addParamAttributes(f.params) : []; + + f.signature = util.format( '%s(%s)', (f.signature || ''), params.join(', ') ); +} + +function addSignatureReturns(f) { + const attribs = []; + let attribsString = ''; + let returnTypes = []; + let returnTypesString = ''; + const source = f.yields || f.returns; + + // jam all the return-type attributes into an array. this could create odd results (for example, + // if there are both nullable and non-nullable return types), but let's assume that most people + // who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa. + if (source) { + source.forEach(item => { + helper.getAttribs(item).forEach(attrib => { + if (!attribs.includes(attrib)) { + attribs.push(attrib); + } + }); + }); + + attribsString = buildAttribsString(attribs); + } + + if (source) { + returnTypes = addNonParamAttributes(source); + } + if (returnTypes.length) { + returnTypesString = util.format( ' → %s{%s}', attribsString, returnTypes.join('|') ); + } + + f.signature = `${f.signature || ''}${returnTypesString}`; +} + +function addSignatureTypes(f) { + const types = f.type ? buildItemTypeStrings(f) : []; + + f.signature = `${f.signature || ''}${types.length ? ` :${types.join('|')}` : ''}`; +} + +function addAttribs(f) { + const attribs = helper.getAttribs(f); + const attribsString = buildAttribsString(attribs); + + f.attribs = util.format('%s', attribsString); +} + +function shortenPaths(files, commonPrefix) { + Object.keys(files).forEach(file => { + files[file].shortened = files[file].resolved.replace(commonPrefix, '') + // always use forward slashes + .replace(/\\/g, '/'); + }); + + return files; +} + +function getPathFromDoclet({meta}) { + if (!meta) { + return null; + } + + return meta.path && meta.path !== 'null' ? + path.join(meta.path, meta.filename) : + meta.filename; +} + +function generate(title, docs, filename, resolveLinks) { + let docData; + let html; + let outpath; + + resolveLinks = resolveLinks !== false; + + docData = { + env: env, + title: title, + // remove tags from header, also see layout.tmpl + header: title.replace(/]*>/,"").replace(/<\/a>/,""), + docs: docs + }; + + outpath = path.join(outdir, filename); + html = view.render('container.tmpl', docData); + + if (resolveLinks) { + html = helper.resolveLinks(html); // turn {@link foo} into foo + } + + fs.writeFileSync(outpath, html, 'utf8'); +} + +function generateSourceFiles(sourceFiles, encoding = 'utf8') { + Object.keys(sourceFiles).forEach(file => { + let source; + // links are keyed to the shortened path in each doclet's `meta.shortpath` property + const sourceOutfile = helper.getUniqueFilename(sourceFiles[file].shortened); + + helper.registerLink(sourceFiles[file].shortened, sourceOutfile); + + try { + source = { + kind: 'source', + code: helper.htmlsafe( fs.readFileSync(sourceFiles[file].resolved, encoding) ) + }; + } + catch (e) { + logger.error('Error while generating source file %s: %s', file, e.message); + } + + generate(`Source: ${sourceFiles[file].shortened}`, [source], sourceOutfile, + false); + }); +} + +/** + * Look for classes or functions with the same name as modules (which indicates that the module + * exports only that class or function), then attach the classes or functions to the `module` + * property of the appropriate module doclets. The name of each class or function is also updated + * for display purposes. This function mutates the original arrays. + * + * @private + * @param {Array.} doclets - The array of classes and functions to + * check. + * @param {Array.} modules - The array of module doclets to search. + */ +function attachModuleSymbols(doclets, modules) { + const symbols = {}; + + // build a lookup table + doclets.forEach(symbol => { + symbols[symbol.longname] = symbols[symbol.longname] || []; + symbols[symbol.longname].push(symbol); + }); + + modules.forEach(module => { + if (symbols[module.longname]) { + module.modules = symbols[module.longname] + // Only show symbols that have a description. Make an exception for classes, because + // we want to show the constructor-signature heading no matter what. + .filter(({description, kind}) => description || kind === 'class') + .map(symbol => { + symbol = doop(symbol); + + if (symbol.kind === 'class' || symbol.kind === 'function') { + symbol.name = `${symbol.name.replace('module:', '(require("')}"))`; + } + + return symbol; + }); + } + }); +} + +function buildMemberNav(items, itemHeading, itemsSeen, linktoFn) { + let nav = ''; + + if (items.length) { + let itemsNav = ''; + + items.forEach(item => { + let displayName; + + if ( !hasOwnProp.call(item, 'longname') ) { + itemsNav += `
  • ${linktoFn('', item.name)}
  • `; + } + else if ( !hasOwnProp.call(itemsSeen, item.longname) ) { + if (env.conf.templates.default.useLongnameInNav) { + displayName = item.longname; + } else { + displayName = item.name; + } + itemsNav += `
  • ${linktoFn(item.longname, displayName.replace(/\b(module|event):/g, ''))}
  • `; + + itemsSeen[item.longname] = true; + } + }); + + if (itemsNav !== '') { + nav += `

    ${itemHeading}

      ${itemsNav}
    `; + } + } + + return nav; +} + +function linktoTutorial(longName, name) { + return tutoriallink(name); +} + +function linktoExternal(longName, name) { + return linkto(longName, name.replace(/(^"|"$)/g, '')); +} + +/** + * Create the navigation sidebar. + * @param {object} members The members that will be used to create the sidebar. + * @param {array} members.classes + * @param {array} members.externals + * @param {array} members.globals + * @param {array} members.mixins + * @param {array} members.modules + * @param {array} members.namespaces + * @param {array} members.tutorials + * @param {array} members.events + * @param {array} members.interfaces + * @return {string} The HTML for the navigation sidebar. + */ +function buildNav(members) { + let globalNav; + let nav = ''; // '

    Home

    '; + const seen = {}; + const seenTutorials = {}; + + nav += buildMemberNav(members.modules, 'Modules', {}, linkto); + nav += buildMemberNav(members.externals, 'Externals', seen, linktoExternal); + nav += buildMemberNav(members.namespaces, 'Namespaces', seen, linkto); +// nav += buildMemberNav(members.classes, 'Classes', seen, linkto); + nav += buildMemberNav(members.interfaces, 'Interfaces', seen, linkto); + nav += buildMemberNav(members.events, 'Events', seen, linkto); + nav += buildMemberNav(members.mixins, 'Mixins', seen, linkto); + nav += buildMemberNav(members.tutorials, 'Tutorials', seenTutorials, linktoTutorial); + + if (members.globals.length) { + globalNav = ''; + + members.globals.forEach(({kind, longname, name}) => { + if ( kind !== 'typedef' && !hasOwnProp.call(seen, longname) ) { + globalNav += `
  • ${linkto(longname, name)}
  • `; + } + seen[longname] = true; + }); + + if (!globalNav) { + // turn the heading into a link so you can actually get to the global page + // MH: 9/7/19: use the basename of the folder as heading + // MH: 13/7/19: we turn "_" into " §", in order to have nice headings + // JC: 29/3/20: restrict above transformation to first "_" + const symbolReplacedName = path.basename(outdir).replace(/_/, " §"); + // JC: 29/3/20: change all remaining "_" to " " + const displayName = symbolReplacedName.replace(/_/g, " "); + const link = `${displayName}`; + nav += `

    ${linkto('global', 'Predeclared in '+ link)}

    `; + } + else { + nav += `

    Predeclared names

      ${globalNav}
    `; + } + } + + return nav; +} + +/** + @param {TAFFY} taffyData See . + @param {object} opts + @param {Tutorial} tutorials + */ +exports.publish = (taffyData, opts, tutorials) => { + let classes; + let conf; + let externals; + let files; + let fromDir; + let globalUrl; + let indexUrl; + let interfaces; + let members; + let mixins; + let modules; + let namespaces; + let outputSourceFiles; + let packageInfo; + let packages; + const sourceFilePaths = []; + let sourceFiles = {}; + let staticFileFilter; + let staticFilePaths; + let staticFiles; + let staticFileScanner; + let templatePath; + + data = taffyData; + + conf = env.conf.templates || {}; + conf.default = conf.default || {}; + + templatePath = path.normalize(opts.template); + view = new template.Template( path.join(templatePath, 'tmpl') ); + + // claim some special filenames in advance, so the All-Powerful Overseer of Filename Uniqueness + // doesn't try to hand them out later + indexUrl = helper.getUniqueFilename('index'); + // don't call registerLink() on this one! 'index' is also a valid longname + + globalUrl = helper.getUniqueFilename('global'); + helper.registerLink('global', globalUrl); + + // set up templating + view.layout = conf.default.layoutFile ? + path.getResourcePath(path.dirname(conf.default.layoutFile), + path.basename(conf.default.layoutFile) ) : + 'layout.tmpl'; + + // set up tutorials for helper + helper.setTutorials(tutorials); + + data = helper.prune(data); + data.sort('longname, version, since'); + helper.addEventListeners(data); + + data().each(doclet => { + let sourcePath; + + doclet.attribs = ''; + + if (doclet.examples) { + doclet.examples = doclet.examples.map(example => { + let caption; + let code; + + if (example.match(/^\s*([\s\S]+?)<\/caption>(\s*[\n\r])([\s\S]+)$/i)) { + caption = RegExp.$1; + code = RegExp.$3; + } + + return { + caption: caption || '', + code: code || example + }; + }); + } + if (doclet.see) { + doclet.see.forEach((seeItem, i) => { + doclet.see[i] = hashToLink(doclet, seeItem); + }); + } + + // build a list of source files + if (doclet.meta) { + sourcePath = getPathFromDoclet(doclet); + sourceFiles[sourcePath] = { + resolved: sourcePath, + shortened: null + }; + if (!sourceFilePaths.includes(sourcePath)) { + sourceFilePaths.push(sourcePath); + } + } + }); + + // update outdir if necessary, then create outdir + packageInfo = ( find({kind: 'package'}) || [] )[0]; + if (packageInfo && packageInfo.name) { + outdir = path.join( outdir, packageInfo.name, (packageInfo.version || '') ); + } + fs.mkPath(outdir); + + // copy the template's static files to outdir + fromDir = path.join(templatePath, 'static'); + staticFiles = fs.ls(fromDir, 3); + + staticFiles.forEach(fileName => { + const toDir = fs.toDir( fileName.replace(fromDir, outdir) ); + + fs.mkPath(toDir); + fs.copyFileSync(fileName, toDir); + }); + + // copy user-specified static files to outdir + if (conf.default.staticFiles) { + // The canonical property name is `include`. We accept `paths` for backwards compatibility + // with a bug in JSDoc 3.2.x. + staticFilePaths = conf.default.staticFiles.include || + conf.default.staticFiles.paths || + []; + staticFileFilter = new (require('jsdoc/src/filter').Filter)(conf.default.staticFiles); + staticFileScanner = new (require('jsdoc/src/scanner').Scanner)(); + + staticFilePaths.forEach(filePath => { + let extraStaticFiles; + + filePath = path.resolve(env.pwd, filePath); + extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter); + + extraStaticFiles.forEach(fileName => { + const sourcePath = fs.toDir(filePath); + const toDir = fs.toDir( fileName.replace(sourcePath, outdir) ); + + fs.mkPath(toDir); + fs.copyFileSync(fileName, toDir); + }); + }); + } + + if (sourceFilePaths.length) { + sourceFiles = shortenPaths( sourceFiles, path.commonPrefix(sourceFilePaths) ); + } + data().each(doclet => { + let docletPath; + const url = helper.createLink(doclet); + + helper.registerLink(doclet.longname, url); + + // add a shortened version of the full path + if (doclet.meta) { + docletPath = getPathFromDoclet(doclet); + docletPath = sourceFiles[docletPath].shortened; + if (docletPath) { + doclet.meta.shortpath = docletPath; + } + } + }); + + data().each(doclet => { + const url = helper.longnameToUrl[doclet.longname]; + + if (url.includes('#')) { + doclet.id = helper.longnameToUrl[doclet.longname].split(/#/).pop(); + } + else { + doclet.id = doclet.name; + } + + if ( needsSignature(doclet) ) { + addSignatureParams(doclet); + addSignatureReturns(doclet); + addAttribs(doclet); + } + }); + + // do this after the urls have all been generated + data().each(doclet => { + doclet.ancestors = getAncestorLinks(doclet); + + if (doclet.kind === 'member') { + addSignatureTypes(doclet); + addAttribs(doclet); + } + + if (doclet.kind === 'constant') { + addSignatureTypes(doclet); + addAttribs(doclet); + doclet.kind = 'member'; + } + }); + + members = helper.getMembers(data); + members.tutorials = tutorials.children; + + // output pretty-printed source files by default + outputSourceFiles = conf.default && conf.default.outputSourceFiles !== false; + + // add template helpers + view.find = find; + view.linkto = linkto; + view.resolveAuthorLinks = resolveAuthorLinks; + view.tutoriallink = tutoriallink; + view.htmlsafe = htmlsafe; + view.outputSourceFiles = outputSourceFiles; + + // once for all + view.nav = buildNav(members); + attachModuleSymbols( find({ longname: {left: 'module:'} }), members.modules ); + + // generate the pretty-printed source files first so other pages can link to them + if (outputSourceFiles) { + generateSourceFiles(sourceFiles, opts.encoding); + } + + // MH: 9/7/19: use the basename of the folder as heading + let baseName = path.basename(outdir); + // MH: 13/7/19: turn "_" into " §", in order to have nice headings + // JC: 29/3/20: restrict above transformation to first "_" + const symbolReplacedName = baseName.replace(/_/, " §"); + // JC: 29/3/20: change all remaining "_" to " ", then capitalize each word + const spacedName = symbolReplacedName.replace(/_/g, " "); + // Arsalan: 21/4/20: capitalize the first letter of each word, including those separated by a hyphen + const displayName = spacedName.replace(/(^|[\s-])\S/g, firstLetter => firstLetter.toUpperCase()); + + const link = `${displayName}`; + + // MH: 23/4/2020: added else to conditional to allow for empty libs + if (members.globals.length) { + generate('Predeclared in '+ link, [{kind: 'globalobj'}], globalUrl); + } else { + generate('No names predeclared in ' + link, [{kind: 'globalobj'}], globalUrl); + } + + // index page displays information from package.json and lists files + files = find({kind: 'file'}); + packages = find({kind: 'package'}); + + generate(displayName, // MH: 1/7/2019: This was: + // generate('Home', + packages.concat( + [{ + kind: 'mainpage', + readme: opts.readme, + longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page' + }] + ).concat(files), indexUrl); + + // set up the lists that we'll use to generate pages + classes = taffy(members.classes); + modules = taffy(members.modules); + namespaces = taffy(members.namespaces); + mixins = taffy(members.mixins); + externals = taffy(members.externals); + interfaces = taffy(members.interfaces); + + Object.keys(helper.longnameToUrl).forEach(longname => { + const myClasses = helper.find(classes, {longname: longname}); + const myExternals = helper.find(externals, {longname: longname}); + const myInterfaces = helper.find(interfaces, {longname: longname}); + const myMixins = helper.find(mixins, {longname: longname}); + const myModules = helper.find(modules, {longname: longname}); + const myNamespaces = helper.find(namespaces, {longname: longname}); + + if (myModules.length) { + generate(`Module: ${myModules[0].name}`, myModules, helper.longnameToUrl[longname]); + } + + if (myClasses.length) { + generate(`Class: ${myClasses[0].name}`, myClasses, helper.longnameToUrl[longname]); + } + + if (myNamespaces.length) { + generate(`Namespace: ${myNamespaces[0].name}`, myNamespaces, helper.longnameToUrl[longname]); + } + + if (myMixins.length) { + generate(`Mixin: ${myMixins[0].name}`, myMixins, helper.longnameToUrl[longname]); + } + + if (myExternals.length) { + generate(`External: ${myExternals[0].name}`, myExternals, helper.longnameToUrl[longname]); + } + + if (myInterfaces.length) { + generate(`Interface: ${myInterfaces[0].name}`, myInterfaces, helper.longnameToUrl[longname]); + } + }); + + // TODO: move the tutorial functions to templateHelper.js + function generateTutorial(title, tutorial, filename) { + const tutorialData = { + title: title, + header: tutorial.title, + content: tutorial.parse(), + children: tutorial.children + }; + const tutorialPath = path.join(outdir, filename); + let html = view.render('tutorial.tmpl', tutorialData); + + // yes, you can use {@link} in tutorials too! + html = helper.resolveLinks(html); // turn {@link foo} into foo + + fs.writeFileSync(tutorialPath, html, 'utf8'); + } + + // tutorials can have only one parent so there is no risk for loops + function saveChildren({children}) { + children.forEach(child => { + generateTutorial(`Tutorial: ${child.title}`, child, helper.tutorialToUrl(child.name)); + saveChildren(child); + }); + } + + saveChildren(tutorials); +}; diff --git a/docs/jsdoc/templates/template/static/README.md b/docs/jsdoc/templates/template/static/README.md new file mode 100644 index 0000000..c55ab7f --- /dev/null +++ b/docs/jsdoc/templates/template/static/README.md @@ -0,0 +1,3 @@ +Changelog: + +styles changed by MH on 1/7/2019, see styles/README.md diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Bold-webfont.eot b/docs/jsdoc/templates/template/static/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 0000000..5d20d91 Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-Bold-webfont.eot differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Bold-webfont.svg b/docs/jsdoc/templates/template/static/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 0000000..3ed7be4 --- /dev/null +++ b/docs/jsdoc/templates/template/static/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Bold-webfont.woff b/docs/jsdoc/templates/template/static/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 0000000..1205787 Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-Bold-webfont.woff differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-BoldItalic-webfont.eot b/docs/jsdoc/templates/template/static/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 0000000..1f639a1 Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-BoldItalic-webfont.svg b/docs/jsdoc/templates/template/static/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 0000000..6a2607b --- /dev/null +++ b/docs/jsdoc/templates/template/static/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-BoldItalic-webfont.woff b/docs/jsdoc/templates/template/static/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 0000000..ed760c0 Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Italic-webfont.eot b/docs/jsdoc/templates/template/static/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 0000000..0c8a0ae Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-Italic-webfont.eot differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Italic-webfont.svg b/docs/jsdoc/templates/template/static/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 0000000..e1075dc --- /dev/null +++ b/docs/jsdoc/templates/template/static/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Italic-webfont.woff b/docs/jsdoc/templates/template/static/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 0000000..ff652e6 Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-Italic-webfont.woff differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Light-webfont.eot b/docs/jsdoc/templates/template/static/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 0000000..1486840 Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-Light-webfont.eot differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Light-webfont.svg b/docs/jsdoc/templates/template/static/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 0000000..11a472c --- /dev/null +++ b/docs/jsdoc/templates/template/static/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Light-webfont.woff b/docs/jsdoc/templates/template/static/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 0000000..e786074 Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-Light-webfont.woff differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-LightItalic-webfont.eot b/docs/jsdoc/templates/template/static/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 0000000..8f44592 Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-LightItalic-webfont.svg b/docs/jsdoc/templates/template/static/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 0000000..431d7e3 --- /dev/null +++ b/docs/jsdoc/templates/template/static/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-LightItalic-webfont.woff b/docs/jsdoc/templates/template/static/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 0000000..43e8b9e Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Regular-webfont.eot b/docs/jsdoc/templates/template/static/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 0000000..6bbc3cf Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-Regular-webfont.eot differ diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Regular-webfont.svg b/docs/jsdoc/templates/template/static/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 0000000..25a3952 --- /dev/null +++ b/docs/jsdoc/templates/template/static/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/jsdoc/templates/template/static/fonts/OpenSans-Regular-webfont.woff b/docs/jsdoc/templates/template/static/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 0000000..e231183 Binary files /dev/null and b/docs/jsdoc/templates/template/static/fonts/OpenSans-Regular-webfont.woff differ diff --git a/docs/jsdoc/templates/template/static/scripts/prettify/Apache-License-2.0.txt b/docs/jsdoc/templates/template/static/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/docs/jsdoc/templates/template/static/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/docs/jsdoc/templates/template/static/styles/README.md b/docs/jsdoc/templates/template/static/styles/README.md new file mode 100644 index 0000000..6e6e82d --- /dev/null +++ b/docs/jsdoc/templates/template/static/styles/README.md @@ -0,0 +1,3 @@ +Changelog: + +// jsdoc-default.css modified by MH: 1/7/2019, see MH below \ No newline at end of file diff --git a/docs/jsdoc/templates/template/static/styles/jsdoc-default.css b/docs/jsdoc/templates/template/static/styles/jsdoc-default.css new file mode 100644 index 0000000..a2802ea --- /dev/null +++ b/docs/jsdoc/templates/template/static/styles/jsdoc-default.css @@ -0,0 +1,367 @@ +/* modified by MH: 1/7/2019, see MH below */ + +@font-face { + font-family: 'Open Sans'; + font-weight: normal; + font-style: normal; + src: url('../fonts/OpenSans-Regular-webfont.eot'); + src: + local('Open Sans'), + local('OpenSans'), + url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), + url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), + url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg'); +} + +@font-face { + font-family: 'Open Sans Light'; + font-weight: normal; + font-style: normal; + src: url('../fonts/OpenSans-Light-webfont.eot'); + src: + local('Open Sans Light'), + local('OpenSans Light'), + url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), + url('../fonts/OpenSans-Light-webfont.woff') format('woff'), + url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg'); +} + +html +{ + overflow: auto; + background-color: #fff; + font-size: 14px; +} + +body +{ + font-family: 'Open Sans', sans-serif; + line-height: 1.5; + color: #4d4e53; + background-color: white; +} + +a, a:visited, a:active { + color: #0095dd; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +header +{ + display: block; + padding: 0px 4px; +} + +tt, code, kbd, samp { + font-family: Consolas, Monaco, 'Andale Mono', monospace; +} + +.class-description { + font-size: 130%; + line-height: 140%; + margin-bottom: 1em; + margin-top: 1em; +} + +.class-description:empty { + margin: 0; +} + +#main { + float: left; + width: 70%; +} + +article dl { + margin-bottom: 40px; +} + +article img { + max-width: 100%; +} + +section +{ + display: block; + background-color: #fff; + padding: 12px 24px; + border-bottom: 1px solid #ccc; + margin-right: 30px; +} + +.variation { + display: none; +} + +.signature-attributes { + font-size: 60%; + color: #aaa; + font-style: italic; + font-weight: lighter; +} + +nav +{ + display: block; + float: right; + margin-top: 28px; + width: 30%; + box-sizing: border-box; + border-left: 1px solid #ccc; + padding-left: 16px; +} + +nav ul { + font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; + font-size: 100%; + line-height: 17px; + padding: 0; + margin: 0; + list-style-type: none; +} + +nav ul a, nav ul a:visited, nav ul a:active { + font-family: Consolas, Monaco, 'Andale Mono', monospace; + line-height: 18px; + color: #4D4E53; +} + +nav h3 { + margin-top: 12px; +} + +nav li { + margin-top: 6px; +} + +footer { + display: block; + padding: 6px; + margin-top: 12px; + font-style: italic; + font-size: 90%; +} + +h1, h2, h3, h4 { + font-weight: 200; + margin: 0; +} + +h1 +{ + font-family: 'Open Sans Light', sans-serif; + font-size: 48px; + letter-spacing: -2px; + margin: 12px 24px 20px; +} + +/* added by MH: 1/7/2019 + support for overall library index, + using library-page class */ +h2.libraries-page { + margin: 16px 28px 24px; +} + +h2, h3.subsection-title +{ + font-size: 30px; + font-weight: 700; + letter-spacing: -1px; + margin-bottom: 12px; +} + +h3 +{ + font-size: 24px; + letter-spacing: -0.5px; + margin-bottom: 12px; +} + +h4 +{ + font-size: 18px; + letter-spacing: -0.33px; + margin-bottom: 12px; + color: #4d4e53; +} + +h5, .container-overview .subsection-title +{ + font-size: 120%; + font-weight: bold; + letter-spacing: -0.01em; + margin: 8px 0 3px 0; +} + +h6 +{ + font-size: 100%; + letter-spacing: -0.01em; + margin: 6px 0 3px 0; + font-style: italic; +} + +table +{ + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +td, th +{ + border: 1px solid #ddd; + margin: 0px; + text-align: left; + vertical-align: top; + padding: 4px 6px; + display: table-cell; +} + +thead tr +{ + background-color: #ddd; + font-weight: bold; +} + +th { border-right: 1px solid #aaa; } +tr > th:last-child { border-right: 1px solid #ddd; } + +.ancestors, .attribs { color: #999; } +.ancestors a, .attribs a +{ + color: #999 !important; + text-decoration: none; +} + +.clear +{ + clear: both; +} + +.important +{ + font-weight: bold; + color: #950B02; +} + +.yes-def { + text-indent: -1000px; +} + +.type-signature { + color: #aaa; +} + +.name, .signature { + font-family: Consolas, Monaco, 'Andale Mono', monospace; +} + +.details { margin-top: 14px; border-left: 2px solid #DDD; } +.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } +.details dd { margin-left: 70px; } +.details ul { margin: 0; } +.details ul { list-style-type: none; } +.details li { margin-left: 30px; padding-top: 6px; } +.details pre.prettyprint { margin: 0 } +.details .object-value { padding-top: 0; } + +.description { + margin-bottom: 1em; + margin-top: 1em; +} + +.code-caption +{ + font-style: italic; + font-size: 107%; + margin: 0; +} + +.source +{ + border: 1px solid #ddd; + width: 80%; + overflow: auto; +} + +.prettyprint.source { + width: inherit; +} + +.source code +{ + font-size: 100%; + line-height: 18px; + display: block; + padding: 4px 12px; + margin: 0; + background-color: #fff; + color: #4D4E53; +} + +.prettyprint code span.line +{ + display: inline-block; +} + +.prettyprint.linenums +{ + padding-left: 70px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.prettyprint.linenums ol +{ + padding-left: 0; +} + +.prettyprint.linenums li +{ + border-left: 3px #ddd solid; +} + +.prettyprint.linenums li.selected, +.prettyprint.linenums li.selected * +{ + background-color: lightyellow; +} + +.prettyprint.linenums li * +{ + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.params .name, .props .name, .name code { + color: #4D4E53; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 100%; +} + +.params td.description > p:first-child, +.props td.description > p:first-child +{ + margin-top: 0; + padding-top: 0; +} + +.params td.description > p:last-child, +.props td.description > p:last-child +{ + margin-bottom: 0; + padding-bottom: 0; +} + +.disabled { + color: #454545; +} diff --git a/docs/jsdoc/templates/template/static/styles/prettify-jsdoc.css b/docs/jsdoc/templates/template/static/styles/prettify-jsdoc.css new file mode 100644 index 0000000..5a2526e --- /dev/null +++ b/docs/jsdoc/templates/template/static/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/docs/jsdoc/templates/template/static/styles/prettify-tomorrow.css b/docs/jsdoc/templates/template/static/styles/prettify-tomorrow.css new file mode 100644 index 0000000..b6f92a7 --- /dev/null +++ b/docs/jsdoc/templates/template/static/styles/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/docs/jsdoc/templates/template/tmpl/README.md b/docs/jsdoc/templates/template/tmpl/README.md new file mode 100644 index 0000000..8b5d6e1 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/README.md @@ -0,0 +1,4 @@ +Changelog, compared to default template + +container.tmpl: + \ No newline at end of file diff --git a/docs/jsdoc/templates/template/tmpl/augments.tmpl b/docs/jsdoc/templates/template/tmpl/augments.tmpl new file mode 100644 index 0000000..446d28a --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/augments.tmpl @@ -0,0 +1,10 @@ + + + +
      +
    • +
    + diff --git a/docs/jsdoc/templates/template/tmpl/container.tmpl b/docs/jsdoc/templates/template/tmpl/container.tmpl new file mode 100644 index 0000000..0912be5 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/container.tmpl @@ -0,0 +1,235 @@ + + + + + + + + + + +
    +
    +

    + Below you find all constants and functions used in the textbook + Structure and Interpretation + of Computer Programs, JavaScript Adaptation (SICP JS). + These constants and functions are predeclared in the language + Source §4, a JavaScript sublanguage implemented in the + Source Academy. +

    +

    Can I use these constants and functions without the Source Academy ?

    +

    + Yes, these constants and functions are provided by the + NPM package sicp. You can + use this package to run the JavaScript programs of SICP JS in any JavaScript + system that is based on Node.js. Follow the + link for installation instructions. +

    +
    +
    + + + + + + + + + + +
    + +
    + +

    + +

    + +
    + + + + +
    + + + +
    + +
    +
    + + +
    + + + + + + + + + +
    + + + + + +

    Example 1? 's':'' ?>

    + + + +
    + + +

    Extends

    + + + + + +

    Requires

    + +
      +
    • +
    + + + +

    Classes

    + +
    +
    +
    +
    + + + +

    Interfaces

    + +
    +
    +
    +
    + + + +

    Mixins

    + +
    +
    +
    +
    + + + +

    Namespaces

    + +
    +
    +
    +
    + + + +

    Constants

    + + +
    + +
    + + + + +

    Functions

    + + +
    + +
    + + + + +

    Type Definitions

    + + + + + + + + + +

    Events

    + + + + + +
    + +
    + + + diff --git a/docs/jsdoc/templates/template/tmpl/details.tmpl b/docs/jsdoc/templates/template/tmpl/details.tmpl new file mode 100644 index 0000000..d8a7c6e --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/details.tmpl @@ -0,0 +1,144 @@ +" + data.defaultvalue + ""; + defaultObjectClass = ' class="object-value"'; +} +?> + + +
    Properties:
    + + + + + +
    + + +
    Version:
    +
    + + + +
    Since:
    +
    + + + +
    Inherited From:
    +
    • + +
    + + + +
    Overrides:
    +
    • + +
    + + + +
    Implementations:
    +
      + +
    • + +
    + + + +
    Implements:
    +
      + +
    • + +
    + + + +
    Mixes In:
    + +
      + +
    • + +
    + + + +
    Deprecated:
    • Yes
    + + + +
    Author:
    +
    +
      +
    • +
    +
    + + + + + + + + +
    License:
    +
    + + + +
    Default Value:
    +
      + > +
    + + + + +
    Source:
    +
    • + , +
    + + + +
    Tutorials:
    +
    +
      +
    • +
    +
    + + + +
    See:
    +
    +
      +
    • +
    +
    + + + +
    To Do:
    +
    +
      +
    • +
    +
    + +
    diff --git a/docs/jsdoc/templates/template/tmpl/example.tmpl b/docs/jsdoc/templates/template/tmpl/example.tmpl new file mode 100644 index 0000000..e87caa5 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/example.tmpl @@ -0,0 +1,2 @@ + +
    diff --git a/docs/jsdoc/templates/template/tmpl/examples.tmpl b/docs/jsdoc/templates/template/tmpl/examples.tmpl new file mode 100644 index 0000000..04d975e --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/examples.tmpl @@ -0,0 +1,13 @@ + +

    + +
    + \ No newline at end of file diff --git a/docs/jsdoc/templates/template/tmpl/exceptions.tmpl b/docs/jsdoc/templates/template/tmpl/exceptions.tmpl new file mode 100644 index 0000000..9cef6c7 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/exceptions.tmpl @@ -0,0 +1,32 @@ + + +
    +
    +
    + +
    +
    +
    +
    +
    +
    + Type +
    +
    + +
    +
    +
    +
    +
    + +
    + + + + + +
    + diff --git a/docs/jsdoc/templates/template/tmpl/layout.tmpl b/docs/jsdoc/templates/template/tmpl/layout.tmpl new file mode 100644 index 0000000..52ca053 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/layout.tmpl @@ -0,0 +1,42 @@ + + + + + <?js= header ?> + + + + + + + + + + +
    + +

    + + +
    + + + +
    + + + + + + + diff --git a/docs/jsdoc/templates/template/tmpl/mainpage.tmpl b/docs/jsdoc/templates/template/tmpl/mainpage.tmpl new file mode 100644 index 0000000..64e9e59 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/mainpage.tmpl @@ -0,0 +1,14 @@ + + + +

    + + + +
    +
    +
    + diff --git a/docs/jsdoc/templates/template/tmpl/members.tmpl b/docs/jsdoc/templates/template/tmpl/members.tmpl new file mode 100644 index 0000000..154c17b --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/members.tmpl @@ -0,0 +1,38 @@ + +

    + + +

    + + + +
    + +
    + + + +
    Type:
    +
      +
    • + +
    • +
    + + + + + +
    Fires:
    +
      +
    • +
    + + + +
    Example 1? 's':'' ?>
    + + diff --git a/docs/jsdoc/templates/template/tmpl/method.tmpl b/docs/jsdoc/templates/template/tmpl/method.tmpl new file mode 100644 index 0000000..0125fe2 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/method.tmpl @@ -0,0 +1,131 @@ + + + +

    Constructor

    + + + +

    + + + +

    + + + + +
    + +
    + + + +
    Extends:
    + + + + +
    Type:
    +
      +
    • + +
    • +
    + + + +
    This:
    +
    + + + +
    Parameters:
    + + + + + + +
    Requires:
    +
      +
    • +
    + + + +
    Fires:
    +
      +
    • +
    + + + +
    Listens to Events:
    +
      +
    • +
    + + + +
    Listeners of This Event:
    +
      +
    • +
    + + + +
    Modifies:
    + 1) { ?>
      +
    • +
    + + + + +
    Throws:
    + 1) { ?>
      +
    • +
    + + + + +
    Returns:
    + 1) { ?>
      +
    • +
    + + + + +
    Yields:
    + 1) { ?>
      +
    • +
    + + + + +
    Example 1? 's':'' ?>
    + + diff --git a/docs/jsdoc/templates/template/tmpl/modifies.tmpl b/docs/jsdoc/templates/template/tmpl/modifies.tmpl new file mode 100644 index 0000000..16ccbf8 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/modifies.tmpl @@ -0,0 +1,14 @@ + + + +
    +
    + Type +
    +
    + +
    +
    + diff --git a/docs/jsdoc/templates/template/tmpl/params.tmpl b/docs/jsdoc/templates/template/tmpl/params.tmpl new file mode 100644 index 0000000..1fb4049 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/params.tmpl @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeAttributesDefaultDescription
    + + + + + + <optional>
    + + + + <nullable>
    + + + + <repeatable>
    + +
    + + + + +
    Properties
    + +
    diff --git a/docs/jsdoc/templates/template/tmpl/properties.tmpl b/docs/jsdoc/templates/template/tmpl/properties.tmpl new file mode 100644 index 0000000..40e0909 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/properties.tmpl @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeAttributesDefaultDescription
    + + + + + + <optional>
    + + + + <nullable>
    + +
    + + + + +
    Properties
    +
    diff --git a/docs/jsdoc/templates/template/tmpl/returns.tmpl b/docs/jsdoc/templates/template/tmpl/returns.tmpl new file mode 100644 index 0000000..d070459 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/returns.tmpl @@ -0,0 +1,19 @@ + +
    + +
    + + + +
    +
    + Type +
    +
    + +
    +
    + \ No newline at end of file diff --git a/docs/jsdoc/templates/template/tmpl/source.tmpl b/docs/jsdoc/templates/template/tmpl/source.tmpl new file mode 100644 index 0000000..e559b5d --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/source.tmpl @@ -0,0 +1,8 @@ + +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/docs/jsdoc/templates/template/tmpl/tutorial.tmpl b/docs/jsdoc/templates/template/tmpl/tutorial.tmpl new file mode 100644 index 0000000..88a0ad5 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/tutorial.tmpl @@ -0,0 +1,19 @@ +
    + +
    + 0) { ?> +
      +
    • +
    + + +

    +
    + +
    + +
    + +
    diff --git a/docs/jsdoc/templates/template/tmpl/type.tmpl b/docs/jsdoc/templates/template/tmpl/type.tmpl new file mode 100644 index 0000000..ec2c6c0 --- /dev/null +++ b/docs/jsdoc/templates/template/tmpl/type.tmpl @@ -0,0 +1,7 @@ + + +| + \ No newline at end of file diff --git a/docs/lib/math.d.ts b/docs/lib/math.d.ts new file mode 100644 index 0000000..5be3c1b --- /dev/null +++ b/docs/lib/math.d.ts @@ -0,0 +1,530 @@ +/** + * + * Return the absolute value of a number as a float. + * Unlike the built-in abs(), math_fabs() always returns a float, + * even when the input is an integer. + * It only accepts int or float types (complex numbers are not supported). + * + * @param {int | float} x - The number whose absolute value is computed. + * @returns {float} absolute value of x +*/ +declare function math_fabs(x: any): float; +/** + * Return the number of ways to choose k items from n items + * without repetition and without order. + * Returns zero when k > n. + * + * @param {int} n - Total number of items (must be a non-negative integer). + * @param {int} k - Number of items to choose (must be a non-negative integer). + * @returns {int} the binomial coefficient of n and k + */ +declare function math_comb(n: any, k: any): int; +/** + * Return n factorial as an integer. + * + * @param {int} n - A non-negative integer whose factorial is to be computed. + * @returns {int} the factorial of n + */ +declare function math_factorial(n: any): int; +/** + * Return the greatest common divisor of the specified *integers arguments. + * If any of the arguments is nonzero, then the returned value is the largest positive + * integer that is a divisor of all arguments. + * If all arguments are 0, then the returned value is 0. + * gcd() without arguments returns 0. + * If any of the provided integers is negative, the function treats it as its + * absolute value when computing the GCD. + * + * @param {int} *integers - A variable number of integer arguments for + * which to compute the greatest common divisor. + * @returns {int} the greatest common divisor of the given integers as a positive + * integer + */ +declare function math_gcd(...integers: any[]): int; +/** + * Return the integer square root of the non-negative n. + * + * @param {int} n - A non-negative integer for which to compute the + * integer square root. + * @returns {int} the integer square root of n + */ +declare function math_isqrt(n: any): int; +/** + * Return the least common multiple of the specified integer arguments. + * If all arguments are nonzero, then the returned value is the smallest positive + * integer that is a multiple of all arguments. + * If any of the arguments is 0, then the returned value is 0. + * lcm() without arguments returns 1. + * If any of the input integers is negative, math_lcm() treats it + * as its absolute value when computing the LCM, so the result is always + * non-negative. + * + * @param {int} *integers - A variable number of integer arguments for + * which the least common multiple is computed. + * @returns {int} the least common multiple of the given integers as a positive + * integer + */ +declare function math_lcm(...integers: any[]): int; +/** + * Return the number of ways to choose k items from n items without + * repetition and with order. + * Returns zero when k > n. + * + * @param {int} n - Total number of items (must be a non-negative integer). + * @param {int} k - Number of items to choose (must be a non-negative integer). + * @returns {int} the permutations of n and k + */ +declare function math_perm(n: any, k: any): int; +/** + * Return the ceiling of x, the smallest integer greater than or equal to + * x. + * + * @param {int | float} x - The numeric value for which to compute the ceiling. + * @returns {int} the ceiling of x + */ +declare function math_ceil(x: any): int; +/** + * Return the floor of x, the largest integer less than or equal to + * x. + * + * @param {int | float} x - The numeric value for which to compute the flooring. + * @returns {int} the flooring of x + */ +declare function math_floor(x: any): int; +/** + * Fused multiply–add operation. Return (x * y) + z, computed as though with infinite + * precision and range followed by a single round to the float format. + * This operation often provides better accuracy than the direct expression + * (x * y) + z. + * This function follows the specification of the + * (fusedMultiplyAdd) operation described in the IEEE 754 standard. + * The standard leaves one case implementation-defined, namely the result of + * fma(0, inf, nan) and fma(inf, 0, nan). + * In these cases, math.fma returns a math.nan, and does not raise any exception. + * + * @param {int | float} x - The first multiplicand. It is multiplied by y. + * @param {int | float} y - The second multiplicand. It is multiplied by x. + * @param {int | float} z - The addend. The product of x and y + * is added to z using a fused multiply–add operation. + * @returns {float} the float value of (x * y) + z + */ +declare function math_fma(x: any, y: any, z: any): float; +/** + * Return the floating-point remainder of x / y, as defined by the + * platform C library function fmod(x, y). The sign of the result is the same as the + * sign of x. + * + * @param {int | float} x - The dividend. It will be converted to a float + * if necessary. + * @param {int | float} y - The divisor. It will be converted to a float + * if necessary. + * @returns {float} the platform C library function fmod(x, y) style remainder of + * x divided by y + */ +declare function math_fmod(x: any, y: any): float; +/** + * Return the IEEE 754-style remainder of x with respect to y. For finite + * x and finite nonzero y, this is the difference x - n*y, where + * n is the closest integer to the exact value of the quotient x / y. + * If x / y is exactly halfway between two consecutive integers, the nearest + * even integer is used for n. The remainder r = remainder(x, y) + * thus always satisfies abs(r) <= 0.5 * abs(y). + * + * @param {int | float} x - The dividend. It will be converted to a float + * if necessary. + * @param {int | float} y - The divisor. It will be converted to a float + * if necessary. + * @returns {float} the IEEE 754-style remainder of x divided by y + */ +declare function math_remainder(x: any, y: any): float; +/** + * Return x with the fractional part removed, leaving the integer part. + * trunc() is equivalent to floor() for positive x, and equivalent + * to ceil() for negative x. + * + * @param {int | float} x - The numeric value from which the fractional part is removed, + * returning the integral part (i.e. x rounded toward 0). + * @returns {int} the integer part of x + */ +declare function math_trunc(x: any): int; +/** + * Return a float with the magnitude (absolute value) of x + * but the sign of y. + * + * @param {int | float} x - The value whose magnitude (absolute value) will be used. + * @param {int | float} y - The value whose sign will be applied to x's magnitude. + * @returns {float} a float with the absolute value of x but with the sign of + * y + */ +declare function math_copysign(x: any, y: any): float; +/** + * Return True if x is neither an infinity nor a nan, + * and False otherwise. + * + * @param {int | float} x - A numeric value. It is converted to float if necessary. + * @returns {bool} the True if x is finite; otherwise, False + */ +declare function math_isfinite(x: any): bool; +/** + * Return True if x is a positive or negative infinity, + * and False otherwise. + * + * @param {int | float} x - A numeric value. It is converted to float if necessary. + * @returns {bool} the True if x is an infinity (positive or negative); + * otherwise, False + */ +declare function math_isinf(x: any): bool; +/** + * Return True if x is a nan (not a number), + * and False otherwise. + * + * @param {int | float} x - A numeric value. It is converted to float if necessary. + * @returns {bool} the True if x is nan; otherwise, False + */ +declare function math_isnan(x: any): bool; +/** + * Return x * (2**i). This is essentially the inverse of function + * frexp(). + * + * @param {int | float} x - A numeric value (the significand). It is converted to + * float if necessary. + * @param {int} i - An integer exponent. + * @returns {float} the result of x multiplied by 2 raised to the power + * i + */ +declare function math_ldexp(x: any, i: any): float; +/** + * Return the floating-point value steps steps after x towards + * y. If x is equal to y, return y, unless + * steps is 0. + * + * @param {int | float} x - The starting floating-point number from which the stepping begins. + * @param {int | float} y - The target value that determines the direction. The function will + * return a value toward y from x. + * @param {int} steps - The number of representable floating-point values to step from + * x toward y (default is 1). + * @returns {float} the floating-point number that is exactly steps representable numbers + * away from x in the direction of y + */ +declare function math_nextafter(x: any, y: any, steps?: number): float; +/** + * Return the value of the least significant bit of the float x. + * If x is a NaN (not a number), return x. + * If x is negative, return ulp(-x). + * If x is a positive infinity, return x. + * If x is equal to 0, return the smallest positive denormalized + * representable float (smaller than the minimum positive normalized float, + * sys.float_info.min, approximately 1.7976931348623157e+308). + * If x is equal to the largest positive representable float, return the value + * of the least significant bit of x, such that the first float smaller than + * x is x - ulp(x). + * Otherwise (when x is a positive finite number), return the value of the least significant + * bit of x, such that the first float bigger than x is + * x + ulp(x). + * + * @param {int | float} x - The numeric value (typically a float) for which to compute + * the ULP (Unit in the Last Place). The function returns the value of the least significant + * bit of x, handling special cases (NaN, infinities, 0, etc.) + * as specified by IEEE 754. + * @returns {float} the spacing between x and the next representable float in the + * direction defined by x's sign + */ +declare function math_ulp(x: any): float; +/** + * Return the cube root of x. + * + * @param {int | float} x - The numeric value for which to compute the cube root. + * @returns {float} the cube root of x + */ +declare function math_cbrt(x: any): float; +/** + * Return e raised to the power x, where e = 2.718281… + * is the base of natural logarithms. + * + * @param {int | float} x - The exponent for which to compute e^x. + * @returns {float} the value of e raised to the power x with high accuracy + */ +declare function math_exp(x: any): float; +/** + * Return 2 raised to the power x. + * + * @param {int | float} x - The exponent for which to compute 2^x. + * @returns {float} the value of 2 raised to the power x with high accuracy + */ +declare function math_exp2(x: any): float; +/** + * Return e raised to the power x, minus 1. Here e is + * the base of natural logarithms. For small x, the subtraction in + * exp(x) - 1 can result in a significant loss of precision; the expm1() function + * provides a way to compute this quantity to full precision. + * + * @param {int | float} x - The exponent for which to compute e^x. + * @returns {float} the value of e raised to the power x minus 1 with high accuracy + */ +declare function math_expm1(x: any): float; +/** + * With one argument, return the natural logarithm of x (to base e). + * With two arguments, return the logarithm of x to the given base, + * calculated as log(x)/log(base). + * + * @param {int | float} x - The numeric value for which to compute the logarithm. + * @param {int | float} base(optional) - The base of the logarithm. If provided, the result is computed as + * log(x)/log(base). If omitted, the natural logarithm (base e) is returned. + * @returns {float} a float representing the logarithm of x (either natural logarithm when + * base is not provided, or logarithm with the given base otherwise) + */ +declare function math_log(x: any, base: any): float; +/** + * Return the natural logarithm of 1+x (base e). The result is calculated in a way + * which is accurate for x near 0. + * + * @param {int | float} x - The number to be added to 1. The function returns the natural + * logarithm of (1+x), computed in a way that is accurate for values of x near 0. + * @returns {float} the natural logarithm of 1+x (base e) + */ +declare function math_log1p(x: any): float; +/** + * Return the base-2 logarithm of x. This is usually more accurate than + * log(x, 2). + * + * @param {int | float} x - A positive number. The function returns the logarithm of + * x to base 2. + * @returns {float} the base-2 logarithm of x + */ +declare function math_log2(x: any): float; +/** + * Return the base-10 logarithm of x. This is usually more accurate than + * log(x, 10). + * + * @param {int | float} x - A positive number. The function returns the logarithm of + * x to base 10. + * @returns {float} the base-10 logarithm of x + */ +declare function math_log10(x: any): float; +/** + * Return x raised to the power y. Unlike the built-in + * ** operator, math_pow() converts both its arguments to type float. + * + * @param {int | float} x - The base value. Both x and y are converted + * to float before the operation. + * @param {int | float} y - The exponent value. The function computes x raised to the power + * y, following IEEE 754 rules for special cases. + * @returns {float} the value of x raised to the power y + */ +declare function math_pow(x: any, y: any): float; +/** + * Return the square root of x. + * + * @param {int | float} x - A non-negative number. x is converted to a float + * if necessary. + * @returns {float} the square root of x + */ +declare function math_sqrt(x: any): float; +/** + * Convert angle x from radians to degrees. + * + * @param {int | float} x - The angle in radians to be converted to degrees. + * @returns {float} the angle, in degrees, corresponding to the given radians + */ +declare function math_degrees(x: any): float; +/** + * Convert angle x from degrees to radians. + * + * @param {int | float} x - The angle in degrees to be converted to radians. + * @returns {float} the angle, in radians, corresponding to the given degrees + */ +declare function math_radians(x: any): float; +/** + * Return the arc cosine of x, in radians. The result is between 0 and pi. + * + * @param {int | float} x - The value whose arc cosine is to be computed. Must be in the interval + * [-1, 1]. + * @returns {float} the arc cosine of x in radians + */ +declare function math_acos(x: any): float; +/** + * Return the arc sine of x, in radians. The result is between -pi/2 and pi/2. + * + * @param {int | float} x - The value whose arc sine is to be computed. Must be in the interval + * [-1, 1]. + * @returns {float} the arc sine of x in radians + */ +declare function math_asin(x: any): float; +/** + * Return the arc tangent of x, in radians. The result is between -pi/2 and pi/2. + * + * @param {int | float} x - The value whose arc tangent is to be computed. + * @returns {float} the arc tangent of x in radians + */ +declare function math_atan(x: any): float; +/** + * Return atan(y / x), in radians. + * + * @param {int | float} y - The y-coordinate of the point. + * @param {int | float} x - The x-coordinate of the point. + * @returns {float} the arc tangent of y/x in radians + */ +declare function math_atan2(y: any, x: any): float; +/** + * Return the cosine of x radians. + * + * @param {int | float} x - The angle in radians for which the cosine is computed. + * @returns {float} the cosine of x + */ +declare function math_cos(x: any): float; +/** + * Return the sine of x radians. + * + * @param {int | float} x - The angle in radians for which the sine is computed. + * @returns {float} the sine of x + */ +declare function math_sin(x: any): float; +/** + * Return the tangent of x radians. + * + * @param {int | float} x - The angle in radians for which the tangent is computed. + * @returns {float} the tangent of x + */ +declare function math_tan(x: any): float; +/** + * Return the inverse hyperbolic cosine of x. + * + * @param {int | float} x - The number for which to compute the inverse hyperbolic cosine. + * (Typically, x must be ≥ 1.) + * @returns {float} the inverse hyperbolic cosine of x + */ +declare function math_acosh(x: any): float; +/** + * Return the inverse hyperbolic sine of x. + * + * @param {int | float} x - The number for which to compute the inverse hyperbolic sine. + * @returns {float} the inverse hyperbolic sine of x + */ +declare function math_asinh(x: any): float; +/** + * Return the inverse hyperbolic tangent of x. + * + * @param {int | float} x - The number for which to compute the inverse hyperbolic tangent. + * (Must be in the interval (-1, 1).) + * @returns {float} the inverse hyperbolic tangent of x + */ +declare function math_atanh(x: any): float; +/** + * Return the hyperbolic cosine of x. + * + * @param {int | float} x - The angle in radians for which to compute cosh(x). + * @returns {float} the hyperbolic cosine of x + */ +declare function math_cosh(x: any): float; +/** + * Return the hyperbolic sine of x. + * + * @param {int | float} x - The angle in radians for which to compute sinh(x). + * @returns {float} the hyperbolic sine of x + */ +declare function math_sinh(x: any): float; +/** + * Return the hyperbolic tangent of x. + * + * @param {int | float} x - The angle in radians for which to compute tanh(x). + * @returns {float} the hyperbolic tangent of x + */ +declare function math_tanh(x: any): float; +/** + * Return the error function at x. + * + * @param {int | float} x - The value at which to evaluate the error function. + * @returns {float} the error function value at x + */ +declare function math_erf(x: any): float; +/** + * Return the complementary error function at x. The complementary error function is + * defined as 1.0 - erf(x). It is used for large values of x where a subtraction + * from one would cause a loss of significance. + * + * @param {int | float} x - The value at which to evaluate the complementary error function. + * @returns {float} the complementary error function at x + */ +declare function math_erfc(x: any): float; +/** + * Return the Gamma function at x. + * + * @param {int | float} x - The input value at which the Gamma function is computed. + * @returns {float} the Gamma function at x + */ +declare function math_gamma(x: any): float; +/** + * Return the natural logarithm of the absolute value of the Gamma function at x. + * + * @param {int | float} x - The input value for which to compute the natural logarithm of the + * absolute Gamma function. + * @returns {float} the natural logarithm of the absolute value of the Gamma function at x + */ +declare function math_lgamma(x: any): float; +/** + * + * The Number value for e, Euler's number, + * which is approximately 2.718281828459045. + * @const {float} + * + */ +declare const math_e: 2.718281828459045; +/** + * + * The name inf refers to float value positive infinity. + * (For negative infinity, use -math.inf.) Equivalent to + * the output of float('inf'). + * See also Python 3.13 Documentation. + * @const {float} + * + */ +declare const math_inf: number; +/** + * + * A floating-point “not a number” (nan) value. + * Equivalent to the output of float('nan'). + * See also Python 3.13 Documentation. + * @const {float} + * + */ +declare const math_nan: number; +/** + * + * The float value of π, + * the ratio of the circumference of a circle to its diameter, + * which is approximately 3.1415926535897932. + * @const {float} + * + */ +declare const math_pi: undefined; +/** + * + * Tau is a circle constant equals to , + * the ratio of a circle’s circumference to its radius, + * which is approximately 6.283185307179586. + * @const {float} + * + */ +declare const math_tau: undefined; +/** + * + * An object frequently used to represent the absence of a value. + * See also Python 3.13 Documentation. + * @const {NoneType} + * + */ +declare const None: undefined; +/** + * + * The true value of the bool type. + * @const {bool} + * + */ +declare const True: true; +/** + * + * The false value of the bool type. + * @const {bool} + * + */ +declare const False: false; diff --git a/docs/lib/math.js b/docs/lib/math.js new file mode 100644 index 0000000..26d56d2 --- /dev/null +++ b/docs/lib/math.js @@ -0,0 +1,586 @@ +/** + * + * The Number value for e, Euler's number, + * which is approximately 2.718281828459045. + * @const {float} + * + */ +const math_e = 2.718281828459045; + +/** + * + * The name inf refers to float value positive infinity. + * (For negative infinity, use -math.inf.) Equivalent to + * the output of float('inf'). + * See also Python 3.13 Documentation. + * @const {float} + * + */ +const math_inf = 1 / 0; + +/** + * + * A floating-point “not a number” (nan) value. + * Equivalent to the output of float('nan'). + * See also Python 3.13 Documentation. + * @const {float} + * + */ +const math_nan = NaN; + +/** + * + * The float value of π, + * the ratio of the circumference of a circle to its diameter, + * which is approximately 3.1415926535897932. + * @const {float} + * + */ +const math_pi = undefined; + +/** + * + * Tau is a circle constant equals to , + * the ratio of a circle’s circumference to its radius, + * which is approximately 6.283185307179586. + * @const {float} + * + */ +const math_tau = undefined; + +/** + * + * An object frequently used to represent the absence of a value. + * See also Python 3.13 Documentation. + * @const {NoneType} + * + */ +const None = undefined; + +/** + * + * The true value of the bool type. + * @const {bool} + * + */ +const True = true; + +/** + * + * The false value of the bool type. + * @const {bool} + * + */ +const False = false; + +/** + * + * Return the absolute value of a number as a float. + * Unlike the built-in abs(), math_fabs() always returns a float, + * even when the input is an integer. + * It only accepts int or float types (complex numbers are not supported). + * + * @param {int | float} x - The number whose absolute value is computed. + * @returns {float} absolute value of x +*/ +function math_fabs( x ) {} + +/** + * Return the number of ways to choose k items from n items + * without repetition and without order. + * Returns zero when k > n. + * + * @param {int} n - Total number of items (must be a non-negative integer). + * @param {int} k - Number of items to choose (must be a non-negative integer). + * @returns {int} the binomial coefficient of n and k + */ +function math_comb( n, k ) {} + +/** + * Return n factorial as an integer. + * + * @param {int} n - A non-negative integer whose factorial is to be computed. + * @returns {int} the factorial of n + */ +function math_factorial(n) {} + +/** + * Return the greatest common divisor of the specified *integers arguments. + * If any of the arguments is nonzero, then the returned value is the largest positive + * integer that is a divisor of all arguments. + * If all arguments are 0, then the returned value is 0. + * gcd() without arguments returns 0. + * If any of the provided integers is negative, the function treats it as its + * absolute value when computing the GCD. + * + * @param {int} *integers - A variable number of integer arguments for + * which to compute the greatest common divisor. + * @returns {int} the greatest common divisor of the given integers as a positive + * integer + */ +function math_gcd(...integers) {} + +/** + * Return the integer square root of the non-negative n. + * + * @param {int} n - A non-negative integer for which to compute the + * integer square root. + * @returns {int} the integer square root of n + */ +function math_isqrt(n) {} + +/** + * Return the least common multiple of the specified integer arguments. + * If all arguments are nonzero, then the returned value is the smallest positive + * integer that is a multiple of all arguments. + * If any of the arguments is 0, then the returned value is 0. + * lcm() without arguments returns 1. + * If any of the input integers is negative, math_lcm() treats it + * as its absolute value when computing the LCM, so the result is always + * non-negative. + * + * @param {int} *integers - A variable number of integer arguments for + * which the least common multiple is computed. + * @returns {int} the least common multiple of the given integers as a positive + * integer + */ +function math_lcm(...integers) {} + +/** + * Return the number of ways to choose k items from n items without + * repetition and with order. + * Returns zero when k > n. + * + * @param {int} n - Total number of items (must be a non-negative integer). + * @param {int} k - Number of items to choose (must be a non-negative integer). + * @returns {int} the permutations of n and k + */ +function math_perm(n, k) {} + +/** + * Return the ceiling of x, the smallest integer greater than or equal to + * x. + * + * @param {int | float} x - The numeric value for which to compute the ceiling. + * @returns {int} the ceiling of x + */ +function math_ceil(x) {} + +/** + * Return the floor of x, the largest integer less than or equal to + * x. + * + * @param {int | float} x - The numeric value for which to compute the flooring. + * @returns {int} the flooring of x + */ +function math_floor(x) {} + +/** + * Fused multiply–add operation. Return (x * y) + z, computed as though with infinite + * precision and range followed by a single round to the float format. + * This operation often provides better accuracy than the direct expression + * (x * y) + z. + * This function follows the specification of the + * (fusedMultiplyAdd) operation described in the IEEE 754 standard. + * The standard leaves one case implementation-defined, namely the result of + * fma(0, inf, nan) and fma(inf, 0, nan). + * In these cases, math.fma returns a math.nan, and does not raise any exception. + * + * @param {int | float} x - The first multiplicand. It is multiplied by y. + * @param {int | float} y - The second multiplicand. It is multiplied by x. + * @param {int | float} z - The addend. The product of x and y + * is added to z using a fused multiply–add operation. + * @returns {float} the float value of (x * y) + z + */ +function math_fma(x, y, z) {} + +/** + * Return the floating-point remainder of x / y, as defined by the + * platform C library function fmod(x, y). The sign of the result is the same as the + * sign of x. + * + * @param {int | float} x - The dividend. It will be converted to a float + * if necessary. + * @param {int | float} y - The divisor. It will be converted to a float + * if necessary. + * @returns {float} the platform C library function fmod(x, y) style remainder of + * x divided by y + */ +function math_fmod(x, y) {} + +/** + * Return the IEEE 754-style remainder of x with respect to y. For finite + * x and finite nonzero y, this is the difference x - n*y, where + * n is the closest integer to the exact value of the quotient x / y. + * If x / y is exactly halfway between two consecutive integers, the nearest + * even integer is used for n. The remainder r = remainder(x, y) + * thus always satisfies abs(r) <= 0.5 * abs(y). + * + * @param {int | float} x - The dividend. It will be converted to a float + * if necessary. + * @param {int | float} y - The divisor. It will be converted to a float + * if necessary. + * @returns {float} the IEEE 754-style remainder of x divided by y + */ +function math_remainder(x, y) {} + +/** + * Return x with the fractional part removed, leaving the integer part. + * trunc() is equivalent to floor() for positive x, and equivalent + * to ceil() for negative x. + * + * @param {int | float} x - The numeric value from which the fractional part is removed, + * returning the integral part (i.e. x rounded toward 0). + * @returns {int} the integer part of x + */ +function math_trunc(x) {} + +/** + * Return a float with the magnitude (absolute value) of x + * but the sign of y. + * + * @param {int | float} x - The value whose magnitude (absolute value) will be used. + * @param {int | float} y - The value whose sign will be applied to x's magnitude. + * @returns {float} a float with the absolute value of x but with the sign of + * y + */ +function math_copysign(x, y) {} + +/** + * Return True if x is neither an infinity nor a nan, + * and False otherwise. + * + * @param {int | float} x - A numeric value. It is converted to float if necessary. + * @returns {bool} the True if x is finite; otherwise, False + */ +function math_isfinite(x) {} + +/** + * Return True if x is a positive or negative infinity, + * and False otherwise. + * + * @param {int | float} x - A numeric value. It is converted to float if necessary. + * @returns {bool} the True if x is an infinity (positive or negative); + * otherwise, False + */ +function math_isinf(x) {} + +/** + * Return True if x is a nan (not a number), + * and False otherwise. + * + * @param {int | float} x - A numeric value. It is converted to float if necessary. + * @returns {bool} the True if x is nan; otherwise, False + */ +function math_isnan(x) {} + +/** + * Return x * (2**i). This is essentially the inverse of function + * frexp(). + * + * @param {int | float} x - A numeric value (the significand). It is converted to + * float if necessary. + * @param {int} i - An integer exponent. + * @returns {float} the result of x multiplied by 2 raised to the power + * i + */ +function math_ldexp(x, i) {} + +/** + * Return the floating-point value steps steps after x towards + * y. If x is equal to y, return y, unless + * steps is 0. + * + * @param {int | float} x - The starting floating-point number from which the stepping begins. + * @param {int | float} y - The target value that determines the direction. The function will + * return a value toward y from x. + * @param {int} steps - The number of representable floating-point values to step from + * x toward y (default is 1). + * @returns {float} the floating-point number that is exactly steps representable numbers + * away from x in the direction of y + */ +function math_nextafter(x, y, steps = 1) {} + +/** + * Return the value of the least significant bit of the float x. + * If x is a NaN (not a number), return x. + * If x is negative, return ulp(-x). + * If x is a positive infinity, return x. + * If x is equal to 0, return the smallest positive denormalized + * representable float (smaller than the minimum positive normalized float, + * sys.float_info.min, approximately 1.7976931348623157e+308). + * If x is equal to the largest positive representable float, return the value + * of the least significant bit of x, such that the first float smaller than + * x is x - ulp(x). + * Otherwise (when x is a positive finite number), return the value of the least significant + * bit of x, such that the first float bigger than x is + * x + ulp(x). + * + * @param {int | float} x - The numeric value (typically a float) for which to compute + * the ULP (Unit in the Last Place). The function returns the value of the least significant + * bit of x, handling special cases (NaN, infinities, 0, etc.) + * as specified by IEEE 754. + * @returns {float} the spacing between x and the next representable float in the + * direction defined by x's sign + */ +function math_ulp(x) {} + +/** + * Return the cube root of x. + * + * @param {int | float} x - The numeric value for which to compute the cube root. + * @returns {float} the cube root of x + */ +function math_cbrt(x) {} + +/** + * Return e raised to the power x, where e = 2.718281… + * is the base of natural logarithms. + * + * @param {int | float} x - The exponent for which to compute e^x. + * @returns {float} the value of e raised to the power x with high accuracy + */ +function math_exp(x) {} + +/** + * Return 2 raised to the power x. + * + * @param {int | float} x - The exponent for which to compute 2^x. + * @returns {float} the value of 2 raised to the power x with high accuracy + */ +function math_exp2(x) {} + +/** + * Return e raised to the power x, minus 1. Here e is + * the base of natural logarithms. For small x, the subtraction in + * exp(x) - 1 can result in a significant loss of precision; the expm1() function + * provides a way to compute this quantity to full precision. + * + * @param {int | float} x - The exponent for which to compute e^x. + * @returns {float} the value of e raised to the power x minus 1 with high accuracy + */ +function math_expm1(x) {} + +/** + * With one argument, return the natural logarithm of x (to base e). + * With two arguments, return the logarithm of x to the given base, + * calculated as log(x)/log(base). + * + * @param {int | float} x - The numeric value for which to compute the logarithm. + * @param {int | float} base(optional) - The base of the logarithm. If provided, the result is computed as + * log(x)/log(base). If omitted, the natural logarithm (base e) is returned. + * @returns {float} a float representing the logarithm of x (either natural logarithm when + * base is not provided, or logarithm with the given base otherwise) + */ +function math_log(x, base) {} + +/** + * Return the natural logarithm of 1+x (base e). The result is calculated in a way + * which is accurate for x near 0. + * + * @param {int | float} x - The number to be added to 1. The function returns the natural + * logarithm of (1+x), computed in a way that is accurate for values of x near 0. + * @returns {float} the natural logarithm of 1+x (base e) + */ +function math_log1p(x) {} + +/** + * Return the base-2 logarithm of x. This is usually more accurate than + * log(x, 2). + * + * @param {int | float} x - A positive number. The function returns the logarithm of + * x to base 2. + * @returns {float} the base-2 logarithm of x + */ +function math_log2(x) {} + +/** + * Return the base-10 logarithm of x. This is usually more accurate than + * log(x, 10). + * + * @param {int | float} x - A positive number. The function returns the logarithm of + * x to base 10. + * @returns {float} the base-10 logarithm of x + */ +function math_log10(x) {} + +/** + * Return x raised to the power y. Unlike the built-in + * ** operator, math_pow() converts both its arguments to type float. + * + * @param {int | float} x - The base value. Both x and y are converted + * to float before the operation. + * @param {int | float} y - The exponent value. The function computes x raised to the power + * y, following IEEE 754 rules for special cases. + * @returns {float} the value of x raised to the power y + */ +function math_pow(x, y) {} + +/** + * Return the square root of x. + * + * @param {int | float} x - A non-negative number. x is converted to a float + * if necessary. + * @returns {float} the square root of x + */ +function math_sqrt(x) {} + +/** + * Convert angle x from radians to degrees. + * + * @param {int | float} x - The angle in radians to be converted to degrees. + * @returns {float} the angle, in degrees, corresponding to the given radians + */ +function math_degrees(x) {} + +/** + * Convert angle x from degrees to radians. + * + * @param {int | float} x - The angle in degrees to be converted to radians. + * @returns {float} the angle, in radians, corresponding to the given degrees + */ +function math_radians(x) {} + +/** + * Return the arc cosine of x, in radians. The result is between 0 and pi. + * + * @param {int | float} x - The value whose arc cosine is to be computed. Must be in the interval + * [-1, 1]. + * @returns {float} the arc cosine of x in radians + */ +function math_acos(x) {} + +/** + * Return the arc sine of x, in radians. The result is between -pi/2 and pi/2. + * + * @param {int | float} x - The value whose arc sine is to be computed. Must be in the interval + * [-1, 1]. + * @returns {float} the arc sine of x in radians + */ +function math_asin(x) {} + +/** + * Return the arc tangent of x, in radians. The result is between -pi/2 and pi/2. + * + * @param {int | float} x - The value whose arc tangent is to be computed. + * @returns {float} the arc tangent of x in radians + */ +function math_atan(x) {} + +/** + * Return atan(y / x), in radians. + * + * @param {int | float} y - The y-coordinate of the point. + * @param {int | float} x - The x-coordinate of the point. + * @returns {float} the arc tangent of y/x in radians + */ +function math_atan2(y, x) {} + +/** + * Return the cosine of x radians. + * + * @param {int | float} x - The angle in radians for which the cosine is computed. + * @returns {float} the cosine of x + */ +function math_cos(x) {} + +/** + * Return the sine of x radians. + * + * @param {int | float} x - The angle in radians for which the sine is computed. + * @returns {float} the sine of x + */ +function math_sin(x) {} + +/** + * Return the tangent of x radians. + * + * @param {int | float} x - The angle in radians for which the tangent is computed. + * @returns {float} the tangent of x + */ +function math_tan(x) {} + +/** + * Return the inverse hyperbolic cosine of x. + * + * @param {int | float} x - The number for which to compute the inverse hyperbolic cosine. + * (Typically, x must be ≥ 1.) + * @returns {float} the inverse hyperbolic cosine of x + */ +function math_acosh(x) {} + +/** + * Return the inverse hyperbolic sine of x. + * + * @param {int | float} x - The number for which to compute the inverse hyperbolic sine. + * @returns {float} the inverse hyperbolic sine of x + */ +function math_asinh(x) {} + +/** + * Return the inverse hyperbolic tangent of x. + * + * @param {int | float} x - The number for which to compute the inverse hyperbolic tangent. + * (Must be in the interval (-1, 1).) + * @returns {float} the inverse hyperbolic tangent of x + */ +function math_atanh(x) {} + +/** + * Return the hyperbolic cosine of x. + * + * @param {int | float} x - The angle in radians for which to compute cosh(x). + * @returns {float} the hyperbolic cosine of x + */ +function math_cosh(x) {} + +/** + * Return the hyperbolic sine of x. + * + * @param {int | float} x - The angle in radians for which to compute sinh(x). + * @returns {float} the hyperbolic sine of x + */ +function math_sinh(x) {} + +/** + * Return the hyperbolic tangent of x. + * + * @param {int | float} x - The angle in radians for which to compute tanh(x). + * @returns {float} the hyperbolic tangent of x + */ +function math_tanh(x) {} + +/** + * Return the error function at x. + * + * @param {int | float} x - The value at which to evaluate the error function. + * @returns {float} the error function value at x + */ +function math_erf(x) {} + +/** + * Return the complementary error function at x. The complementary error function is + * defined as 1.0 - erf(x). It is used for large values of x where a subtraction + * from one would cause a loss of significance. + * + * @param {int | float} x - The value at which to evaluate the complementary error function. + * @returns {float} the complementary error function at x + */ +function math_erfc(x) {} + +/** + * Return the Gamma function at x. + * + * @param {int | float} x - The input value at which the Gamma function is computed. + * @returns {float} the Gamma function at x + */ +function math_gamma(x) {} + +/** + * Return the natural logarithm of the absolute value of the Gamma function at x. + * + * @param {int | float} x - The input value for which to compute the natural logarithm of the + * absolute Gamma function. + * @returns {float} the natural logarithm of the absolute value of the Gamma function at x + */ +function math_lgamma(x) {} diff --git a/docs/lib/misc.d.ts b/docs/lib/misc.d.ts new file mode 100644 index 0000000..0554a48 --- /dev/null +++ b/docs/lib/misc.d.ts @@ -0,0 +1,141 @@ +/** + * Takes a string s as the first argument and a nonnegative + * integer i as the second argument. If i is less than + * the length of s, this function returns a one-character string that + * contains the character of s at position i, counting from 0. + * If i is larger than or equal to the length of s, this function returns + * None. + * + * @param {string} s - the given string + * @param {int} i - the index + * @returns {string} one-character string or None + */ +declare function char_at(s: any, i: any): string; +/** + * A simplified version of the Python built-in print function. + * This function takes any number of parameters *object, converts them to their + * string representations using str(), and writes them to the standard + * output (sys.stdout), followed by a newline character. See the official Python + * documentation for print. + * + * @param {any} *object - object(s) to be printed to the standard output + * @returns {NoneType} the None value + */ +declare function print(...object: any[]): NoneType; +/** + * Prints the provided *object arguments to the standard output (similar to a simplified + * print) and then raises an exception. This function accepts a variable number of arguments, + * converts them to their string representations using str(), outputs them (with a + * newline) just like what print does, and immediately halts execution by raising an exception. + * + * @param {any} *object - Objects to be printed to the standard output + * @returns {NoneType} the None value + */ +declare function error(...object: any[]): NoneType; +/** + * Return the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. + * + * @returns {float} current time in milliseconds + */ +declare function time_time(): float; +/** + * Return True if object is an instance of classinfo. + * classinfo can be None, int, float, string, + * bool, and complex. + * + * @param {any} object - The object to be checked, i.e. the one to determine whether it is an + * instance of the specified type. + * @param {string} classinfo - The name of a single class (type). The type information used to test + * the object's type. + * @returns {bool} indicating whether object is an instance of classinfo + */ +declare function isinstance(object: any, classinfo: any): bool; +/** + * Return the absolute value of x. + * For an int input, it returns the non-negative integer equivalent. + * For a float input, it returns the positive floating-point number representing its magnitude. + * For a complex input, it computes and returns the modulus (the square root of the sum of the + * squares of the real and imaginary parts) as a float. + * + * @param {int | float | complex} x - The number whose absolute value is computed. + * @returns {int | float | complex} the absolute value of x + */ +declare function abs(x: any): int | float | complex; +/** + * Returns the largest of the provided values. If multiple items are equal to the maximum, + * the first encountered is returned. All values should be mutually comparable. + * + * @param {int | float | string} arg1 - The first item to compare. + * @param {int | float | string} arg2 - The second item to compare. + * @param {int | float | string} *args - Additional items to compare. + * @returns {int | float | string} the largest of the provided values + */ +declare function max(arg1: any, arg2: any, ...args: any[]): int | float | string; +/** + * Returns the smallest of the provided values. If multiple items are equal to the minimum, + * the first encountered is returned. All values should be mutually comparable. + * + * @param {int | float | string} arg1 - The first item to compare. + * @param {int | float | string} arg2 - The second item to compare. + * @param {int | float | string} *args - Additional items to compare. + * @returns {int | float | string} the smallest of the provided values + */ +declare function min(arg1: any, arg2: any, ...args: any[]): int | float | string; +/** + * Return number rounded to ndigits precision after the decimal point. If + * ndigits is omitted or is None, it returns the nearest integer + * to its input. + * + * @param {int | float} number - The value to be rounded. + * @param {int} ndigits - The number of digits to round to after the decimal point. If omitted + * or None, the function rounds to the nearest integer. + * @returns {float} the number rounded to ndigits precision + */ +declare function round(number: any, ndigits: any): float; +/** + * Return the next random floating-point number in the range 0.0 ≤ X < 1.0. + * + * @returns {float} the next random floating-point number in the range 0.0 ≤ X < 1.0 + */ +declare function random_random(): float; +/** + * Return an integer object constructed from a number, or return 0 + * if no arguments are given. + * + * @param {int | float} number - The numeric value from which to construct the + * integer. If provided, it is converted to an integer by truncating toward 0. + * If omitted, it defaults to 0. + * @returns {int} an integer object constructed from the given number + */ +declare function _int(number?: number): int; +/** + * Return an integer object constructed from a string. If base is given, + * the string is parsed as an integer in radix base. The string + * may include optional whitespace, a leading sign (+ or -), and underscores between digits. + * + * @param {string} string - A string representing an integer in a given base. + * The string may include optional whitespace, a leading sign, and underscores between digits. + * @param {int} base - The base (radix) for conversion. It must be 0 + * or an integer in the range 236. The default is 10. + * @returns {int} an integer object parsed from the provided string using the specified base + */ +declare function _int_from_string(string: any, base?: number): int; +/** + * If the prompt argument is present, it is written to standard output without a trailing newline. + * The function then reads a line from input, converts it to a string (stripping a trailing newline), + * and returns that. + * + * @param {string} prompt - An optional string that is written to standard output + * (without a trailing newline) before input is read. + * @returns {string} the input read from the user as a string, with any trailing newline removed + */ +declare function input(prompt: any): string; +/** + * Return a string version of object. If object is not provided, returns + * the empty string. + * + * @param {any} object - The object to be converted to a string. + * If not provided, an empty string is returned. + * @returns {string} the informal string representation of object + */ +declare function str(object?: string): string; diff --git a/docs/lib/misc.js b/docs/lib/misc.js new file mode 100644 index 0000000..b55795a --- /dev/null +++ b/docs/lib/misc.js @@ -0,0 +1,154 @@ +/** + * Takes a string s as the first argument and a nonnegative + * integer i as the second argument. If i is less than + * the length of s, this function returns a one-character string that + * contains the character of s at position i, counting from 0. + * If i is larger than or equal to the length of s, this function returns + * None. + * + * @param {string} s - the given string + * @param {int} i - the index + * @returns {string} one-character string or None + */ +function char_at(s, i) {} + +/** + * A simplified version of the Python built-in print function. + * This function takes any number of parameters *object, converts them to their + * string representations using str(), and writes them to the standard + * output (sys.stdout), followed by a newline character. See the official Python + * documentation for print. + * + * @param {any} *object - object(s) to be printed to the standard output + * @returns {NoneType} the None value + */ +function print(...object) {} + +/** + * Prints the provided *object arguments to the standard output (similar to a simplified + * print) and then raises an exception. This function accepts a variable number of arguments, + * converts them to their string representations using str(), outputs them (with a + * newline) just like what print does, and immediately halts execution by raising an exception. + * + * @param {any} *object - Objects to be printed to the standard output + * @returns {NoneType} the None value + */ +function error(...object) {} + +/** + * Return the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. + * + * @returns {float} current time in milliseconds + */ +function time_time() {} + +/** + * Return True if object is an instance of classinfo. + * classinfo can be None, int, float, string, + * bool, and complex. + * + * @param {any} object - The object to be checked, i.e. the one to determine whether it is an + * instance of the specified type. + * @param {string} classinfo - The name of a single class (type). The type information used to test + * the object's type. + * @returns {bool} indicating whether object is an instance of classinfo + */ +function isinstance(object, classinfo) {} + +/** + * Return the absolute value of x. + * For an int input, it returns the non-negative integer equivalent. + * For a float input, it returns the positive floating-point number representing its magnitude. + * For a complex input, it computes and returns the modulus (the square root of the sum of the + * squares of the real and imaginary parts) as a float. + * + * @param {int | float | complex} x - The number whose absolute value is computed. + * @returns {int | float | complex} the absolute value of x + */ +function abs(x) {} + +/** + * Returns the largest of the provided values. If multiple items are equal to the maximum, + * the first encountered is returned. All values should be mutually comparable. + * + * @param {int | float | string} arg1 - The first item to compare. + * @param {int | float | string} arg2 - The second item to compare. + * @param {int | float | string} *args - Additional items to compare. + * @returns {int | float | string} the largest of the provided values + */ +function max(arg1, arg2, ...args) {} + +/** + * Returns the smallest of the provided values. If multiple items are equal to the minimum, + * the first encountered is returned. All values should be mutually comparable. + * + * @param {int | float | string} arg1 - The first item to compare. + * @param {int | float | string} arg2 - The second item to compare. + * @param {int | float | string} *args - Additional items to compare. + * @returns {int | float | string} the smallest of the provided values + */ +function min(arg1, arg2, ...args) {} + +/** + * Return number rounded to ndigits precision after the decimal point. If + * ndigits is omitted or is None, it returns the nearest integer + * to its input. + * + * @param {int | float} number - The value to be rounded. + * @param {int} ndigits - The number of digits to round to after the decimal point. If omitted + * or None, the function rounds to the nearest integer. + * @returns {float} the number rounded to ndigits precision + */ +function round(number, ndigits) {} + +/** + * Return the next random floating-point number in the range 0.0 ≤ X < 1.0. + * + * @returns {float} the next random floating-point number in the range 0.0 ≤ X < 1.0 + */ +function random_random() {} + +/** + * Return an integer object constructed from a number, or return 0 + * if no arguments are given. + * + * @param {int | float} number - The numeric value from which to construct the + * integer. If provided, it is converted to an integer by truncating toward 0. + * If omitted, it defaults to 0. + * @returns {int} an integer object constructed from the given number + */ +function _int(number = 0) {} + +/** + * Return an integer object constructed from a string. If base is given, + * the string is parsed as an integer in radix base. The string + * may include optional whitespace, a leading sign (+ or -), and underscores between digits. + * + * @param {string} string - A string representing an integer in a given base. + * The string may include optional whitespace, a leading sign, and underscores between digits. + * @param {int} base - The base (radix) for conversion. It must be 0 + * or an integer in the range 236. The default is 10. + * @returns {int} an integer object parsed from the provided string using the specified base + */ +function _int_from_string(string, base = 10) {} + +/** + * If the prompt argument is present, it is written to standard output without a trailing newline. + * The function then reads a line from input, converts it to a string (stripping a trailing newline), + * and returns that. + * + * @param {string} prompt - An optional string that is written to standard output + * (without a trailing newline) before input is read. + * @returns {string} the input read from the user as a string, with any trailing newline removed + */ +function input(prompt) {} + +/** + * Return a string version of object. If object is not provided, returns + * the empty string. + * + * @param {any} object - The object to be converted to a string. + * If not provided, an empty string is returned. + * @returns {string} the informal string representation of object + */ +function str(object = '') {} diff --git a/docs/md/README_1.md b/docs/md/README_1.md new file mode 100644 index 0000000..ae0000d --- /dev/null +++ b/docs/md/README_1.md @@ -0,0 +1,144 @@ +Source §1 is a small programming language, designed for the first chapter +of the textbook +Structure and Interpretation +of Computer Programs, JavaScript Adaptation (SICP JS). + +## What names are predeclared in Source §1? + +On the right, you see all predeclared names of Source §1, in alphabetical +order. Click on a name to see how it is defined and used. +They come in these groups: +
      +
    • + MISC: Miscellaneous constants and functions +
    • +
    • + MATH: Mathematical constants and functions +
    • +
    + +## What can you do in Source §1? + +You can use all features that are introduced in +chapter 1 of the +textbook. Below is the list of features, each with a link to the +textbook section that introduces it and a small example. + +### Literal values + +Literal values are simple expressions that directly evaluate to values. These +include numbers in the usual decimal notation, the two boolean values +`true` and `false`, and the predeclared names +`NaN`, `Infinity` and `undefined`. +More on literal values in section +1.1 The Elements of Programming of the textbook. + +### Constant declarations + +Constant declarations are done in Source with
    const my_name = x + 2;
    +Here the name `my_name` gets declared within the surrounding block, +and refers to the result of evaluating `x + 2` in the rest of the block. +You can read more about the scope of names in +section 1.1.8 +Functions as Black-Box Abstractions. + +### Conditional statements and conditional expressions + +Within expressions, you can let a predicate determine whether +a consequent expression +gets evaluated or an alternative expression. This is done by writing, +for example +
    return p(x) ? 7 : f(y);
    +Read more on conditional expressions in +section 1.1.6 +Conditional Expressions and Predicates. +Conditional evaluation is also possible within statements, for +example the body of a function declaration. For that, you can use conditional +statements, for example:
    if (p(x)) {
    +    return 7;
    +} else {
    +    return f(y);
    +}
    +Read about conditional statements in +section 1.3.2 +Function Definition Expressions. + +### Function declarations and function definitions + +A function declaration is a statement that declares a name and binds it +to a function. For example +
    function square(x) {
    +    return x * x;
    +}
    +
    +declares the name `square` and binds it to a squaring function, so that it can be applied +as in `square(5);`. You can read about function declaration statements in textbook +section 1.1.4 Functions. + +Sometimes, it's not necessary to give a name to a function: You may +want to create a function only to pass it to some other function as argument. +For that, Source +supports function definition expressions. For example +
    (x => x * x)(3); // returns 9
    +
    +creates a square function just like the function declaration above, +but does not give it a name. +Its only purpose it to be applied to the number 3. See also +textbook +section 1.3.2 Function Definition Expressions. + +### Blocks + +Blocks make up the bodies of functions and the consequent and alternative statements of +conditional statements. You can use blocks also elsewhere in your program, if you +want to declare constants local to a specific scope. For example in this program +
    const a = 1;
    +{
    +   const a = 2;
    +   display(a);
    +}
    +display(a);
    +
    +the first application of `display` shows the value 2, because the +declaration const `a = 2;` re-declares the constant `a`. +However, the second application +of `display` shows the value 1, because +the declaration const `a = 2;` is limited in scope by its surrounding block. +You can read more about blocks in +section 1.1.8 +Functions as Black-Box Abstractions. + +### Boolean operators + +Boolean operators in Source have a special meaning. Usually, an operator combination +evaluates all its arguments and then applies the operation to which the operator refers. +For example, `(2 * 3) + (4 * 5)` evaluates `2 * 3` and `4 * 5` first, before the addition +is carried out. However, the operator `&&` works differently. An expression +`e1 && e2` should be seen as an abbreviation for `e1 ? e2 : false`. The expression +`e2` only gets evaluated if `e1` evaluates to `true`. The behaviour of `||` is similar: +`e1 || e2` should be seen as an abbreviation for `e1 ? true : e2`. More on these +two boolean operators in textbook +section 1.1.6 Conditional +Expressions and Predicates. + +### Sequences + +A program or the body of a block does not need to consist of a single statement. +You can write multiple statements in a row. In the REPL ("Read-Eval-Print-Loop") +of a Source implementation, you can write +
    cube(7);
    +square(5);
    +The statements in such a sequence are evaluated in the given order. The +result of evaluating the sequence is the result of evaluating the last +statement in the sequence, in this case `square(5);`. +Read more about sequences in +section 1.1.2 +Naming and the Environment of the textbook. + +## You want the definitive specs? + +For our development team, we are maintaining a definitive description +of the language, called the +Specification of Source §1. Feel free to +take a peek. + diff --git a/docs/python/python_1/README.md b/docs/python/python_1/README.md new file mode 100644 index 0000000..c55ab7f --- /dev/null +++ b/docs/python/python_1/README.md @@ -0,0 +1,3 @@ +Changelog: + +styles changed by MH on 1/7/2019, see styles/README.md diff --git a/docs/python/python_1/fonts/OpenSans-Bold-webfont.eot b/docs/python/python_1/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 0000000..5d20d91 Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-Bold-webfont.eot differ diff --git a/docs/python/python_1/fonts/OpenSans-Bold-webfont.svg b/docs/python/python_1/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 0000000..3ed7be4 --- /dev/null +++ b/docs/python/python_1/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/python/python_1/fonts/OpenSans-Bold-webfont.woff b/docs/python/python_1/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 0000000..1205787 Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-Bold-webfont.woff differ diff --git a/docs/python/python_1/fonts/OpenSans-BoldItalic-webfont.eot b/docs/python/python_1/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 0000000..1f639a1 Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/docs/python/python_1/fonts/OpenSans-BoldItalic-webfont.svg b/docs/python/python_1/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 0000000..6a2607b --- /dev/null +++ b/docs/python/python_1/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/python/python_1/fonts/OpenSans-BoldItalic-webfont.woff b/docs/python/python_1/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 0000000..ed760c0 Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/docs/python/python_1/fonts/OpenSans-Italic-webfont.eot b/docs/python/python_1/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 0000000..0c8a0ae Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-Italic-webfont.eot differ diff --git a/docs/python/python_1/fonts/OpenSans-Italic-webfont.svg b/docs/python/python_1/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 0000000..e1075dc --- /dev/null +++ b/docs/python/python_1/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/python/python_1/fonts/OpenSans-Italic-webfont.woff b/docs/python/python_1/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 0000000..ff652e6 Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-Italic-webfont.woff differ diff --git a/docs/python/python_1/fonts/OpenSans-Light-webfont.eot b/docs/python/python_1/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 0000000..1486840 Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-Light-webfont.eot differ diff --git a/docs/python/python_1/fonts/OpenSans-Light-webfont.svg b/docs/python/python_1/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 0000000..11a472c --- /dev/null +++ b/docs/python/python_1/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/python/python_1/fonts/OpenSans-Light-webfont.woff b/docs/python/python_1/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 0000000..e786074 Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-Light-webfont.woff differ diff --git a/docs/python/python_1/fonts/OpenSans-LightItalic-webfont.eot b/docs/python/python_1/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 0000000..8f44592 Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/docs/python/python_1/fonts/OpenSans-LightItalic-webfont.svg b/docs/python/python_1/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 0000000..431d7e3 --- /dev/null +++ b/docs/python/python_1/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/python/python_1/fonts/OpenSans-LightItalic-webfont.woff b/docs/python/python_1/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 0000000..43e8b9e Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/docs/python/python_1/fonts/OpenSans-Regular-webfont.eot b/docs/python/python_1/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 0000000..6bbc3cf Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-Regular-webfont.eot differ diff --git a/docs/python/python_1/fonts/OpenSans-Regular-webfont.svg b/docs/python/python_1/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 0000000..25a3952 --- /dev/null +++ b/docs/python/python_1/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/python/python_1/fonts/OpenSans-Regular-webfont.woff b/docs/python/python_1/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 0000000..e231183 Binary files /dev/null and b/docs/python/python_1/fonts/OpenSans-Regular-webfont.woff differ diff --git a/docs/python/python_1/global.html b/docs/python/python_1/global.html new file mode 100644 index 0000000..17dfa6a --- /dev/null +++ b/docs/python/python_1/global.html @@ -0,0 +1,11358 @@ + + + + + Predeclared in Python §1 + + + + + + + + + + +
    + +

    Predeclared in Python §1

    + + + + + + + + + + + + + + +
    + +
    + +

    + + +
    + +
    +
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + + + + + + + + + + + + + +

    Constants

    + + +
    + +

    (constant) False :bool

    + + + + +
    + The false value of the bool type. +
    + + + +
    Type:
    +
      +
    • + +bool + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + +
    + +

    (constant) None :NoneType

    + + + + +
    + An object frequently used to represent the absence of a value. +See also Python 3.13 Documentation. +
    + + + +
    Type:
    +
      +
    • + +NoneType + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + +
    + +

    (constant) True :bool

    + + + + +
    + The true value of the bool type. +
    + + + +
    Type:
    +
      +
    • + +bool + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + +
    + +

    (constant) math_e :float

    + + + + +
    + The Number value for e, Euler's number, +which is approximately 2.718281828459045. +
    + + + +
    Type:
    +
      +
    • + +float + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + +
    + +

    (constant) math_inf :float

    + + + + +
    + The name inf refers to float value positive infinity. +(For negative infinity, use -math.inf.) Equivalent to +the output of float('inf'). +See also Python 3.13 Documentation. +
    + + + +
    Type:
    +
      +
    • + +float + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + +
    + +

    (constant) math_nan :float

    + + + + +
    + A floating-point “not a number” (nan) value. +Equivalent to the output of float('nan'). +See also Python 3.13 Documentation. +
    + + + +
    Type:
    +
      +
    • + +float + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + +
    + +

    (constant) math_pi :float

    + + + + +
    + The float value of π, +the ratio of the circumference of a circle to its diameter, +which is approximately 3.1415926535897932. +
    + + + +
    Type:
    +
      +
    • + +float + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + +
    + +

    (constant) math_tau :float

    + + + + +
    + Tau is a circle constant equals to , +the ratio of a circle’s circumference to its radius, +which is approximately 6.283185307179586. +
    + + + +
    Type:
    +
      +
    • + +float + + +
    • +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + +
    + + + + +

    Functions

    + + +
    + + + + + +

    _int(number) → {int}

    + + + + + + +
    + Return an integer object constructed from a number, or return 0 +if no arguments are given. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    number + + +int +| + +float + + + + The numeric value from which to construct the +integer. If provided, it is converted to an integer by truncating toward 0. +If omitted, it defaults to 0.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + an integer object constructed from the given number +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    _int_from_string(string, base) → {int}

    + + + + + + +
    + Return an integer object constructed from a string. If base is given, +the string is parsed as an integer in radix base. The string +may include optional whitespace, a leading sign (+ or -), and underscores between digits. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    string + + +string + + + + A string representing an integer in a given base. +The string may include optional whitespace, a leading sign, and underscores between digits.
    base + + +int + + + + The base (radix) for conversion. It must be 0 +or an integer in the range 236. The default is 10.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + an integer object parsed from the provided string using the specified base +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    abs(x) → {int|float|complex}

    + + + + + + +
    + Return the absolute value of x. +For an int input, it returns the non-negative integer equivalent. +For a float input, it returns the positive floating-point number representing its magnitude. +For a complex input, it computes and returns the modulus (the square root of the sum of the +squares of the real and imaginary parts) as a float. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float +| + +complex + + + + The number whose absolute value is computed.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the absolute value of x +
    + + + +
    +
    + Type +
    +
    + +int +| + +float +| + +complex + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    char_at(s, i) → {string}

    + + + + + + +
    + Takes a string s as the first argument and a nonnegative +integer i as the second argument. If i is less than +the length of s, this function returns a one-character string that +contains the character of s at position i, counting from 0. +If i is larger than or equal to the length of s, this function returns +None. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    s + + +string + + + + the given string
    i + + +int + + + + the index
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + one-character string or None +
    + + + +
    +
    + Type +
    +
    + +string + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    error(*object) → {NoneType}

    + + + + + + +
    + Prints the provided *object arguments to the standard output (similar to a simplified +print) and then raises an exception. This function accepts a variable number of arguments, +converts them to their string representations using str(), outputs them (with a +newline) just like what print does, and immediately halts execution by raising an exception. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    *object + + +any + + + + Objects to be printed to the standard output
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the None value +
    + + + +
    +
    + Type +
    +
    + +NoneType + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    input(prompt) → {string}

    + + + + + + +
    + If the prompt argument is present, it is written to standard output without a trailing newline. +The function then reads a line from input, converts it to a string (stripping a trailing newline), +and returns that. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    prompt + + +string + + + + An optional string that is written to standard output +(without a trailing newline) before input is read.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the input read from the user as a string, with any trailing newline removed +
    + + + +
    +
    + Type +
    +
    + +string + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    isinstance(object, classinfo) → {bool}

    + + + + + + +
    + Return True if object is an instance of classinfo. +classinfo can be None, int, float, string, +bool, and complex. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    object + + +any + + + + The object to be checked, i.e. the one to determine whether it is an +instance of the specified type.
    classinfo + + +string + + + + The name of a single class (type). The type information used to test +the object's type.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + indicating whether object is an instance of classinfo +
    + + + +
    +
    + Type +
    +
    + +bool + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_acos(x) → {float}

    + + + + + + +
    + Return the arc cosine of x, in radians. The result is between 0 and pi. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The value whose arc cosine is to be computed. Must be in the interval +[-1, 1].
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the arc cosine of x in radians +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_acosh(x) → {float}

    + + + + + + +
    + Return the inverse hyperbolic cosine of x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The number for which to compute the inverse hyperbolic cosine. +(Typically, x must be ≥ 1.)
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the inverse hyperbolic cosine of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_asin(x) → {float}

    + + + + + + +
    + Return the arc sine of x, in radians. The result is between -pi/2 and pi/2. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The value whose arc sine is to be computed. Must be in the interval +[-1, 1].
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the arc sine of x in radians +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_asinh(x) → {float}

    + + + + + + +
    + Return the inverse hyperbolic sine of x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The number for which to compute the inverse hyperbolic sine.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the inverse hyperbolic sine of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_atan(x) → {float}

    + + + + + + +
    + Return the arc tangent of x, in radians. The result is between -pi/2 and pi/2. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The value whose arc tangent is to be computed.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the arc tangent of x in radians +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_atan2(y, x) → {float}

    + + + + + + +
    + Return atan(y / x), in radians. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    y + + +int +| + +float + + + + The y-coordinate of the point.
    x + + +int +| + +float + + + + The x-coordinate of the point.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the arc tangent of y/x in radians +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_atanh(x) → {float}

    + + + + + + +
    + Return the inverse hyperbolic tangent of x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The number for which to compute the inverse hyperbolic tangent. +(Must be in the interval (-1, 1).)
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the inverse hyperbolic tangent of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_cbrt(x) → {float}

    + + + + + + +
    + Return the cube root of x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The numeric value for which to compute the cube root.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the cube root of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_ceil(x) → {int}

    + + + + + + +
    + Return the ceiling of x, the smallest integer greater than or equal to +x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The numeric value for which to compute the ceiling.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the ceiling of x +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_comb(n, k) → {int}

    + + + + + + +
    + Return the number of ways to choose k items from n items +without repetition and without order. +Returns zero when k > n. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    n + + +int + + + + Total number of items (must be a non-negative integer).
    k + + +int + + + + Number of items to choose (must be a non-negative integer).
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the binomial coefficient of n and k +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_copysign(x, y) → {float}

    + + + + + + +
    + Return a float with the magnitude (absolute value) of x +but the sign of y. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The value whose magnitude (absolute value) will be used.
    y + + +int +| + +float + + + + The value whose sign will be applied to x's magnitude.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + a float with the absolute value of x but with the sign of +y +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_cos(x) → {float}

    + + + + + + +
    + Return the cosine of x radians. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The angle in radians for which the cosine is computed.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the cosine of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_cosh(x) → {float}

    + + + + + + +
    + Return the hyperbolic cosine of x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The angle in radians for which to compute cosh(x).
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the hyperbolic cosine of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_degrees(x) → {float}

    + + + + + + +
    + Convert angle x from radians to degrees. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The angle in radians to be converted to degrees.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the angle, in degrees, corresponding to the given radians +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_erf(x) → {float}

    + + + + + + +
    + Return the error function at x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The value at which to evaluate the error function.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the error function value at x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_erfc(x) → {float}

    + + + + + + +
    + Return the complementary error function at x. The complementary error function is +defined as 1.0 - erf(x). It is used for large values of x where a subtraction +from one would cause a loss of significance. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The value at which to evaluate the complementary error function.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the complementary error function at x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_exp(x) → {float}

    + + + + + + +
    + Return e raised to the power x, where e = 2.718281… +is the base of natural logarithms. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The exponent for which to compute e^x.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the value of e raised to the power x with high accuracy +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_exp2(x) → {float}

    + + + + + + +
    + Return 2 raised to the power x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The exponent for which to compute 2^x.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the value of 2 raised to the power x with high accuracy +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_expm1(x) → {float}

    + + + + + + +
    + Return e raised to the power x, minus 1. Here e is +the base of natural logarithms. For small x, the subtraction in +exp(x) - 1 can result in a significant loss of precision; the expm1() function +provides a way to compute this quantity to full precision. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The exponent for which to compute e^x.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the value of e raised to the power x minus 1 with high accuracy +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_fabs(x) → {float}

    + + + + + + +
    + Return the absolute value of a number as a float. +Unlike the built-in abs(), math_fabs() always returns a float, +even when the input is an integer. +It only accepts int or float types (complex numbers are not supported). +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The number whose absolute value is computed.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + absolute value of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_factorial(n) → {int}

    + + + + + + +
    + Return n factorial as an integer. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    n + + +int + + + + A non-negative integer whose factorial is to be computed.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the factorial of n +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_floor(x) → {int}

    + + + + + + +
    + Return the floor of x, the largest integer less than or equal to +x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The numeric value for which to compute the flooring.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the flooring of x +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_fma(x, y, z) → {float}

    + + + + + + +
    + Fused multiply–add operation. Return (x * y) + z, computed as though with infinite +precision and range followed by a single round to the float format. +This operation often provides better accuracy than the direct expression +(x * y) + z. +This function follows the specification of the +(fusedMultiplyAdd) operation described in the IEEE 754 standard. +The standard leaves one case implementation-defined, namely the result of +fma(0, inf, nan) and fma(inf, 0, nan). +In these cases, math.fma returns a math.nan, and does not raise any exception. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The first multiplicand. It is multiplied by y.
    y + + +int +| + +float + + + + The second multiplicand. It is multiplied by x.
    z + + +int +| + +float + + + + The addend. The product of x and y +is added to z using a fused multiply–add operation.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the float value of (x * y) + z +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_fmod(x, y) → {float}

    + + + + + + +
    + Return the floating-point remainder of x / y, as defined by the +platform C library function fmod(x, y). The sign of the result is the same as the +sign of x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The dividend. It will be converted to a float +if necessary.
    y + + +int +| + +float + + + + The divisor. It will be converted to a float +if necessary.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the platform C library function fmod(x, y) style remainder of +x divided by y +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_gamma(x) → {float}

    + + + + + + +
    + Return the Gamma function at x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The input value at which the Gamma function is computed.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the Gamma function at x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_gcd(*integers) → {int}

    + + + + + + +
    + Return the greatest common divisor of the specified *integers arguments. +If any of the arguments is nonzero, then the returned value is the largest positive +integer that is a divisor of all arguments. +If all arguments are 0, then the returned value is 0. +gcd() without arguments returns 0. +If any of the provided integers is negative, the function treats it as its +absolute value when computing the GCD. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    *integers + + +int + + + + A variable number of integer arguments for +which to compute the greatest common divisor.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the greatest common divisor of the given integers as a positive +integer +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_isfinite(x) → {bool}

    + + + + + + +
    + Return True if x is neither an infinity nor a nan, +and False otherwise. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + A numeric value. It is converted to float if necessary.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the True if x is finite; otherwise, False +
    + + + +
    +
    + Type +
    +
    + +bool + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_isinf(x) → {bool}

    + + + + + + +
    + Return True if x is a positive or negative infinity, +and False otherwise. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + A numeric value. It is converted to float if necessary.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the True if x is an infinity (positive or negative); +otherwise, False +
    + + + +
    +
    + Type +
    +
    + +bool + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_isnan(x) → {bool}

    + + + + + + +
    + Return True if x is a nan (not a number), +and False otherwise. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + A numeric value. It is converted to float if necessary.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the True if x is nan; otherwise, False +
    + + + +
    +
    + Type +
    +
    + +bool + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_isqrt(n) → {int}

    + + + + + + +
    + Return the integer square root of the non-negative n. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    n + + +int + + + + A non-negative integer for which to compute the +integer square root.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the integer square root of n +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_lcm(*integers) → {int}

    + + + + + + +
    + Return the least common multiple of the specified integer arguments. +If all arguments are nonzero, then the returned value is the smallest positive +integer that is a multiple of all arguments. +If any of the arguments is 0, then the returned value is 0. +lcm() without arguments returns 1. +If any of the input integers is negative, math_lcm() treats it +as its absolute value when computing the LCM, so the result is always +non-negative. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    *integers + + +int + + + + A variable number of integer arguments for +which the least common multiple is computed.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the least common multiple of the given integers as a positive +integer +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_ldexp(x, i) → {float}

    + + + + + + +
    + Return x * (2**i). This is essentially the inverse of function +frexp(). +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + A numeric value (the significand). It is converted to +float if necessary.
    i + + +int + + + + An integer exponent.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the result of x multiplied by 2 raised to the power +i +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_lgamma(x) → {float}

    + + + + + + +
    + Return the natural logarithm of the absolute value of the Gamma function at x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The input value for which to compute the natural logarithm of the +absolute Gamma function.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the natural logarithm of the absolute value of the Gamma function at x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_log(x, base(optional)) → {float}

    + + + + + + +
    + With one argument, return the natural logarithm of x (to base e). +With two arguments, return the logarithm of x to the given base, +calculated as log(x)/log(base). +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The numeric value for which to compute the logarithm.
    base(optional) + + +int +| + +float + + + + The base of the logarithm. If provided, the result is computed as +log(x)/log(base). If omitted, the natural logarithm (base e) is returned.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + a float representing the logarithm of x (either natural logarithm when +base is not provided, or logarithm with the given base otherwise) +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_log10(x) → {float}

    + + + + + + +
    + Return the base-10 logarithm of x. This is usually more accurate than +log(x, 10). +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + A positive number. The function returns the logarithm of +x to base 10.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the base-10 logarithm of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_log1p(x) → {float}

    + + + + + + +
    + Return the natural logarithm of 1+x (base e). The result is calculated in a way +which is accurate for x near 0. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The number to be added to 1. The function returns the natural +logarithm of (1+x), computed in a way that is accurate for values of x near 0.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the natural logarithm of 1+x (base e) +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_log2(x) → {float}

    + + + + + + +
    + Return the base-2 logarithm of x. This is usually more accurate than +log(x, 2). +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + A positive number. The function returns the logarithm of +x to base 2.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the base-2 logarithm of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_nextafter(x, y, steps) → {float}

    + + + + + + +
    + Return the floating-point value steps steps after x towards +y. If x is equal to y, return y, unless +steps is 0. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The starting floating-point number from which the stepping begins.
    y + + +int +| + +float + + + + The target value that determines the direction. The function will +return a value toward y from x.
    steps + + +int + + + + The number of representable floating-point values to step from +x toward y (default is 1).
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the floating-point number that is exactly steps representable numbers +away from x in the direction of y +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_perm(n, k) → {int}

    + + + + + + +
    + Return the number of ways to choose k items from n items without +repetition and with order. +Returns zero when k > n. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    n + + +int + + + + Total number of items (must be a non-negative integer).
    k + + +int + + + + Number of items to choose (must be a non-negative integer).
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the permutations of n and k +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_pow(x, y) → {float}

    + + + + + + +
    + Return x raised to the power y. Unlike the built-in +** operator, math_pow() converts both its arguments to type float. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The base value. Both x and y are converted +to float before the operation.
    y + + +int +| + +float + + + + The exponent value. The function computes x raised to the power +y, following IEEE 754 rules for special cases.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the value of x raised to the power y +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_radians(x) → {float}

    + + + + + + +
    + Convert angle x from degrees to radians. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The angle in degrees to be converted to radians.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the angle, in radians, corresponding to the given degrees +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_remainder(x, y) → {float}

    + + + + + + +
    + Return the IEEE 754-style remainder of x with respect to y. For finite +x and finite nonzero y, this is the difference x - n*y, where +n is the closest integer to the exact value of the quotient x / y. +If x / y is exactly halfway between two consecutive integers, the nearest +even integer is used for n. The remainder r = remainder(x, y) +thus always satisfies abs(r) <= 0.5 * abs(y). +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The dividend. It will be converted to a float +if necessary.
    y + + +int +| + +float + + + + The divisor. It will be converted to a float +if necessary.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the IEEE 754-style remainder of x divided by y +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_sin(x) → {float}

    + + + + + + +
    + Return the sine of x radians. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The angle in radians for which the sine is computed.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the sine of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_sinh(x) → {float}

    + + + + + + +
    + Return the hyperbolic sine of x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The angle in radians for which to compute sinh(x).
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the hyperbolic sine of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_sqrt(x) → {float}

    + + + + + + +
    + Return the square root of x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + A non-negative number. x is converted to a float +if necessary.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the square root of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_tan(x) → {float}

    + + + + + + +
    + Return the tangent of x radians. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The angle in radians for which the tangent is computed.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the tangent of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_tanh(x) → {float}

    + + + + + + +
    + Return the hyperbolic tangent of x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The angle in radians for which to compute tanh(x).
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the hyperbolic tangent of x +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_trunc(x) → {int}

    + + + + + + +
    + Return x with the fractional part removed, leaving the integer part. +trunc() is equivalent to floor() for positive x, and equivalent +to ceil() for negative x. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The numeric value from which the fractional part is removed, +returning the integral part (i.e. x rounded toward 0).
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the integer part of x +
    + + + +
    +
    + Type +
    +
    + +int + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    math_ulp(x) → {float}

    + + + + + + +
    + Return the value of the least significant bit of the float x. +If x is a NaN (not a number), return x. +If x is negative, return ulp(-x). +If x is a positive infinity, return x. +If x is equal to 0, return the smallest positive denormalized +representable float (smaller than the minimum positive normalized float, +sys.float_info.min, approximately 1.7976931348623157e+308). +If x is equal to the largest positive representable float, return the value +of the least significant bit of x, such that the first float smaller than +x is x - ulp(x). +Otherwise (when x is a positive finite number), return the value of the least significant +bit of x, such that the first float bigger than x is +x + ulp(x). +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +int +| + +float + + + + The numeric value (typically a float) for which to compute +the ULP (Unit in the Last Place). The function returns the value of the least significant +bit of x, handling special cases (NaN, infinities, 0, etc.) +as specified by IEEE 754.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the spacing between x and the next representable float in the +direction defined by x's sign +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    max(arg1, arg2, *args) → {int|float|string}

    + + + + + + +
    + Returns the largest of the provided values. If multiple items are equal to the maximum, +the first encountered is returned. All values should be mutually comparable. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    arg1 + + +int +| + +float +| + +string + + + + The first item to compare.
    arg2 + + +int +| + +float +| + +string + + + + The second item to compare.
    *args + + +int +| + +float +| + +string + + + + Additional items to compare.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the largest of the provided values +
    + + + +
    +
    + Type +
    +
    + +int +| + +float +| + +string + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    min(arg1, arg2, *args) → {int|float|string}

    + + + + + + +
    + Returns the smallest of the provided values. If multiple items are equal to the minimum, +the first encountered is returned. All values should be mutually comparable. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    arg1 + + +int +| + +float +| + +string + + + + The first item to compare.
    arg2 + + +int +| + +float +| + +string + + + + The second item to compare.
    *args + + +int +| + +float +| + +string + + + + Additional items to compare.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the smallest of the provided values +
    + + + +
    +
    + Type +
    +
    + +int +| + +float +| + +string + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    print(*object) → {NoneType}

    + + + + + + +
    + A simplified version of the Python built-in print function. +This function takes any number of parameters *object, converts them to their +string representations using str(), and writes them to the standard +output (sys.stdout), followed by a newline character. See the official Python +documentation for print. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    *object + + +any + + + + object(s) to be printed to the standard output
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the None value +
    + + + +
    +
    + Type +
    +
    + +NoneType + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    random_random() → {float}

    + + + + + + +
    + Return the next random floating-point number in the range 0.0 ≤ X < 1.0. +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the next random floating-point number in the range 0.0 ≤ X < 1.0 +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    round(number, ndigits) → {float}

    + + + + + + +
    + Return number rounded to ndigits precision after the decimal point. If +ndigits is omitted or is None, it returns the nearest integer +to its input. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    number + + +int +| + +float + + + + The value to be rounded.
    ndigits + + +int + + + + The number of digits to round to after the decimal point. If omitted +or None, the function rounds to the nearest integer.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the number rounded to ndigits precision +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    str(object) → {string}

    + + + + + + +
    + Return a string version of object. If object is not provided, returns +the empty string. +
    + + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    object + + +any + + + + The object to be converted to a string. +If not provided, an empty string is returned.
    + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + the informal string representation of object +
    + + + +
    +
    + Type +
    +
    + +string + + +
    +
    + + + + + + + +
    + +
    + + + + + +

    time_time() → {float}

    + + + + + + +
    + Return the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    Returns:
    + + +
    + current time in milliseconds +
    + + + +
    +
    + Type +
    +
    + +float + + +
    +
    + + + + + + + +
    + + + + + + +
    + +
    + + + + +
    + + + +
    + + + + + + + \ No newline at end of file diff --git a/docs/python/python_1/index.html b/docs/python/python_1/index.html new file mode 100644 index 0000000..af39f64 --- /dev/null +++ b/docs/python/python_1/index.html @@ -0,0 +1,207 @@ + + + + + Python §1 + + + + + + + + + + +
    + +

    Python §1

    + + + + + + + + + + + + + + + + +

    + + + + + + + + + + + + + + + + + + + + +
    +

    Source §1 is a small programming language, designed for the first chapter +of the textbook +Structure and Interpretation +of Computer Programs, JavaScript Adaptation (SICP JS).

    +

    What names are predeclared in Source §1?

    +

    On the right, you see all predeclared names of Source §1, in alphabetical +order. Click on a name to see how it is defined and used. +They come in these groups:

    +
      +
    • + MISC: Miscellaneous constants and functions +
    • +
    • + MATH: Mathematical constants and functions +
    • +
    +

    What can you do in Source §1?

    +

    You can use all features that are introduced in +chapter 1 of the +textbook. Below is the list of features, each with a link to the +textbook section that introduces it and a small example.

    +

    Literal values

    +

    Literal values are simple expressions that directly evaluate to values. These +include numbers in the usual decimal notation, the two boolean values +true and false, and the predeclared names +NaN, Infinity and undefined. +More on literal values in section +1.1 The Elements of Programming of the textbook.

    +

    Constant declarations

    +

    Constant declarations are done in Source with

    const my_name = x + 2;
    +Here the name my_name gets declared within the surrounding block, +and refers to the result of evaluating x + 2 in the rest of the block. +You can read more about the scope of names in +section 1.1.8 +Functions as Black-Box Abstractions.

    +

    Conditional statements and conditional expressions

    +

    Within expressions, you can let a predicate determine whether +a consequent expression +gets evaluated or an alternative expression. This is done by writing, +for example

    +
    return p(x) ? 7 : f(y);
    +

    Read more on conditional expressions in +section 1.1.6 +Conditional Expressions and Predicates. +Conditional evaluation is also possible within statements, for +example the body of a function declaration. For that, you can use conditional +statements, for example:

    if (p(x)) {
    +return 7;
    +} else {
    +return f(y);
    +}
    +Read about conditional statements in +section 1.3.2 +Function Definition Expressions.

    +

    Function declarations and function definitions

    +

    A function declaration is a statement that declares a name and binds it +to a function. For example

    +
    function square(x) {
    +    return x * x;
    +}
    +
    +

    declares the name square and binds it to a squaring function, so that it can be applied +as in square(5);. You can read about function declaration statements in textbook +section 1.1.4 Functions.

    +

    Sometimes, it's not necessary to give a name to a function: You may +want to create a function only to pass it to some other function as argument. +For that, Source +supports function definition expressions. For example

    +
    (x => x * x)(3); // returns 9
    +
    +

    creates a square function just like the function declaration above, +but does not give it a name. +Its only purpose it to be applied to the number 3. See also +textbook +section 1.3.2 Function Definition Expressions.

    +

    Blocks

    +

    Blocks make up the bodies of functions and the consequent and alternative statements of +conditional statements. You can use blocks also elsewhere in your program, if you +want to declare constants local to a specific scope. For example in this program

    +
    const a = 1;
    +{
    +   const a = 2;
    +   display(a);
    +}
    +display(a);
    +
    +

    the first application of display shows the value 2, because the +declaration const a = 2; re-declares the constant a. +However, the second application +of display shows the value 1, because +the declaration const a = 2; is limited in scope by its surrounding block. +You can read more about blocks in +section 1.1.8 +Functions as Black-Box Abstractions.

    +

    Boolean operators

    +

    Boolean operators in Source have a special meaning. Usually, an operator combination +evaluates all its arguments and then applies the operation to which the operator refers. +For example, (2 * 3) + (4 * 5) evaluates 2 * 3 and 4 * 5 first, before the addition +is carried out. However, the operator && works differently. An expression +e1 && e2 should be seen as an abbreviation for e1 ? e2 : false. The expression +e2 only gets evaluated if e1 evaluates to true. The behaviour of || is similar: +e1 || e2 should be seen as an abbreviation for e1 ? true : e2. More on these +two boolean operators in textbook +section 1.1.6 Conditional +Expressions and Predicates.

    +

    Sequences

    +

    A program or the body of a block does not need to consist of a single statement. +You can write multiple statements in a row. In the REPL ("Read-Eval-Print-Loop") +of a Source implementation, you can write

    +
    cube(7);
    +square(5);
    +

    The statements in such a sequence are evaluated in the given order. The +result of evaluating the sequence is the result of evaluating the last +statement in the sequence, in this case square(5);. +Read more about sequences in +section 1.1.2 +Naming and the Environment of the textbook.

    +

    You want the definitive specs?

    +

    For our development team, we are maintaining a definitive description +of the language, called the +Specification of Source §1. Feel free to +take a peek.

    +
    + + + + + + +
    + + + +
    + + + + + + + \ No newline at end of file diff --git a/docs/python/python_1/scripts/prettify/Apache-License-2.0.txt b/docs/python/python_1/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/docs/python/python_1/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/docs/python/python_1/styles/README.md b/docs/python/python_1/styles/README.md new file mode 100644 index 0000000..6e6e82d --- /dev/null +++ b/docs/python/python_1/styles/README.md @@ -0,0 +1,3 @@ +Changelog: + +// jsdoc-default.css modified by MH: 1/7/2019, see MH below \ No newline at end of file diff --git a/docs/python/python_1/styles/jsdoc-default.css b/docs/python/python_1/styles/jsdoc-default.css new file mode 100644 index 0000000..a2802ea --- /dev/null +++ b/docs/python/python_1/styles/jsdoc-default.css @@ -0,0 +1,367 @@ +/* modified by MH: 1/7/2019, see MH below */ + +@font-face { + font-family: 'Open Sans'; + font-weight: normal; + font-style: normal; + src: url('../fonts/OpenSans-Regular-webfont.eot'); + src: + local('Open Sans'), + local('OpenSans'), + url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), + url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), + url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg'); +} + +@font-face { + font-family: 'Open Sans Light'; + font-weight: normal; + font-style: normal; + src: url('../fonts/OpenSans-Light-webfont.eot'); + src: + local('Open Sans Light'), + local('OpenSans Light'), + url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), + url('../fonts/OpenSans-Light-webfont.woff') format('woff'), + url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg'); +} + +html +{ + overflow: auto; + background-color: #fff; + font-size: 14px; +} + +body +{ + font-family: 'Open Sans', sans-serif; + line-height: 1.5; + color: #4d4e53; + background-color: white; +} + +a, a:visited, a:active { + color: #0095dd; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +header +{ + display: block; + padding: 0px 4px; +} + +tt, code, kbd, samp { + font-family: Consolas, Monaco, 'Andale Mono', monospace; +} + +.class-description { + font-size: 130%; + line-height: 140%; + margin-bottom: 1em; + margin-top: 1em; +} + +.class-description:empty { + margin: 0; +} + +#main { + float: left; + width: 70%; +} + +article dl { + margin-bottom: 40px; +} + +article img { + max-width: 100%; +} + +section +{ + display: block; + background-color: #fff; + padding: 12px 24px; + border-bottom: 1px solid #ccc; + margin-right: 30px; +} + +.variation { + display: none; +} + +.signature-attributes { + font-size: 60%; + color: #aaa; + font-style: italic; + font-weight: lighter; +} + +nav +{ + display: block; + float: right; + margin-top: 28px; + width: 30%; + box-sizing: border-box; + border-left: 1px solid #ccc; + padding-left: 16px; +} + +nav ul { + font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; + font-size: 100%; + line-height: 17px; + padding: 0; + margin: 0; + list-style-type: none; +} + +nav ul a, nav ul a:visited, nav ul a:active { + font-family: Consolas, Monaco, 'Andale Mono', monospace; + line-height: 18px; + color: #4D4E53; +} + +nav h3 { + margin-top: 12px; +} + +nav li { + margin-top: 6px; +} + +footer { + display: block; + padding: 6px; + margin-top: 12px; + font-style: italic; + font-size: 90%; +} + +h1, h2, h3, h4 { + font-weight: 200; + margin: 0; +} + +h1 +{ + font-family: 'Open Sans Light', sans-serif; + font-size: 48px; + letter-spacing: -2px; + margin: 12px 24px 20px; +} + +/* added by MH: 1/7/2019 + support for overall library index, + using library-page class */ +h2.libraries-page { + margin: 16px 28px 24px; +} + +h2, h3.subsection-title +{ + font-size: 30px; + font-weight: 700; + letter-spacing: -1px; + margin-bottom: 12px; +} + +h3 +{ + font-size: 24px; + letter-spacing: -0.5px; + margin-bottom: 12px; +} + +h4 +{ + font-size: 18px; + letter-spacing: -0.33px; + margin-bottom: 12px; + color: #4d4e53; +} + +h5, .container-overview .subsection-title +{ + font-size: 120%; + font-weight: bold; + letter-spacing: -0.01em; + margin: 8px 0 3px 0; +} + +h6 +{ + font-size: 100%; + letter-spacing: -0.01em; + margin: 6px 0 3px 0; + font-style: italic; +} + +table +{ + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +td, th +{ + border: 1px solid #ddd; + margin: 0px; + text-align: left; + vertical-align: top; + padding: 4px 6px; + display: table-cell; +} + +thead tr +{ + background-color: #ddd; + font-weight: bold; +} + +th { border-right: 1px solid #aaa; } +tr > th:last-child { border-right: 1px solid #ddd; } + +.ancestors, .attribs { color: #999; } +.ancestors a, .attribs a +{ + color: #999 !important; + text-decoration: none; +} + +.clear +{ + clear: both; +} + +.important +{ + font-weight: bold; + color: #950B02; +} + +.yes-def { + text-indent: -1000px; +} + +.type-signature { + color: #aaa; +} + +.name, .signature { + font-family: Consolas, Monaco, 'Andale Mono', monospace; +} + +.details { margin-top: 14px; border-left: 2px solid #DDD; } +.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } +.details dd { margin-left: 70px; } +.details ul { margin: 0; } +.details ul { list-style-type: none; } +.details li { margin-left: 30px; padding-top: 6px; } +.details pre.prettyprint { margin: 0 } +.details .object-value { padding-top: 0; } + +.description { + margin-bottom: 1em; + margin-top: 1em; +} + +.code-caption +{ + font-style: italic; + font-size: 107%; + margin: 0; +} + +.source +{ + border: 1px solid #ddd; + width: 80%; + overflow: auto; +} + +.prettyprint.source { + width: inherit; +} + +.source code +{ + font-size: 100%; + line-height: 18px; + display: block; + padding: 4px 12px; + margin: 0; + background-color: #fff; + color: #4D4E53; +} + +.prettyprint code span.line +{ + display: inline-block; +} + +.prettyprint.linenums +{ + padding-left: 70px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.prettyprint.linenums ol +{ + padding-left: 0; +} + +.prettyprint.linenums li +{ + border-left: 3px #ddd solid; +} + +.prettyprint.linenums li.selected, +.prettyprint.linenums li.selected * +{ + background-color: lightyellow; +} + +.prettyprint.linenums li * +{ + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.params .name, .props .name, .name code { + color: #4D4E53; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 100%; +} + +.params td.description > p:first-child, +.props td.description > p:first-child +{ + margin-top: 0; + padding-top: 0; +} + +.params td.description > p:last-child, +.props td.description > p:last-child +{ + margin-bottom: 0; + padding-bottom: 0; +} + +.disabled { + color: #454545; +} diff --git a/docs/python/python_1/styles/prettify-jsdoc.css b/docs/python/python_1/styles/prettify-jsdoc.css new file mode 100644 index 0000000..5a2526e --- /dev/null +++ b/docs/python/python_1/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/docs/python/python_1/styles/prettify-tomorrow.css b/docs/python/python_1/styles/prettify-tomorrow.css new file mode 100644 index 0000000..b6f92a7 --- /dev/null +++ b/docs/python/python_1/styles/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/docs/python/specs/source_1.aux b/docs/python/specs/source_1.aux new file mode 100644 index 0000000..703bf34 --- /dev/null +++ b/docs/python/specs/source_1.aux @@ -0,0 +1,7 @@ +\relax +\providecommand\hyper@newdestlabel[2]{} +\providecommand\HyField@AuxAddToFields[1]{} +\providecommand\HyField@AuxAddToCoFields[2]{} +\@writefile{toc}{\contentsline {section}{\numberline {1}Syntax}{1}{section.1}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {2}Dynamic Type Checking}{5}{section.2}\protected@file@percent } +\gdef \@abspage@last{6} diff --git a/docs/python/specs/source_1.fdb_latexmk b/docs/python/specs/source_1.fdb_latexmk new file mode 100644 index 0000000..60c285c --- /dev/null +++ b/docs/python/specs/source_1.fdb_latexmk @@ -0,0 +1,173 @@ +# Fdb version 4 +["pdflatex"] 1740107269.74022 "/Users/wangdahai/Downloads/py-slang-main/docs/python/specs/source_1.tex" "source_1.pdf" "source_1" 1740107270.48316 0 + "/Users/wangdahai/Downloads/py-slang-main/docs/python/specs/source_1.tex" 1740107220.3762 451 d072f5c821628f79e043eaaa19c46dff "" + "/usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/base/8r.enc" 1165713224 4850 80dc9bab7f31fb78a000ccfed0e27cab "" + "/usr/local/texlive/2024/texmf-dist/fonts/map/fontname/texfonts.map" 1577235249 3524 cb3e574dea2d1052e39280babc910dc8 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8r.tfm" 1136768653 2652 fbb260af94169655e2163df863ca2995 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8t.tfm" 1136768653 3556 261ac613091c62ddacfd00939d8dd353 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl7t.tfm" 1136768653 1800 f68747be4f89b17e96149118d1894979 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8c.tfm" 1136768653 1364 ff23d074a5ae37cc24b918b3e8850fc0 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8r.tfm" 1136768653 2608 d8b24d9becc080c35b069bf5c09816a3 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm" 1136768653 3488 d5b156792a73291a2f69626e6a3f8632 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkli8r.tfm" 1136768653 2812 072107f186dcf718ca4dd92aa2ad5cdd "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkli8t.tfm" 1136768653 3644 a367c8016388e00e23add28a96a95e35 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbklo8r.tfm" 1136768653 2756 a1a6b86d07e2c434df00ec3df166fa99 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbklo8t.tfm" 1136768653 3620 0c547f3d07d80a465f8d79b7555c812e "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrb8r.tfm" 1136768653 1292 3059476c50a24578715759f22652f3d0 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrb8t.tfm" 1136768653 1384 87406e4336af44af883a035f17f319d9 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrr8c.tfm" 1136768653 1268 8bd405dc5751cfed76cb6fb2db78cb50 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrr8r.tfm" 1136768653 1292 bd42be2f344128bff6d35d98474adfe3 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrr8t.tfm" 1136768653 1384 4632f5e54900a7dadbb83f555bc61e56 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrro8r.tfm" 1136768653 1544 4fb84cf2931ec523c2c6a08d939088ba "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrro8t.tfm" 1136768653 1596 04a657f277f0401ba37d66e716627ac4 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex7.tfm" 1246382020 1004 54797486969f23fa377b128694d548df "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex8.tfm" 1246382020 988 bdf658c3bfc2d96d3c8b02cfc1c94c20 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam10.tfm" 1246382020 916 f87d7c45f9c908e672703b83b72241a3 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam5.tfm" 1246382020 924 9904cf1d39e9767e7a3622f2a125a565 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam7.tfm" 1246382020 928 2dc8d444221b7a635bb58038579b861a "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm10.tfm" 1246382020 908 2921f8a10601f252058503cc6570e581 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm5.tfm" 1246382020 940 75ac932a52f80982a9f8ea75d03a34cf "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm7.tfm" 1246382020 940 228d6584342e91276bf566bcf9716b83 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmmi6.tfm" 1136768653 1512 f21f83efb36853c0b70002322c1ab3ad "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmmi8.tfm" 1136768653 1520 eccf95517727cb11801f4f1aee3a21b4 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmr6.tfm" 1136768653 1300 b62933e007d01cfd073f79b963c01526 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmr8.tfm" 1136768653 1292 21c1c5bfeaebccffdb478fd231a0997d "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmsy6.tfm" 1136768653 1116 933a60c408fc0a863a92debe84b2d294 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmsy8.tfm" 1136768653 1120 8b7d695260f3cff42e636090a8002094 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmtt10.tfm" 1136768653 768 1321e9409b4137d6fb428ac9dc956269 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmtt8.tfm" 1136768653 768 d7b9a2629a0c353102ad947dc9221d49 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy10.tfm" 1136768653 520 82a3d37183f34b6eb363a161dfc002c2 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy5.tfm" 1136768653 520 d082ac03a1087bc1ec2a06e24a9f68c0 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy6.tfm" 1136768653 520 4889cce2180234b97cad636b6039c722 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy7.tfm" 1136768653 520 a74c6ed8cb48679fdc3ea874d9d34a7e "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy8.tfm" 1136768653 520 7bb3abb160b19e0ed6ac404bb59052b7 "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb" 1248133631 36299 5f9df58c2139e7edcf37c8fca4bd384d "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb" 1248133631 36281 c355509802a035cadc5f15869451dcee "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi8.pfb" 1248133631 35469 70d41d2b9ea31d5d813066df7c99281c "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb" 1248133631 35752 024fb6c41858982481f6968b5fc26508 "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb" 1248133631 32726 0a1aea6fcd6468ee2cf64d891f5c43c8 "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb" 1248133631 32569 5e5ddc8df908dea60932f3c484a54c0d "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy8.pfb" 1248133631 32626 4f5c1b83753b1dd3a97d1b399a005b4b "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/urw/bookman/ubkd8a.pfb" 1136849748 44768 f7f73d132286e7860b4a7010de7f597c "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/urw/bookman/ubkl8a.pfb" 1136849748 44934 6b22cea7b9558c69bac00cbdc55a9953 "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/urw/bookman/ubkli8a.pfb" 1136849748 44162 e6f462fe4e2c0d41f03e92355604b703 "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/urw/courier/ucrb8a.pfb" 1136849748 50493 4ed1f7e9eba8f1f3e1ec25195460190d "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/urw/courier/ucrr8a.pfb" 1136849748 45758 19968a0990191524e34e1994d4a31cb6 "" + "/usr/local/texlive/2024/texmf-dist/fonts/type1/urw/courier/ucrro8a.pfb" 1136849748 44404 ea3d9c0311883914133975dd62a9185c "" + "/usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkd8t.vf" 1136768653 2352 d2be7cc526a6d08fef772daa8eebafce "" + "/usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkl8c.vf" 1136768653 3556 1d2c096c9bb83e765b39929a72752e94 "" + "/usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkl8t.vf" 1136768653 2356 7ea60a0e563963d05cf27387ad3d563a "" + "/usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkli8t.vf" 1136768653 2324 c701597cbd6efd5d5edf607c5a1308b2 "" + "/usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbklo8t.vf" 1136768653 2356 99734ce2288d2f531f17825697cad06c "" + "/usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/courier/pcrb8t.vf" 1136768653 2184 5d20c8b00cd914e50251116c274e2d0b "" + "/usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/courier/pcrr8c.vf" 1136768653 3552 6a7911d0b338a7c32cbfc3a9e985ccca "" + "/usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/courier/pcrr8t.vf" 1136768653 2184 8475af1b9cfa983db5f46f5ed4b8f9f7 "" + "/usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/courier/pcrro8t.vf" 1136768653 2280 d7cd083c724c9449e1d12731253966f7 "" + "/usr/local/texlive/2024/texmf-dist/tex/context/base/mkii/supp-pdf.mkii" 1461363279 71627 94eb9990bed73c364d7f53f960cc8c5b "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/atbegshi/atbegshi.sty" 1575674566 24708 5584a51a7101caf7e6bbf1fc27d8f7b1 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty" 1576625341 40635 c40361e206be584d448876bba8a64a3b "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty" 1576016050 33961 6b5c75130e435b2bfdb9f480a09a39f9 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty" 1576625223 8371 9d55b8bd010bc717624922fb3477d92e "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/ifpdf.sty" 1572645307 480 5778104efadad304ced77548ca2184b1 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty" 1644112042 7237 bdd120a32c8fdb4b433cf9ca2e7cd98a "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty" 1575499628 8356 7bbb2c2373aa810be568c29e333da8ed "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty" 1576625065 31769 002a487f55041f8e805cfbf6385ffd97 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty" 1576878844 5412 d5a2436094cd7be85769db90f29250a6 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty" 1701727651 17865 1a9bd36b4f98178fa551aca822290953 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty" 1576015897 19007 15924f7228aca6c6d184b115f4baa231 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty" 1593379760 20089 80423eac55aa175305d35b49e04fe23b "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty" 1576624663 7008 f92eaa0a3872ed622bbf538217cd2ab7 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty" 1359763108 5949 3f3fd50a8cc94c3d4cbf4fc66cd3df1c "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty" 1359763108 13829 94730e64147574077f8ecfea9bb69af4 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/umsa.fd" 1359763108 961 6518c6525a34feb5e8250ffa91731cff "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/umsb.fd" 1359763108 961 d02606146ba5601b5645f987c92e6193 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty" 1686341992 2222 499d61426192c39efd8f410ee1a52b9c "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty" 1686341992 4173 82ac04dfb1256038fad068287fbb4fe6 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty" 1686341992 88371 d84032c0f422c3d1e282266c01bef237 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty" 1686341992 4474 b811654f4bf125f11506d13d13647efb "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty" 1686341992 2444 0d0c1ee65478277e8015d65b86983da2 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/atveryend/atveryend.sty" 1576191570 19336 ce7ae9438967282886b3b036cfad1e4d "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty" 1576625391 3935 57aa3c3e203a5c2effb4d2bd2efbc323 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls" 1705352648 20144 147463a6a579f4597269ef9565205cfe "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty" 1705352648 3045 273c666a54e60b9f730964f431a56c1b "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty" 1705352648 2462 6bc53756156dbd71c1ad550d30a3b93f "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty" 1705352648 5119 a04a8b68ab4f6ce800a41f7f8012a10e "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/inputenc.sty" 1705352648 5048 425739d70251273bf93e3d51f3c40048 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/latexsym.sty" 1705352648 2853 22ef275b938b198870f6474b02bbd3b1 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo" 1705352648 8448 dbc0dbf4156c0bb9ba01a1c685d3bad0 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/ulasy.fd" 1705352648 2233 223b021f06a068bcbf05919274832728 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.enc" 1634853225 29591 d67c9aa515f4260cdd60fa9f76d96368 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.sty" 1634853225 33241 3ee25f21824a4a347866900e5037d6f3 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJKutf8.sty" 1634853225 24621 e1c0abd54a87918dd1e31a35b20e99e4 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/mule/MULEenc.sty" 1634853225 12177 48c95ebf85a580326918e5eb490b477b "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/colortbl/colortbl.sty" 1708463147 12355 ec728d2e4c37cf8919ee2eff9b75ad0c "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty" 1579991033 13886 d1306dcf79a944f6988e688c1785f9ce "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty" 1601931149 46845 3b58f70c6e861a13d927bff09d35ecbc "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg" 1459978653 1213 620bba36b25224fa9b7e1ccb4ecb76fd "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg" 1465944070 1224 978390e9c2234eab29404bc21b268d1e "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def" 1663965824 19448 1e988b341dda20961a6b931bcde55519 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/color.sty" 1654720880 7233 e46ce9241d2b2ca2a78155475fdd557a "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def" 1654720880 5009 d242512eef244b70f2fc3fde14419206 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty" 1654720880 18387 8f900a490197ebaf93c02ae9476d4b09 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty" 1654720880 8010 a8d949cbdbc5c983593827c9eec252e1 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty" 1654720880 2671 7e67d78d9b88c845599a85b2d41f2e39 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx" 1667332637 2885 9c645d672ae17285bba324998918efd8 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty" 1654720880 4023 293ea1c16429fc0c4cf605f4da1791a9 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty" 1580250785 17914 4c28a13fc3d975e6e81c9bea1d697276 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hpdftex.def" 1705871765 48154 e46bf8adeb936500541441171d61726d "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty" 1705871765 220920 fd3cbb5f1a2bc9b8f451b8b7d8171264 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty" 1705871765 11026 182c63f139a71afd30a28e5f1ed2cd1c "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def" 1705871765 14249 e67cb186717b7ab18d14a4875e7e98b5 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def" 1705871765 117112 05831178ece2cad4d9629dcf65099b11 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty" 1688762466 100856 24b70029ad44c2ee829db2529cf4ee23 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty" 1688762466 21943 93cf6c456e50f74225092b8714462fa4 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty" 1688762466 11185 15c86b5a61db19da88ab941ca5b70a12 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty" 1688762466 3328 3d5fc41a419bf18130ce17d90a23c295 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty" 1688762466 2162 418e29bcf2b8059e8a9ee1ea4d0d0c87 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty" 1688762466 58382 11e5cfa7a7ea68055da565b4657ea350 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty" 1655478651 22555 6d8e155cfef6d82c3d5c742fea7c992e "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty" 1665067230 13815 760b0c02f691ea230f5359c4e1de23a7 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def" 1708463273 30006 3d512c0edd558928ddea1690180ef77e "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg" 1279039959 678 4792914a8f45be57bb98413425e4c7af "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.cfg" 1708549794 1830 20af84c556326f7c12b9202ebe363f56 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.sty" 1708549794 81322 d02238bdeb305f2c9f9d0229f99371d0 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstmisc.sty" 1708549794 77022 5c8c440739265e7ba15b8379ece6ecd7 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstpatch.sty" 1708549794 329 f19f5da7234b51d16764e23d20999c73 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mathtools.sty" 1710187076 62672 9ff036bc89365461cc2bd482cc1e4879 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mhsetup.sty" 1616101747 5582 a43dedf8e5ec418356f1e9dfe5d29fc3 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/bookman.sty" 1586716065 866 5241a7e4e68212672a723eb098264f76 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ot1pbk.fd" 1137110629 1421 b89e9ec050a70360ae1c79e70871b9d3 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pbk.fd" 1137110629 1226 fd3e9c2f6a1a90301d595e18ba984a8b "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pcr.fd" 1137110629 798 d5895e9edc628f2be019beb2c0ec66df "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ts1pbk.fd" 1137110629 963 7e5b0bcf15b54d8f362c34df00ed1ce1 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ts1pcr.fd" 1137110629 643 92c451bb86386a4e36a174603ddb5a13 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty" 1576624809 9878 9e94e8fa600d95f9c7731bb21dfb67a4 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty" 1657483315 9714 ba3194bd52c8499b3f1e3eb91d409670 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/tools/array.sty" 1698869629 12667 e4b5eb11e4b7239e6c8a52bbe074a6c6 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/tools/calc.sty" 1698869629 10214 547fd4d29642cb7c80bf54b49d447f01 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty" 1388531844 12796 8edb7d69a20b857904dd0ea757c14ec9 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/svgnam.def" 1700082560 4705 ec4d2f4b7125d5a5145cc9aabae1d54b "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty" 1700082560 55487 80a65caedd3722f4c20a14a69e785d8f "" + "/usr/local/texlive/2024/texmf-dist/web2c/texmf.cnf" 1708706663 41649 5d6ae549fbbcb850a863f69aa41f3d10 "" + "/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map" 1738291199.1036 5467645 128b85b7cde5f5edc5cb7f1dd7ff8736 "" + "/usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt" 1738291196 8221423 551d4db5f903f8b0c96265fcbe7f49ca "" + "/usr/local/texlive/2024/texmf.cnf" 1710266656 577 e590dabc9e28c5b61546e15f63eebcdf "" + "source_1.aux" 1740107270.40704 383 29e6cbb31acc0f0050f27b67b46cc53f "pdflatex" + "source_1.out" 1740107270.40737 227 8703366a5a497cfe8d26d36f3b045ba7 "pdflatex" + "source_1.tex" 1740107220.3762 451 d072f5c821628f79e043eaaa19c46dff "" + "source_1_bnf.tex" 1740107220.33217 7524 2e5672aa00a1cee232e74c1dbc9aa30b "" + "source_header.tex" 1740107220.3849 3811 0cb091abda3c7a93166c3e0f7058162b "" + "source_import.tex" 1740107220.39199 381 915699871cad9de56d96a8f1f96dfbd7 "" + "source_indentation.tex" 1740107220.39485 944 8203d8d9c3c4430e900adcf09948784e "" + "source_intro.tex" 1740107220.39732 235 9368127c23dd31779aa1d837a7af79f3 "" + "source_names_lang.tex" 1740107220.39997 1969 d23ea6a0df31a923c17ae741feb97902 "" + "source_numbers.tex" 1740107220.40666 1527 a31f400b6f10920eeaee5ec742bc0c03 "" + "source_return.tex" 1740107220.40939 1700 4e4a5bcc246852a0ef2ffa1b7ef58131 "" + "source_strings.tex" 1740107220.41131 2204 ad74a40054d69b2d64ff15abf5a96d64 "" + "source_typing.tex" 1740107220.41364 3369 ee3fb12537597c8b1c0dc074e2a8f788 "" + (generated) + "source_1.aux" + "source_1.log" + "source_1.out" + "source_1.pdf" + (rewritten before read) diff --git a/docs/python/specs/source_1.fls b/docs/python/specs/source_1.fls new file mode 100644 index 0000000..7aecc1e --- /dev/null +++ b/docs/python/specs/source_1.fls @@ -0,0 +1,335 @@ +PWD /Users/wangdahai/Downloads/py-slang-main/docs/python/specs +INPUT /usr/local/texlive/2024/texmf.cnf +INPUT /usr/local/texlive/2024/texmf-dist/web2c/texmf.cnf +INPUT /usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt +INPUT /Users/wangdahai/Downloads/py-slang-main/docs/python/specs/source_1.tex +OUTPUT source_1.log +INPUT source_header.tex +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/svgnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/svgnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/svgnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/colortbl/colortbl.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/colortbl/colortbl.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/tools/array.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/tools/array.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/color.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/bookman.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/bookman.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJKutf8.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJKutf8.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/iftex/ifpdf.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/iftex/ifpdf.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/inputenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/inputenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/mule/MULEenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/mule/MULEenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.enc +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ot1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ot1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ot1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/map/fontname/texfonts.map +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl7t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/latexsym.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/latexsym.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mathtools.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mathtools.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/tools/calc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/tools/calc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mhsetup.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mhsetup.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstpatch.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstpatch.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstpatch.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstmisc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstmisc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstmisc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/atbegshi/atbegshi.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hpdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hpdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hpdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/atveryend/atveryend.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def +INPUT ./source_1.aux +INPUT ./source_1.aux +INPUT source_1.aux +OUTPUT source_1.aux +INPUT /usr/local/texlive/2024/texmf-dist/tex/context/base/mkii/supp-pdf.mkii +INPUT /usr/local/texlive/2024/texmf-dist/tex/context/base/mkii/supp-pdf.mkii +INPUT /usr/local/texlive/2024/texmf-dist/tex/context/base/mkii/supp-pdf.mkii +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +INPUT ./source_1.out +INPUT ./source_1.out +INPUT source_1.out +INPUT source_1.out +OUTPUT source_1.pdf +INPUT ./source_1.out +INPUT ./source_1.out +OUTPUT source_1.out +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm +INPUT source_intro.tex +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex7.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex7.tfm +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/ulasy.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/ulasy.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/ulasy.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy10.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy7.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy5.tfm +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/umsa.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/umsa.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/umsa.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam10.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam7.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam5.tfm +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/umsb.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/umsb.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/umsb.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm10.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm7.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm5.tfm +INPUT source_1_bnf.tex +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkli8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmr8.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmr6.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmmi8.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmmi6.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmsy8.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmsy6.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex8.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/cmextra/cmex7.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy8.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/latex-fonts/lasy6.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam10.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam7.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm10.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm7.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkli8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pcr.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pcr.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pcr.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrb8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkli8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkli8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrb8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrb8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrb8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrro8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrro8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrro8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrr8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrr8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrr8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkd8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8r.tfm +INPUT /usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map +INPUT /usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/base/8r.enc +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkl8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkl8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkl8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkli8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkli8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkl8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkl8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkl8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkli8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkli8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/courier/pcrb8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrb8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbklo8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbklo8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbklo8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/courier/pcrb8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrb8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/courier/pcrro8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrro8r.tfm +INPUT source_indentation.tex +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ts1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ts1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ts1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8c.tfm +INPUT source_return.tex +INPUT source_import.tex +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkd8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/courier/pcrr8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrr8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkl8c.vf +INPUT source_names_lang.tex +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrb8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmtt10.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmtt8.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmtt8.tfm +INPUT source_numbers.tex +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ts1pcr.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ts1pcr.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ts1pcr.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/courier/pcrr8c.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/bookman/pbkd8t.vf +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkd8r.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/vf/adobe/courier/pcrr8c.vf +INPUT source_strings.tex +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmtt8.tfm +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/public/cm/cmtt8.tfm +INPUT source_typing.tex +INPUT source_1.aux +INPUT ./source_1.out +INPUT ./source_1.out +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi8.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy8.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/urw/bookman/ubkd8a.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/urw/bookman/ubkl8a.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/urw/bookman/ubkl8a.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/urw/bookman/ubkli8a.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/urw/courier/ucrb8a.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/urw/courier/ucrr8a.pfb +INPUT /usr/local/texlive/2024/texmf-dist/fonts/type1/urw/courier/ucrro8a.pfb diff --git a/docs/python/specs/source_1.out b/docs/python/specs/source_1.out new file mode 100644 index 0000000..9964e8b --- /dev/null +++ b/docs/python/specs/source_1.out @@ -0,0 +1,2 @@ +\BOOKMARK [1][-]{section.1}{\376\377\000S\000y\000n\000t\000a\000x}{}% 1 +\BOOKMARK [1][-]{section.2}{\376\377\000D\000y\000n\000a\000m\000i\000c\000\040\000T\000y\000p\000e\000\040\000C\000h\000e\000c\000k\000i\000n\000g}{}% 2 diff --git a/docs/python/specs/source_1.pdf b/docs/python/specs/source_1.pdf new file mode 100644 index 0000000..b9a75d7 Binary files /dev/null and b/docs/python/specs/source_1.pdf differ diff --git a/docs/python/specs/source_1.synctex.gz b/docs/python/specs/source_1.synctex.gz new file mode 100644 index 0000000..f6f0400 Binary files /dev/null and b/docs/python/specs/source_1.synctex.gz differ diff --git a/docs/python/specs/source_1.tex b/docs/python/specs/source_1.tex new file mode 100644 index 0000000..aced6d5 --- /dev/null +++ b/docs/python/specs/source_1.tex @@ -0,0 +1,28 @@ +\input source_header.tex + +\begin{document} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \docheader{2025}{Python}{\S 1}{Authors} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\input source_intro.tex + +\input source_1_bnf.tex + +\newpage + +\input source_indentation +\input source_return +\input source_import + +\newpage + +\input source_names_lang +\input source_numbers + +\newpage + +\input source_strings +\input source_typing.tex + +\end{document} \ No newline at end of file diff --git a/docs/python/specs/source_1_bnf.tex b/docs/python/specs/source_1_bnf.tex new file mode 100644 index 0000000..9ae6156 --- /dev/null +++ b/docs/python/specs/source_1_bnf.tex @@ -0,0 +1,86 @@ +\section{Syntax} + +A Python program is a \emph{program}, defined using Backus-Naur Form\footnote{ +We adopt Henry Ledgard's BNF variant that he described in +\emph{A human engineered variant of BNF}, ACM SIGPLAN Notices, Volume 15 Issue 10, +October 1980, Pages 57-62. In our grammars, we use \textbf{\texttt{bold}} font for keywords, +{\it italics} for syntactic variables, $\epsilon$ for nothing, +$x\ |\ y$ for $x$ or $y$, $[\ x\ ]$ for an optional $x$, +$ x ...$ for zero or more repetitions of $x$, and $(\ x\ )$ for clarifying the structure of BNF expressions.} +as follows: + +\begin{alignat*}{9} +&& \textit{program} &&\quad ::= &\quad && \textit{import-stmt} ... \ \textit{block} + && \textrm{program} \\[1mm] +&& \textit{import-stmt} &&\quad ::= &\quad && \textbf{\texttt{from}}\ \textit{dotted-name} \ \textbf{\texttt{import}}\ \textit{import-clause} \ \quad + && \textrm{import statement} \\[1mm] +&& \textit{dotted-name} && ::= &\quad && \textit{name}\ (\textbf{\texttt{.}} \ \textit{name}\ )... \ && \textrm{dotted identifier chain} \\[1mm] +&& \textit{import-clause} && ::= &\quad && \textit{import-as-names} \\ +&& && | &\quad && \textbf{\texttt{(}} \ \textit{import-as-names} \ \textbf{\texttt{)}} \ && \textrm{wildcard or name list} \\[1mm] +&& \textit{import-as-names} && ::= &\quad && \textit{import-as-name}\ (\textit{\texttt{,}} \ \textit{import-as-name}\ ) ... + && \textrm{clause name list} \\[1mm] +&& \textit{import-as-name} && ::= &\quad && \textit{name}\ [\ \textbf{\texttt{as}} \ \textit{name}\ ] && \textrm{clause name and alias}\\[1mm] +&& \textit{statement} &&\quad ::= &\quad && \textit{name} \ \textbf{\texttt{=}}\ \textit{expression} + && \textrm{variable declaration} \\ +&& && | &\quad && \textbf{\texttt{def}}\ \textit{name} \ + \textbf{\texttt{(}}\ \textit{names} \ \textbf{\texttt{)}}\ \textbf{\texttt{:}}\ \textit{block} \quad + && \textrm{function declaration}\\ +&& && | &\quad && \textbf{\texttt{return}}\ \textit{expression} + && \textrm{return statement}\\ +&& && | &\quad && \textit{if-statement} \quad + && \textrm{conditional statement}\\ +&& && | &\quad && \textit{expression} + && \textrm{expression statement} \\ +&& && | &\quad && \textbf{\texttt{debugger()}} + && \textrm{breakpoint} \\[1mm] +&& \textit{names} && ::= &\quad && \epsilon\ | \ \textit{name} \ + (\ \textbf{\texttt{,}} \ \textit{name}\ ) ... + && \textrm{name list} \\[1mm] +&& \textit{if-statement} && ::= &\quad && \textbf{\texttt{if}} \ \textit{expression} \textbf{\texttt{:}} \ \textit{block} \\ +&& && & && (\ \textbf{\texttt{elif}} \ \textit{expression} \textbf{\texttt{:}} \ \textit{block}\ )... \\ +&& && & && \textbf{\texttt{else}}\ \textbf{\texttt{:}} \ \textit{block} + && \textrm{conditional statement} \\[1mm] +&& \textit{block} && ::= & && \textit{statement}... \quad + && \textrm{block statement}\\[1mm] +&& \textit{expression} && ::= &\quad && \textit{number} && \textrm{primitive number expression}\\ +&& && | &\quad && \textbf{\texttt{true}}\ |\ \textbf{\texttt{false}} + && \textrm{primitive boolean expression}\\ +&& && | &\quad && \textit{string} && \textrm{primitive string expression}\\ +&& && | &\quad && \textit{name} && \textrm{name expression}\\ +&& && | &\quad && \textit{expression} \ \textit{binary-operator} \ + \textit{expression} \qquad + && \textrm{binary operator combination}\\ +&& && | &\quad && \textit{unary-operator} \ + \textit{expression} + && \textrm{unary operator combination}\\ +&& && | &\quad && \textit{expression} \ \textit{binary-logical} \ + \textit{expression} \qquad + && \textrm{logical composition}\\ +&& && | &\quad && \textit{expression}\ \textbf{\texttt{(}}\ \textit{expressions}\ \textbf{\texttt{)}} + && \textrm{function application}\\ +&& && | &\quad && \textbf{\texttt{lambda}}\ ( \textit{name}\ | \ + \textbf{\texttt{(}}\ \textit{names}\ \textbf{\texttt{)}}\ + )\ + \texttt{\textbf{:}}\ \textit{expression} + && \textrm{lambda expression}\\ +&& && | &\quad && \textit{expression} \ \textbf{\texttt{if}}\ + \textit{expression} + \ \textbf{\texttt{else}}\ + \textit{expression}\ + && \textrm{conditional expression}\\ +&& && | &\quad && \textbf{\texttt{(}}\ \textit{expression} \ + \textbf{\texttt{)}} && \textrm{parenthesised expression}\\[1mm] +&& \textit{binary-operator} + && ::= &\quad && \textbf{\texttt{+}}\ |\ \textbf{\texttt{-}}\ |\ \textbf{\texttt{*}}\ |\ \textbf{\texttt{/}}\ |\ \textbf{\texttt{**}}\ |\ \textbf{\texttt{\%}}\ | \\ +&& && | &\quad && \textbf{\texttt{==}}\ |\ \textbf{\texttt{!=}}\ |\ \texttt{\textbf{>}}\ |\ \texttt{\textbf{<}}\ |\ \texttt{\textbf{>=}}\ |\ \texttt{\textbf{<=}} && \textrm{binary operator}\\[1mm] +&& \textit{unary-operator} + && ::= &\quad && \textbf{\texttt{not}}\ |\ \textbf{\texttt{-}} + && \textrm{unary operator}\\[1mm] +&& \textit{binary-logical} && ::= &\quad && \textbf{\texttt{and}}\ |\ \texttt{\textbf{or}} + && {logical composition symbol}\\[1mm] +&& \textit{expressions} && ::= &\quad && \epsilon\ | \ \textit{expression}\ ( + \ \textbf{\texttt{,}} \ + \textit{expression} \ + ) ... + && \textrm{argument expressions} +\end{alignat*} diff --git a/docs/python/specs/source_header.fdb_latexmk b/docs/python/specs/source_header.fdb_latexmk new file mode 100644 index 0000000..6bbf627 --- /dev/null +++ b/docs/python/specs/source_header.fdb_latexmk @@ -0,0 +1,91 @@ +# Fdb version 4 +["pdflatex"] 1740107264.49065 "/Users/wangdahai/Downloads/py-slang-main/docs/python/specs/source_header.tex" "source_header.pdf" "source_header" 1740107264.90175 2 + "/Users/wangdahai/Downloads/py-slang-main/docs/python/specs/source_header.tex" 1740107220.3849 3811 0cb091abda3c7a93166c3e0f7058162b "" + "/usr/local/texlive/2024/texmf-dist/fonts/map/fontname/texfonts.map" 1577235249 3524 cb3e574dea2d1052e39280babc910dc8 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl7t.tfm" 1136768653 1800 f68747be4f89b17e96149118d1894979 "" + "/usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm" 1136768653 3488 d5b156792a73291a2f69626e6a3f8632 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/atbegshi/atbegshi.sty" 1575674566 24708 5584a51a7101caf7e6bbf1fc27d8f7b1 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty" 1576625341 40635 c40361e206be584d448876bba8a64a3b "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty" 1576016050 33961 6b5c75130e435b2bfdb9f480a09a39f9 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty" 1576625223 8371 9d55b8bd010bc717624922fb3477d92e "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/ifpdf.sty" 1572645307 480 5778104efadad304ced77548ca2184b1 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty" 1644112042 7237 bdd120a32c8fdb4b433cf9ca2e7cd98a "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty" 1575499628 8356 7bbb2c2373aa810be568c29e333da8ed "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty" 1576625065 31769 002a487f55041f8e805cfbf6385ffd97 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty" 1576878844 5412 d5a2436094cd7be85769db90f29250a6 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty" 1701727651 17865 1a9bd36b4f98178fa551aca822290953 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty" 1576015897 19007 15924f7228aca6c6d184b115f4baa231 "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty" 1593379760 20089 80423eac55aa175305d35b49e04fe23b "" + "/usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty" 1576624663 7008 f92eaa0a3872ed622bbf538217cd2ab7 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty" 1359763108 5949 3f3fd50a8cc94c3d4cbf4fc66cd3df1c "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty" 1359763108 13829 94730e64147574077f8ecfea9bb69af4 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty" 1686341992 2222 499d61426192c39efd8f410ee1a52b9c "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty" 1686341992 4173 82ac04dfb1256038fad068287fbb4fe6 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty" 1686341992 88371 d84032c0f422c3d1e282266c01bef237 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty" 1686341992 4474 b811654f4bf125f11506d13d13647efb "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty" 1686341992 2444 0d0c1ee65478277e8015d65b86983da2 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/atveryend/atveryend.sty" 1576191570 19336 ce7ae9438967282886b3b036cfad1e4d "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty" 1576625391 3935 57aa3c3e203a5c2effb4d2bd2efbc323 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls" 1705352648 20144 147463a6a579f4597269ef9565205cfe "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty" 1705352648 3045 273c666a54e60b9f730964f431a56c1b "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty" 1705352648 2462 6bc53756156dbd71c1ad550d30a3b93f "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty" 1705352648 5119 a04a8b68ab4f6ce800a41f7f8012a10e "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/inputenc.sty" 1705352648 5048 425739d70251273bf93e3d51f3c40048 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/latexsym.sty" 1705352648 2853 22ef275b938b198870f6474b02bbd3b1 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo" 1705352648 8448 dbc0dbf4156c0bb9ba01a1c685d3bad0 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.enc" 1634853225 29591 d67c9aa515f4260cdd60fa9f76d96368 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.sty" 1634853225 33241 3ee25f21824a4a347866900e5037d6f3 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJKutf8.sty" 1634853225 24621 e1c0abd54a87918dd1e31a35b20e99e4 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/mule/MULEenc.sty" 1634853225 12177 48c95ebf85a580326918e5eb490b477b "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/colortbl/colortbl.sty" 1708463147 12355 ec728d2e4c37cf8919ee2eff9b75ad0c "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty" 1601931149 46845 3b58f70c6e861a13d927bff09d35ecbc "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg" 1459978653 1213 620bba36b25224fa9b7e1ccb4ecb76fd "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg" 1465944070 1224 978390e9c2234eab29404bc21b268d1e "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def" 1663965824 19448 1e988b341dda20961a6b931bcde55519 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/color.sty" 1654720880 7233 e46ce9241d2b2ca2a78155475fdd557a "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def" 1654720880 5009 d242512eef244b70f2fc3fde14419206 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty" 1654720880 18387 8f900a490197ebaf93c02ae9476d4b09 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty" 1654720880 8010 a8d949cbdbc5c983593827c9eec252e1 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty" 1654720880 2671 7e67d78d9b88c845599a85b2d41f2e39 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx" 1667332637 2885 9c645d672ae17285bba324998918efd8 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty" 1654720880 4023 293ea1c16429fc0c4cf605f4da1791a9 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty" 1580250785 17914 4c28a13fc3d975e6e81c9bea1d697276 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hpdftex.def" 1705871765 48154 e46bf8adeb936500541441171d61726d "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty" 1705871765 220920 fd3cbb5f1a2bc9b8f451b8b7d8171264 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty" 1705871765 11026 182c63f139a71afd30a28e5f1ed2cd1c "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def" 1705871765 14249 e67cb186717b7ab18d14a4875e7e98b5 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def" 1705871765 117112 05831178ece2cad4d9629dcf65099b11 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty" 1688762466 100856 24b70029ad44c2ee829db2529cf4ee23 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty" 1688762466 21943 93cf6c456e50f74225092b8714462fa4 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty" 1688762466 11185 15c86b5a61db19da88ab941ca5b70a12 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty" 1688762466 3328 3d5fc41a419bf18130ce17d90a23c295 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty" 1688762466 2162 418e29bcf2b8059e8a9ee1ea4d0d0c87 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty" 1688762466 58382 11e5cfa7a7ea68055da565b4657ea350 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty" 1655478651 22555 6d8e155cfef6d82c3d5c742fea7c992e "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty" 1665067230 13815 760b0c02f691ea230f5359c4e1de23a7 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.cfg" 1708549794 1830 20af84c556326f7c12b9202ebe363f56 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.sty" 1708549794 81322 d02238bdeb305f2c9f9d0229f99371d0 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstmisc.sty" 1708549794 77022 5c8c440739265e7ba15b8379ece6ecd7 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstpatch.sty" 1708549794 329 f19f5da7234b51d16764e23d20999c73 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mathtools.sty" 1710187076 62672 9ff036bc89365461cc2bd482cc1e4879 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mhsetup.sty" 1616101747 5582 a43dedf8e5ec418356f1e9dfe5d29fc3 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/bookman.sty" 1586716065 866 5241a7e4e68212672a723eb098264f76 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ot1pbk.fd" 1137110629 1421 b89e9ec050a70360ae1c79e70871b9d3 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pbk.fd" 1137110629 1226 fd3e9c2f6a1a90301d595e18ba984a8b "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty" 1576624809 9878 9e94e8fa600d95f9c7731bb21dfb67a4 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty" 1657483315 9714 ba3194bd52c8499b3f1e3eb91d409670 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/tools/array.sty" 1698869629 12667 e4b5eb11e4b7239e6c8a52bbe074a6c6 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/tools/calc.sty" 1698869629 10214 547fd4d29642cb7c80bf54b49d447f01 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty" 1388531844 12796 8edb7d69a20b857904dd0ea757c14ec9 "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/svgnam.def" 1700082560 4705 ec4d2f4b7125d5a5145cc9aabae1d54b "" + "/usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty" 1700082560 55487 80a65caedd3722f4c20a14a69e785d8f "" + "/usr/local/texlive/2024/texmf-dist/web2c/texmf.cnf" 1708706663 41649 5d6ae549fbbcb850a863f69aa41f3d10 "" + "/usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt" 1738291196 8221423 551d4db5f903f8b0c96265fcbe7f49ca "" + "/usr/local/texlive/2024/texmf.cnf" 1710266656 577 e590dabc9e28c5b61546e15f63eebcdf "" + "source_header.aux" 0 -1 0 "pdflatex" + "source_header.tex" 1740107220.3849 3811 0cb091abda3c7a93166c3e0f7058162b "" + (generated) + "source_header.aux" + "source_header.log" + "source_header.pdf" + (rewritten before read) diff --git a/docs/python/specs/source_header.fls b/docs/python/specs/source_header.fls new file mode 100644 index 0000000..bd973b2 --- /dev/null +++ b/docs/python/specs/source_header.fls @@ -0,0 +1,171 @@ +PWD /Users/wangdahai/Downloads/py-slang-main/docs/python/specs +INPUT /usr/local/texlive/2024/texmf.cnf +INPUT /usr/local/texlive/2024/texmf-dist/web2c/texmf.cnf +INPUT /usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt +INPUT /Users/wangdahai/Downloads/py-slang-main/docs/python/specs/source_header.tex +OUTPUT source_header.log +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/xcolor.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/svgnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/svgnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/xcolor/svgnam.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/colortbl/colortbl.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/colortbl/colortbl.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/tools/array.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/tools/array.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/color.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/bookman.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/bookman.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJKutf8.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJKutf8.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/iftex/ifpdf.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/iftex/ifpdf.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/inputenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/inputenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/mule/MULEenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/mule/MULEenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/cjk/texinput/CJK.enc +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ot1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ot1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/ot1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/map/fontname/texfonts.map +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl7t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/latexsym.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/latexsym.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mathtools.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mathtools.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/tools/calc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/tools/calc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mhsetup.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/mathtools/mhsetup.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/fontenc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/psnfss/t1pbk.fd +INPUT /usr/local/texlive/2024/texmf-dist/fonts/tfm/adobe/bookman/pbkl8t.tfm +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/typearea.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrkbase.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrbase.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/koma-script/scrlogo.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstpatch.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstpatch.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstpatch.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstmisc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstmisc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/lstmisc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/listings/listings.cfg +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/url/url.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hyperref.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/pdfescape/pdfescape.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/infwarerr/infwarerr.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hycolor/hycolor.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/auxhook/auxhook.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/nameref.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/refcount/refcount.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/kvoptions/kvoptions.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/etoolbox/etoolbox.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/pd1enc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/intcalc/intcalc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/puenc.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/bitset/bitset.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/atbegshi/atbegshi.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/atbegshi-ltx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hpdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hpdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/hyperref/hpdftex.def +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/atveryend/atveryend.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/base/atveryend-ltx.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty +INPUT /usr/local/texlive/2024/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty diff --git a/docs/python/specs/source_header.tex b/docs/python/specs/source_header.tex new file mode 100644 index 0000000..05c6ca3 --- /dev/null +++ b/docs/python/specs/source_header.tex @@ -0,0 +1,152 @@ +\documentclass[epic,eepic,10pt,a4paper]{article} +\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} +\usepackage{graphicx,bookman} +\usepackage{graphics} +\usepackage{CJKutf8} +\usepackage{latexsym} +\usepackage{mathtools} +\usepackage{amsmath,amssymb} + +\usepackage[T1]{fontenc} + +\usepackage[paper=210mm:297mm]{typearea} + +\usepackage{listings} + +\lstdefinelanguage{Python}{ + keywords={const, let, break, case, catch, continue, debugger, default, delete, do, else, finally, for, function, if, in, instanceof, new, return, switch, this, throw, try, typeof, var, void, while, with}, + morecomment=[l]{//}, + morecomment=[s]{/*}{*/}, + morestring=[b]', + morestring=[b]", + sensitive=true +} + +\lstset{ + language=Python, + basicstyle=\ttfamily, + showstringspaces=false, + showspaces=false, + escapechar={^} +} + +\pagestyle{myheadings} + +% ALIGN EVEN- AND ODD-NUMBERED PAGES. +\evensidemargin 35pt + +% HORIZONTAL MARGINS +% Left margin 1 inch (0 + 1) +\setlength{\oddsidemargin}{0in} +% Text width 6.5 inch (so right margin 1 inch). +\setlength{\textwidth}{6.5in} + +% ---------------- +% VERTICAL MARGINS +% Top margin 0.5 inch (-0.5 + 1) +\setlength{\topmargin}{-0.5in} +% Head height 0.25 inch (where page headers go) +\setlength{\headheight}{0.25in} +% Head separation 0.25 inch (between header and top line of text) +\setlength{\headsep}{0.25in} +% Text height 8.5 inch (so bottom margin 1.5 in) +\setlength{\textheight}{10.0in} + +% ---------------- +% PARAGRAPH INDENTATION +\setlength{\parindent}{0in} + +% SPACE BETWEEN PARAGRAPHS +%\setlength{\parskip}{\medskipamount} + +% ---------------- +% EVALUATION SYMBOL +\newcommand{\evalsto}{$\Longrightarrow$} + +% ---------------- +% STRUTS +% HORIZONTAL STRUT. One argument (width). +\newcommand{\hstrut}[1]{\hspace*{#1}} +% VERTICAL STRUT. Two arguments (offset from baseline, height). +\newcommand{\vstrut}[2]{\rule[#1]{0in}{#2}} + +% ---------------- +% EMPTY BOXES OF VARIOUS WIDTHS, FOR INDENTATION +\newcommand{\hm}{\hspace*{1em}} +\newcommand{\hmm}{\hspace*{2em}} +\newcommand{\hmmm}{\hspace*{3em}} +\newcommand{\hmmmm}{\hspace*{4em}} + +% ---------------- +% VARIOUS CONVENIENT WIDTHS RELATIVE TO THE TEXT WIDTH, FOR BOXES. +\newlength{\hlessmm} +\setlength{\hlessmm}{\textwidth} +\addtolength{\hlessmm}{-2em} + +\newlength{\hlessmmmm} +\setlength{\hlessmmmm}{\textwidth} +\addtolength{\hlessmmmm}{-4em} + +% ---------------- +% ``TIGHTLIST'' ENVIRONMENT (no para space between items, small indent) +\newenvironment{tightlist}% +{\begin{list}{$\bullet$}{% + \setlength{\topsep}{0in} + \setlength{\partopsep}{0in} + \setlength{\itemsep}{0in} + \setlength{\parsep}{0in} + \setlength{\leftmargin}{1.5em} + \setlength{\rightmargin}{0in} + \setlength{\itemindent}{0in} +} +}% +{\end{list} +} + +% ---------------- +% CODE FONT (e.g. {\cf x := 0}). +\newcommand{\cf}{\footnotesize\tt} + +% ---------------- +% INSTRUCTION POINTER +\newcommand{\IP}{$\bullet$} +\newcommand{\goesto}{$\longrightarrow$} + +% \illuswidth is used to set up boxes around illustrations. +\newlength{\illuswidth} +\setlength{\illuswidth}{\textwidth} +\addtolength{\illuswidth}{-7pt} + +% PROBLEM SET HEADER -- args are semester and problem set or solution +% example: \psetheader{Spring Semester, 1989}{Problem set 1} +\newcommand{\docheader}[4]{% + + \thispagestyle{empty} + +\markright{SICP, Python Adaptation, #2 #3, #1} +\begin{center} + {\Large {\bf Specification of #2 #3}---#1 edition}\\[10mm] + + {\large #4}\\[5mm] + + {\large National University of Singapore \\ + School of Computing}\\[10mm] + + {\large \today}\\[10mm] +\end{center} +} + +% ---------------------------------------------------------------- +% HERE BEGINS THE DOCUMENT +% start with \begin{document} + + + \usepackage{url} + \usepackage{hyperref} + + \hypersetup{ + colorlinks=true, + linkcolor=Maroon, + filecolor=Maroon, + urlcolor=Maroon +} diff --git a/docs/python/specs/source_import.tex b/docs/python/specs/source_import.tex new file mode 100644 index 0000000..4da63cb --- /dev/null +++ b/docs/python/specs/source_import.tex @@ -0,0 +1,6 @@ +\subsection*{Import directives} + +Import directives allow programs to import values from modules and bind them to names, whose scope +is the entire program in which the import directive occurs. All names that appear in import directives +must be distinct, and must also be distinct from all top-level variables. The Source specifications do not specify how modules are +programmed. diff --git a/docs/python/specs/source_indentation.tex b/docs/python/specs/source_indentation.tex new file mode 100644 index 0000000..9a6778c --- /dev/null +++ b/docs/python/specs/source_indentation.tex @@ -0,0 +1,14 @@ +\subsection*{Indentation} + +In Python, +\href{https://docs.python.org/3/reference/lexical_analysis.html\#indentation}{\color{DarkBlue} +indentation} +is syntactically significant and strictly enforces code block structure. Unlike languages using braces, +Python employs whitespace (spaces or tabs) to delimit blocks for control flow (e.g., \texttt{if}, \texttt{for}, \texttt{while}), function definitions, and class declarations. Key rules: + +\begin{itemize} +\item Consistency: Use 4 spaces per indentation level (PEP 8 recommendation). Mixing tabs and spaces is prohibited. +\item Alignment: Statements within the same block must align vertically. Misaligned indentation raises an \texttt{IndentationError}. +\item Nesting: Each nested block increases indentation by one level. Dedenting resumes the outer block. +\item Line Continuation: For multi-line statements, align wrapped lines with the opening delimiter or use an extra level. +\end{itemize} diff --git a/docs/python/specs/source_intro.tex b/docs/python/specs/source_intro.tex new file mode 100644 index 0000000..ac21663 --- /dev/null +++ b/docs/python/specs/source_intro.tex @@ -0,0 +1,5 @@ +The language ``Python \S $x$'' is a sublanguage of +\href{https://docs.python.org/3/index.html}{\color{DarkBlue} +Python 3.13} +and defined in the documents titled ``Python \S $x$'', where $x$ refers to the +respective textbook chapter. diff --git a/docs/python/specs/source_names_lang.tex b/docs/python/specs/source_names_lang.tex new file mode 100644 index 0000000..7a2e06a --- /dev/null +++ b/docs/python/specs/source_names_lang.tex @@ -0,0 +1,25 @@ +\subsection*{Names} + +Names\footnote{ +In +\href{https://docs.python.org/3/reference/lexical_analysis.html}{ +\color{DarkBlue} Python 3.13 Documentation}, +these names are called \emph{identifiers}. +} start with \verb@_@, or a +letter\footnote{ +By \emph{letter} +we mean \href{http://unicode.org/reports/tr44/}{\color{DarkBlue}Unicode} letters (L) or letter numbers (NI). +} and contain only \verb@_@, +letters or digits\footnote{ +By \emph{digit} we mean characters in the +\href{http://unicode.org/reports/tr44/}{Unicode} categories +Nd (including the decimal digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9), Mn, Mc and Pc. +}. Reserved words\footnote{ +By \emph{reserved word} we mean any of: +$\textbf{\texttt{False}}$, $\textbf{\texttt{await}}$, $\textbf{\texttt{else}}$, $\textbf{\texttt{import}}$, $\textbf{\texttt{pass}}$, $\textbf{\texttt{None}}$, $\textbf{\texttt{break}}$, $\textbf{\texttt{except}}$, $\textbf{\texttt{in}}$, $\textbf{\texttt{raise}}$, $\textbf{\texttt{True}}$, $\textbf{\texttt{class}}$, $\textbf{\texttt{finally}}$, $\textbf{\texttt{is}}$, $\textbf{\texttt{return}}$, $\textbf{\texttt{and}}$, $\textbf{\texttt{continue}}$, $\textbf{\texttt{for}}$, $\textbf{\texttt{lambda}}$, $\textbf{\texttt{try}}$, $\textbf{\texttt{as}}$, $\textbf{\texttt{def}}$, $\textbf{\texttt{from}}$, $\textbf{\texttt{nonlocal}}$, $\textbf{\texttt{while}}$, $\textbf{\texttt{assert}}$, $\textbf{\texttt{del}}$, $\textbf{\texttt{global}}$, $\textbf{\texttt{not}}$, $\textbf{\texttt{with}}$, $\textbf{\texttt{async}}$, $\textbf{\texttt{elif}}$, $\textbf{\texttt{if}}$, $\textbf{\texttt{or}}$, $\textbf{\texttt{yield}}$. +These are all reserved words, or keywords of the language that cannot be used as ordinary identifiers. +} are not allowed as names. + +Valid names are \verb@x@, \verb@_45@, and $\mathtt{\pi}$, +but always keep in mind that programming is communicating and that the familiarity of the +audience with the characters used in names is an important aspect of program readability. diff --git a/docs/python/specs/source_numbers.tex b/docs/python/specs/source_numbers.tex new file mode 100644 index 0000000..a78193a --- /dev/null +++ b/docs/python/specs/source_numbers.tex @@ -0,0 +1,25 @@ +\subsection*{\href{https://sourceacademy.org/sicpjs/1.1.1\#p3}{Numbers}} + +Python supports three numeric types: integers (\texttt{int}), floats (\texttt{float}), and complex numbers (\texttt{complex}). + +\subsubsection*{Integers (\texttt{int})} + +Integers can be represented in decimal notation, optionally prefixed with a sign (\texttt{+} or \texttt{-}). +Additional base notations are supported, such as binary (\texttt{0b1010} or \texttt{0B1010}), octal (\texttt{0o777} or \texttt{0O777}), and +hexadecimal (\texttt{0x1A3F} or \texttt{0X1A3F}). +Underscores (\verb|_|) may be used for readability (e.g., \verb|1_000_000|). +Examples include \texttt{42}, \texttt{-0b1101}, and \verb|0x_FF_00|. + +\subsubsection*{Floats (\texttt{float})} +Floats use decimal notation with an optional decimal dot. Scientific notation (multiplying the number by +$10^x$) is indicated with the letter \texttt{e} or \texttt{E}, followed by the exponent +\texttt{x}. +Special values inf (infinity), -inf, and nan (not a number) are allowed. +Examples include \texttt{3.14}, \texttt{-0.001e+05}, and \texttt{6.022E23}. + +\subsubsection*{Complex Numbers (\texttt{complex})} +Complex numbers are written as \texttt{±j}, where \texttt{j} (or \texttt{J}) denotes the imaginary unit. +Both the real and imaginary parts are stored as floats. The imaginary part is mandatory +(e.g., \texttt{5j}, \texttt{0j}, and \texttt{0 + 3j} is valid, \texttt{5} alone is real). + +Examples include \texttt{2+3j}, \texttt{-4.5J}, \texttt{0j}, and \texttt{1e3-6.2E2J}. \ No newline at end of file diff --git a/docs/python/specs/source_return.tex b/docs/python/specs/source_return.tex new file mode 100644 index 0000000..5ab00e3 --- /dev/null +++ b/docs/python/specs/source_return.tex @@ -0,0 +1,21 @@ +\subsection*{Restrictions} + +\begin{itemize} +\item Return statements are only allowed in bodies of functions. +\item Line breaks within a statement must be explicitly continued using a backslash or be enclosed in parentheses, brackets, or braces. +Python does not perform implicit statement termination like automatic semicolon insertion; +each logical line—that is, each complete statement as interpreted by the interpreter, which may span multiple physical lines when properly continued—must be syntactically complete. +\item Lambda expressions are limited to a single logical line. +\item Re-declaration variables or functions is not allowed. Once a variable or function is defined, it cannot be redefined with the same name in the same scope +\footnote{ +Scope refers to the region of a program in which a particular name (such as a variable, function, or class) is defined and can be accessed. In other words, +it determines the part of the program where you can use that name without causing a name error. +Scope is determined by the program's structure (usually its lexical or textual layout) and governs the visibility and lifetime of variables and other identifiers. + +In \href{https://docs.python.org/3/tutorial/classes.html\#python-scopes-and-namespaces}{\color{DarkBlue}Python}, the \emph{scope} of a declaration is determined lexically: a variable declared inside a function is local to that function; +if it is declared outside any function, it is global (i.e., module-level). Moreover, if a variable is declared in an enclosing function, +it is available to inner functions (the enclosing scope), and if not found in these scopes, Python looks into the built-in scope. +}. +\end{itemize} + + diff --git a/docs/python/specs/source_strings.tex b/docs/python/specs/source_strings.tex new file mode 100644 index 0000000..5b3b07d --- /dev/null +++ b/docs/python/specs/source_strings.tex @@ -0,0 +1,35 @@ +\subsection*{\href{https://sourceacademy.org/sicpjs/2.3.1}{Strings}} + +Strings are of the form \texttt{"}$ \textit{double-quote-characters} $\texttt{"}, +where $\textit{double-quote-characters}$ is a possibly empty sequence of characters without +the character \texttt{"} and without the newline character, +of the form +\texttt{'}$ \textit{single-quote-characters} $\texttt{'}, +where $\textit{single-quote-characters}$ is a possibly empty sequence of characters without +the character~\texttt{'} and without the newline character, +and of the form +\texttt{'}\texttt{'}\texttt{'}$ \textit{triple-single-quote-characters} $\texttt{'}\texttt{'}\texttt{'}, or +\texttt{"""}$ \textit{triple-double-quote-characters} $\texttt{"""} +where $\textit{backquote-characters}$ is a possibly empty sequence of characters and +can span multiple lines and may contain both single and double quotes without escaping. + +The following characters can be represented in strings\footnote{ +In \href{https://docs.python.org/3/reference/lexical_analysis.html}{ +\color{DarkBlue} Python 3.13 Documentation}, +unless an 'r' or 'R' prefix is present, escape sequences in string and bytes literals are interpreted according to rules similar to those used by Standard C. \emph{identifiers}. +} as given: +\begin{itemize} + \item \verb|\|: Backslash followed by a newline is ignored. + \item \verb|\\|: Represents a backslash (i.e., \texttt{\textbackslash}). + \item \verb|\'|: Represents a single quote ('). + \item \verb|\"|: Represents a double quote ("). + \item \verb|\a|: Represents the ASCII Bell (BEL) character. + \item \verb|\b|: Represents the ASCII Backspace (BS) character. + \item \verb|\f|: Represents the ASCII Formfeed (FF) character. + \item \verb|\n|: Represents the ASCII Linefeed (LF) character. + \item \verb|\r|: Represents the ASCII Carriage Return (CR) character. + \item \verb|\t|: Represents the ASCII Horizontal Tab (TAB) character. + \item \verb|\v|: Represents the ASCII Vertical Tab (VT) character. + \item \verb|\ooo|: Represents the character with the octal value \texttt{ooo}. + \item \verb|\xhh|: Represents the character with the hexadecimal value \texttt{hh}. +\end{itemize} diff --git a/docs/python/specs/source_typing.tex b/docs/python/specs/source_typing.tex new file mode 100644 index 0000000..2f7537e --- /dev/null +++ b/docs/python/specs/source_typing.tex @@ -0,0 +1,69 @@ + +\section{Dynamic Type Checking} + +Expressions evaluate to integers, floats, complex numbers, boolean values, strings or function values. +Implementations of Source generate error messages when unexpected values are used as follows. + +Only function values can be applied using the syntax: + +\begin{eqnarray*} + \textit{expression} + & ::= & \textit{name} + \texttt{\textbf{(}}\ \textit{expressions} \ + \texttt{\textbf{)}}\\ +\end{eqnarray*} + +For compound functions, implementations need to check that the number of \textit{expressions} +matches the number of parameters. + +The following table specifies what arguments Source's operators +take and what results they return. Implementations need to check the types of arguments and +generate an error message when the types do not match. + +\begin{center} +\begin{tabular}{c|c|c|c} +operator & argument 1 & argument 2 & result\\ \hline +\texttt{\textbf{+,-,*}} & int & int & int\\ +\texttt{\textbf{+,-,*}} & int & float & float\\ +\texttt{\textbf{+,-,*}} & int & complex & complex\\ +\texttt{\textbf{+,-,*}} & float & int, float & float\\ +\texttt{\textbf{+,-,*}} & float & complex & complex\\ +\texttt{\textbf{+,-,*}} & complex & int, float, complex & complex\\ +\texttt{\href{https://sourceacademy.org/sicpjs/3.3.4\#p24}{\textbf{+}}} & string & string & string\\ +\texttt{\textbf{/}} & int & int, float & float\\ +\texttt{\textbf{/}} & int & complex & complex\\ +\texttt{\textbf{/}} & float & int, float & float\\ +\texttt{\textbf{/}} & float & complex & complex\\ +\texttt{\textbf{/}} & complex & int, float, complex & complex\\ +\texttt{\textbf{**}} & int & int \verb|>=| 0 & int\\ +\texttt{\textbf{**}} & int & int \verb|<| 0 & float\\ +\texttt{\textbf{**}} & int & float & float\\ +\texttt{\textbf{**}} & int & complex & complex\\ +\texttt{\textbf{**}} & float & int, float & float\\ +\texttt{\textbf{**}} & float & complex & complex\\ +\texttt{\textbf{**}} & complex & int, float, complex & complex\\ +\texttt{\textbf{\%}} & int & int & int\\ +\texttt{\textbf{\%}} & int & float & float\\ +\texttt{\textbf{\%}} & float & float & float\\ +\texttt{\textbf{==}} & int,float,complex & int,float,complex & bool\\ +\texttt{\textbf{==}} & string & string & bool\\ +\texttt{\textbf{!=}} & int,float,complex & int,float,complex & bool\\ +\texttt{\textbf{!=}} & string & string & bool\\ +\texttt{\textbf{>}} & int,float & int,float & bool\\ +\texttt{\textbf{>}} & string & string & bool\\ +\texttt{\textbf{<}} & int,float & int,float & bool\\ +\texttt{\textbf{<}} & string & string & bool\\ +\texttt{\textbf{>=}} & int,float & int,float & bool\\ +\texttt{\textbf{>=}} & string & string & bool\\ +\texttt{\textbf{<=}} & int,float & int,float & bool\\ +\texttt{\textbf{<=}} & string & string & bool\\ +\texttt{\textbf{and}} & bool & bool & bool\\ +\texttt{\textbf{or}} & bool & bool & bool\\ +\texttt{\textbf{not}} & bool & & bool\\ +\texttt{\textbf{-}} & int & & int\\ +\texttt{\textbf{-}} & float & & float\\ +\texttt{\textbf{-}} & complex & & complex + +\end{tabular} +\end{center} + diff --git a/package-lock.json b/package-lock.json index 4d48713..998a711 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,48 +1,64 @@ { - "name": "py-slang", + "name": "py-slang-test-pac", "version": "1.0.0", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "py-slang", + "name": "py-slang-test-pac", "version": "1.0.0", "license": "Apache-2.0", "dependencies": { "@types/estree": "^1.0.0", - "fast-levenshtein": "^3.0.0" + "fast-levenshtein": "^3.0.0", + "mathjs": "^14.4.0" }, "devDependencies": { + "@rollup/plugin-commonjs": "^28.0.3", + "@rollup/plugin-node-resolve": "^16.0.1", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^12.1.2", + "@types/fast-levenshtein": "^0.0.4", "@types/jest": "^29.4.0", - "@types/node": "^18.11.13", + "@types/mathjs": "^9.4.1", + "@types/node": "^18.19.84", + "glob": "^11.0.1", + "jest": "^29.7.0", + "jsdoc": "^4.0.4", "nodemon": "^2.0.20", "rimraf": "^3.0.2", + "rollup": "^4.38.0", + "rollup-plugin-modify": "^3.0.0", + "taffydb": "^2.7.3", "ts-jest": "^29.0.5", "ts-node": "^10.9.1", - "typescript": "^4.9.4" + "tslib": "^2.8.1", + "typescript": "^5.5.3" } }, "node_modules/@ampproject/remapping": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", - "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, - "peer": true, + "license": "Apache-2.0", "dependencies": { - "@jridgewell/gen-mapping": "^0.1.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/code-frame": { - "version": "7.24.2", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", - "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/highlight": "^7.24.2", + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", "picocolors": "^1.0.0" }, "engines": { @@ -50,37 +66,37 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.20.14", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.14.tgz", - "integrity": "sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw==", + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.20.12", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.12.tgz", - "integrity": "sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg==", - "dev": true, - "peer": true, - "dependencies": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.20.7", - "@babel/helper-compilation-targets": "^7.20.7", - "@babel/helper-module-transforms": "^7.20.11", - "@babel/helpers": "^7.20.7", - "@babel/parser": "^7.20.7", - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.12", - "@babel/types": "^7.20.7", - "convert-source-map": "^1.7.0", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", + "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.10", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.10", + "@babel/parser": "^7.26.10", + "@babel/template": "^7.26.9", + "@babel/traverse": "^7.26.10", + "@babel/types": "^7.26.10", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.2.2", - "semver": "^6.3.0" + "json5": "^2.2.3", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -90,341 +106,135 @@ "url": "https://opencollective.com/babel" } }, - "node_modules/@babel/core/node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true, - "peer": true - }, - "node_modules/@babel/core/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "peer": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@babel/core/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true, - "peer": true - }, - "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "peer": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/@babel/generator": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.5.tgz", - "integrity": "sha512-x32i4hEXvr+iI0NEoEfDKzlemF8AmtOP8CcrRaEcpzysWuoEb1KknpcvMsHKPONoKZiDuItklgWhB18xEhr9PA==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.0.tgz", + "integrity": "sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.24.5", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", - "jsesc": "^2.5.1" + "jsesc": "^3.0.2" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/generator/node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", - "dev": true, - "peer": true, - "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/generator/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, - "peer": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz", - "integrity": "sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.0.tgz", + "integrity": "sha512-LVk7fbXml0H2xH34dFzKQ7TDZ2G4/rVTOrq9V+icbbadjbVxxeFeDsNHv2SrZeWoA+6ZiTyWYWtScEIW07EAcA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.20.5", - "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.21.3", + "@babel/compat-data": "^7.26.8", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", "lru-cache": "^5.1.1", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-compilation-targets/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "peer": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", - "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", - "dev": true, - "peer": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", - "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", - "dev": true, - "peer": true, - "dependencies": { - "@babel/template": "^7.22.15", - "@babel/types": "^7.23.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", - "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", - "dev": true, - "peer": true, - "dependencies": { - "@babel/types": "^7.22.5" + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", - "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.18.6" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.20.11", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz", - "integrity": "sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg==", - "dev": true, - "peer": true, - "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.20.2", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.19.1", - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.10", - "@babel/types": "^7.20.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", - "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", - "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.20.2" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.5.tgz", - "integrity": "sha512-5CHncttXohrHk8GWOFCcCl4oRD9fKosWlIRgWm4ql9VYioKm52Mk2xsmoohvm7f3JoiLSM5ZgJuRaf5QZZYd3Q==", + "node_modules/@babel/helper-plugin-utils": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", "dev": true, - "peer": true, - "dependencies": { - "@babel/types": "^7.24.5" - }, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz", - "integrity": "sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", - "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.20.13", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.13.tgz", - "integrity": "sha512-nzJ0DWCL3gB5RCXbUO3KIMMsBY2Eqbx8mBpKGE/02PgyRQFcPQLbkQ1vyy596mZLaP+dAfD+R4ckASzNVmW3jg==", - "dev": true, - "peer": true, - "dependencies": { - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.13", - "@babel/types": "^7.20.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", - "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.0.tgz", + "integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.24.5", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "node_modules/@babel/parser": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz", + "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "@babel/types": "^7.27.0" }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.5.tgz", - "integrity": "sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg==", - "dev": true, - "peer": true, "bin": { "parser": "bin/babel-parser.js" }, @@ -437,7 +247,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -450,7 +260,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -463,7 +273,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.12.13" }, @@ -471,12 +281,44 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-import-meta": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, @@ -489,7 +331,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -498,13 +340,13 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz", + "integrity": "sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -518,7 +360,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, @@ -531,7 +373,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -544,7 +386,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, @@ -557,7 +399,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -570,7 +412,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -583,7 +425,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" }, @@ -591,12 +433,28 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-top-level-await": { "version": "7.14.5", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" }, @@ -608,13 +466,13 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz", - "integrity": "sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz", + "integrity": "sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.19.0" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -623,78 +481,61 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/template": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", - "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", - "dev": true, - "peer": true, + "node_modules/@babel/runtime": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz", + "integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==", + "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.23.5", - "@babel/parser": "^7.24.0", - "@babel/types": "^7.24.0" + "regenerator-runtime": "^0.14.0" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/traverse": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.5.tgz", - "integrity": "sha512-7aaBLeDQ4zYcUFDUD41lJc1fG8+5IU9DaNSJAgal866FGvmD5EbWQgnEC6kO1gGLsX0esNkfnJSndbTXA3r7UA==", - "dev": true, - "peer": true, - "dependencies": { - "@babel/code-frame": "^7.24.2", - "@babel/generator": "^7.24.5", - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.23.0", - "@babel/helper-hoist-variables": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.24.5", - "@babel/parser": "^7.24.5", - "@babel/types": "^7.24.5", - "debug": "^4.3.1", - "globals": "^11.1.0" + "node_modules/@babel/template": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz", + "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/traverse/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "node_modules/@babel/traverse": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.27.0.tgz", + "integrity": "sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.27.0", + "@babel/parser": "^7.27.0", + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0", + "debug": "^4.3.1", + "globals": "^11.1.0" }, "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "node": ">=6.9.0" } }, - "node_modules/@babel/traverse/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true, - "peer": true - }, "node_modules/@babel/types": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.5.tgz", - "integrity": "sha512-6mQNsaLeXTw0nxYUYu+NSa4Hx4BlF1x1x8/PMFbiR+GBSr+2DkECc69b8hgy2frEodNcvPffeH8YfWd3LI6jhQ==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz", + "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.24.1", - "@babel/helper-validator-identifier": "^7.24.5", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -705,13 +546,14 @@ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -719,12 +561,41 @@ "node": ">=12" } }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { "camelcase": "^5.3.1", "find-up": "^4.1.0", @@ -741,23 +612,23 @@ "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@jest/console": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.4.1.tgz", - "integrity": "sha512-m+XpwKSi3PPM9znm5NGS8bBReeAJJpSkL1OuFCqaMaJL2YX9YXLkkI+MBchMPwu+ZuM2rynL51sgfkQteQ1CKQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", "slash": "^3.0.0" }, "engines": { @@ -765,38 +636,38 @@ } }, "node_modules/@jest/core": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.4.1.tgz", - "integrity": "sha512-RXFTohpBqpaTebNdg5l3I5yadnKo9zLBajMT0I38D0tDhreVBYv3fA8kywthI00sWxPztWLD3yjiUkewwu/wKA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/console": "^29.4.1", - "@jest/reporters": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "ci-info": "^3.2.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.4.0", - "jest-config": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-resolve-dependencies": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "jest-watcher": "^29.4.1", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.7.0", "slash": "^3.0.0", "strip-ansi": "^6.0.0" }, @@ -812,95 +683,119 @@ } } }, + "node_modules/@jest/core/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/core/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@jest/environment": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.4.1.tgz", - "integrity": "sha512-pJ14dHGSQke7Q3mkL/UZR9ZtTOxqskZaC91NzamEH4dlKRt42W+maRBXiw/LWkdJe+P0f/zDR37+SPMplMRlPg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-mock": "^29.4.1" + "jest-mock": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-ZxKJP5DTUNF2XkpJeZIzvnzF1KkfrhEF6Rz0HGG69fHl6Bgx5/GoU3XyaeFYEjuuKSOOsbqD/k72wFvFxc3iTw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "expect": "^29.4.1", - "jest-snapshot": "^29.4.1" + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/expect-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.1.tgz", - "integrity": "sha512-w6YJMn5DlzmxjO00i9wu2YSozUYRBhIoJ6nQwpMYcBMtiqMGJm1QBzOf6DDgRao8dbtpDoaqLg6iiQTvv0UHhQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", "dev": true, + "license": "MIT", "dependencies": { - "jest-get-type": "^29.2.0" + "jest-get-type": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/fake-timers": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.4.1.tgz", - "integrity": "sha512-/1joI6rfHFmmm39JxNfmNAO3Nwm6Y0VoL5fJDy7H1AtWrD1CgRtqJbN9Ld6rhAkGO76qqp4cwhhxJ9o9kYjQMw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@sinonjs/fake-timers": "^10.0.2", "@types/node": "*", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/globals": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.4.1.tgz", - "integrity": "sha512-znoK2EuFytbHH0ZSf2mQK2K1xtIgmaw4Da21R2C/NE/+NnItm5mPEFQmn8gmF3f0rfOlmZ3Y3bIf7bFj7DHxAA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/types": "^29.4.1", - "jest-mock": "^29.4.1" + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/reporters": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.4.1.tgz", - "integrity": "sha512-AISY5xpt2Xpxj9R6y0RF1+O6GRy9JsGa8+vK23Lmzdy1AYcpQn5ItX79wJSsTmfzPKSAcsY1LNt/8Y5Xe5LOSg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "@types/node": "*", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", @@ -908,13 +803,13 @@ "glob": "^7.1.3", "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-instrument": "^6.0.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", "slash": "^3.0.0", "string-length": "^4.0.1", "strip-ansi": "^6.0.0", @@ -932,64 +827,112 @@ } } }, - "node_modules/@jest/reporters/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "node_modules/@jest/reporters/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, - "peer": true, - "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/@jest/schemas": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.0.tgz", - "integrity": "sha512-0E01f/gOZeNTG76i5eWWSupvSHaIINrTie7vCyjiYFKgzNdyEGd12BUv4oNBFHOqlHDbtoJi3HrQ38KCC90NsQ==", + "node_modules/@jest/reporters/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, + "license": "MIT", "dependencies": { - "@sinclair/typebox": "^0.25.16" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/@jest/source-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.2.0.tgz", - "integrity": "sha512-1NX9/7zzI0nqa6+kgpSdKPK+WU1p+SJk3TloWZf5MzPbxri9UEeXX5bWZAPCzbQcyuAzubcdUHA7hcNznmRqWQ==", + "node_modules/@jest/reporters/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { - "@jridgewell/trace-mapping": "^0.3.15", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/source-map/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dev": true, - "peer": true, + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@jest/reporters/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@jest/reporters/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/test-result": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.4.1.tgz", - "integrity": "sha512-WRt29Lwt+hEgfN8QDrXqXGgCTidq1rLyFqmZ4lmJOpVArC8daXrZWkWjiaijQvgd3aOUj2fM8INclKHsQW9YyQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/console": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" }, @@ -998,15 +941,15 @@ } }, "node_modules/@jest/test-sequencer": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.4.1.tgz", - "integrity": "sha512-v5qLBNSsM0eHzWLXsQ5fiB65xi49A3ILPSFQKPXzGL4Vyux0DPZAIN7NAFJa9b4BiTDP9MBF/Zqc/QA1vuiJ0w==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/test-result": "^29.4.1", + "@jest/test-result": "^29.7.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.7.0", "slash": "^3.0.0" }, "engines": { @@ -1014,50 +957,40 @@ } }, "node_modules/@jest/transform": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.4.1.tgz", - "integrity": "sha512-5w6YJrVAtiAgr0phzKjYd83UPbCXsBRTeYI4BXokv9Er9CcrH9hfXL/crCvP2d2nGOcovPUnlYiLPFLZrkG5Hg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/core": "^7.11.6", - "@jest/types": "^29.4.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "write-file-atomic": "^5.0.0" + "write-file-atomic": "^4.0.2" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/transform/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dev": true, - "peer": true, - "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - }, "node_modules/@jest/types": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.1.tgz", - "integrity": "sha512-zbrAXDUOnpJ+FMST2rV7QZOgec8rskg2zv8g2ajeqitp4tvZiyqTCYXANrKsM+ryj5o+LI+ZN2EgU9drrkiwSA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", "dev": true, + "license": "MIT", "dependencies": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", @@ -1069,24 +1002,26 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", - "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.0.0", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -1096,83 +1031,253 @@ "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@jsdoc/salty": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.9.tgz", + "integrity": "sha512-yYxMVH7Dqw6nO0d5NIV8OQWnitU8k6vXH8NtgqAfIa/IUqRMxRv/NUJJ08VEKbAakwxlgBl5PJdrU0dMPStsnw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=v12.0.0" + } + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "28.0.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.3.tgz", + "integrity": "sha512-pyltgilam1QPdn+Zd9gaCfOLcnjMEJ9gV+bTw6/r73INdvzf1ah9zLIJBm+kW7R6IUFIQ1YO+VqZtYxZNWFPEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "fdir": "^6.2.0", + "is-reference": "1.2.1", + "magic-string": "^0.30.3", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=16.0.0 || 14 >= 14.17" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.1.tgz", + "integrity": "sha512-tk5YCxJWIG81umIvNkSod2qK5KyQW19qcBF/B78n1bjtOON6gzKoVeSzAE8yHCZEDmqkHKkxplExA8KzdJLJpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-terser": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", + "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "serialize-javascript": "^6.0.1", + "smob": "^1.0.0", + "terser": "^5.17.4" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-typescript": { + "version": "12.1.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.2.tgz", + "integrity": "sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.1.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.14.0||^3.0.0||^4.0.0", + "tslib": "*", + "typescript": ">=3.7.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "tslib": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", + "integrity": "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } } }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.38.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.38.0.tgz", + "integrity": "sha512-Mgcmc78AjunP1SKXl624vVBOF2bzwNWFPMP4fpOu05vS0amnLcX8gHIge7q/lDAHy3T2HeR0TqrriZDQS2Woeg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, "node_modules/@sinclair/typebox": { - "version": "0.25.21", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", - "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==", - "dev": true + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true, + "license": "MIT" }, "node_modules/@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", "dependencies": { "type-detect": "4.0.8" } }, "node_modules/@sinonjs/fake-timers": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", - "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^2.0.0" + "@sinonjs/commons": "^3.0.0" } }, "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true, + "license": "MIT" }, "node_modules/@types/babel__core": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", - "integrity": "sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", @@ -1182,130 +1287,179 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", - "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__template": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", - "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__traverse": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.3.tgz", - "integrity": "sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.7.tgz", + "integrity": "sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.3.0" + "@babel/types": "^7.20.7" } }, "node_modules/@types/estree": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz", - "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "license": "MIT" + }, + "node_modules/@types/fast-levenshtein": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@types/fast-levenshtein/-/fast-levenshtein-0.0.4.tgz", + "integrity": "sha512-tkDveuitddQCxut1Db8eEFfMahTjOumTJGPHmT9E7KUH+DkVq9WTpVvlfenf3S+uCBeu8j5FP2xik/KfxOEjeA==", + "dev": true, + "license": "MIT" }, "node_modules/@types/graceful-fs": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", - "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@types/node": "*" } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", - "dev": true + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true, + "license": "MIT" }, "node_modules/@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", "dev": true, + "license": "MIT", "dependencies": { "@types/istanbul-lib-coverage": "*" } }, "node_modules/@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/istanbul-lib-report": "*" } }, "node_modules/@types/jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.4.0.tgz", - "integrity": "sha512-VaywcGQ9tPorCX/Jkkni7RWGFfI11whqzs8dvxF41P17Z+z872thvEvlIbznjPJ02kl1HMX3LmLOonsj2n7HeQ==", + "version": "29.5.14", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.14.tgz", + "integrity": "sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==", "dev": true, + "license": "MIT", "dependencies": { "expect": "^29.0.0", "pretty-format": "^29.0.0" } }, + "node_modules/@types/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/markdown-it": { + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", + "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/linkify-it": "^5", + "@types/mdurl": "^2" + } + }, + "node_modules/@types/mathjs": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/@types/mathjs/-/mathjs-9.4.1.tgz", + "integrity": "sha512-pEvgJ9c0LkVSZODbBuxeFngyhg/xMpZElcmvtFLayUXEgt6I4fGcMaxlPspV4kIMucmY6W4YwmtaWyTAQpqsrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mathjs": "*" + } + }, + "node_modules/@types/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { - "version": "18.11.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz", - "integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==", - "dev": true + "version": "18.19.85", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.85.tgz", + "integrity": "sha512-61sLB7tXUMpkHJagZQAzPV4xGyqzulLvphe0lquRX80rZG24VupRv9p6Qo06V9VBNeGBM8Sv8rRVVLji6pi7QQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } }, - "node_modules/@types/prettier": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", - "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", + "node_modules/@types/resolve": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", + "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", - "dev": true + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true, + "license": "MIT" }, "node_modules/@types/yargs": { - "version": "17.0.22", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz", - "integrity": "sha512-pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g==", + "version": "17.0.33", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", + "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", "dev": true, + "license": "MIT", "dependencies": { "@types/yargs-parser": "*" } }, "node_modules/@types/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", - "dev": true - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true, + "license": "MIT" }, "node_modules/acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -1314,10 +1468,14 @@ } }, "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, "engines": { "node": ">=0.4.0" } @@ -1327,7 +1485,7 @@ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "type-fest": "^0.21.3" }, @@ -1339,13 +1497,16 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, "node_modules/ansi-styles": { @@ -1353,6 +1514,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -1368,6 +1530,7 @@ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, + "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -1376,33 +1539,54 @@ "node": ">= 8" } }, + "node_modules/anymatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "sprintf-js": "~1.0.2" } }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "dev": true, + "license": "MIT" + }, "node_modules/babel-jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.4.1.tgz", - "integrity": "sha512-xBZa/pLSsF/1sNpkgsiT3CmY7zV1kAsZ9OxxtrFqYucnOuRftXAfcJqcDVyOPeN4lttWTwhLdu0T9f8uvoPEUg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/transform": "^29.4.1", + "@jest/transform": "^29.7.0", "@types/babel__core": "^7.1.14", "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.4.0", + "babel-preset-jest": "^29.6.3", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "slash": "^3.0.0" @@ -1419,7 +1603,7 @@ "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", "@istanbuljs/load-nyc-config": "^1.0.0", @@ -1431,12 +1615,29 @@ "node": ">=8" } }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/babel-plugin-jest-hoist": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.4.0.tgz", - "integrity": "sha512-a/sZRLQJEmsmejQ2rPEUe35nO1+C9dc9O1gplH1SXmJxveQSRUYdBk8yGZG/VOUuZs1u2aHZJusEGoRMbhhwCg==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/template": "^7.3.3", "@babel/types": "^7.3.3", @@ -1448,37 +1649,40 @@ } }, "node_modules/babel-preset-current-node-syntax": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", - "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz", + "integrity": "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/plugin-syntax-async-generators": "^7.8.4", "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-import-attributes": "^7.24.7", + "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "node_modules/babel-preset-jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.4.0.tgz", - "integrity": "sha512-fUB9vZflUSM3dO/6M2TCAepTzvA4VkOvl67PjErcrQMGt9Eve7uazaeyCZ2th3UtI7ljpiBJES0F7A1vBRsLZA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "babel-plugin-jest-hoist": "^29.4.0", + "babel-plugin-jest-hoist": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0" }, "engines": { @@ -1492,25 +1696,37 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true, + "license": "MIT" + }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, + "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -1518,6 +1734,7 @@ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, + "license": "MIT", "dependencies": { "fill-range": "^7.1.1" }, @@ -1526,9 +1743,9 @@ } }, "node_modules/browserslist": { - "version": "4.21.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", - "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", "dev": true, "funding": [ { @@ -1538,14 +1755,18 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], - "peer": true, + "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001449", - "electron-to-chromium": "^1.4.284", - "node-releases": "^2.0.8", - "update-browserslist-db": "^1.0.10" + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" @@ -1559,6 +1780,7 @@ "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", "dev": true, + "license": "MIT", "dependencies": { "fast-json-stable-stringify": "2.x" }, @@ -1571,7 +1793,7 @@ "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", "dev": true, - "peer": true, + "license": "Apache-2.0", "dependencies": { "node-int64": "^0.4.0" } @@ -1581,14 +1803,14 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -1598,15 +1820,15 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/caniuse-lite": { - "version": "1.0.30001450", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001450.tgz", - "integrity": "sha512-qMBmvmQmFXaSxexkjjfMvD5rnDL0+m+dUMZKoDYsGG8iZN29RuYh9eRoMvKsT6uMAWlyUUGDEQGJJYjzCIO9ew==", + "version": "1.0.30001707", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001707.tgz", + "integrity": "sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==", "dev": true, "funding": [ { @@ -1616,15 +1838,33 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], - "peer": true + "license": "CC-BY-4.0" + }, + "node_modules/catharsis": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", + "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.15" + }, + "engines": { + "node": ">= 10" + } }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1636,48 +1876,22 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chalk/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/char-regex": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=10" } }, "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], + "license": "MIT", "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -1690,14 +1904,17 @@ "engines": { "node": ">= 8.10.0" }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "node_modules/ci-info": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.7.1.tgz", - "integrity": "sha512-4jYS4MOAaCIStSRwiuxc4B8MYhIe676yO1sYGzARnjXkWpmzZMMYxY6zu8WYWDhSuth5zhrQ1rhNSibyyvv4/w==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", "dev": true, "funding": [ { @@ -1705,23 +1922,24 @@ "url": "https://github.com/sponsors/sibiraj-s" } ], + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz", + "integrity": "sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", @@ -1731,29 +1949,93 @@ "node": ">=12" } }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "iojs": ">= 1.0.0", "node": ">= 0.12.0" } }, "node_modules/collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -1765,33 +2047,85 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "dev": true, + "license": "MIT" + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true, + "license": "MIT" + }, + "node_modules/complex.js": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.4.2.tgz", + "integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==", + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true, - "peer": true + "license": "MIT" + }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } }, "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1802,27 +2136,50 @@ } }, "node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "^2.1.1" + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, + "node_modules/decimal.js": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.5.0.tgz", + "integrity": "sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw==", + "license": "MIT" + }, "node_modules/dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", + "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", "dev": true, - "peer": true + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } }, "node_modules/deepmerge": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.0.tgz", - "integrity": "sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -1832,7 +2189,7 @@ "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -1842,32 +2199,57 @@ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, "node_modules/diff-sequences": { - "version": "29.3.1", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz", - "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true, + "license": "MIT", "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/electron-to-chromium": { - "version": "1.4.286", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.286.tgz", - "integrity": "sha512-Vp3CVhmYpgf4iXNKAucoQUDcCrBQX3XLBtwgFqP9BUXuucgvAV9zWp1kYU7LL9j4++s9O+12cb3wMtN4SJy6UQ==", + "version": "1.5.129", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.129.tgz", + "integrity": "sha512-JlXUemX4s0+9f8mLqib/bHH8gOHf5elKS6KeWG3sk3xozb/JTq/RLXIv8OKUWiK4Ah00Wm88EFj5PYkFr4RUPA==", "dev": true, - "peer": true + "license": "ISC" }, "node_modules/emittery": { "version": "0.13.1", "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -1876,37 +2258,57 @@ } }, "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dev": true, - "peer": true + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "is-arrayish": "^0.2.1" } }, "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6" } }, + "node_modules/escape-latex": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz", + "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==", + "license": "MIT" + }, "node_modules/escape-string-regexp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -1916,7 +2318,7 @@ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true, - "peer": true, + "license": "BSD-2-Clause", "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -1925,12 +2327,19 @@ "node": ">=4" } }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "license": "MIT" + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -1949,27 +2358,34 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/execa/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, "node_modules/exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", "dev": true, - "peer": true, "engines": { "node": ">= 0.8.0" } }, "node_modules/expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-OKrGESHOaMxK3b6zxIq9SOW8kEXztKff/Dvg88j4xIJxur1hspEbedVkR3GpHe5LO+WB2Qw7OWN0RMTdp6as5A==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", "dev": true, + "license": "MIT", "dependencies": { - "@jest/expect-utils": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1" + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -1979,12 +2395,14 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-levenshtein": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-3.0.0.tgz", "integrity": "sha512-hKKNajm46uNmTlhHSyZkmToAc56uZJwYq7yrciZjqOxnlfQwERDQJmHPUp7m1m9wx8vgOe8IaCKZ5Kv2k1DdCQ==", + "license": "MIT", "dependencies": { "fastest-levenshtein": "^1.0.7" } @@ -1993,6 +2411,7 @@ "version": "1.0.16", "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "license": "MIT", "engines": { "node": ">= 4.9.1" } @@ -2002,16 +2421,55 @@ "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", "dev": true, - "peer": true, + "license": "Apache-2.0", "dependencies": { "bser": "2.1.1" } }, + "node_modules/fdir": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", + "integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -2024,7 +2482,7 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -2033,39 +2491,59 @@ "node": ">=8" } }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fraction.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.2.2.tgz", + "integrity": "sha512-uXBDv5knpYmv/2gLzWQ5mBHGBRk9wcKTeWu6GLTUEQfjCxO09uM/mHDrojlL+Q1mVGIIFo149Gba7od1XPgSzQ==", + "license": "MIT", + "engines": { + "node": ">= 12" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } + "license": "ISC" }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, - "peer": true + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -2075,7 +2553,7 @@ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, - "peer": true, + "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -2085,7 +2563,7 @@ "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8.0.0" } @@ -2095,7 +2573,7 @@ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -2104,20 +2582,24 @@ } }, "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.1.tgz", + "integrity": "sha512-zrQDm8XPnYEKawJScsnM0QzobJxlT/kHOOlRTio8IH/GrmxRE5fjllkzdaHclIuNjUQTJYH2xHNIGfdpJkDJUw==", "dev": true, + "license": "ISC", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "foreground-child": "^3.1.0", + "jackspeak": "^4.0.1", + "minimatch": "^10.0.0", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" }, "engines": { - "node": "*" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -2128,6 +2610,7 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, + "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, @@ -2140,37 +2623,39 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "peer": true, - "dependencies": { - "function-bind": "^1.1.1" - }, + "license": "MIT", "engines": { - "node": ">= 0.4.0" + "node": ">=8" } }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, "engines": { - "node": ">=4" + "node": ">= 0.4" } }, "node_modules/html-escaper": { @@ -2178,14 +2663,14 @@ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true, - "peer": true, + "license": "Apache-2.0", "engines": { "node": ">=10.17.0" } @@ -2194,14 +2679,15 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/import-local": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", - "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "pkg-dir": "^4.2.0", "resolve-cwd": "^3.0.0" @@ -2221,7 +2707,7 @@ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=0.8.19" } @@ -2230,7 +2716,9 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dev": true, + "license": "ISC", "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -2240,20 +2728,22 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, + "license": "MIT", "dependencies": { "binary-extensions": "^2.0.0" }, @@ -2262,13 +2752,16 @@ } }, "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2279,6 +2772,7 @@ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -2288,7 +2782,7 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -2298,7 +2792,7 @@ "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -2308,6 +2802,7 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, + "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, @@ -2315,21 +2810,39 @@ "node": ">=0.10.0" } }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true, + "license": "MIT" + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.12.0" } }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -2342,148 +2855,168 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true, - "peer": true + "license": "ISC" }, "node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", "engines": { "node": ">=8" } }, "node_modules/istanbul-lib-instrument": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", - "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" + "semver": "^7.5.4" }, "engines": { - "node": ">=8" + "node": ">=10" } }, "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, - "peer": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", "dependencies": { "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", + "make-dir": "^4.0.0", "supports-color": "^7.1.0" }, "engines": { - "node": ">=8" + "node": ">=10" } }, - "node_modules/istanbul-lib-report/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, "engines": { - "node": ">=8" + "node": ">=10" } }, - "node_modules/istanbul-lib-report/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", "dependencies": { - "has-flag": "^4.0.0" + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" }, "engines": { "node": ">=8" } }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "node_modules/jackspeak": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.0.tgz", + "integrity": "sha512-9DDdhb5j6cpeitCbvLO7n7J4IxnbM6hoF6O1g4HQ5TfhvvKN8ywDM7668ZhMHRqVmxqhps/F6syWK2KcPxYlkw==", "dev": true, - "peer": true, + "license": "BlueOak-1.0.0", "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" + "@isaacs/cliui": "^8.0.2" }, "engines": { - "node": ">=10" + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/istanbul-lib-source-maps/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "node_modules/jake": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", + "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", "dev": true, - "peer": true, + "license": "Apache-2.0", "dependencies": { - "ms": "2.1.2" + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" }, - "engines": { - "node": ">=6.0" + "bin": { + "jake": "bin/cli.js" }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "engines": { + "node": ">=10" } }, - "node_modules/istanbul-lib-source-maps/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "node_modules/jake/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "peer": true + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } }, - "node_modules/istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "node_modules/jake/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=8" + "node": "*" } }, + "node_modules/javascript-natural-sort": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", + "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==", + "license": "MIT" + }, "node_modules/jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.4.1.tgz", - "integrity": "sha512-cknimw7gAXPDOmj0QqztlxVtBVCw2lYY9CeIE5N6kD+kET1H4H79HSNISJmijb1HF+qk+G+ploJgiDi5k/fRlg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/core": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", "import-local": "^3.0.2", - "jest-cli": "^29.4.1" + "jest-cli": "^29.7.0" }, "bin": { "jest": "bin/jest.js" @@ -2501,13 +3034,14 @@ } }, "node_modules/jest-changed-files": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.4.0.tgz", - "integrity": "sha512-rnI1oPxgFghoz32Y8eZsGJMjW54UlqT17ycQeCEktcxxwqqKdlj9afl8LNeO0Pbu+h2JQHThQP0BzS67eTRx4w==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "execa": "^5.0.0", + "jest-util": "^29.7.0", "p-limit": "^3.1.0" }, "engines": { @@ -2515,29 +3049,30 @@ } }, "node_modules/jest-circus": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.4.1.tgz", - "integrity": "sha512-v02NuL5crMNY4CGPHBEflLzl4v91NFb85a+dH9a1pUNx6Xjggrd8l9pPy4LZ1VYNRXlb+f65+7O/MSIbLir6pA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", - "dedent": "^0.7.0", + "dedent": "^1.0.0", "is-generator-fn": "^2.0.0", - "jest-each": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", "p-limit": "^3.1.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, @@ -2546,23 +3081,22 @@ } }, "node_modules/jest-cli": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.4.1.tgz", - "integrity": "sha512-jz7GDIhtxQ37M+9dlbv5K+/FVcIo1O/b1sX3cJgzlQUf/3VG25nvuWzlDC4F1FLLzUThJeWLu8I7JF9eWpuURQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/core": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", "chalk": "^4.0.0", + "create-jest": "^29.7.0", "exit": "^0.1.2", - "graceful-fs": "^4.2.9", "import-local": "^3.0.2", - "jest-config": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "prompts": "^2.0.1", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", "yargs": "^17.3.1" }, "bin": { @@ -2581,32 +3115,32 @@ } }, "node_modules/jest-config": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.4.1.tgz", - "integrity": "sha512-g7p3q4NuXiM4hrS4XFATTkd+2z0Ml2RhFmFPM8c3WyKwVDNszbl4E7cV7WIx1YZeqqCtqbtTtZhGZWJlJqngzg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.4.1", - "@jest/types": "^29.4.1", - "babel-jest": "^29.4.1", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-circus": "^29.4.1", - "jest-environment-node": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", "micromatch": "^4.0.4", "parse-json": "^5.2.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.7.0", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" }, @@ -2626,27 +3160,74 @@ } } }, + "node_modules/jest-config/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/jest-config/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/jest-config/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/jest-diff": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.1.tgz", - "integrity": "sha512-uazdl2g331iY56CEyfbNA0Ut7Mn2ulAG5vUaEHXycf1L6IPyuImIxSz4F0VYBKi7LYIuxOwTZzK3wh5jHzASMw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.0.0", - "diff-sequences": "^29.3.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-docblock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.2.0.tgz", - "integrity": "sha512-bkxUsxTgWQGbXV5IENmfiIuqZhJcyvF7tU4zJ/7ioTutdz4ToB5Yx6JOFBpgI+TphRY4lhOyCWGNH/QFQh5T6A==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "detect-newline": "^3.0.0" }, @@ -2655,65 +3236,66 @@ } }, "node_modules/jest-each": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.4.1.tgz", - "integrity": "sha512-QlYFiX3llJMWUV0BtWht/esGEz9w+0i7BHwODKCze7YzZzizgExB9MOfiivF/vVT0GSQ8wXLhvHXh3x2fVD4QQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "jest-util": "^29.4.1", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-environment-node": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.4.1.tgz", - "integrity": "sha512-x/H2kdVgxSkxWAIlIh9MfMuBa0hZySmfsC5lCsWmWr6tZySP44ediRKDUiNggX/eHLH7Cd5ZN10Rw+XF5tXsqg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-get-type": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", - "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", "dev": true, + "license": "MIT", "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-haste-map": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.4.1.tgz", - "integrity": "sha512-imTjcgfVVTvg02khXL11NNLTx9ZaofbAWhilrMg/G8dIkp+HYCswhxf0xxJwBkfhWb3e8dwbjuWburvxmcr58w==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/graceful-fs": "^4.1.3", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", "micromatch": "^4.0.4", "walker": "^1.0.8" }, @@ -2725,47 +3307,49 @@ } }, "node_modules/jest-leak-detector": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.4.1.tgz", - "integrity": "sha512-akpZv7TPyGMnH2RimOCgy+hPmWZf55EyFUvymQ4LMsQP8xSPlZumCPtXGoDhFNhUE2039RApZkTQDKU79p/FiQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-matcher-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.1.tgz", - "integrity": "sha512-k5h0u8V4nAEy6lSACepxL/rw78FLDkBnXhZVgFneVpnJONhb2DhZj/Gv4eNe+1XqQ5IhgUcqj745UwH0HJmMnA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.0.0", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-message-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.1.tgz", - "integrity": "sha512-H4/I0cXUaLeCw6FM+i4AwCnOwHRgitdaUFOdm49022YD5nfyr8C/DrbXOBEyJaj+w/y0gGJ57klssOaUiLLQGQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", "dev": true, + "license": "MIT", "dependencies": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.7.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, @@ -2774,15 +3358,15 @@ } }, "node_modules/jest-mock": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.4.1.tgz", - "integrity": "sha512-MwA4hQ7zBOcgVCVnsM8TzaFLVUD/pFWTfbkY953Y81L5ret3GFRZtmPmRFAjKQSdCKoJvvqOu6Bvfpqlwwb0dQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-util": "^29.4.1" + "jest-util": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -2793,7 +3377,7 @@ "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6" }, @@ -2807,28 +3391,28 @@ } }, "node_modules/jest-regex-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.2.0.tgz", - "integrity": "sha512-6yXn0kg2JXzH30cr2NlThF+70iuO/3irbaB4mh5WyqNIvLLP+B6sFdluO1/1RJmslyh/f9osnefECflHvTbwVA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-resolve": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.4.1.tgz", - "integrity": "sha512-j/ZFNV2lm9IJ2wmlq1uYK0Y/1PiyDq9g4HEGsNTNr3viRbJdV+8Lf1SXIiLZXFvyiisu0qUyIXGBnw+OKWkJwQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "chalk": "^4.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.7.0", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", "resolve": "^1.20.0", "resolve.exports": "^2.0.0", "slash": "^3.0.0" @@ -2838,45 +3422,45 @@ } }, "node_modules/jest-resolve-dependencies": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.4.1.tgz", - "integrity": "sha512-Y3QG3M1ncAMxfjbYgtqNXC5B595zmB6e//p/qpA/58JkQXu/IpLDoLeOa8YoYfsSglBKQQzNUqtfGJJT/qLmJg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "jest-regex-util": "^29.2.0", - "jest-snapshot": "^29.4.1" + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-runner": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.4.1.tgz", - "integrity": "sha512-8d6XXXi7GtHmsHrnaqBKWxjKb166Eyj/ksSaUYdcBK09VbjPwIgWov1VwSmtupCIz8q1Xv4Qkzt/BTo3ZqiCeg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/console": "^29.4.1", - "@jest/environment": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "emittery": "^0.13.1", "graceful-fs": "^4.2.9", - "jest-docblock": "^29.2.0", - "jest-environment-node": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-leak-detector": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-resolve": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-util": "^29.4.1", - "jest-watcher": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", "p-limit": "^3.1.0", "source-map-support": "0.5.13" }, @@ -2885,33 +3469,32 @@ } }, "node_modules/jest-runtime": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.4.1.tgz", - "integrity": "sha512-UXTMU9uKu2GjYwTtoAw5rn4STxWw/nadOfW7v1sx6LaJYa3V/iymdCLQM6xy3+7C6mY8GfX22vKpgxY171UIoA==", - "dev": true, - "peer": true, - "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/globals": "^29.4.1", - "@jest/source-map": "^29.2.0", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "semver": "^7.3.5", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", "slash": "^3.0.0", "strip-bom": "^4.0.0" }, @@ -2919,100 +3502,90 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-runtime/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "node_modules/jest-runtime/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/jest-runtime/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "node_modules/jest-runtime/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">=10" + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/jest-runtime/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "node_modules/jest-runtime/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "peer": true + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } }, "node_modules/jest-snapshot": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.4.1.tgz", - "integrity": "sha512-l4iV8EjGgQWVz3ee/LR9sULDk2pCkqb71bjvlqn+qp90lFwpnulHj4ZBT8nm1hA1C5wowXLc7MGnw321u0tsYA==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/core": "^7.11.6", "@babel/generator": "^7.7.2", "@babel/plugin-syntax-jsx": "^7.7.2", "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^29.4.1", + "expect": "^29.7.0", "graceful-fs": "^4.2.9", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-haste-map": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", "natural-compare": "^1.4.0", - "pretty-format": "^29.4.1", - "semver": "^7.3.5" + "pretty-format": "^29.7.0", + "semver": "^7.5.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-snapshot/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "peer": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, - "peer": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -3020,20 +3593,14 @@ "node": ">=10" } }, - "node_modules/jest-snapshot/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "peer": true - }, "node_modules/jest-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.1.tgz", - "integrity": "sha512-bQy9FPGxVutgpN4VRc0hk6w7Hx/m6L53QxpDreTZgJd9gfx/AV2MjyPde9tGyZRINAUrSv57p2inGBu2dRLmkQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", "dev": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -3044,19 +3611,32 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-util/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/jest-validate": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.4.1.tgz", - "integrity": "sha512-qNZXcZQdIQx4SfUB/atWnI4/I2HUvhz8ajOSYUu40CSmf9U5emil8EDHgE7M+3j9/pavtk3knlZBDsgFvv/SWw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", + "jest-get-type": "^29.6.3", "leven": "^3.1.0", - "pretty-format": "^29.4.1" + "pretty-format": "^29.7.0" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -3067,7 +3647,7 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -3076,19 +3656,19 @@ } }, "node_modules/jest-watcher": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.4.1.tgz", - "integrity": "sha512-vFOzflGFs27nU6h8dpnVRER3O2rFtL+VMEwnG0H3KLHcllLsU8y9DchSh0AL/Rg5nN1/wSiQ+P4ByMGpuybaVw==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "emittery": "^0.13.1", - "jest-util": "^29.4.1", + "jest-util": "^29.7.0", "string-length": "^4.0.1" }, "engines": { @@ -3096,14 +3676,14 @@ } }, "node_modules/jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@types/node": "*", - "jest-util": "^29.4.1", + "jest-util": "^29.7.0", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" }, @@ -3111,22 +3691,12 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, "node_modules/jest-worker/node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -3141,14 +3711,15 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -3157,17 +3728,57 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/js2xmlparser": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", + "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "xmlcreate": "^2.0.4" + } + }, + "node_modules/jsdoc": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.4.tgz", + "integrity": "sha512-zeFezwyXeG4syyYHbvh1A967IAqq/67yXtXvuL5wnqCkFZe8I0vKfm+EO+YEvLguo6w9CDUbrAXVtJSHh2E8rw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@babel/parser": "^7.20.15", + "@jsdoc/salty": "^0.2.1", + "@types/markdown-it": "^14.1.1", + "bluebird": "^3.7.2", + "catharsis": "^0.9.0", + "escape-string-regexp": "^2.0.0", + "js2xmlparser": "^4.0.2", + "klaw": "^3.0.0", + "markdown-it": "^14.1.0", + "markdown-it-anchor": "^8.6.7", + "marked": "^4.0.10", + "mkdirp": "^1.0.4", + "requizzle": "^0.2.3", + "strip-json-comments": "^3.1.0", + "underscore": "~1.13.2" + }, + "bin": { + "jsdoc": "jsdoc.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "dev": true, - "peer": true, + "license": "MIT", "bin": { "jsesc": "bin/jsesc" }, "engines": { - "node": ">=4" + "node": ">=6" } }, "node_modules/json-parse-even-better-errors": { @@ -3175,13 +3786,14 @@ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, + "license": "MIT", "bin": { "json5": "lib/cli.js" }, @@ -3189,12 +3801,22 @@ "node": ">=6" } }, + "node_modules/klaw": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", + "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.9" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -3204,7 +3826,7 @@ "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -3214,14 +3836,24 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true, - "peer": true + "license": "MIT" + }, + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "p-locate": "^4.1.0" }, @@ -3229,138 +3861,282 @@ "node": ">=8" } }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "license": "MIT" + }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { "yallist": "^3.0.2" } }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "semver": "^6.0.0" + "semver": "^7.5.3" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, - "peer": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", "dependencies": { "tmpl": "1.0.5" } }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true, - "peer": true - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", "dev": true, + "license": "MIT", "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" }, - "engines": { - "node": ">=8.6" + "bin": { + "markdown-it": "bin/markdown-it.mjs" } }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "node_modules/markdown-it-anchor": { + "version": "8.6.7", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz", + "integrity": "sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==", "dev": true, - "peer": true, - "engines": { - "node": ">=6" + "license": "Unlicense", + "peerDependencies": { + "@types/markdown-it": "*", + "markdown-it": "*" } }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/markdown-it/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" + "license": "Python-2.0" + }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dev": true, + "license": "MIT", + "bin": { + "marked": "bin/marked.js" }, "engines": { - "node": "*" + "node": ">= 12" + } + }, + "node_modules/mathjs": { + "version": "14.4.0", + "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-14.4.0.tgz", + "integrity": "sha512-CpoYDhNENefjIG9wU9epr+0pBHzlaySfpWcblZdAf5qXik/j/U8eSmx/oNbmXO0F5PyfwPGVD/wK4VWsTho1SA==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime": "^7.26.10", + "complex.js": "^2.2.5", + "decimal.js": "^10.4.3", + "escape-latex": "^1.2.0", + "fraction.js": "^5.2.1", + "javascript-natural-sort": "^0.7.1", + "seedrandom": "^3.0.5", + "tiny-emitter": "^2.1.0", + "typed-function": "^4.2.1" + }, + "bin": { + "mathjs": "bin/cli.js" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true, + "license": "MIT" + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.9.tgz", - "integrity": "sha512-2xfmOrRkGogbTK9R6Leda0DGiXeY3p2NJpy4+gNCffdUvV6mdEJnaDEic1i3Ec2djAo8jWYoJMR5PB0MSMpxUA==", + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/nodemon": { - "version": "2.0.20", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz", - "integrity": "sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==", + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", + "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==", "dev": true, + "license": "MIT", "dependencies": { "chokidar": "^3.5.2", "debug": "^3.2.7", @@ -3384,19 +4160,71 @@ "url": "https://opencollective.com/nodemon" } }, - "node_modules/nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", + "node_modules/nodemon/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/nodemon/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/nodemon/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { - "abbrev": "1" + "brace-expansion": "^1.1.7" }, + "engines": { + "node": "*" + } + }, + "node_modules/nodemon/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", "bin": { - "nopt": "bin/nopt.js" + "semver": "bin/semver" + } + }, + "node_modules/nodemon/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" }, "engines": { - "node": "*" + "node": ">=4" } }, "node_modules/normalize-path": { @@ -3404,6 +4232,7 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3413,7 +4242,7 @@ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "path-key": "^3.0.0" }, @@ -3426,6 +4255,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, + "license": "ISC", "dependencies": { "wrappy": "1" } @@ -3435,7 +4265,7 @@ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "mimic-fn": "^2.1.0" }, @@ -3446,12 +4276,71 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ospec": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ospec/-/ospec-3.1.0.tgz", + "integrity": "sha512-+nGtjV3vlADp+UGfL51miAh/hB4awPBkQrArhcgG4trAaoA2gKt5bf9w0m9ch9zOr555cHWaCHZEDiBOkNZSxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "ospec": "bin/ospec" + } + }, + "node_modules/ospec/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/ospec/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ospec/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" }, @@ -3467,7 +4356,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "p-limit": "^2.2.0" }, @@ -3480,7 +4369,7 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "p-try": "^2.0.0" }, @@ -3496,17 +4385,24 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -3525,7 +4421,7 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -3535,6 +4431,7 @@ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3544,7 +4441,7 @@ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -3554,32 +4451,61 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true, - "peer": true + "license": "MIT" + }, + "node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.1.0.tgz", + "integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" }, "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">= 6" } @@ -3589,7 +4515,7 @@ "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "find-up": "^4.0.0" }, @@ -3598,12 +4524,13 @@ } }, "node_modules/pretty-format": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.1.tgz", - "integrity": "sha512-dt/Z761JUVsrIKaY215o1xQJBGlSmTx/h4cSqXqjHLnU1+Kt+mavVE7UgqJJO5ukx5HjSswHfmXz4LjS2oIJfg==", + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", "dev": true, + "license": "MIT", "dependencies": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" }, @@ -3616,6 +4543,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -3628,7 +4556,7 @@ "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "kleur": "^3.0.3", "sisteransi": "^1.0.5" @@ -3641,19 +4569,59 @@ "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true + "dev": true, + "license": "MIT" + }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } }, "node_modules/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true, + "license": "MIT" }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, + "license": "MIT", "dependencies": { "picomatch": "^2.2.1" }, @@ -3661,30 +4629,62 @@ "node": ">=8.10.0" } }, + "node_modules/readdirp/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "license": "MIT" + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, + "node_modules/requizzle": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", + "integrity": "sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.21" + } + }, "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { - "is-core-module": "^2.9.0", + "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3694,7 +4694,7 @@ "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "resolve-from": "^5.0.0" }, @@ -3707,17 +4707,17 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/resolve.exports": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.0.tgz", - "integrity": "sha512-6K/gDlqgQscOlg9fSRpWstA8sYe8rbELsSTNpx+3kTrsVCzvSl0zIvRErM7fdl9ERWDsKnrLnwB+Ne89918XOg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", + "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=10" } @@ -3726,7 +4726,9 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, + "license": "ISC", "dependencies": { "glob": "^7.1.3" }, @@ -3737,26 +4739,171 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "bin": { - "semver": "bin/semver" + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/rollup": { + "version": "4.38.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.38.0.tgz", + "integrity": "sha512-5SsIRtJy9bf1ErAOiFMFzl64Ex9X5V7bnJ+WlFMb+zmP459OSWCEG7b0ERZ+PEU7xPt4OG3RHbrp1LJlXxYTrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.7" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.38.0", + "@rollup/rollup-android-arm64": "4.38.0", + "@rollup/rollup-darwin-arm64": "4.38.0", + "@rollup/rollup-darwin-x64": "4.38.0", + "@rollup/rollup-freebsd-arm64": "4.38.0", + "@rollup/rollup-freebsd-x64": "4.38.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.38.0", + "@rollup/rollup-linux-arm-musleabihf": "4.38.0", + "@rollup/rollup-linux-arm64-gnu": "4.38.0", + "@rollup/rollup-linux-arm64-musl": "4.38.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.38.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.38.0", + "@rollup/rollup-linux-riscv64-gnu": "4.38.0", + "@rollup/rollup-linux-riscv64-musl": "4.38.0", + "@rollup/rollup-linux-s390x-gnu": "4.38.0", + "@rollup/rollup-linux-x64-gnu": "4.38.0", + "@rollup/rollup-linux-x64-musl": "4.38.0", + "@rollup/rollup-win32-arm64-msvc": "4.38.0", + "@rollup/rollup-win32-ia32-msvc": "4.38.0", + "@rollup/rollup-win32-x64-msvc": "4.38.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/rollup-plugin-modify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-modify/-/rollup-plugin-modify-3.0.0.tgz", + "integrity": "sha512-p/ffs0Y2jz2dEnWjq1oVC7SY37tuS+aP7whoNaQz1EAAOPg+k3vKJo8cMMWx6xpdd0NzhX4y2YF9o/NPu5YR0Q==", + "dev": true, + "license": "WTFPL", + "dependencies": { + "magic-string": "0.25.2", + "ospec": "3.1.0" + } + }, + "node_modules/rollup-plugin-modify/node_modules/magic-string": { + "version": "0.25.2", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.2.tgz", + "integrity": "sha512-iLs9mPjh9IuTtRsqqhNGYcZXGei0Nh/A4xirrsqW7c+QhKVFL2vm7U09ru6cHRD22azaP/wMDgI+HCqbETMTtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sourcemap-codec": "^1.4.4" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/seedrandom": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", + "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/shebang-regex": { @@ -3764,23 +4911,30 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, - "peer": true + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } }, "node_modules/simple-update-notifier": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", "dev": true, + "license": "MIT", "dependencies": { "semver": "~7.0.0" }, @@ -3793,6 +4947,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" } @@ -3802,23 +4957,31 @@ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", "dev": true, - "peer": true + "license": "MIT" }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/smob": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", + "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", + "dev": true, + "license": "MIT" + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, - "peer": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -3828,24 +4991,33 @@ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "deprecated": "Please use @jridgewell/sourcemap-codec instead", + "dev": true, + "license": "MIT" + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true, - "peer": true + "license": "BSD-3-Clause" }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "dev": true, + "license": "MIT", "dependencies": { "escape-string-regexp": "^2.0.0" }, @@ -3858,7 +5030,7 @@ "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "char-regex": "^1.0.2", "strip-ansi": "^6.0.0" @@ -3867,12 +5039,54 @@ "node": ">=10" } }, + "node_modules/string-length/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-length/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -3882,12 +5096,59 @@ "node": ">=8" } }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -3895,12 +5156,22 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -3910,7 +5181,7 @@ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -3920,7 +5191,7 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -3929,15 +5200,16 @@ } }, "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/supports-preserve-symlinks-flag": { @@ -3945,7 +5217,7 @@ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -3953,12 +5225,49 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/taffydb": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.7.3.tgz", + "integrity": "sha512-GQ3gtYFSOAxSMN/apGtDKKkbJf+8izz5YfbGqIsUc7AMiQOapARZ76dhilRY2h39cynYxBFdafQo5HUL5vgkrg==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/terser": { + "version": "5.39.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.39.0.tgz", + "integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser/node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { "@istanbuljs/schema": "^0.1.2", "glob": "^7.1.4", @@ -3968,28 +5277,71 @@ "node": ">=8" } }, - "node_modules/tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "peer": true + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "peer": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, "engines": { - "node": ">=4" + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" } }, + "node_modules/tiny-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", + "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", + "license": "MIT" + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true, + "license": "BSD-3-Clause" + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -3998,49 +5350,54 @@ } }, "node_modules/touch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", "dev": true, - "dependencies": { - "nopt": "~1.0.10" - }, + "license": "ISC", "bin": { "nodetouch": "bin/nodetouch.js" } }, "node_modules/ts-jest": { - "version": "29.0.5", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.0.5.tgz", - "integrity": "sha512-PL3UciSgIpQ7f6XjVOmbi96vmDHUqAyqDr8YxzopDqX3kfgYtX1cuNeBjP+L9sFXi6nzsGGA6R3fP3DDDJyrxA==", + "version": "29.3.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.3.1.tgz", + "integrity": "sha512-FT2PIRtZABwl6+ZCry8IY7JZ3xMuppsEV9qFVHOVe8jDzggwUZ9TsM4chyJxL9yi6LvkqcZYU3LmapEE454zBQ==", "dev": true, + "license": "MIT", "dependencies": { - "bs-logger": "0.x", - "fast-json-stable-stringify": "2.x", + "bs-logger": "^0.2.6", + "ejs": "^3.1.10", + "fast-json-stable-stringify": "^2.1.0", "jest-util": "^29.0.0", "json5": "^2.2.3", - "lodash.memoize": "4.x", - "make-error": "1.x", - "semver": "7.x", - "yargs-parser": "^21.0.1" + "lodash.memoize": "^4.1.2", + "make-error": "^1.3.6", + "semver": "^7.7.1", + "type-fest": "^4.38.0", + "yargs-parser": "^21.1.1" }, "bin": { "ts-jest": "cli.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/transform": "^29.0.0", "@jest/types": "^29.0.0", "babel-jest": "^29.0.0", "jest": "^29.0.0", - "typescript": ">=4.3" + "typescript": ">=4.3 <6" }, "peerDependenciesMeta": { "@babel/core": { "optional": true }, + "@jest/transform": { + "optional": true + }, "@jest/types": { "optional": true }, @@ -4052,26 +5409,12 @@ } } }, - "node_modules/ts-jest/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/ts-jest/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -4079,17 +5422,25 @@ "node": ">=10" } }, - "node_modules/ts-jest/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "node_modules/ts-jest/node_modules/type-fest": { + "version": "4.38.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.38.0.tgz", + "integrity": "sha512-2dBz5D5ycHIoliLYLi0Q2V7KRaDlH0uWIvmk7TYlAg5slqwiPv1ezJdZm1QEM0xgk29oYWMCbIG7E6gHpvChlg==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, + "license": "MIT", "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -4128,12 +5479,19 @@ } } }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true, - "peer": true, + "license": "MIT", "engines": { "node": ">=4" } @@ -4143,7 +5501,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true, - "peer": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -4151,29 +5509,61 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typed-function": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.2.1.tgz", + "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==", + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, "node_modules/typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "version": "5.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz", + "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true, + "license": "MIT" + }, "node_modules/undefsafe": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true + "dev": true, + "license": "MIT" + }, + "node_modules/underscore": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz", + "integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, + "license": "MIT" }, "node_modules/update-browserslist-db": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", - "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", "dev": true, "funding": [ { @@ -4183,15 +5573,19 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], - "peer": true, + "license": "MIT", "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.2.0", + "picocolors": "^1.1.1" }, "bin": { - "browserslist-lint": "cli.js" + "update-browserslist-db": "cli.js" }, "peerDependencies": { "browserslist": ">= 4.21.0" @@ -4201,47 +5595,30 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { "@jridgewell/trace-mapping": "^0.3.12", "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0" + "convert-source-map": "^2.0.0" }, "engines": { "node": ">=10.12.0" } }, - "node_modules/v8-to-istanbul/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dev": true, - "peer": true, - "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - }, - "node_modules/v8-to-istanbul/node_modules/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true, - "peer": true - }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", "dev": true, - "peer": true, + "license": "Apache-2.0", "dependencies": { "makeerror": "1.0.12" } @@ -4251,7 +5628,7 @@ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, @@ -4263,11 +5640,30 @@ } }, "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -4280,32 +5676,105 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/write-file-atomic": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.0.tgz", - "integrity": "sha512-R7NYMnHSlV42K54lwY9lvW6MnSm1HSJqZL3xiSgi9E7//FYaI74r2G0rd+/X6VAMkHEdzxQaU5HUOXWUz5kA/w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, - "peer": true, + "license": "ISC", "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/write-file-atomic/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/xmlcreate": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", + "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, - "peer": true, + "license": "ISC", "engines": { "node": ">=10" } @@ -4315,14 +5784,14 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, - "peer": true + "license": "ISC" }, "node_modules/yargs": { - "version": "17.6.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", - "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -4341,3379 +5810,78 @@ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", "dev": true, + "license": "ISC", "engines": { "node": ">=12" } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, - "peer": true, + "license": "MIT", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - }, - "dependencies": { - "@ampproject/remapping": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", - "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/gen-mapping": "^0.1.0", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, - "@babel/code-frame": { - "version": "7.24.2", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", - "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", - "dev": true, - "requires": { - "@babel/highlight": "^7.24.2", - "picocolors": "^1.0.0" + "node": ">=8" } }, - "@babel/compat-data": { - "version": "7.20.14", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.14.tgz", - "integrity": "sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw==", + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true, - "peer": true + "license": "MIT" }, - "@babel/core": { - "version": "7.20.12", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.12.tgz", - "integrity": "sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg==", + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, - "peer": true, - "requires": { - "@ampproject/remapping": "^2.1.0", - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.20.7", - "@babel/helper-compilation-targets": "^7.20.7", - "@babel/helper-module-transforms": "^7.20.11", - "@babel/helpers": "^7.20.7", - "@babel/parser": "^7.20.7", - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.12", - "@babel/types": "^7.20.7", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.2", - "semver": "^6.3.0" - }, + "license": "MIT", "dependencies": { - "convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true, - "peer": true - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "peer": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true, - "peer": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "peer": true - } - } - }, - "@babel/generator": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.5.tgz", - "integrity": "sha512-x32i4hEXvr+iI0NEoEfDKzlemF8AmtOP8CcrRaEcpzysWuoEb1KknpcvMsHKPONoKZiDuItklgWhB18xEhr9PA==", - "dev": true, - "peer": true, - "requires": { - "@babel/types": "^7.24.5", - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25", - "jsesc": "^2.5.1" - }, - "dependencies": { - "@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - } - } - }, - "@babel/helper-compilation-targets": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz", - "integrity": "sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==", - "dev": true, - "peer": true, - "requires": { - "@babel/compat-data": "^7.20.5", - "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.21.3", - "lru-cache": "^5.1.1", - "semver": "^6.3.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "peer": true - } - } - }, - "@babel/helper-environment-visitor": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", - "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", - "dev": true, - "peer": true - }, - "@babel/helper-function-name": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", - "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", - "dev": true, - "peer": true, - "requires": { - "@babel/template": "^7.22.15", - "@babel/types": "^7.23.0" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", - "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", - "dev": true, - "peer": true, - "requires": { - "@babel/types": "^7.22.5" - } - }, - "@babel/helper-module-imports": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", - "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", - "dev": true, - "peer": true, - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-module-transforms": { - "version": "7.20.11", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz", - "integrity": "sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.20.2", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.19.1", - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.10", - "@babel/types": "^7.20.7" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", - "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", - "dev": true, - "peer": true - }, - "@babel/helper-simple-access": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", - "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", - "dev": true, - "peer": true, - "requires": { - "@babel/types": "^7.20.2" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.5.tgz", - "integrity": "sha512-5CHncttXohrHk8GWOFCcCl4oRD9fKosWlIRgWm4ql9VYioKm52Mk2xsmoohvm7f3JoiLSM5ZgJuRaf5QZZYd3Q==", - "dev": true, - "peer": true, - "requires": { - "@babel/types": "^7.24.5" - } - }, - "@babel/helper-string-parser": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz", - "integrity": "sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==", - "dev": true, - "peer": true - }, - "@babel/helper-validator-identifier": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", - "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", - "dev": true - }, - "@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", - "dev": true, - "peer": true - }, - "@babel/helpers": { - "version": "7.20.13", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.13.tgz", - "integrity": "sha512-nzJ0DWCL3gB5RCXbUO3KIMMsBY2Eqbx8mBpKGE/02PgyRQFcPQLbkQ1vyy596mZLaP+dAfD+R4ckASzNVmW3jg==", - "dev": true, - "peer": true, - "requires": { - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.13", - "@babel/types": "^7.20.7" + "engines": { + "node": ">=8" } }, - "@babel/highlight": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", - "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.24.5", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, + "license": "MIT", "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true - } - } - }, - "@babel/parser": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.5.tgz", - "integrity": "sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg==", - "dev": true, - "peer": true - }, - "@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.12.13" + "license": "MIT", + "engines": { + "node": ">=6" } }, - "@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } - }, - "@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-typescript": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz", - "integrity": "sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.19.0" - } - }, - "@babel/template": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", - "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", - "dev": true, - "peer": true, - "requires": { - "@babel/code-frame": "^7.23.5", - "@babel/parser": "^7.24.0", - "@babel/types": "^7.24.0" - } - }, - "@babel/traverse": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.5.tgz", - "integrity": "sha512-7aaBLeDQ4zYcUFDUD41lJc1fG8+5IU9DaNSJAgal866FGvmD5EbWQgnEC6kO1gGLsX0esNkfnJSndbTXA3r7UA==", - "dev": true, - "peer": true, - "requires": { - "@babel/code-frame": "^7.24.2", - "@babel/generator": "^7.24.5", - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.23.0", - "@babel/helper-hoist-variables": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.24.5", - "@babel/parser": "^7.24.5", - "@babel/types": "^7.24.5", - "debug": "^4.3.1", - "globals": "^11.1.0" - }, - "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "peer": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true, - "peer": true - } - } - }, - "@babel/types": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.5.tgz", - "integrity": "sha512-6mQNsaLeXTw0nxYUYu+NSa4Hx4BlF1x1x8/PMFbiR+GBSr+2DkECc69b8hgy2frEodNcvPffeH8YfWd3LI6jhQ==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-string-parser": "^7.24.1", - "@babel/helper-validator-identifier": "^7.24.5", - "to-fast-properties": "^2.0.0" - } - }, - "@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true, - "peer": true - }, - "@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "0.3.9" - } - }, - "@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", - "dev": true, - "peer": true, - "requires": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - } - }, - "@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true, - "peer": true - }, - "@jest/console": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.4.1.tgz", - "integrity": "sha512-m+XpwKSi3PPM9znm5NGS8bBReeAJJpSkL1OuFCqaMaJL2YX9YXLkkI+MBchMPwu+ZuM2rynL51sgfkQteQ1CKQ==", - "dev": true, - "peer": true, - "requires": { - "@jest/types": "^29.4.1", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", - "slash": "^3.0.0" - } - }, - "@jest/core": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.4.1.tgz", - "integrity": "sha512-RXFTohpBqpaTebNdg5l3I5yadnKo9zLBajMT0I38D0tDhreVBYv3fA8kywthI00sWxPztWLD3yjiUkewwu/wKA==", - "dev": true, - "peer": true, - "requires": { - "@jest/console": "^29.4.1", - "@jest/reporters": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.4.0", - "jest-config": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-resolve-dependencies": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "jest-watcher": "^29.4.1", - "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "@jest/environment": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.4.1.tgz", - "integrity": "sha512-pJ14dHGSQke7Q3mkL/UZR9ZtTOxqskZaC91NzamEH4dlKRt42W+maRBXiw/LWkdJe+P0f/zDR37+SPMplMRlPg==", - "dev": true, - "peer": true, - "requires": { - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/node": "*", - "jest-mock": "^29.4.1" - } - }, - "@jest/expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-ZxKJP5DTUNF2XkpJeZIzvnzF1KkfrhEF6Rz0HGG69fHl6Bgx5/GoU3XyaeFYEjuuKSOOsbqD/k72wFvFxc3iTw==", - "dev": true, - "peer": true, - "requires": { - "expect": "^29.4.1", - "jest-snapshot": "^29.4.1" - } - }, - "@jest/expect-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.1.tgz", - "integrity": "sha512-w6YJMn5DlzmxjO00i9wu2YSozUYRBhIoJ6nQwpMYcBMtiqMGJm1QBzOf6DDgRao8dbtpDoaqLg6iiQTvv0UHhQ==", - "dev": true, - "requires": { - "jest-get-type": "^29.2.0" - } - }, - "@jest/fake-timers": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.4.1.tgz", - "integrity": "sha512-/1joI6rfHFmmm39JxNfmNAO3Nwm6Y0VoL5fJDy7H1AtWrD1CgRtqJbN9Ld6rhAkGO76qqp4cwhhxJ9o9kYjQMw==", - "dev": true, - "peer": true, - "requires": { - "@jest/types": "^29.4.1", - "@sinonjs/fake-timers": "^10.0.2", - "@types/node": "*", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" - } - }, - "@jest/globals": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.4.1.tgz", - "integrity": "sha512-znoK2EuFytbHH0ZSf2mQK2K1xtIgmaw4Da21R2C/NE/+NnItm5mPEFQmn8gmF3f0rfOlmZ3Y3bIf7bFj7DHxAA==", - "dev": true, - "peer": true, - "requires": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/types": "^29.4.1", - "jest-mock": "^29.4.1" - } - }, - "@jest/reporters": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.4.1.tgz", - "integrity": "sha512-AISY5xpt2Xpxj9R6y0RF1+O6GRy9JsGa8+vK23Lmzdy1AYcpQn5ItX79wJSsTmfzPKSAcsY1LNt/8Y5Xe5LOSg==", - "dev": true, - "peer": true, - "requires": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@jridgewell/trace-mapping": "^0.3.15", - "@types/node": "*", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", - "slash": "^3.0.0", - "string-length": "^4.0.1", - "strip-ansi": "^6.0.0", - "v8-to-istanbul": "^9.0.1" - }, - "dependencies": { - "@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - } - } - }, - "@jest/schemas": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.0.tgz", - "integrity": "sha512-0E01f/gOZeNTG76i5eWWSupvSHaIINrTie7vCyjiYFKgzNdyEGd12BUv4oNBFHOqlHDbtoJi3HrQ38KCC90NsQ==", - "dev": true, - "requires": { - "@sinclair/typebox": "^0.25.16" - } - }, - "@jest/source-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.2.0.tgz", - "integrity": "sha512-1NX9/7zzI0nqa6+kgpSdKPK+WU1p+SJk3TloWZf5MzPbxri9UEeXX5bWZAPCzbQcyuAzubcdUHA7hcNznmRqWQ==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/trace-mapping": "^0.3.15", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" - }, - "dependencies": { - "@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - } - } - }, - "@jest/test-result": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.4.1.tgz", - "integrity": "sha512-WRt29Lwt+hEgfN8QDrXqXGgCTidq1rLyFqmZ4lmJOpVArC8daXrZWkWjiaijQvgd3aOUj2fM8INclKHsQW9YyQ==", - "dev": true, - "peer": true, - "requires": { - "@jest/console": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - } - }, - "@jest/test-sequencer": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.4.1.tgz", - "integrity": "sha512-v5qLBNSsM0eHzWLXsQ5fiB65xi49A3ILPSFQKPXzGL4Vyux0DPZAIN7NAFJa9b4BiTDP9MBF/Zqc/QA1vuiJ0w==", - "dev": true, - "peer": true, - "requires": { - "@jest/test-result": "^29.4.1", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "slash": "^3.0.0" - } - }, - "@jest/transform": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.4.1.tgz", - "integrity": "sha512-5w6YJrVAtiAgr0phzKjYd83UPbCXsBRTeYI4BXokv9Er9CcrH9hfXL/crCvP2d2nGOcovPUnlYiLPFLZrkG5Hg==", - "dev": true, - "peer": true, - "requires": { - "@babel/core": "^7.11.6", - "@jest/types": "^29.4.1", - "@jridgewell/trace-mapping": "^0.3.15", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", - "convert-source-map": "^2.0.0", - "fast-json-stable-stringify": "^2.1.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", - "slash": "^3.0.0", - "write-file-atomic": "^5.0.0" - }, - "dependencies": { - "@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - } - } - }, - "@jest/types": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.1.tgz", - "integrity": "sha512-zbrAXDUOnpJ+FMST2rV7QZOgec8rskg2zv8g2ajeqitp4tvZiyqTCYXANrKsM+ryj5o+LI+ZN2EgU9drrkiwSA==", - "dev": true, - "requires": { - "@jest/schemas": "^29.4.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - } - }, - "@jridgewell/gen-mapping": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", - "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/set-array": "^1.0.0", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "dev": true - }, - "@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, - "peer": true - }, - "@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true - }, - "@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "@sinclair/typebox": { - "version": "0.25.21", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", - "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==", - "dev": true - }, - "@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", - "dev": true, - "peer": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@sinonjs/fake-timers": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", - "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", - "dev": true, - "peer": true, - "requires": { - "@sinonjs/commons": "^2.0.0" - } - }, - "@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true - }, - "@types/babel__core": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", - "integrity": "sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ==", - "dev": true, - "peer": true, - "requires": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "@types/babel__generator": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", - "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", - "dev": true, - "peer": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@types/babel__template": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", - "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", - "dev": true, - "peer": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@types/babel__traverse": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.3.tgz", - "integrity": "sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w==", - "dev": true, - "peer": true, - "requires": { - "@babel/types": "^7.3.0" - } - }, - "@types/estree": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz", - "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==" - }, - "@types/graceful-fs": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", - "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", - "dev": true, - "peer": true, - "requires": { - "@types/node": "*" - } - }, - "@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", - "dev": true - }, - "@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*" - } - }, - "@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", - "dev": true, - "requires": { - "@types/istanbul-lib-report": "*" - } - }, - "@types/jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.4.0.tgz", - "integrity": "sha512-VaywcGQ9tPorCX/Jkkni7RWGFfI11whqzs8dvxF41P17Z+z872thvEvlIbznjPJ02kl1HMX3LmLOonsj2n7HeQ==", - "dev": true, - "requires": { - "expect": "^29.0.0", - "pretty-format": "^29.0.0" - } - }, - "@types/node": { - "version": "18.11.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.13.tgz", - "integrity": "sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==", - "dev": true - }, - "@types/prettier": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", - "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", - "dev": true, - "peer": true - }, - "@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", - "dev": true - }, - "@types/yargs": { - "version": "17.0.22", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz", - "integrity": "sha512-pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g==", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "@types/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", - "dev": true - }, - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, - "acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", - "dev": true - }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true - }, - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "peer": true, - "requires": { - "type-fest": "^0.21.3" - } - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "peer": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "peer": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "babel-jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.4.1.tgz", - "integrity": "sha512-xBZa/pLSsF/1sNpkgsiT3CmY7zV1kAsZ9OxxtrFqYucnOuRftXAfcJqcDVyOPeN4lttWTwhLdu0T9f8uvoPEUg==", - "dev": true, - "peer": true, - "requires": { - "@jest/transform": "^29.4.1", - "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.4.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "slash": "^3.0.0" - } - }, - "babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - } - }, - "babel-plugin-jest-hoist": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.4.0.tgz", - "integrity": "sha512-a/sZRLQJEmsmejQ2rPEUe35nO1+C9dc9O1gplH1SXmJxveQSRUYdBk8yGZG/VOUuZs1u2aHZJusEGoRMbhhwCg==", - "dev": true, - "peer": true, - "requires": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.1.14", - "@types/babel__traverse": "^7.0.6" - } - }, - "babel-preset-current-node-syntax": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", - "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", - "dev": true, - "peer": true, - "requires": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" - } - }, - "babel-preset-jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.4.0.tgz", - "integrity": "sha512-fUB9vZflUSM3dO/6M2TCAepTzvA4VkOvl67PjErcrQMGt9Eve7uazaeyCZ2th3UtI7ljpiBJES0F7A1vBRsLZA==", - "dev": true, - "peer": true, - "requires": { - "babel-plugin-jest-hoist": "^29.4.0", - "babel-preset-current-node-syntax": "^1.0.0" - } - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "requires": { - "fill-range": "^7.1.1" - } - }, - "browserslist": { - "version": "4.21.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", - "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", - "dev": true, - "peer": true, - "requires": { - "caniuse-lite": "^1.0.30001449", - "electron-to-chromium": "^1.4.284", - "node-releases": "^2.0.8", - "update-browserslist-db": "^1.0.10" - } - }, - "bs-logger": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "dev": true, - "requires": { - "fast-json-stable-stringify": "2.x" - } - }, - "bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "peer": true, - "requires": { - "node-int64": "^0.4.0" - } - }, - "buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true, - "peer": true - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "peer": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "peer": true - }, - "caniuse-lite": { - "version": "1.0.30001450", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001450.tgz", - "integrity": "sha512-qMBmvmQmFXaSxexkjjfMvD5rnDL0+m+dUMZKoDYsGG8iZN29RuYh9eRoMvKsT6uMAWlyUUGDEQGJJYjzCIO9ew==", - "dev": true, - "peer": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "char-regex": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", - "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", - "dev": true, - "peer": true - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "ci-info": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.7.1.tgz", - "integrity": "sha512-4jYS4MOAaCIStSRwiuxc4B8MYhIe676yO1sYGzARnjXkWpmzZMMYxY6zu8WYWDhSuth5zhrQ1rhNSibyyvv4/w==", - "dev": true - }, - "cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", - "dev": true, - "peer": true - }, - "cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "peer": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - } - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", - "dev": true, - "peer": true - }, - "collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", - "dev": true, - "peer": true - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "peer": true - }, - "create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "peer": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", - "dev": true, - "peer": true - }, - "deepmerge": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.0.tgz", - "integrity": "sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==", - "dev": true, - "peer": true - }, - "detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true, - "peer": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "diff-sequences": { - "version": "29.3.1", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz", - "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==", - "dev": true - }, - "electron-to-chromium": { - "version": "1.4.286", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.286.tgz", - "integrity": "sha512-Vp3CVhmYpgf4iXNKAucoQUDcCrBQX3XLBtwgFqP9BUXuucgvAV9zWp1kYU7LL9j4++s9O+12cb3wMtN4SJy6UQ==", - "dev": true, - "peer": true - }, - "emittery": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", - "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", - "dev": true, - "peer": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "peer": true - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "peer": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "peer": true - }, - "escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "peer": true - }, - "execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "peer": true, - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - } - }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", - "dev": true, - "peer": true - }, - "expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-OKrGESHOaMxK3b6zxIq9SOW8kEXztKff/Dvg88j4xIJxur1hspEbedVkR3GpHe5LO+WB2Qw7OWN0RMTdp6as5A==", - "dev": true, - "requires": { - "@jest/expect-utils": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1" - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-3.0.0.tgz", - "integrity": "sha512-hKKNajm46uNmTlhHSyZkmToAc56uZJwYq7yrciZjqOxnlfQwERDQJmHPUp7m1m9wx8vgOe8IaCKZ5Kv2k1DdCQ==", - "requires": { - "fastest-levenshtein": "^1.0.7" - } - }, - "fastest-levenshtein": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==" - }, - "fb-watchman": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", - "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", - "dev": true, - "peer": true, - "requires": { - "bser": "2.1.1" - } - }, - "fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "peer": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true, - "peer": true - }, - "gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "peer": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "peer": true - }, - "get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true, - "peer": true - }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "peer": true - }, - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, - "peer": true - }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "peer": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true - }, - "html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true, - "peer": true - }, - "human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "peer": true - }, - "ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", - "dev": true - }, - "import-local": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", - "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", - "dev": true, - "peer": true, - "requires": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "peer": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true, - "peer": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", - "dev": true, - "peer": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "peer": true - }, - "is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true, - "peer": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "peer": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "peer": true - }, - "istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true, - "peer": true - }, - "istanbul-lib-instrument": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", - "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", - "dev": true, - "peer": true, - "requires": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "peer": true - } - } - }, - "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "peer": true, - "requires": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "peer": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "peer": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", - "dev": true, - "peer": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "peer": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true, - "peer": true - } - } - }, - "istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", - "dev": true, - "peer": true, - "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - } - }, - "jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.4.1.tgz", - "integrity": "sha512-cknimw7gAXPDOmj0QqztlxVtBVCw2lYY9CeIE5N6kD+kET1H4H79HSNISJmijb1HF+qk+G+ploJgiDi5k/fRlg==", - "dev": true, - "peer": true, - "requires": { - "@jest/core": "^29.4.1", - "@jest/types": "^29.4.1", - "import-local": "^3.0.2", - "jest-cli": "^29.4.1" - } - }, - "jest-changed-files": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.4.0.tgz", - "integrity": "sha512-rnI1oPxgFghoz32Y8eZsGJMjW54UlqT17ycQeCEktcxxwqqKdlj9afl8LNeO0Pbu+h2JQHThQP0BzS67eTRx4w==", - "dev": true, - "peer": true, - "requires": { - "execa": "^5.0.0", - "p-limit": "^3.1.0" - } - }, - "jest-circus": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.4.1.tgz", - "integrity": "sha512-v02NuL5crMNY4CGPHBEflLzl4v91NFb85a+dH9a1pUNx6Xjggrd8l9pPy4LZ1VYNRXlb+f65+7O/MSIbLir6pA==", - "dev": true, - "peer": true, - "requires": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "dedent": "^0.7.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "p-limit": "^3.1.0", - "pretty-format": "^29.4.1", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - } - }, - "jest-cli": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.4.1.tgz", - "integrity": "sha512-jz7GDIhtxQ37M+9dlbv5K+/FVcIo1O/b1sX3cJgzlQUf/3VG25nvuWzlDC4F1FLLzUThJeWLu8I7JF9eWpuURQ==", - "dev": true, - "peer": true, - "requires": { - "@jest/core": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "import-local": "^3.0.2", - "jest-config": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "prompts": "^2.0.1", - "yargs": "^17.3.1" - } - }, - "jest-config": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.4.1.tgz", - "integrity": "sha512-g7p3q4NuXiM4hrS4XFATTkd+2z0Ml2RhFmFPM8c3WyKwVDNszbl4E7cV7WIx1YZeqqCtqbtTtZhGZWJlJqngzg==", - "dev": true, - "peer": true, - "requires": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.4.1", - "@jest/types": "^29.4.1", - "babel-jest": "^29.4.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.4.1", - "jest-environment-node": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "micromatch": "^4.0.4", - "parse-json": "^5.2.0", - "pretty-format": "^29.4.1", - "slash": "^3.0.0", - "strip-json-comments": "^3.1.1" - } - }, - "jest-diff": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.1.tgz", - "integrity": "sha512-uazdl2g331iY56CEyfbNA0Ut7Mn2ulAG5vUaEHXycf1L6IPyuImIxSz4F0VYBKi7LYIuxOwTZzK3wh5jHzASMw==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "diff-sequences": "^29.3.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" - } - }, - "jest-docblock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.2.0.tgz", - "integrity": "sha512-bkxUsxTgWQGbXV5IENmfiIuqZhJcyvF7tU4zJ/7ioTutdz4ToB5Yx6JOFBpgI+TphRY4lhOyCWGNH/QFQh5T6A==", - "dev": true, - "peer": true, - "requires": { - "detect-newline": "^3.0.0" - } - }, - "jest-each": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.4.1.tgz", - "integrity": "sha512-QlYFiX3llJMWUV0BtWht/esGEz9w+0i7BHwODKCze7YzZzizgExB9MOfiivF/vVT0GSQ8wXLhvHXh3x2fVD4QQ==", - "dev": true, - "peer": true, - "requires": { - "@jest/types": "^29.4.1", - "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "jest-util": "^29.4.1", - "pretty-format": "^29.4.1" - } - }, - "jest-environment-node": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.4.1.tgz", - "integrity": "sha512-x/H2kdVgxSkxWAIlIh9MfMuBa0hZySmfsC5lCsWmWr6tZySP44ediRKDUiNggX/eHLH7Cd5ZN10Rw+XF5tXsqg==", - "dev": true, - "peer": true, - "requires": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/node": "*", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" - } - }, - "jest-get-type": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", - "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", - "dev": true - }, - "jest-haste-map": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.4.1.tgz", - "integrity": "sha512-imTjcgfVVTvg02khXL11NNLTx9ZaofbAWhilrMg/G8dIkp+HYCswhxf0xxJwBkfhWb3e8dwbjuWburvxmcr58w==", - "dev": true, - "peer": true, - "requires": { - "@jest/types": "^29.4.1", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.3.2", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", - "micromatch": "^4.0.4", - "walker": "^1.0.8" - } - }, - "jest-leak-detector": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.4.1.tgz", - "integrity": "sha512-akpZv7TPyGMnH2RimOCgy+hPmWZf55EyFUvymQ4LMsQP8xSPlZumCPtXGoDhFNhUE2039RApZkTQDKU79p/FiQ==", - "dev": true, - "peer": true, - "requires": { - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" - } - }, - "jest-matcher-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.1.tgz", - "integrity": "sha512-k5h0u8V4nAEy6lSACepxL/rw78FLDkBnXhZVgFneVpnJONhb2DhZj/Gv4eNe+1XqQ5IhgUcqj745UwH0HJmMnA==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" - } - }, - "jest-message-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.1.tgz", - "integrity": "sha512-H4/I0cXUaLeCw6FM+i4AwCnOwHRgitdaUFOdm49022YD5nfyr8C/DrbXOBEyJaj+w/y0gGJ57klssOaUiLLQGQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.4.1", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - } - }, - "jest-mock": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.4.1.tgz", - "integrity": "sha512-MwA4hQ7zBOcgVCVnsM8TzaFLVUD/pFWTfbkY953Y81L5ret3GFRZtmPmRFAjKQSdCKoJvvqOu6Bvfpqlwwb0dQ==", - "dev": true, - "peer": true, - "requires": { - "@jest/types": "^29.4.1", - "@types/node": "*", - "jest-util": "^29.4.1" - } - }, - "jest-pnp-resolver": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", - "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", - "dev": true, - "peer": true, - "requires": {} - }, - "jest-regex-util": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.2.0.tgz", - "integrity": "sha512-6yXn0kg2JXzH30cr2NlThF+70iuO/3irbaB4mh5WyqNIvLLP+B6sFdluO1/1RJmslyh/f9osnefECflHvTbwVA==", - "dev": true, - "peer": true - }, - "jest-resolve": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.4.1.tgz", - "integrity": "sha512-j/ZFNV2lm9IJ2wmlq1uYK0Y/1PiyDq9g4HEGsNTNr3viRbJdV+8Lf1SXIiLZXFvyiisu0qUyIXGBnw+OKWkJwQ==", - "dev": true, - "peer": true, - "requires": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "resolve": "^1.20.0", - "resolve.exports": "^2.0.0", - "slash": "^3.0.0" - } - }, - "jest-resolve-dependencies": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.4.1.tgz", - "integrity": "sha512-Y3QG3M1ncAMxfjbYgtqNXC5B595zmB6e//p/qpA/58JkQXu/IpLDoLeOa8YoYfsSglBKQQzNUqtfGJJT/qLmJg==", - "dev": true, - "peer": true, - "requires": { - "jest-regex-util": "^29.2.0", - "jest-snapshot": "^29.4.1" - } - }, - "jest-runner": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.4.1.tgz", - "integrity": "sha512-8d6XXXi7GtHmsHrnaqBKWxjKb166Eyj/ksSaUYdcBK09VbjPwIgWov1VwSmtupCIz8q1Xv4Qkzt/BTo3ZqiCeg==", - "dev": true, - "peer": true, - "requires": { - "@jest/console": "^29.4.1", - "@jest/environment": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.2.0", - "jest-environment-node": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-leak-detector": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-resolve": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-util": "^29.4.1", - "jest-watcher": "^29.4.1", - "jest-worker": "^29.4.1", - "p-limit": "^3.1.0", - "source-map-support": "0.5.13" - } - }, - "jest-runtime": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.4.1.tgz", - "integrity": "sha512-UXTMU9uKu2GjYwTtoAw5rn4STxWw/nadOfW7v1sx6LaJYa3V/iymdCLQM6xy3+7C6mY8GfX22vKpgxY171UIoA==", - "dev": true, - "peer": true, - "requires": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/globals": "^29.4.1", - "@jest/source-map": "^29.2.0", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/node": "*", - "chalk": "^4.0.0", - "cjs-module-lexer": "^1.0.0", - "collect-v8-coverage": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "semver": "^7.3.5", - "slash": "^3.0.0", - "strip-bom": "^4.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "peer": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "peer": true - } - } - }, - "jest-snapshot": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.4.1.tgz", - "integrity": "sha512-l4iV8EjGgQWVz3ee/LR9sULDk2pCkqb71bjvlqn+qp90lFwpnulHj4ZBT8nm1hA1C5wowXLc7MGnw321u0tsYA==", - "dev": true, - "peer": true, - "requires": { - "@babel/core": "^7.11.6", - "@babel/generator": "^7.7.2", - "@babel/plugin-syntax-jsx": "^7.7.2", - "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", - "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", - "babel-preset-current-node-syntax": "^1.0.0", - "chalk": "^4.0.0", - "expect": "^29.4.1", - "graceful-fs": "^4.2.9", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-haste-map": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", - "natural-compare": "^1.4.0", - "pretty-format": "^29.4.1", - "semver": "^7.3.5" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "peer": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "peer": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "peer": true - } - } - }, - "jest-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.1.tgz", - "integrity": "sha512-bQy9FPGxVutgpN4VRc0hk6w7Hx/m6L53QxpDreTZgJd9gfx/AV2MjyPde9tGyZRINAUrSv57p2inGBu2dRLmkQ==", - "dev": true, - "requires": { - "@jest/types": "^29.4.1", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - } - }, - "jest-validate": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.4.1.tgz", - "integrity": "sha512-qNZXcZQdIQx4SfUB/atWnI4/I2HUvhz8ajOSYUu40CSmf9U5emil8EDHgE7M+3j9/pavtk3knlZBDsgFvv/SWw==", - "dev": true, - "peer": true, - "requires": { - "@jest/types": "^29.4.1", - "camelcase": "^6.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "leven": "^3.1.0", - "pretty-format": "^29.4.1" - }, - "dependencies": { - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "peer": true - } - } - }, - "jest-watcher": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.4.1.tgz", - "integrity": "sha512-vFOzflGFs27nU6h8dpnVRER3O2rFtL+VMEwnG0H3KLHcllLsU8y9DchSh0AL/Rg5nN1/wSiQ+P4ByMGpuybaVw==", - "dev": true, - "peer": true, - "requires": { - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "jest-util": "^29.4.1", - "string-length": "^4.0.1" - } - }, - "jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", - "dev": true, - "peer": true, - "requires": { - "@types/node": "*", - "jest-util": "^29.4.1", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "peer": true - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "peer": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "peer": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true, - "peer": true - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true, - "peer": true - }, - "json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true - }, - "kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true, - "peer": true - }, - "leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true, - "peer": true - }, - "lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true, - "peer": true - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "peer": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", - "dev": true - }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "peer": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "peer": true, - "requires": { - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "peer": true - } - } - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "makeerror": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", - "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", - "dev": true, - "peer": true, - "requires": { - "tmpl": "1.0.5" - } - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true, - "peer": true - }, - "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "peer": true - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true, - "peer": true - }, - "node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "dev": true, - "peer": true - }, - "node-releases": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.9.tgz", - "integrity": "sha512-2xfmOrRkGogbTK9R6Leda0DGiXeY3p2NJpy4+gNCffdUvV6mdEJnaDEic1i3Ec2djAo8jWYoJMR5PB0MSMpxUA==", - "dev": true, - "peer": true - }, - "nodemon": { - "version": "2.0.20", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz", - "integrity": "sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==", - "dev": true, - "requires": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "simple-update-notifier": "^1.0.7", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - } - }, - "nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", - "dev": true, - "requires": { - "abbrev": "1" - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "peer": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "peer": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "peer": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "peer": true, - "requires": { - "p-limit": "^2.2.0" - }, - "dependencies": { - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "peer": true, - "requires": { - "p-try": "^2.0.0" - } - } - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "peer": true - }, - "parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, - "peer": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "peer": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "peer": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true, - "peer": true - }, - "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", - "dev": true, - "peer": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "peer": true, - "requires": { - "find-up": "^4.0.0" - } - }, - "pretty-format": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.1.tgz", - "integrity": "sha512-dt/Z761JUVsrIKaY215o1xQJBGlSmTx/h4cSqXqjHLnU1+Kt+mavVE7UgqJJO5ukx5HjSswHfmXz4LjS2oIJfg==", - "dev": true, - "requires": { - "@jest/schemas": "^29.4.0", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true - } - } - }, - "prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "dev": true, - "peer": true, - "requires": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - } - }, - "pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true - }, - "react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "peer": true - }, - "resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", - "dev": true, - "peer": true, - "requires": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, - "resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "peer": true, - "requires": { - "resolve-from": "^5.0.0" - } - }, - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "peer": true - }, - "resolve.exports": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.0.tgz", - "integrity": "sha512-6K/gDlqgQscOlg9fSRpWstA8sYe8rbELsSTNpx+3kTrsVCzvSl0zIvRErM7fdl9ERWDsKnrLnwB+Ne89918XOg==", - "dev": true, - "peer": true - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "peer": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "peer": true - }, - "signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, - "peer": true - }, - "simple-update-notifier": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", - "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", - "dev": true, - "requires": { - "semver": "~7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "dev": true - } - } - }, - "sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", - "dev": true, - "peer": true - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "peer": true - }, - "source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", - "dev": true, - "peer": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true, - "peer": true - }, - "stack-utils": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", - "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", - "dev": true, - "requires": { - "escape-string-regexp": "^2.0.0" - } - }, - "string-length": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", - "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", - "dev": true, - "peer": true, - "requires": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - } - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "peer": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "peer": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true, - "peer": true - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "peer": true - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "peer": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "peer": true - }, - "test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "peer": true, - "requires": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - } - }, - "tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", - "dev": true, - "peer": true - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "peer": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "touch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dev": true, - "requires": { - "nopt": "~1.0.10" - } - }, - "ts-jest": { - "version": "29.0.5", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.0.5.tgz", - "integrity": "sha512-PL3UciSgIpQ7f6XjVOmbi96vmDHUqAyqDr8YxzopDqX3kfgYtX1cuNeBjP+L9sFXi6nzsGGA6R3fP3DDDJyrxA==", - "dev": true, - "requires": { - "bs-logger": "0.x", - "fast-json-stable-stringify": "2.x", - "jest-util": "^29.0.0", - "json5": "^2.2.3", - "lodash.memoize": "4.x", - "make-error": "1.x", - "semver": "7.x", - "yargs-parser": "^21.0.1" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "requires": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "peer": true - }, - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "peer": true - }, - "typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", - "dev": true - }, - "undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true - }, - "update-browserslist-db": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", - "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", - "dev": true, - "peer": true, - "requires": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" - } - }, - "v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, - "v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0" - }, - "dependencies": { - "@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", - "dev": true, - "peer": true, - "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - }, - "convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true, - "peer": true - } - } - }, - "walker": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", - "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", - "dev": true, - "peer": true, - "requires": { - "makeerror": "1.0.12" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "peer": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "peer": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "write-file-atomic": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.0.tgz", - "integrity": "sha512-R7NYMnHSlV42K54lwY9lvW6MnSm1HSJqZL3xiSgi9E7//FYaI74r2G0rd+/X6VAMkHEdzxQaU5HUOXWUz5kA/w==", - "dev": true, - "peer": true, - "requires": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - } - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "peer": true - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "peer": true - }, - "yargs": { - "version": "17.6.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", - "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", - "dev": true, - "peer": true, - "requires": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - } - }, - "yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true - }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "peer": true } } } diff --git a/package.json b/package.json index 3f78cbd..e6f4c37 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,16 @@ { - "name": "py-slang", + "name": "py-slang-test-pac", + "packageManager": "yarn@1.22.22", "version": "1.0.0", "description": "", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { - "regen": "npm run build && node build/generate.js", + "regen": "npm run build && node dist/generate.js", "start:dev": "npx nodemon", - "build": "rimraf ./build && tsc", - "start": "npm run build && node build/index.js", + "build": "rollup -c --bundleConfigAsCjs", + "start": "npm run build && node dist/index.js", + "jsdoc": "./scripts/jsdoc.sh", "test": "jest" }, "keywords": [ @@ -22,16 +24,30 @@ }, "license": "Apache-2.0", "devDependencies": { + "@rollup/plugin-commonjs": "^28.0.3", + "@rollup/plugin-node-resolve": "^16.0.1", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^12.1.2", + "@types/fast-levenshtein": "^0.0.4", "@types/jest": "^29.4.0", - "@types/node": "^18.11.13", + "@types/mathjs": "^9.4.1", + "@types/node": "^18.19.84", + "glob": "^11.0.1", + "jest": "^29.7.0", + "jsdoc": "^4.0.4", "nodemon": "^2.0.20", "rimraf": "^3.0.2", + "rollup": "^4.38.0", + "rollup-plugin-modify": "^3.0.0", + "taffydb": "^2.7.3", "ts-jest": "^29.0.5", "ts-node": "^10.9.1", - "typescript": "^4.9.4" + "tslib": "^2.8.1", + "typescript": "^5.5.3" }, "dependencies": { "@types/estree": "^1.0.0", - "fast-levenshtein": "^3.0.0" + "fast-levenshtein": "^3.0.0", + "mathjs": "^14.4.0" } } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..ddb8381 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,25 @@ +import resolve from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import typescript from '@rollup/plugin-typescript'; + +/** + * @type {import('rollup').RollupOptions} + */ +const config = { + input: 'src/index.ts', + output: { + file: 'dist/index.js', + format: 'umd', + name: 'PySlangRunner', + sourcemap: true + }, + plugins: [ + resolve(), + commonjs(), + typescript({ + tsconfig: './tsconfig.json' + }) + ] +}; + +export default config; diff --git a/scripts/jsdoc.sh b/scripts/jsdoc.sh new file mode 100755 index 0000000..fa94d66 --- /dev/null +++ b/scripts/jsdoc.sh @@ -0,0 +1,66 @@ +#! /usr/bin/env bash + +set -e + +JSDOC="node_modules/.bin/jsdoc" +TMPL="docs/jsdoc/templates/template" +DST="docs/python" +MD="docs/md" +LIB="docs/lib" +SPECS="docs/python/specs" + +main() { + + if [ "$1" == "prepare" ]; then + prepare + elif [ "$1" == "clean" ]; then + clean + elif [[ "$(git rev-parse --show-toplevel 2> /dev/null)" -ef "$PWD" ]]; then + run + else + echo "Please run this command from the git root directory." + false # exit 1 + fi +} + +run() { + + # Source §1 + + ${JSDOC} -r -t ${TMPL} \ + -c docs/jsdoc/conf.json \ + -R ${MD}/README_1.md \ + -d ${DST}/"python_1"/ \ + ${LIB}/misc.js \ + ${LIB}/math.js + + # # MISC + + # ${JSDOC} -r -t ${TMPL} \ + # -c docs/jsdoc/conf.json \ + # -R ${MD}/README_MISC.md \ + # -d ${DST}/MISC/ \ + # ${LIB}/misc.js + + # # MATH + + # ${JSDOC} -r -t ${TMPL} \ + # -c docs/jsdoc/conf.json \ + # -R ${MD}/README_MATH.md \ + # -d ${DST}/MATH/ \ + # ${LIB}/math.js +} + +prepare() { + run + cp -r docs/images ${DST} ; \ + cd ${SPECS}; make; cp *.pdf ../source; cd ../.. +} + +clean() { + + rm -rf ${DST}/* + +} + +main $1 diff --git a/src/ast-types.ts b/src/ast-types.ts index 7637799..17b3a6e 100644 --- a/src/ast-types.ts +++ b/src/ast-types.ts @@ -1,5 +1,6 @@ // This file is autogenerated by generate-ast.ts. DO NOT EDIT THIS FILE DIRECTLY. import {Token} from "./tokenizer"; +import { PyComplexNumber } from "./types"; export namespace ExprNS { export interface Visitor { @@ -15,6 +16,8 @@ export namespace ExprNS { visitMultiLambdaExpr(expr: MultiLambda): T visitVariableExpr(expr: Variable): T visitCallExpr(expr: Call): T + visitComplexExpr(expr: Complex): T + visitNoneExpr(expr: None): T } export abstract class Expr { startToken: Token; @@ -25,6 +28,14 @@ export namespace ExprNS { } abstract accept(visitor: Visitor): any; } + export class None extends Expr { + constructor(startToken: Token, endToken: Token, value: string = "None") { + super(startToken, endToken); + } + override accept(visitor: Visitor): any { + return visitor.visitNoneExpr(this); + } + } export class BigIntLiteral extends Expr { value: string; constructor(startToken: Token, endToken: Token, value: string){ @@ -35,6 +46,16 @@ export namespace ExprNS { return visitor.visitBigIntLiteralExpr(this) } } + export class Complex extends Expr { + value: PyComplexNumber; + constructor(startToken: Token, endToken: Token, value: string) { + super(startToken, endToken); + this.value = PyComplexNumber.fromString(value);; + } + override accept(visitor: Visitor): T { + return visitor.visitComplexExpr(this); + } + } export class Binary extends Expr { left: Expr; operator: Token; diff --git a/src/common/Constant.ts b/src/common/Constant.ts new file mode 100644 index 0000000..d3c41ef --- /dev/null +++ b/src/common/Constant.ts @@ -0,0 +1,4 @@ +export const enum Constant { + PROTOCOL_VERSION = 0, + PROTOCOL_MIN_VERSION = 0, +} diff --git a/src/common/ds/MessageQueue.ts b/src/common/ds/MessageQueue.ts new file mode 100644 index 0000000..9d5ad08 --- /dev/null +++ b/src/common/ds/MessageQueue.ts @@ -0,0 +1,27 @@ +import { Queue } from "./Queue"; + +export class MessageQueue { + private readonly __inputQueue: Queue = new Queue(); + private readonly __promiseQueue: Queue = new Queue(); + + push(item: T) { + if (this.__promiseQueue.length !== 0) this.__promiseQueue.pop()(item); + else this.__inputQueue.push(item); + } + + async pop(): Promise { + if (this.__inputQueue.length !== 0) return this.__inputQueue.pop(); + return new Promise((resolve, _reject) => { + this.__promiseQueue.push(resolve); + }); + } + + tryPop(): T | undefined { + if (this.__inputQueue.length !== 0) return this.__inputQueue.pop(); + return undefined; + } + + constructor() { + this.push = this.push.bind(this); + } +} diff --git a/src/common/ds/Queue.ts b/src/common/ds/Queue.ts new file mode 100644 index 0000000..da9b850 --- /dev/null +++ b/src/common/ds/Queue.ts @@ -0,0 +1,51 @@ +/** + * A stack-based queue implementation. + * `push` and `pop` run in amortized constant time. + */ +export class Queue { + /** The output stack. */ + private __s1: T[] = []; + /** The input stack. */ + private __s2: T[] = []; + + /** + * Adds an item to the queue. + * @param item The item to be added to the queue. + */ + push(item: T) { + this.__s2.push(item); + } + + /** + * Removes an item from the queue. + * @returns The item removed from the queue. + * @throws If the queue is empty. + */ + pop(): T { + if (this.__s1.length === 0) { + if (this.__s2.length === 0) throw new Error("queue is empty"); + let temp = this.__s1; + this.__s1 = this.__s2.reverse(); + this.__s2 = temp; + } + return this.__s1.pop()!; // as the length is nonzero + } + + /** + * The length of the queue. + */ + get length() { + return this.__s1.length + this.__s2.length; + } + + /** + * Makes a copy of the queue. + * @returns A copy of the queue. + */ + clone(): Queue { + const newQueue = new Queue(); + newQueue.__s1 = [...this.__s1]; + newQueue.__s2 = [...this.__s2]; + return newQueue; + } +} diff --git a/src/common/ds/index.ts b/src/common/ds/index.ts new file mode 100644 index 0000000..4f75299 --- /dev/null +++ b/src/common/ds/index.ts @@ -0,0 +1,2 @@ +export { MessageQueue } from "./MessageQueue"; +export { Queue } from "./Queue"; diff --git a/src/common/errors/ConductorError.ts b/src/common/errors/ConductorError.ts new file mode 100644 index 0000000..7e3e740 --- /dev/null +++ b/src/common/errors/ConductorError.ts @@ -0,0 +1,13 @@ +import { ErrorType } from "./ErrorType"; + +/** + * Generic Conductor Error. + */ +export class ConductorError extends Error { + override name = "ConductorError"; + readonly errorType: ErrorType | string = ErrorType.UNKNOWN; + + constructor(message: string) { + super(message); + } +} diff --git a/src/common/errors/ConductorInternalError.ts b/src/common/errors/ConductorInternalError.ts new file mode 100644 index 0000000..b2f635b --- /dev/null +++ b/src/common/errors/ConductorInternalError.ts @@ -0,0 +1,14 @@ +import { ConductorError } from "./ConductorError"; +import { ErrorType } from "./ErrorType"; + +/** + * Conductor internal error, probably caused by developer oversight. + */ +export class ConductorInternalError extends ConductorError { + override name = "ConductorInternalError"; + override readonly errorType: ErrorType | string = ErrorType.INTERNAL; + + constructor(message: string) { + super(message); + } +} diff --git a/src/common/errors/ErrorType.ts b/src/common/errors/ErrorType.ts new file mode 100644 index 0000000..2f49c20 --- /dev/null +++ b/src/common/errors/ErrorType.ts @@ -0,0 +1,8 @@ +export const enum ErrorType { + UNKNOWN = "__unknown", + INTERNAL = "__internal", + EVALUATOR = "__evaluator", + EVALUATOR_SYNTAX = "__evaluator_syntax", + EVALUATOR_TYPE = "__evaluator_type", + EVALUATOR_RUNTIME = "__evaluator_runtime", +} diff --git a/src/common/errors/EvaluatorError.ts b/src/common/errors/EvaluatorError.ts new file mode 100644 index 0000000..50f393d --- /dev/null +++ b/src/common/errors/EvaluatorError.ts @@ -0,0 +1,26 @@ +import { ConductorError } from "./ConductorError"; +import { ErrorType } from "./ErrorType"; + +/** + * Generic evaluation error, caused by a problem in user code. + */ +export class EvaluatorError extends ConductorError { + override name = "EvaluatorError"; + override readonly errorType: ErrorType | string = ErrorType.EVALUATOR; + + readonly rawMessage: string; + readonly line?: number; + readonly column?: number; + readonly fileName?: string + + constructor(message: string, line?: number, column?: number, fileName?: string) { + const location = line !== undefined + ? `${fileName ? fileName + ":" : ""}${line}${column !== undefined ? ":" + column : ""}: ` + : ""; + super(`${location}${message}`); + this.rawMessage = message; + this.line = line; + this.column = column; + this.fileName = fileName + } +} diff --git a/src/common/errors/EvaluatorRuntimeError.ts b/src/common/errors/EvaluatorRuntimeError.ts new file mode 100644 index 0000000..f743c96 --- /dev/null +++ b/src/common/errors/EvaluatorRuntimeError.ts @@ -0,0 +1,10 @@ +import { ErrorType } from "./ErrorType"; +import { EvaluatorError } from "./EvaluatorError"; + +/** + * Evaluator runtime error - some problem occurred while running the user code. + */ +export class EvaluatorRuntimeError extends EvaluatorError { + override name = "EvaluatorRuntimeError"; + override readonly errorType: ErrorType | string = ErrorType.EVALUATOR_RUNTIME; +} diff --git a/src/common/errors/EvaluatorSyntaxError.ts b/src/common/errors/EvaluatorSyntaxError.ts new file mode 100644 index 0000000..b3e210d --- /dev/null +++ b/src/common/errors/EvaluatorSyntaxError.ts @@ -0,0 +1,10 @@ +import { ErrorType } from "./ErrorType"; +import { EvaluatorError } from "./EvaluatorError"; + +/** + * Evaluator syntax error - the user code does not follow the evaluator's prescribed syntax. + */ +export class EvaluatorSyntaxError extends EvaluatorError { + override name = "EvaluatorSyntaxError"; + override readonly errorType: ErrorType | string = ErrorType.EVALUATOR_SYNTAX; +} diff --git a/src/common/errors/EvaluatorTypeError.ts b/src/common/errors/EvaluatorTypeError.ts new file mode 100644 index 0000000..360b110 --- /dev/null +++ b/src/common/errors/EvaluatorTypeError.ts @@ -0,0 +1,22 @@ +import { ConductorError } from "./ConductorError"; +import { ErrorType } from "./ErrorType"; +import { EvaluatorError } from "./EvaluatorError"; + +/** + * Evaluator type error - the user code is not well typed or provides values of incorrect type to external functions. + */ +export class EvaluatorTypeError extends EvaluatorError { + override name = "EvaluatorTypeError"; + override readonly errorType: ErrorType | string = ErrorType.EVALUATOR_TYPE; + + override readonly rawMessage: string; + readonly expected: string; + readonly actual: string; + + constructor(message: string, expected: string, actual: string, line?: number, column?: number, fileName?: string) { + super(`${message} (expected ${expected}, got ${actual})`, line, column, fileName); + this.rawMessage = message; + this.expected = expected; + this.actual = actual; + } +} diff --git a/src/common/errors/index.ts b/src/common/errors/index.ts new file mode 100644 index 0000000..e060bb0 --- /dev/null +++ b/src/common/errors/index.ts @@ -0,0 +1,4 @@ +export { ConductorError } from "./ConductorError"; +export { ConductorInternalError } from "./ConductorInternalError"; +export { ErrorType } from "./ErrorType"; +export { EvaluatorTypeError } from "./EvaluatorTypeError"; diff --git a/src/common/util/InvalidModuleError.ts b/src/common/util/InvalidModuleError.ts new file mode 100644 index 0000000..df626af --- /dev/null +++ b/src/common/util/InvalidModuleError.ts @@ -0,0 +1,10 @@ +import { ConductorError } from "../errors"; + +export class InvalidModuleError extends ConductorError { + override name = "InvalidModuleError"; + override readonly errorType = "__invalidmodule"; + + constructor() { + super("Not a module"); + } +} diff --git a/src/common/util/importExternalModule.ts b/src/common/util/importExternalModule.ts new file mode 100644 index 0000000..c91e3c8 --- /dev/null +++ b/src/common/util/importExternalModule.ts @@ -0,0 +1,14 @@ +import type { IModulePlugin } from "../../conductor/module"; +import { PluginClass } from "../../conduit/types"; +import { importExternalPlugin } from "./importExternalPlugin"; + +/** + * Imports an external module from a given location. + * @param location Where to find the external module. + * @returns A promise resolving to the imported module. + */ +export async function importExternalModule(location: string): Promise> { + const plugin = await importExternalPlugin(location) as PluginClass; + // TODO: additional verification it is a module + return plugin; +} diff --git a/src/common/util/importExternalPlugin.ts b/src/common/util/importExternalPlugin.ts new file mode 100644 index 0000000..4ae323f --- /dev/null +++ b/src/common/util/importExternalPlugin.ts @@ -0,0 +1,12 @@ +import { PluginClass } from "../../conduit/types"; + +/** + * Imports an external plugin from a given location. + * @param location Where to find the external plugin. + * @returns A promise resolving to the imported plugin. + */ +export async function importExternalPlugin(location: string): Promise { + const plugin = (await import(/* webpackIgnore: true */ location)).plugin as PluginClass; + // TODO: verify it is actually a plugin + return plugin; +} diff --git a/src/common/util/index.ts b/src/common/util/index.ts new file mode 100644 index 0000000..d25108c --- /dev/null +++ b/src/common/util/index.ts @@ -0,0 +1,3 @@ +export { importExternalModule } from "./importExternalModule"; +export { importExternalPlugin } from "./importExternalPlugin"; +export { InvalidModuleError } from "./InvalidModuleError"; diff --git a/src/conductor/host/BasicHostPlugin.ts b/src/conductor/host/BasicHostPlugin.ts new file mode 100644 index 0000000..dc3663e --- /dev/null +++ b/src/conductor/host/BasicHostPlugin.ts @@ -0,0 +1,112 @@ +import { Constant } from "../../common/Constant"; +import type { ConductorError } from "../../common/errors"; +import { importExternalPlugin } from "../../common/util"; +import { IChannel, IConduit, IPlugin } from "../../conduit"; +import { makeRpc } from "../../conduit/rpc"; +import { PluginClass } from "../../conduit/types"; +import { checkIsPluginClass } from "../../conduit/util"; +import { InternalChannelName, InternalPluginName } from "../strings"; +import { AbortServiceMessage, Chunk, EntryServiceMessage, HelloServiceMessage, IChunkMessage, IErrorMessage, IIOMessage, IServiceMessage, IStatusMessage, PluginServiceMessage, RunnerStatus } from "../types"; +import { ServiceMessageType } from "../types"; +import { IHostFileRpc, IHostPlugin } from "./types"; + +@checkIsPluginClass +export abstract class BasicHostPlugin implements IHostPlugin { + name = InternalPluginName.HOST_MAIN; + + private readonly __conduit: IConduit; + private readonly __chunkChannel: IChannel; + private readonly __serviceChannel: IChannel; + private readonly __ioChannel: IChannel; + + private readonly __status = new Map(); + + private __chunkCount: number = 0; + + // @ts-expect-error TODO: figure proper way to typecheck this + private readonly __serviceHandlers = new Map void>([ + [ServiceMessageType.HELLO, function helloServiceHandler(this: BasicHostPlugin, message: HelloServiceMessage) { + if (message.data.version < Constant.PROTOCOL_MIN_VERSION) { + this.__serviceChannel.send(new AbortServiceMessage(Constant.PROTOCOL_MIN_VERSION)); + console.error(`Runner's protocol version (${message.data.version}) must be at least ${Constant.PROTOCOL_MIN_VERSION}`); + } else { + console.log(`Runner is using protocol version ${message.data.version}`); + } + }], + [ServiceMessageType.ABORT, function abortServiceHandler(this: BasicHostPlugin, message: AbortServiceMessage) { + console.error(`Runner expects at least protocol version ${message.data.minVersion}, but we are on version ${Constant.PROTOCOL_VERSION}`); + this.__conduit.terminate(); + }], + [ServiceMessageType.PLUGIN, function pluginServiceHandler(this: BasicHostPlugin, message: PluginServiceMessage) { + const pluginName = message.data; + this.requestLoadPlugin(pluginName); + }] + ]); + + abstract requestFile(fileName: string): Promise; + + abstract requestLoadPlugin(pluginName: string): void; + + startEvaluator(entryPoint: string): void { + this.__serviceChannel.send(new EntryServiceMessage(entryPoint)); + } + + sendChunk(chunk: Chunk): void { + this.__chunkChannel.send({ id: this.__chunkCount++, chunk }); + } + + sendInput(message: string): void { + this.__ioChannel.send({ message }); + } + + receiveOutput?(message: string): void; + + receiveError?(message: ConductorError): void; + + isStatusActive(status: RunnerStatus): boolean { + return this.__status.get(status) ?? false; + } + + receiveStatusUpdate?(status: RunnerStatus, isActive: boolean): void; + + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer { + return this.__conduit.registerPlugin(pluginClass, ...arg); + } + + unregisterPlugin(plugin: IPlugin): void { + this.__conduit.unregisterPlugin(plugin); + } + + async importAndRegisterExternalPlugin(location: string, ...arg: any[]): Promise { + const pluginClass = await importExternalPlugin(location); + return this.registerPlugin(pluginClass as any, ...arg); + } + + static readonly channelAttach = [InternalChannelName.FILE, InternalChannelName.CHUNK, InternalChannelName.SERVICE, InternalChannelName.STANDARD_IO, InternalChannelName.ERROR, InternalChannelName.STATUS]; + constructor(conduit: IConduit, [fileChannel, chunkChannel, serviceChannel, ioChannel, errorChannel, statusChannel]: IChannel[]) { + this.__conduit = conduit; + + makeRpc(fileChannel, { + requestFile: this.requestFile.bind(this) + }); + + this.__chunkChannel = chunkChannel; + this.__serviceChannel = serviceChannel; + + this.__ioChannel = ioChannel; + ioChannel.subscribe((ioMessage: IIOMessage) => this.receiveOutput?.(ioMessage.message)); + + errorChannel.subscribe((errorMessage: IErrorMessage) => this.receiveError?.(errorMessage.error)); + + statusChannel.subscribe((statusMessage: IStatusMessage) => { + const {status, isActive} = statusMessage; + this.__status.set(status, isActive); + this.receiveStatusUpdate?.(status, isActive); + }); + + this.__serviceChannel.send(new HelloServiceMessage()); + this.__serviceChannel.subscribe(message => { + this.__serviceHandlers.get(message.type)?.call(this, message); + }); + } +} diff --git a/src/conductor/host/index.ts b/src/conductor/host/index.ts new file mode 100644 index 0000000..7da4918 --- /dev/null +++ b/src/conductor/host/index.ts @@ -0,0 +1,2 @@ +export type { IHostPlugin } from "./types"; +export { BasicHostPlugin } from "./BasicHostPlugin"; diff --git a/src/conductor/host/types/IHostFileRpc.ts b/src/conductor/host/types/IHostFileRpc.ts new file mode 100644 index 0000000..3423934 --- /dev/null +++ b/src/conductor/host/types/IHostFileRpc.ts @@ -0,0 +1,3 @@ +export interface IHostFileRpc { + requestFile(fileName: string): Promise; +} diff --git a/src/conductor/host/types/IHostPlugin.ts b/src/conductor/host/types/IHostPlugin.ts new file mode 100644 index 0000000..cdd403e --- /dev/null +++ b/src/conductor/host/types/IHostPlugin.ts @@ -0,0 +1,109 @@ +import type { ConductorError } from "../../../common/errors"; +import type { IPlugin } from "../../../conduit"; +import { PluginClass } from "../../../conduit/types"; +import type { Chunk, RunnerStatus } from "../../types"; + +export interface IHostPlugin extends IPlugin { + /** + * Request a file's contents. + * @param fileName The name of the file to request. + * @returns A promise resolving to the content of the requested file. + */ + requestFile(fileName: string): Promise; + + /** + * Request to load a plugin. + * @param pluginName The name of the plugin to request loading. + */ + requestLoadPlugin(pluginName: string): void; + + /** + * Starts the evaluator. + * @param entryPoint The entry point file to start running from. + */ + startEvaluator(entryPoint: string): void; + + /** + * Send the next chunk to be run. + * @param chunk The next chunk to be run. + */ + sendChunk(chunk: Chunk): void; + + /** + * Send an input on standard-input. + * @param input The input to be sent on standard-input. + */ + sendInput(input: string): void; + + // /** + // * Request for some output on standard-output. + // * @returns A promise resolving to the output received. + // */ + // requestOutput(): Promise; + + // /** + // * Try to request for some output on standard-output. + // * @returns The output received, or undefined if there is currently no output. + // */ + // tryRequestOutput(): string | undefined; + + /** + * An event handler called when an output is received. + * @param message The output received. + */ + receiveOutput?(message: string): void; + + // /** + // * Request for some output on standard-error. + // * @returns A promise resolving to the error received. + // */ + // requestError(): Promise; + + // /** + // * Try to request for some output on standard-error. + // * @returns The error received, or undefined if there is currently no error. + // */ + // tryRequestError(): ConductorError | undefined; + + /** + * An event handler called when an error is received. + * @param message The error received. + */ + receiveError?(message: ConductorError): void; + + /** + * Checks if a runner status is active. + * @param status The runner status to check. + * @returns true if the given status is active. + */ + isStatusActive(status: RunnerStatus): boolean; + + /** + * An event handler called when a status update is received. + * @param message The status update received. + * @param isActive Is the specified status currently active? + */ + receiveStatusUpdate?(status: RunnerStatus, isActive: boolean): void; + + /** + * Registers a plugin with the conduit. + * @param pluginClass The plugin class to be registered. + * @param arg Arguments to be passed to pluginClass' constructor. + * @returns The registered plugin. + */ + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer; + + /** + * Unregister a plugin from the conduit. + * @param plugin The plugin to be unregistered. + */ + unregisterPlugin(plugin: IPlugin): void; + + /** + * Imports an external plugin and registers it with the conduit. + * @param location The location of the external plugin. + * @param arg Arguments to be passed to the external plugin's constructor. + * @returns The imported plugin. + */ + importAndRegisterExternalPlugin(location: string, ...arg: any[]): Promise; +} diff --git a/src/conductor/host/types/index.ts b/src/conductor/host/types/index.ts new file mode 100644 index 0000000..a6c4b35 --- /dev/null +++ b/src/conductor/host/types/index.ts @@ -0,0 +1,2 @@ +export type { IHostFileRpc } from "./IHostFileRpc"; +export type { IHostPlugin } from "./IHostPlugin"; diff --git a/src/conductor/module/BaseModulePlugin.ts b/src/conductor/module/BaseModulePlugin.ts new file mode 100644 index 0000000..2cf76ba --- /dev/null +++ b/src/conductor/module/BaseModulePlugin.ts @@ -0,0 +1,28 @@ +import { ConductorInternalError } from "../../common/errors/ConductorInternalError"; +import { IChannel, IConduit } from "../../conduit"; +import { checkIsPluginClass } from "../../conduit/util"; +import { IInterfacableEvaluator } from "../runner/types"; +import { ExternCallable, IDataHandler, IFunctionSignature } from "../types"; +import { IModulePlugin, IModuleExport } from "./types"; + +@checkIsPluginClass +export abstract class BaseModulePlugin implements IModulePlugin { + readonly exports: IModuleExport[] = []; + readonly exportedNames: readonly (keyof this)[] = []; + + readonly evaluator: IDataHandler; + + static readonly channelAttach: string[]; + constructor(_conduit: IConduit, _channels: IChannel[], evaluator: IInterfacableEvaluator) { + this.evaluator = evaluator; + for (const name of this.exportedNames) { + const m = this[name] as ExternCallable & {signature?: IFunctionSignature}; + if (!m.signature || typeof m !== "function" || typeof name !== "string") throw new ConductorInternalError(`'${String(name)}' is not an exportable method`); + this.exports.push({ + symbol: name, + value: m, + signature: m.signature + }); + } + } +} diff --git a/src/conductor/module/index.ts b/src/conductor/module/index.ts new file mode 100644 index 0000000..c124d4d --- /dev/null +++ b/src/conductor/module/index.ts @@ -0,0 +1,2 @@ +export type { IModuleExport, IModulePlugin } from "./types"; +export { BaseModulePlugin } from "./BaseModulePlugin"; diff --git a/src/conductor/module/types/IModuleExport.ts b/src/conductor/module/types/IModuleExport.ts new file mode 100644 index 0000000..5494bd6 --- /dev/null +++ b/src/conductor/module/types/IModuleExport.ts @@ -0,0 +1,12 @@ +import type { ExternCallable, IFunctionSignature, NativeValue } from "../../types"; + +export interface IModuleExport { + /** The symbol referencing the export. */ + symbol: string; + + /** The exported value. Can be JS-native values or a function. */ + value: NativeValue | ExternCallable; + + /** If value is a function, provides its function signature. */ + signature?: IFunctionSignature; // TODO: allow richer typing somehow? +} diff --git a/src/conductor/module/types/IModulePlugin.ts b/src/conductor/module/types/IModulePlugin.ts new file mode 100644 index 0000000..bf802cf --- /dev/null +++ b/src/conductor/module/types/IModulePlugin.ts @@ -0,0 +1,9 @@ +import type { IPlugin } from "../../../conduit"; +import type { IDataHandler } from "../../types"; +import type { IModuleExport } from "./IModuleExport"; + +export interface IModulePlugin extends IPlugin { + readonly exports: IModuleExport[]; + + readonly evaluator: IDataHandler; +} diff --git a/src/conductor/module/types/ModuleClass.ts b/src/conductor/module/types/ModuleClass.ts new file mode 100644 index 0000000..7651489 --- /dev/null +++ b/src/conductor/module/types/ModuleClass.ts @@ -0,0 +1,5 @@ +import { PluginClass } from "../../../conduit/types"; +import { IEvaluator } from "../../runner/types"; +import { IModulePlugin } from "./IModulePlugin"; + +export type ModuleClass = PluginClass<[IEvaluator], T>; diff --git a/src/conductor/module/types/index.ts b/src/conductor/module/types/index.ts new file mode 100644 index 0000000..ae1b807 --- /dev/null +++ b/src/conductor/module/types/index.ts @@ -0,0 +1,2 @@ +export type { IModuleExport } from "./IModuleExport"; +export type { IModulePlugin } from "./IModulePlugin"; diff --git a/src/conductor/module/util/index.ts b/src/conductor/module/util/index.ts new file mode 100644 index 0000000..6e09964 --- /dev/null +++ b/src/conductor/module/util/index.ts @@ -0,0 +1 @@ +export { moduleMethod } from "./moduleMethod"; diff --git a/src/conductor/module/util/moduleMethod.ts b/src/conductor/module/util/moduleMethod.ts new file mode 100644 index 0000000..d201e38 --- /dev/null +++ b/src/conductor/module/util/moduleMethod.ts @@ -0,0 +1,9 @@ +import { DataType, ExternCallable, IFunctionSignature } from "../../types"; + +export function moduleMethod(args: Args, returnType: Ret) { + const signature = {args, returnType} as const satisfies IFunctionSignature; + function externalClosureDecorator(method: ExternCallable & {signature?: IFunctionSignature}, _context: ClassMemberDecoratorContext) { + method.signature = signature; + } + return externalClosureDecorator; +} diff --git a/src/conductor/runner/BasicEvaluator.ts b/src/conductor/runner/BasicEvaluator.ts new file mode 100644 index 0000000..646d55d --- /dev/null +++ b/src/conductor/runner/BasicEvaluator.ts @@ -0,0 +1,37 @@ +import { ConductorInternalError } from "../../common/errors"; +import { IEvaluator, IRunnerPlugin } from "./types"; + +export abstract class BasicEvaluator implements IEvaluator { + readonly conductor: IRunnerPlugin; + + async startEvaluator(entryPoint: string): Promise { + const initialChunk = await this.conductor.requestFile(entryPoint); + if (!initialChunk) throw new ConductorInternalError("Cannot load entrypoint file"); + await this.evaluateFile(entryPoint, initialChunk); + while (true) { + const chunk = await this.conductor.requestChunk(); + await this.evaluateChunk(chunk); + } + } + + /** + * Evaluates a file. + * @param fileName The name of the file to be evaluated. + * @param fileContent The content of the file to be evaluated. + * @returns A promise that resolves when the evaluation is complete. + */ + async evaluateFile(fileName: string, fileContent: string): Promise { + return this.evaluateChunk(fileContent); + } + + /** + * Evaluates a chunk. + * @param chunk The chunk to be evaluated. + * @returns A promise that resolves when the evaluation is complete. + */ + abstract evaluateChunk(chunk: string): Promise; + + constructor(conductor: IRunnerPlugin) { + this.conductor = conductor; + } +} diff --git a/src/conductor/runner/RunnerPlugin.ts b/src/conductor/runner/RunnerPlugin.ts new file mode 100644 index 0000000..bc029ec --- /dev/null +++ b/src/conductor/runner/RunnerPlugin.ts @@ -0,0 +1,133 @@ +import { Constant } from "../../common/Constant"; +import type { ConductorError } from "../../common/errors"; +import { ConductorInternalError } from "../../common/errors/ConductorInternalError"; +import { importExternalModule, importExternalPlugin } from "../../common/util"; +import { IConduit, IChannelQueue, IChannel, ChannelQueue, IPlugin } from "../../conduit"; +import { makeRpc } from "../../conduit/rpc"; +import { Remote } from "../../conduit/rpc/types"; +import { PluginClass } from "../../conduit/types"; +import { checkIsPluginClass } from "../../conduit/util"; +import { IHostFileRpc } from "../host/types"; +import { IModulePlugin } from "../module"; +import { ModuleClass } from "../module/types/ModuleClass"; +import { InternalChannelName, InternalPluginName } from "../strings"; +import { Chunk, IChunkMessage, IServiceMessage, IIOMessage, IStatusMessage, RunnerStatus, ServiceMessageType, HelloServiceMessage, AbortServiceMessage, type EntryServiceMessage, IErrorMessage, PluginServiceMessage } from "../types"; +import { IRunnerPlugin, IEvaluator, IInterfacableEvaluator, EvaluatorClass } from "./types"; + +@checkIsPluginClass +export class RunnerPlugin implements IRunnerPlugin { + name = InternalPluginName.RUNNER_MAIN; + + private readonly __evaluator: IEvaluator | IInterfacableEvaluator; + private readonly __isCompatibleWithModules: boolean; + private readonly __conduit: IConduit; + private readonly __fileRpc: Remote; + private readonly __chunkQueue: IChannelQueue; + private readonly __serviceChannel: IChannel; + private readonly __ioQueue: IChannelQueue; + private readonly __errorChannel: IChannel; + private readonly __statusChannel: IChannel; + + // @ts-expect-error TODO: figure proper way to typecheck this + private readonly __serviceHandlers = new Map void>([ + [ServiceMessageType.HELLO, function helloServiceHandler(this: RunnerPlugin, message: HelloServiceMessage) { + if (message.data.version < Constant.PROTOCOL_MIN_VERSION) { + this.__serviceChannel.send(new AbortServiceMessage(Constant.PROTOCOL_MIN_VERSION)); + console.error(`Host's protocol version (${message.data.version}) must be at least ${Constant.PROTOCOL_MIN_VERSION}`); + } else { + console.log(`Host is using protocol version ${message.data.version}`); + } + }], + [ServiceMessageType.ABORT, function abortServiceHandler(this: RunnerPlugin, message: AbortServiceMessage) { + console.error(`Host expects at least protocol version ${message.data.minVersion}, but we are on version ${Constant.PROTOCOL_VERSION}`); + this.__conduit.terminate(); + }], + [ServiceMessageType.ENTRY, function entryServiceHandler(this: RunnerPlugin, message: EntryServiceMessage) { + this.__evaluator.startEvaluator(message.data); + }] + ]); + + requestFile(fileName: string): Promise { + return this.__fileRpc.requestFile(fileName); + } + + async requestChunk(): Promise { + return (await this.__chunkQueue.receive()).chunk; + } + + async requestInput(): Promise { + const { message } = await this.__ioQueue.receive(); + return message; + } + + tryRequestInput(): string | undefined { + const out = this.__ioQueue.tryReceive(); + return out?.message; + } + + sendOutput(message: string): void { + this.__ioQueue.send({ message }); + } + + sendError(error: ConductorError): void { + this.__errorChannel.send({ error }); + } + + updateStatus(status: RunnerStatus, isActive: boolean): void { + this.__statusChannel.send({ status, isActive }); + } + + hostLoadPlugin(pluginName: string): void { + this.__serviceChannel.send(new PluginServiceMessage(pluginName)); + } + + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer { + return this.__conduit.registerPlugin(pluginClass, ...arg); + } + + unregisterPlugin(plugin: IPlugin): void { + this.__conduit.unregisterPlugin(plugin); + } + + registerModule(moduleClass: ModuleClass): NoInfer { + if (!this.__isCompatibleWithModules) throw new ConductorInternalError("Evaluator has no data interface"); + return this.registerPlugin(moduleClass, this.__evaluator as IInterfacableEvaluator); + } + + unregisterModule(module: IModulePlugin): void { + this.unregisterPlugin(module); + } + + async importAndRegisterExternalPlugin(location: string, ...arg: any[]): Promise { + const pluginClass = await importExternalPlugin(location); + return this.registerPlugin(pluginClass as any, ...arg); + } + + async importAndRegisterExternalModule(location: string): Promise { + const moduleClass = await importExternalModule(location); + return this.registerModule(moduleClass); + } + + static readonly channelAttach = [InternalChannelName.FILE, InternalChannelName.CHUNK, InternalChannelName.SERVICE, InternalChannelName.STANDARD_IO, InternalChannelName.ERROR, InternalChannelName.STATUS]; + constructor( + conduit: IConduit, + [fileChannel, chunkChannel, serviceChannel, ioChannel, errorChannel, statusChannel]: IChannel[], + evaluatorClass: EvaluatorClass + ) { + this.__conduit = conduit; + this.__fileRpc = makeRpc<{}, IHostFileRpc>(fileChannel, {}); + this.__chunkQueue = new ChannelQueue(chunkChannel); + this.__serviceChannel = serviceChannel; + this.__ioQueue = new ChannelQueue(ioChannel); + this.__errorChannel = errorChannel; + this.__statusChannel = statusChannel; + + this.__serviceChannel.send(new HelloServiceMessage()); + this.__serviceChannel.subscribe(message => { + this.__serviceHandlers.get(message.type)?.call(this, message); + }); + + this.__evaluator = new evaluatorClass(this); + this.__isCompatibleWithModules = (this.__evaluator as IInterfacableEvaluator).hasDataInterface ?? false; + } +} diff --git a/src/conductor/runner/index.ts b/src/conductor/runner/index.ts new file mode 100644 index 0000000..1b96004 --- /dev/null +++ b/src/conductor/runner/index.ts @@ -0,0 +1,2 @@ +export { BasicEvaluator } from "./BasicEvaluator"; +export { RunnerPlugin } from "./RunnerPlugin"; diff --git a/src/conductor/runner/types/EvaluatorClass.ts b/src/conductor/runner/types/EvaluatorClass.ts new file mode 100644 index 0000000..577a437 --- /dev/null +++ b/src/conductor/runner/types/EvaluatorClass.ts @@ -0,0 +1,5 @@ +import { IEvaluator } from "./IEvaluator"; +import { IInterfacableEvaluator } from "./IInterfacableEvaluator"; +import { IRunnerPlugin } from "./IRunnerPlugin"; + +export type EvaluatorClass = new (conductor: IRunnerPlugin, ...arg: Arg) => IEvaluator | IInterfacableEvaluator; diff --git a/src/conductor/runner/types/IEvaluator.ts b/src/conductor/runner/types/IEvaluator.ts new file mode 100644 index 0000000..2bbb27e --- /dev/null +++ b/src/conductor/runner/types/IEvaluator.ts @@ -0,0 +1,11 @@ +/** + * The IEvaluator interface exposes methods used by Conductor to interact with evaluators. + */ +export interface IEvaluator { + /** + * Starts this evaluator. + * @param entryPoint The entry point file to start running from. + * @returns A promise that resolves when the evaluator has terminated. + */ + startEvaluator(entryPoint: string): Promise; +} diff --git a/src/conductor/runner/types/IInterfacableEvaluator.ts b/src/conductor/runner/types/IInterfacableEvaluator.ts new file mode 100644 index 0000000..755246d --- /dev/null +++ b/src/conductor/runner/types/IInterfacableEvaluator.ts @@ -0,0 +1,4 @@ +import type { IDataHandler } from "../../types"; +import type { IEvaluator } from "./IEvaluator"; + +export type IInterfacableEvaluator = IEvaluator & IDataHandler; diff --git a/src/conductor/runner/types/IRunnerPlugin.ts b/src/conductor/runner/types/IRunnerPlugin.ts new file mode 100644 index 0000000..57b4358 --- /dev/null +++ b/src/conductor/runner/types/IRunnerPlugin.ts @@ -0,0 +1,100 @@ +import type { ConductorError } from "../../../common/errors"; +import type { IPlugin } from "../../../conduit"; +import { PluginClass } from "../../../conduit/types"; +import type { IModulePlugin } from "../../module"; +import { ModuleClass } from "../../module/types/ModuleClass"; +import type { Chunk, RunnerStatus } from "../../types"; + +export interface IRunnerPlugin extends IPlugin { + /** + * Request a file's contents. + * @param fileName The name of the file to request. + * @returns A promise resolving to the content of the requested file. + */ + requestFile(fileName: string): Promise; + + /** + * Request the next chunk to run. + * @returns A promise resolving to the next chunk. + */ + requestChunk(): Promise; + + /** + * Request for some input on standard-input. + * @returns A promise resolving to the input received. + */ + requestInput(): Promise; + + /** + * Try to request for some input on standard-input. + * @returns The input received, or undefined if there is currently no input. + */ + tryRequestInput(): string | undefined; + + /** + * Sends a message on standard-output. + * @param message The output message to send. + */ + sendOutput(message: string): void; + + /** + * Sends an error. + * @param error The error to send. + */ + sendError(error: ConductorError): void; + + /** + * Provide a status update of the runner. + * @param status The status to update. + * @param isActive Is the specified status currently active? + */ + updateStatus(status: RunnerStatus, isActive: boolean): void; + + /** + * Informs the host to load a plugin. + * @param pluginName The name of the plugin to load. + */ + hostLoadPlugin(pluginName: string): void; + + /** + * Registers a plugin with the conduit. + * @param pluginClass The plugin class to be registered. + * @param arg Arguments to be passed to pluginClass' constructor. + * @returns The registered plugin. + */ + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer; + + /** + * Unregister a plugin from the conduit. + * @param plugin The plugin to be unregistered. + */ + unregisterPlugin(plugin: IPlugin): void; + + /** + * Registers an external module with the conduit, and links it with the evaluator. + * @param moduleClass The module class to be registered. + * @returns The registered module. + */ + registerModule(moduleClass: ModuleClass): T; + + /** + * Unregisters an external module from the conduit, and unlinks it from the evaluator. + * @param module The module to be unregistered. + */ + unregisterModule(module: IModulePlugin): void; + + /** + * Imports an external plugin and registers it with the conduit. + * @param location The location of the external plugin. + * @param arg Arguments to be passed to the external plugin's constructor. + * @returns The imported plugin. + */ + importAndRegisterExternalPlugin(location: string, ...arg: any[]): Promise; + + /** + * Imports an external module and registers it with the conduit. + * @param location The location of the external module. + * @returns The imported module. + */ + importAndRegisterExternalModule(location: string): Promise; +} diff --git a/src/conductor/runner/types/PyEvaluator.ts b/src/conductor/runner/types/PyEvaluator.ts new file mode 100644 index 0000000..b1a8c76 --- /dev/null +++ b/src/conductor/runner/types/PyEvaluator.ts @@ -0,0 +1,43 @@ +import { runInContext } from "../../../"; +import { Context } from "../../../cse-machine/context"; +import { BasicEvaluator } from "../BasicEvaluator"; +import { IRunnerPlugin } from "./IRunnerPlugin"; +import { IOptions } from "../../../"; +import { Finished } from "../../../types"; + +const defaultContext = new Context(); +const defaultOptions: IOptions = { + isPrelude: false, + envSteps: 100000, + stepLimit: 100000 +}; + +export class PyEvaluator extends BasicEvaluator { + private context: Context; + private options: IOptions; + + constructor(conductor: IRunnerPlugin) { + super(conductor); + this.context = defaultContext; + this.options = defaultOptions; + } + + async evaluateChunk(chunk: string): Promise { + try { + const result = await runInContext( + chunk, // Code + this.context, + this.options + ); + this.conductor.sendOutput(`${(result as Finished).representation.toString((result as Finished).value)}`); + } catch (error) { + this.conductor.sendOutput(`Error: ${error instanceof Error ? error.message : error}`); + } + } +} + +// runInContext +// IOptions +// Context +// BasicEvaluator; +// IRunnerPlugin \ No newline at end of file diff --git a/src/conductor/runner/types/index.ts b/src/conductor/runner/types/index.ts new file mode 100644 index 0000000..9b8ef04 --- /dev/null +++ b/src/conductor/runner/types/index.ts @@ -0,0 +1,4 @@ +export type { EvaluatorClass } from "./EvaluatorClass"; +export type { IEvaluator } from "./IEvaluator"; +export type { IInterfacableEvaluator } from "./IInterfacableEvaluator"; +export type { IRunnerPlugin } from "./IRunnerPlugin"; diff --git a/src/conductor/runner/util/index.ts b/src/conductor/runner/util/index.ts new file mode 100644 index 0000000..a7e1ca2 --- /dev/null +++ b/src/conductor/runner/util/index.ts @@ -0,0 +1 @@ +export { initialise } from "./initialise"; diff --git a/src/conductor/runner/util/initialise.ts b/src/conductor/runner/util/initialise.ts new file mode 100644 index 0000000..1b478a6 --- /dev/null +++ b/src/conductor/runner/util/initialise.ts @@ -0,0 +1,15 @@ +import { RunnerPlugin } from ".."; +import { Conduit, IConduit, ILink } from "../../../conduit"; +import { EvaluatorClass, IRunnerPlugin } from "../types"; + +/** + * Initialise this runner with the evaluator to be used. + * @param evaluatorClass The Evaluator to be used on this runner. + * @param link The underlying communication link. + * @returns The initialised `runnerPlugin` and `conduit`. + */ +export function initialise(evaluatorClass: EvaluatorClass, link: ILink = self as ILink): { runnerPlugin: IRunnerPlugin, conduit: IConduit } { + const conduit = new Conduit(link, false); + const runnerPlugin = conduit.registerPlugin(RunnerPlugin, evaluatorClass); + return { runnerPlugin, conduit }; +} diff --git a/src/conductor/stdlib/index.ts b/src/conductor/stdlib/index.ts new file mode 100644 index 0000000..d531b66 --- /dev/null +++ b/src/conductor/stdlib/index.ts @@ -0,0 +1,10 @@ +import type { StdlibFunction } from "../types"; +import { accumulate, is_list, length } from "./list"; + +export const stdlib = { + is_list: is_list, + accumulate: accumulate, + length: length +} satisfies Record>; + +export { accumulate }; diff --git a/src/conductor/stdlib/list/accumulate.ts b/src/conductor/stdlib/list/accumulate.ts new file mode 100644 index 0000000..2f7df8b --- /dev/null +++ b/src/conductor/stdlib/list/accumulate.ts @@ -0,0 +1,22 @@ +import { ClosureIdentifier, DataType, IDataHandler, TypedValue, List } from "../../types" + +/** + * Accumulates a Closure over a List. + * + * The Closure is applied in a right-to-left order - the first application + * will be on the last element of the list and the given initial value. + * @param op The Closure to use as an accumulator over the List. + * @param initial The initial typed value (that is, the result of accumulating an empty List). + * @param sequence The List to be accumulated over. + * @param resultType The (expected) type of the result. + * @returns A Promise resolving to the result of accumulating the Closure over the List. + */ +export async function accumulate>(this: IDataHandler, op: ClosureIdentifier, initial: TypedValue, sequence: List, resultType: T): Promise> { + const vec = this.list_to_vec(sequence); + let result = initial; + for (let i = vec.length - 1; i >= 0; --i) { + result = await this.closure_call(op, [vec[i], result], resultType); + } + + return result; +} diff --git a/src/conductor/stdlib/list/index.ts b/src/conductor/stdlib/list/index.ts new file mode 100644 index 0000000..5630e52 --- /dev/null +++ b/src/conductor/stdlib/list/index.ts @@ -0,0 +1,5 @@ +export { accumulate } from "./accumulate"; +export { is_list } from "./is_list"; +export { length } from "./length"; +export { list_to_vec } from "./list_to_vec"; +export { list } from "./list"; diff --git a/src/conductor/stdlib/list/is_list.ts b/src/conductor/stdlib/list/is_list.ts new file mode 100644 index 0000000..13c186c --- /dev/null +++ b/src/conductor/stdlib/list/is_list.ts @@ -0,0 +1,16 @@ +import { DataType, IDataHandler, List } from "../../types" + +/** + * Checks if a List is a true list (`tail(tail...(xs))` is empty-list). + * @param xs The List to check. + * @returns true if the provided List is a true list. + */ +export function is_list(this: IDataHandler, xs: List): boolean { + if (xs === null) return true; // TODO: figure out some way to avoid JS value comparison + while (true) { + const tail = this.pair_tail(xs); + if (tail.type === DataType.EMPTY_LIST) return true; + if (tail.type !== DataType.PAIR) return false; + xs = tail.value; + } +} diff --git a/src/conductor/stdlib/list/length.ts b/src/conductor/stdlib/list/length.ts new file mode 100644 index 0000000..23628fe --- /dev/null +++ b/src/conductor/stdlib/list/length.ts @@ -0,0 +1,19 @@ +import { EvaluatorTypeError } from "../../../common/errors"; +import { DataType, IDataHandler, List } from "../../types" + +/** + * Gets the length of a List. + * @param xs The List to get the length of. + * @returns The length of the List. + */ +export function length(this: IDataHandler, xs: List): number { + let length = 0; + if (xs === null) return length; // TODO: figure out some way to avoid JS value comparison + while (true) { + length++; + const tail = this.pair_tail(xs); + if (tail.type === DataType.EMPTY_LIST) return length; + if (tail.type !== DataType.PAIR) throw new EvaluatorTypeError("Input is not a list", DataType[DataType.LIST], DataType[tail.type]); + xs = tail.value; + } +} diff --git a/src/conductor/stdlib/list/list.ts b/src/conductor/stdlib/list/list.ts new file mode 100644 index 0000000..a8e9799 --- /dev/null +++ b/src/conductor/stdlib/list/list.ts @@ -0,0 +1,16 @@ +import { DataType, IDataHandler, TypedValue } from "../../types"; +import { mList } from "../../util/mList"; + +/** + * Creates a new List from given elements. + * @param elements The elements of the List, given as typed values. + * @returns The newly created List. + */ +export function list(this: IDataHandler, ...elements: TypedValue[]): TypedValue { + let theList: TypedValue = mList(null); + for (let i = elements.length - 1; i >= 0; --i) { + const p = mList(this.pair_make(elements[i], theList)); + theList = p; + } + return theList; +} diff --git a/src/conductor/stdlib/list/list_to_vec.ts b/src/conductor/stdlib/list/list_to_vec.ts new file mode 100644 index 0000000..9563853 --- /dev/null +++ b/src/conductor/stdlib/list/list_to_vec.ts @@ -0,0 +1,14 @@ +import { EvaluatorTypeError } from "../../../common/errors"; +import { DataType, IDataHandler, List, TypedValue } from "../../types"; + +export function list_to_vec(this: IDataHandler, xs: List): TypedValue[] { + const vec: TypedValue[] = []; + if (xs === null) return vec; + while (true) { + vec.push(this.pair_head(xs)); + const tail = this.pair_tail(xs); + if (tail.type === DataType.EMPTY_LIST) return vec; + if (tail.type !== DataType.PAIR) throw new EvaluatorTypeError("Input is not a list", DataType[DataType.LIST], DataType[tail.type]); + xs = tail.value; + } +} diff --git a/src/conductor/stdlib/util/array_assert.ts b/src/conductor/stdlib/util/array_assert.ts new file mode 100644 index 0000000..6e0e328 --- /dev/null +++ b/src/conductor/stdlib/util/array_assert.ts @@ -0,0 +1,14 @@ +import { EvaluatorTypeError } from "../../../common/errors"; +import { ArrayIdentifier, DataType, IDataHandler } from "../../types"; +import { isSameType } from "../../util"; + +export function array_assert(this: IDataHandler, a: ArrayIdentifier, type?: T, length?: number): asserts a is ArrayIdentifier { + if (type) { + const t = this.array_type(a); + if (!isSameType(t, type)) throw new EvaluatorTypeError("Array type assertion failure", DataType[type], DataType[t]); + } + if (length) { + const l = this.array_length(a); + if (l !== length) throw new EvaluatorTypeError("Array length assertion failure", String(length), String(l)); + } +} diff --git a/src/conductor/stdlib/util/closure_arity_assert.ts b/src/conductor/stdlib/util/closure_arity_assert.ts new file mode 100644 index 0000000..8b0a04e --- /dev/null +++ b/src/conductor/stdlib/util/closure_arity_assert.ts @@ -0,0 +1,9 @@ +import { EvaluatorTypeError } from "../../../common/errors"; +import { IDataHandler, ClosureIdentifier, DataType } from "../../types"; + +export function closure_arity_assert(this: IDataHandler, c: ClosureIdentifier, arity: number): void { + const a = this.closure_arity(c); + if (this.closure_is_vararg(c) ? arity < a : arity !== a) { + throw new EvaluatorTypeError("Closure arity assertion failure", String(arity), String(a)); + } +} diff --git a/src/conductor/stdlib/util/index.ts b/src/conductor/stdlib/util/index.ts new file mode 100644 index 0000000..42e285e --- /dev/null +++ b/src/conductor/stdlib/util/index.ts @@ -0,0 +1,3 @@ +export { array_assert } from "./array_assert"; +export { closure_arity_assert } from "./closure_arity_assert"; +export { pair_assert } from "./pair_assert"; diff --git a/src/conductor/stdlib/util/pair_assert.ts b/src/conductor/stdlib/util/pair_assert.ts new file mode 100644 index 0000000..586c0ee --- /dev/null +++ b/src/conductor/stdlib/util/pair_assert.ts @@ -0,0 +1,14 @@ +import { EvaluatorTypeError } from "../../../common/errors"; +import { DataType, IDataHandler, PairIdentifier } from "../../types"; +import { isSameType } from "../../util"; + +export function pair_assert(this: IDataHandler, p: PairIdentifier, headType?: DataType, tailType?: DataType): void { + if (headType) { + const head = this.pair_head(p); + if (!isSameType(head.type, headType)) throw new EvaluatorTypeError("Pair head assertion failure", DataType[headType], DataType[head.type]); + } + if (tailType) { + const tail = this.pair_tail(p); + if (!isSameType(tail.type, tailType)) throw new EvaluatorTypeError("Pair tail assertion failure", DataType[tailType], DataType[tail.type]); + } +} diff --git a/src/conductor/strings/InternalChannelName.ts b/src/conductor/strings/InternalChannelName.ts new file mode 100644 index 0000000..3f6e0e1 --- /dev/null +++ b/src/conductor/strings/InternalChannelName.ts @@ -0,0 +1,8 @@ +export const enum InternalChannelName { + CHUNK = "__chunk", + FILE = "__file_rpc", + SERVICE = "__service", + STANDARD_IO = "__stdio", + ERROR = "__error", + STATUS = "__status", +}; diff --git a/src/conductor/strings/InternalPluginName.ts b/src/conductor/strings/InternalPluginName.ts new file mode 100644 index 0000000..3e0e4c1 --- /dev/null +++ b/src/conductor/strings/InternalPluginName.ts @@ -0,0 +1,4 @@ +export const enum InternalPluginName { + HOST_MAIN = "__host_main", + RUNNER_MAIN = "__runner_main" +}; diff --git a/src/conductor/strings/index.ts b/src/conductor/strings/index.ts new file mode 100644 index 0000000..eb875a6 --- /dev/null +++ b/src/conductor/strings/index.ts @@ -0,0 +1,2 @@ +export { InternalChannelName } from "./InternalChannelName"; +export { InternalPluginName } from "./InternalPluginName"; diff --git a/src/conductor/types/Chunk.ts b/src/conductor/types/Chunk.ts new file mode 100644 index 0000000..29cdaf4 --- /dev/null +++ b/src/conductor/types/Chunk.ts @@ -0,0 +1,2 @@ +/** A chunk of code. */ +export type Chunk = string; diff --git a/src/conductor/types/IChunkMessage.ts b/src/conductor/types/IChunkMessage.ts new file mode 100644 index 0000000..e380ec6 --- /dev/null +++ b/src/conductor/types/IChunkMessage.ts @@ -0,0 +1,6 @@ +import type { Chunk } from "./Chunk"; + +export interface IChunkMessage { + id: number; + chunk: Chunk; +} diff --git a/src/conductor/types/IErrorMessage.ts b/src/conductor/types/IErrorMessage.ts new file mode 100644 index 0000000..0a95b1a --- /dev/null +++ b/src/conductor/types/IErrorMessage.ts @@ -0,0 +1,5 @@ +import type { ConductorError } from "../../common/errors"; + +export interface IErrorMessage { + error: ConductorError; +} diff --git a/src/conductor/types/IIOMessage.ts b/src/conductor/types/IIOMessage.ts new file mode 100644 index 0000000..d09b739 --- /dev/null +++ b/src/conductor/types/IIOMessage.ts @@ -0,0 +1,4 @@ +export interface IIOMessage { + // stream: number; + message: string; +} diff --git a/src/conductor/types/IServiceMessage.ts b/src/conductor/types/IServiceMessage.ts new file mode 100644 index 0000000..7a3e3ff --- /dev/null +++ b/src/conductor/types/IServiceMessage.ts @@ -0,0 +1,6 @@ +import type { ServiceMessageType } from "./ServiceMessageType"; + +export interface IServiceMessage { + readonly type: ServiceMessageType; + readonly data?: any; +} diff --git a/src/conductor/types/IStatusMessage.ts b/src/conductor/types/IStatusMessage.ts new file mode 100644 index 0000000..f0b0d6d --- /dev/null +++ b/src/conductor/types/IStatusMessage.ts @@ -0,0 +1,6 @@ +import type { RunnerStatus } from "./RunnerStatus"; + +export interface IStatusMessage { + status: RunnerStatus; + isActive: boolean; +} diff --git a/src/conductor/types/RunnerStatus.ts b/src/conductor/types/RunnerStatus.ts new file mode 100644 index 0000000..c14e8c8 --- /dev/null +++ b/src/conductor/types/RunnerStatus.ts @@ -0,0 +1,9 @@ +export const enum RunnerStatus { + ONLINE, // Runner is online + EVAL_READY, // Evaluator is ready + RUNNING, // I am running some code + WAITING, // I am waiting for inputs + BREAKPOINT, // I have reached a debug breakpoint + STOPPED, // I have exited, crashed, etc.; the environment is no longer valid + ERROR, // I have stopped unexpectedly +}; diff --git a/src/conductor/types/ServiceMessageType.ts b/src/conductor/types/ServiceMessageType.ts new file mode 100644 index 0000000..80d71ed --- /dev/null +++ b/src/conductor/types/ServiceMessageType.ts @@ -0,0 +1,13 @@ +export const enum ServiceMessageType { + /** A handshake message. See `HelloServiceMessage`. */ + HELLO = 0, + + /** Abort the connection, due to incompatible protocol versions. See `AbortServiceMessage`. */ + ABORT = 1, + + /** The evaluation entry point, sent from the host. See `EntryServiceMessage`. */ + ENTRY = 2, + + /** Plugin advisory sent from the runner so the host may load a corresponding plugin. See `PluginServiceMessage`. */ + PLUGIN = 3, +}; diff --git a/src/conductor/types/index.ts b/src/conductor/types/index.ts new file mode 100644 index 0000000..509a497 --- /dev/null +++ b/src/conductor/types/index.ts @@ -0,0 +1,10 @@ +export type { Chunk } from "./Chunk"; +export type { IChunkMessage } from "./IChunkMessage"; +export type { IErrorMessage } from "./IErrorMessage"; +export type { IIOMessage } from "./IIOMessage"; +export type { IServiceMessage } from "./IServiceMessage"; +export type { IStatusMessage } from "./IStatusMessage"; +export { RunnerStatus } from "./RunnerStatus"; +export { ServiceMessageType } from "./ServiceMessageType"; +export * from "./moduleInterface"; +export * from "./serviceMessages"; diff --git a/src/conductor/types/moduleInterface/ArrayIdentifier.ts b/src/conductor/types/moduleInterface/ArrayIdentifier.ts new file mode 100644 index 0000000..3b37da5 --- /dev/null +++ b/src/conductor/types/moduleInterface/ArrayIdentifier.ts @@ -0,0 +1,5 @@ +import type { DataType } from "./DataType"; +import type { Identifier } from "./Identifier"; + +/** An identifier for an extern array. */ +export type ArrayIdentifier = Identifier & { __brand: "array", __type: T }; // apply branding so it's harder to mix identifiers up diff --git a/src/conductor/types/moduleInterface/ClosureIdentifier.ts b/src/conductor/types/moduleInterface/ClosureIdentifier.ts new file mode 100644 index 0000000..9f82d94 --- /dev/null +++ b/src/conductor/types/moduleInterface/ClosureIdentifier.ts @@ -0,0 +1,5 @@ +import type { DataType } from "./DataType"; +import type { Identifier } from "./Identifier"; + +/** An identifier for an extern closure. */ +export type ClosureIdentifier = Identifier & { __brand: "closure", __ret: T }; // apply branding so it's harder to mix identifiers up diff --git a/src/conductor/types/moduleInterface/DataType.ts b/src/conductor/types/moduleInterface/DataType.ts new file mode 100644 index 0000000..3b388b1 --- /dev/null +++ b/src/conductor/types/moduleInterface/DataType.ts @@ -0,0 +1,31 @@ +export enum DataType { + /** The return type of functions with no returned value. As a convention, the associated JS value is undefined. */ + VOID = 0, + + /** A Boolean value. */ + BOOLEAN = 1, + + /** A numerical value. */ + NUMBER = 2, + + /** An immutable string of characters. */ + CONST_STRING = 3, + + /** The empty list. As a convention, the associated JS value is null. */ + EMPTY_LIST = 4, + + /** A pair of values. Reference type. */ + PAIR = 5, + + /** An array of values of a single type. Reference type. */ + ARRAY = 6, + + /** A value that can be called with fixed arity. Reference type. */ + CLOSURE = 7, + + /** An opaque value that cannot be manipulated from user code. */ + OPAQUE = 8, + + /** A list (either a pair or the empty list). */ + LIST = 9, +}; diff --git a/src/conductor/types/moduleInterface/ExternCallable.ts b/src/conductor/types/moduleInterface/ExternCallable.ts new file mode 100644 index 0000000..5335224 --- /dev/null +++ b/src/conductor/types/moduleInterface/ExternCallable.ts @@ -0,0 +1,10 @@ +import type { DataType } from "./DataType"; +import type { ExternTypeOf } from "./ExternTypeOf"; +import type { IFunctionSignature } from "./IFunctionSignature"; + +type DataTypeMap = { + [Idx in keyof T]: ExternTypeOf +}; + +/** The expected function type based on an IFunctionSignature. */ +export type ExternCallable = (...args: DataTypeMap) => ExternTypeOf | Promise>; diff --git a/src/conductor/types/moduleInterface/ExternTypeOf.ts b/src/conductor/types/moduleInterface/ExternTypeOf.ts new file mode 100644 index 0000000..51e5bb7 --- /dev/null +++ b/src/conductor/types/moduleInterface/ExternTypeOf.ts @@ -0,0 +1,22 @@ +import type { ArrayIdentifier } from "./ArrayIdentifier"; +import type { ClosureIdentifier } from "./ClosureIdentifier"; +import { DataType } from "./DataType"; +import { List } from "./List"; +import type { OpaqueIdentifier } from "./OpaqueIdentifier"; +import type { PairIdentifier } from "./PairIdentifier"; + +type typeMap = { + [DataType.VOID]: void; + [DataType.BOOLEAN]: boolean; + [DataType.NUMBER]: number; + [DataType.CONST_STRING]: string; + [DataType.EMPTY_LIST]: null; + [DataType.PAIR]: PairIdentifier; + [DataType.ARRAY]: ArrayIdentifier; + [DataType.CLOSURE]: ClosureIdentifier; + [DataType.OPAQUE]: OpaqueIdentifier; + [DataType.LIST]: List; +} + +/** Maps the Conductor DataTypes to their corresponding native types. */ +export type ExternTypeOf = T extends DataType ? typeMap[T] : never; diff --git a/src/conductor/types/moduleInterface/ExternValue.ts b/src/conductor/types/moduleInterface/ExternValue.ts new file mode 100644 index 0000000..3794c80 --- /dev/null +++ b/src/conductor/types/moduleInterface/ExternValue.ts @@ -0,0 +1,4 @@ +import type { ArrayIdentifier, ClosureIdentifier, DataType, Identifier, NativeValue, OpaqueIdentifier, PairIdentifier } from "."; + +/** A valid extern value. */ +export type ExternValue = NativeValue | Identifier | PairIdentifier | ArrayIdentifier | ClosureIdentifier | OpaqueIdentifier; diff --git a/src/conductor/types/moduleInterface/IDataHandler.ts b/src/conductor/types/moduleInterface/IDataHandler.ts new file mode 100644 index 0000000..c3c0ffa --- /dev/null +++ b/src/conductor/types/moduleInterface/IDataHandler.ts @@ -0,0 +1,203 @@ +import type { ArrayIdentifier, ClosureIdentifier, DataType, ExternCallable, Identifier, IFunctionSignature, List, OpaqueIdentifier, PairIdentifier, TypedValue } from "."; + +export interface IDataHandler { + readonly hasDataInterface: true; + + ///// Data Handling Functions + + /** + * Makes a new Pair. + * @param head The typed value to be the head of the new Pair. + * @param tail The typed value to be the tail of the new Pair. + * @returns An identifier to the new Pair. + */ + pair_make(head: TypedValue, tail: TypedValue): PairIdentifier; + + /** + * Gets the typed value in the head of a Pair. + * @param p The Pair to retrieve the head of. + * @returns The typed value in the head of the Pair. + */ + pair_head(p: PairIdentifier): TypedValue; + + /** + * Sets the head of a Pair. + * @param p The Pair to set the head of. + * @param tv The typed value to set the head of the Pair to. + */ + pair_sethead(p: PairIdentifier, tv: TypedValue): void; + + /** + * Gets the typed value in the tail of a Pair. + * @param p The Pair to retrieve the tail of. + * @returns The typed value in the tail of the Pair. + */ + pair_tail(p: PairIdentifier): TypedValue; + + /** + * Sets the tail of a Pair. + * @param p The Pair to set the tail of. + * @param tv The typed value to set the tail of the Pair to. + */ + pair_settail(p: PairIdentifier, tv: TypedValue): void; + + /** + * Asserts the type of a Pair. + * @param p The Pair to assert the type of. + * @param headType The expected type of the head of the Pair. + * @param tailType The expected type of the tail of the Pair. + * @throws If the Pair's type is not as expected. + */ + pair_assert(p: PairIdentifier, headType?: DataType, tailType?: DataType): void; + + /** + * Makes a new Array. + * + * Creation of untyped arrays (with type `VOID`) should be avoided. + * @param t The type of the elements of the Array + * @param len The length of the Array + * @param init An optional initial typed value for the elements of the Array + * @returns An identifier to the new Array. + */ + array_make(t: T, len: number, init?: TypedValue>): ArrayIdentifier>; + + /** + * Gets the length of an Array. + * @param a The Array to retrieve the length of. + * @returns The length of the given Array. + */ + array_length(a: ArrayIdentifier): number; + + /** + * Gets the typed value at a specific index of an Array. + * Arrays are 0-indexed. + * @param a The Array to retrieve the value from. + * @param idx The index of the value wanted. + * @returns The typed value at the given index of the given Array. + */ + array_get(a: ArrayIdentifier, idx: number): TypedValue; + array_get(a: ArrayIdentifier, idx: number): TypedValue>; + + /** + * Gets the type of the elements of an Array. + * + * If the Array is untyped, `VOID` is returned. + * @param a The Array to retrieve the element type of. + * @returns The type of the elements of the Array. + */ + array_type(a: ArrayIdentifier): NoInfer; + + /** + * Sets a value at a specific index of an Array. + * Arrays are 0-indexed. + * @param a The Array to be modified. + * @param idx The index to be modified. + * @param tv The new typed value at the given index of the given Array. + * @throws If the array is typed and v's type does not match the Array's type. + */ + array_set(a: ArrayIdentifier, idx: number, tv: TypedValue): void; + array_set(a: ArrayIdentifier, idx: number, tv: TypedValue>): void; + + /** + * Asserts the type and/or length of an Array. + * @param a The Array to assert. + * @param type The expected type of the elements of the Array. + * @param length The expected length of the Array. + * @throws If the Array's type is not as expected. + */ + array_assert(a: ArrayIdentifier, type?: T, length?: number): asserts a is ArrayIdentifier>; + + /** + * Makes a new Closure. + * @param sig The signature of the new Closure. + * @param func A callback to be called when the Closure is called. + * @param dependsOn An optional array of Identifiers the Closure will depend on. + * @returns An identifier to the new Closure. + */ + closure_make(sig: T, func: ExternCallable, dependsOn?: (Identifier | null)[]): ClosureIdentifier; + + /** + * Checks if a Closure accepts variable number of arguments. + * @param c The Closure to check. + * @returns `true` if the Closure accepts variable number of arguments. + */ + closure_is_vararg(c: ClosureIdentifier): boolean; + + /** + * Gets the arity (number of parameters) of a Closure. + * For vararg Closures, the arity is the minimum number of parameters required. + * @param c The Closure to get the arity of. + * @returns The arity of the Closure. + */ + closure_arity(c: ClosureIdentifier): number; + + /** + * Calls a Closure and checks the type of the returned value. + * @param c The Closure to be called. + * @param args An array of typed arguments to be passed to the Closure. + * @param returnType The expected type of the returned value. + * @returns The returned typed value. + */ + closure_call(c: ClosureIdentifier, args: TypedValue[], returnType: T): Promise>>; + + /** + * Calls a Closure of known return type. + * @param c The Closure to be called. + * @param args An array of typed arguments to be passed to the Closure. + * @returns The returned typed value. + */ + closure_call_unchecked(c: ClosureIdentifier, args: TypedValue[]): Promise>>; + + /** + * Asserts the arity of a Closure. + * @param c The Closure to assert the arity of. + * @param arity The expected arity of the Closure. + * @throws If the Closure's arity is not as expected. + */ + closure_arity_assert(c: ClosureIdentifier, arity: number): void; + + /** + * Makes a new Opaque object. + * @param v The value to be stored under this Opaque object. + * @param immutable Mark this Opaque object as immutable. Mutable Opaque objects are not rollback-friendly, + * and evaluators should disable any rollback functionality upon receiving such an object. + * @returns An identifier to the new Opaque object. + */ + opaque_make(v: any, immutable?: boolean): OpaqueIdentifier; + + /** + * Gets the value stored under an Opaque object. + * @param o The identifier to the Opaque object. + * @returns The value stored under this new Opaque object. + */ + opaque_get(o: OpaqueIdentifier): any; + + /** + * Update the value stored under an Opaque object. + * @param o The identifier to the Opaque object. + * @param v The new value to store under this Opaque object. + */ + opaque_update(o: OpaqueIdentifier, v: any): void; + + /** + * Ties the lifetime of the dependee to the dependent. + * @param dependent The object that requires the existence of the dependee. + * @param dependee The object whose existence is required by the dependent. + */ + tie(dependent: Identifier, dependee: Identifier | null): void; + + /** + * Unties the lifetime of the dependee from the dependent. + * @param dependent The tied dependent object. + * @param dependee The tied dependee object. + */ + untie(dependent: Identifier, dependee: Identifier | null): void; + + ///// Standard library functions + + list(...elements: TypedValue[]): TypedValue; + is_list(xs: List): boolean; + list_to_vec(xs: List): TypedValue[]; + accumulate>(op: ClosureIdentifier, initial: TypedValue, sequence: List, resultType: T): Promise>; + length(xs: List): number; +} diff --git a/src/conductor/types/moduleInterface/IFunctionSignature.ts b/src/conductor/types/moduleInterface/IFunctionSignature.ts new file mode 100644 index 0000000..ff50451 --- /dev/null +++ b/src/conductor/types/moduleInterface/IFunctionSignature.ts @@ -0,0 +1,12 @@ +import type { DataType } from "./DataType"; + +export interface IFunctionSignature { + /** The name of this function or closure. */ + name?: string; + + /** The parameter types of this function or closure. */ + args: readonly DataType[]; + + /** The type of the return value from this function or closure. */ + returnType: DataType; +} diff --git a/src/conductor/types/moduleInterface/Identifier.ts b/src/conductor/types/moduleInterface/Identifier.ts new file mode 100644 index 0000000..cf197ee --- /dev/null +++ b/src/conductor/types/moduleInterface/Identifier.ts @@ -0,0 +1,2 @@ +/** An identifier to an extern value. */ +export type Identifier = number; // we want number here so evaluators do not have to specifically cast to it diff --git a/src/conductor/types/moduleInterface/List.ts b/src/conductor/types/moduleInterface/List.ts new file mode 100644 index 0000000..0f4139c --- /dev/null +++ b/src/conductor/types/moduleInterface/List.ts @@ -0,0 +1,4 @@ +import type { PairIdentifier } from "./PairIdentifier"; + +/** Either an identifier for a extern pair, or a null (empty-list) value. */ +export type List = PairIdentifier | null; diff --git a/src/conductor/types/moduleInterface/NativeValue.ts b/src/conductor/types/moduleInterface/NativeValue.ts new file mode 100644 index 0000000..3036018 --- /dev/null +++ b/src/conductor/types/moduleInterface/NativeValue.ts @@ -0,0 +1,2 @@ +/** A value that can be expressed with JS primitives. */ +export type NativeValue = undefined | boolean | number | string | null; diff --git a/src/conductor/types/moduleInterface/OpaqueIdentifier.ts b/src/conductor/types/moduleInterface/OpaqueIdentifier.ts new file mode 100644 index 0000000..69e6280 --- /dev/null +++ b/src/conductor/types/moduleInterface/OpaqueIdentifier.ts @@ -0,0 +1,4 @@ +import type { Identifier } from "./Identifier"; + +/** An identifier for an extern opaque value. */ +export type OpaqueIdentifier = Identifier & { __brand: "opaque" }; // apply branding so it's harder to mix identifiers up diff --git a/src/conductor/types/moduleInterface/PairIdentifier.ts b/src/conductor/types/moduleInterface/PairIdentifier.ts new file mode 100644 index 0000000..c706119 --- /dev/null +++ b/src/conductor/types/moduleInterface/PairIdentifier.ts @@ -0,0 +1,4 @@ +import type { Identifier } from "./Identifier"; + +/** An identifier for an extern pair. */ +export type PairIdentifier = Identifier & { __brand: "pair" }; // apply branding so it's harder to mix identifiers up diff --git a/src/conductor/types/moduleInterface/StdlibFunction.ts b/src/conductor/types/moduleInterface/StdlibFunction.ts new file mode 100644 index 0000000..932aa26 --- /dev/null +++ b/src/conductor/types/moduleInterface/StdlibFunction.ts @@ -0,0 +1,3 @@ +import type { IDataHandler } from "./IDataHandler"; + +export type StdlibFunction = (this: IDataHandler, ...args: Arg) => Ret; diff --git a/src/conductor/types/moduleInterface/TypedValue.ts b/src/conductor/types/moduleInterface/TypedValue.ts new file mode 100644 index 0000000..a454fb0 --- /dev/null +++ b/src/conductor/types/moduleInterface/TypedValue.ts @@ -0,0 +1,10 @@ +import type { DataType } from "./DataType"; +import type { ExternTypeOf } from "./ExternTypeOf"; + +interface ITypedValue { + type: T; + value: ExternTypeOf; +} + +// export a type instead to benefit from distributive conditional type +export type TypedValue = T extends DataType ? ITypedValue : never; diff --git a/src/conductor/types/moduleInterface/index.ts b/src/conductor/types/moduleInterface/index.ts new file mode 100644 index 0000000..723939d --- /dev/null +++ b/src/conductor/types/moduleInterface/index.ts @@ -0,0 +1,15 @@ +export type { ArrayIdentifier } from "./ArrayIdentifier"; +export type { ClosureIdentifier } from "./ClosureIdentifier"; +export { DataType } from "./DataType"; +export type { ExternCallable } from "./ExternCallable"; +export type { ExternTypeOf } from "./ExternTypeOf"; +export type { ExternValue } from "./ExternValue"; +export type { IDataHandler } from "./IDataHandler"; +export type { Identifier } from "./Identifier"; +export type { IFunctionSignature } from "./IFunctionSignature"; +export type { List } from "./List"; +export type { NativeValue } from "./NativeValue"; +export type { OpaqueIdentifier } from "./OpaqueIdentifier"; +export type { PairIdentifier } from "./PairIdentifier"; +export type { StdlibFunction } from "./StdlibFunction"; +export type { TypedValue } from "./TypedValue"; diff --git a/src/conductor/types/serviceMessages/AbortServiceMessage.ts b/src/conductor/types/serviceMessages/AbortServiceMessage.ts new file mode 100644 index 0000000..351766a --- /dev/null +++ b/src/conductor/types/serviceMessages/AbortServiceMessage.ts @@ -0,0 +1,10 @@ +import type { IServiceMessage } from "../IServiceMessage"; +import { ServiceMessageType } from "../ServiceMessageType"; + +export class AbortServiceMessage implements IServiceMessage { + readonly type = ServiceMessageType.ABORT; + readonly data: {minVersion: number}; + constructor(minVersion: number) { + this.data = {minVersion: minVersion}; + } +} diff --git a/src/conductor/types/serviceMessages/EntryServiceMessage.ts b/src/conductor/types/serviceMessages/EntryServiceMessage.ts new file mode 100644 index 0000000..6150b2f --- /dev/null +++ b/src/conductor/types/serviceMessages/EntryServiceMessage.ts @@ -0,0 +1,10 @@ +import type { IServiceMessage } from "../IServiceMessage"; +import { ServiceMessageType } from "../ServiceMessageType"; + +export class EntryServiceMessage implements IServiceMessage { + readonly type = ServiceMessageType.ENTRY; + readonly data: string; + constructor(entryPoint: string) { + this.data = entryPoint; + } +} diff --git a/src/conductor/types/serviceMessages/HelloServiceMessage.ts b/src/conductor/types/serviceMessages/HelloServiceMessage.ts new file mode 100644 index 0000000..da434f8 --- /dev/null +++ b/src/conductor/types/serviceMessages/HelloServiceMessage.ts @@ -0,0 +1,8 @@ +import { Constant } from "../../../common/Constant"; +import type { IServiceMessage } from "../IServiceMessage"; +import { ServiceMessageType } from "../ServiceMessageType"; + +export class HelloServiceMessage implements IServiceMessage { + readonly type = ServiceMessageType.HELLO; + readonly data = { version: Constant.PROTOCOL_VERSION }; +} diff --git a/src/conductor/types/serviceMessages/PluginServiceMessage.ts b/src/conductor/types/serviceMessages/PluginServiceMessage.ts new file mode 100644 index 0000000..b8b1586 --- /dev/null +++ b/src/conductor/types/serviceMessages/PluginServiceMessage.ts @@ -0,0 +1,10 @@ +import type { IServiceMessage } from "../IServiceMessage"; +import { ServiceMessageType } from "../ServiceMessageType"; + +export class PluginServiceMessage implements IServiceMessage { + readonly type = ServiceMessageType.PLUGIN; + readonly data: string; + constructor(pluginName: string) { + this.data = pluginName; + } +} diff --git a/src/conductor/types/serviceMessages/index.ts b/src/conductor/types/serviceMessages/index.ts new file mode 100644 index 0000000..b4e865f --- /dev/null +++ b/src/conductor/types/serviceMessages/index.ts @@ -0,0 +1,4 @@ +export { AbortServiceMessage } from "./AbortServiceMessage"; +export { EntryServiceMessage } from "./EntryServiceMessage"; +export { HelloServiceMessage } from "./HelloServiceMessage"; +export { PluginServiceMessage } from "./PluginServiceMessage"; diff --git a/src/conductor/util/index.ts b/src/conductor/util/index.ts new file mode 100644 index 0000000..4bd2cbf --- /dev/null +++ b/src/conductor/util/index.ts @@ -0,0 +1,12 @@ +export { isReferenceType } from "./isReferenceType"; +export { isSameType } from "./isSameType"; +export { mArray } from "./mArray"; +export { mBoolean } from "./mBoolean"; +export { mClosure } from "./mClosure"; +export { mEmptyList } from "./mEmptyList"; +export { mList } from "./mList"; +export { mNumber } from "./mNumber"; +export { mOpaque } from "./mOpaque"; +export { mPair } from "./mPair"; +export { mString } from "./mString"; +export { mVoid } from "./mVoid"; diff --git a/src/conductor/util/isReferenceType.ts b/src/conductor/util/isReferenceType.ts new file mode 100644 index 0000000..8930670 --- /dev/null +++ b/src/conductor/util/isReferenceType.ts @@ -0,0 +1,18 @@ +import { DataType } from "../types"; + +const lookupTable = { + [DataType.VOID]: false, + [DataType.BOOLEAN]: false, + [DataType.NUMBER]: false, + [DataType.CONST_STRING]: false, + [DataType.EMPTY_LIST]: true, // technically not; see list + [DataType.PAIR]: true, + [DataType.ARRAY]: true, + [DataType.CLOSURE]: true, + [DataType.OPAQUE]: true, + [DataType.LIST]: true, // technically not, but easier to do this due to pair being so +} + +export function isReferenceType(type: DataType): boolean { + return lookupTable[type]; +} diff --git a/src/conductor/util/isSameType.ts b/src/conductor/util/isSameType.ts new file mode 100644 index 0000000..87ca49e --- /dev/null +++ b/src/conductor/util/isSameType.ts @@ -0,0 +1,8 @@ +import { DataType } from "../types"; + +export function isSameType(t1: DataType, t2: DataType): boolean { + if (t1 === t2) return true; + if (t1 === DataType.LIST && (t2 === DataType.PAIR || t2 === DataType.EMPTY_LIST)) return true; + if (t2 === DataType.LIST && (t1 === DataType.PAIR || t1 === DataType.EMPTY_LIST)) return true; + return false; +} diff --git a/src/conductor/util/mArray.ts b/src/conductor/util/mArray.ts new file mode 100644 index 0000000..a539e6a --- /dev/null +++ b/src/conductor/util/mArray.ts @@ -0,0 +1,8 @@ +import { ArrayIdentifier, DataType, TypedValue } from "../types"; + +export function mArray(value: ArrayIdentifier): TypedValue { + return { + type: DataType.ARRAY, + value + }; +} diff --git a/src/conductor/util/mBoolean.ts b/src/conductor/util/mBoolean.ts new file mode 100644 index 0000000..2f03b42 --- /dev/null +++ b/src/conductor/util/mBoolean.ts @@ -0,0 +1,8 @@ +import { DataType, TypedValue } from "../types"; + +export function mBoolean(value: boolean): TypedValue { + return { + type: DataType.BOOLEAN, + value + }; +} diff --git a/src/conductor/util/mClosure.ts b/src/conductor/util/mClosure.ts new file mode 100644 index 0000000..7c5fe8d --- /dev/null +++ b/src/conductor/util/mClosure.ts @@ -0,0 +1,8 @@ +import { ClosureIdentifier, DataType, TypedValue } from "../types"; + +export function mClosure(value: ClosureIdentifier): TypedValue { + return { + type: DataType.CLOSURE, + value + }; +} diff --git a/src/conductor/util/mEmptyList.ts b/src/conductor/util/mEmptyList.ts new file mode 100644 index 0000000..30cb86a --- /dev/null +++ b/src/conductor/util/mEmptyList.ts @@ -0,0 +1,8 @@ +import { DataType, TypedValue } from "../types"; + +export function mEmptyList(value: null = null): TypedValue { + return { + type: DataType.EMPTY_LIST, + value + }; +} diff --git a/src/conductor/util/mList.ts b/src/conductor/util/mList.ts new file mode 100644 index 0000000..78ac6b0 --- /dev/null +++ b/src/conductor/util/mList.ts @@ -0,0 +1,8 @@ +import { DataType, TypedValue, PairIdentifier } from "../types"; + +export function mList(value: PairIdentifier | null): TypedValue { + return { + type: DataType.LIST, + value + }; +} diff --git a/src/conductor/util/mNumber.ts b/src/conductor/util/mNumber.ts new file mode 100644 index 0000000..08ed0e3 --- /dev/null +++ b/src/conductor/util/mNumber.ts @@ -0,0 +1,8 @@ +import { DataType, TypedValue } from "../types"; + +export function mNumber(value: number): TypedValue { + return { + type: DataType.NUMBER, + value + }; +} diff --git a/src/conductor/util/mOpaque.ts b/src/conductor/util/mOpaque.ts new file mode 100644 index 0000000..fb53c64 --- /dev/null +++ b/src/conductor/util/mOpaque.ts @@ -0,0 +1,8 @@ +import { DataType, TypedValue, OpaqueIdentifier } from "../types"; + +export function mOpaque(value: OpaqueIdentifier): TypedValue { + return { + type: DataType.OPAQUE, + value + }; +} diff --git a/src/conductor/util/mPair.ts b/src/conductor/util/mPair.ts new file mode 100644 index 0000000..c337118 --- /dev/null +++ b/src/conductor/util/mPair.ts @@ -0,0 +1,8 @@ +import { DataType, TypedValue, PairIdentifier } from "../types"; + +export function mPair(value: PairIdentifier): TypedValue { + return { + type: DataType.PAIR, + value + }; +} diff --git a/src/conductor/util/mString.ts b/src/conductor/util/mString.ts new file mode 100644 index 0000000..f268ebe --- /dev/null +++ b/src/conductor/util/mString.ts @@ -0,0 +1,8 @@ +import { DataType, TypedValue } from "../types"; + +export function mString(value: string): TypedValue { + return { + type: DataType.CONST_STRING, + value + }; +} diff --git a/src/conductor/util/mVoid.ts b/src/conductor/util/mVoid.ts new file mode 100644 index 0000000..205d34b --- /dev/null +++ b/src/conductor/util/mVoid.ts @@ -0,0 +1,8 @@ +import { DataType, TypedValue } from "../types"; + +export function mVoid(value: void = undefined): TypedValue { + return { + type: DataType.VOID, + value + }; +} diff --git a/src/conduit/Channel.ts b/src/conduit/Channel.ts new file mode 100644 index 0000000..014190f --- /dev/null +++ b/src/conduit/Channel.ts @@ -0,0 +1,90 @@ +import { ConductorInternalError } from "../common/errors/ConductorInternalError"; +import { IChannel, Subscriber } from "./types"; + +export class Channel implements IChannel { + readonly name: string; + + /** The underlying MessagePort of this Channel. */ + private __port!: MessagePort; // replacePort assigns this in the constructor + + /** The callbacks subscribed to this Channel. */ + private readonly __subscribers: Set> = new Set(); // TODO: use WeakRef? but callbacks tend to be thrown away and leaking is better than incorrect behaviour + + /** Is the Channel allowed to be used? */ + private __isAlive: boolean = true; + + private __waitingMessages?: T[] = []; + + send(message: T, transfer?: Transferable[]): void { + this.__verifyAlive(); + this.__port.postMessage(message, transfer ?? []); + } + subscribe(subscriber: Subscriber): void { + this.__verifyAlive(); + this.__subscribers.add(subscriber); + if (this.__waitingMessages) { + for (const data of this.__waitingMessages) { + subscriber(data); + } + delete this.__waitingMessages; + } + } + unsubscribe(subscriber: Subscriber): void { + this.__verifyAlive(); + this.__subscribers.delete(subscriber); + } + close(): void { + this.__verifyAlive(); + this.__isAlive = false; + this.__port?.close(); + } + + /** + * Check if this Channel is allowed to be used. + * @throws Throws an error if the Channel has been closed. + */ + private __verifyAlive() { + if (!this.__isAlive) throw new ConductorInternalError(`Channel ${this.name} has been closed`); + } + + /** + * Dispatch some data to subscribers. + * @param data The data to be dispatched to subscribers. + */ + private __dispatch(data: T): void { + this.__verifyAlive(); + if (this.__waitingMessages) { + this.__waitingMessages.push(data); + } else { + for (const subscriber of this.__subscribers) { + subscriber(data); + } + } + } + + /** + * Listens to the port's message event, and starts the port. + * Messages will be buffered until the first subscriber listens to the Channel. + * @param port The MessagePort to listen to. + */ + listenToPort(port: MessagePort): void { + port.addEventListener("message", e => this.__dispatch(e.data)); + port.start(); + } + + /** + * Replaces the underlying MessagePort of this Channel and closes it, and starts the new port. + * @param port The new port to use. + */ + replacePort(port: MessagePort): void { + this.__verifyAlive(); + this.__port?.close(); + this.__port = port; + this.listenToPort(port); + } + + constructor(name: string, port: MessagePort) { + this.name = name; + this.replacePort(port); + } +} diff --git a/src/conduit/ChannelQueue.ts b/src/conduit/ChannelQueue.ts new file mode 100644 index 0000000..3d6d155 --- /dev/null +++ b/src/conduit/ChannelQueue.ts @@ -0,0 +1,26 @@ +import { MessageQueue } from "../common/ds"; +import { IChannelQueue, IChannel } from "./types"; + +export class ChannelQueue implements IChannelQueue { + readonly name: string; + private __channel: IChannel; + private __messageQueue: MessageQueue = new MessageQueue(); + + async receive(): Promise { + return this.__messageQueue.pop(); + } + tryReceive(): T | undefined { + return this.__messageQueue.tryPop(); + } + send(message: T, transfer?: Transferable[]): void { + this.__channel.send(message, transfer); + } + close(): void { + this.__channel.unsubscribe(this.__messageQueue.push); + } + constructor(channel: IChannel) { + this.name = channel.name; + this.__channel = channel; + this.__channel.subscribe(this.__messageQueue.push); + } +} diff --git a/src/conduit/Conduit.ts b/src/conduit/Conduit.ts new file mode 100644 index 0000000..a045fc2 --- /dev/null +++ b/src/conduit/Conduit.ts @@ -0,0 +1,87 @@ +import { ConductorInternalError } from "../common/errors/ConductorInternalError"; +import { Channel } from "./Channel"; +import { IConduit, ILink, IPlugin, IChannel, PluginClass } from "./types"; + +export class Conduit implements IConduit { + private __alive: boolean = true; + private readonly __link: ILink; + private readonly __parent: boolean; + private readonly __channels: Map> = new Map(); + private readonly __pluginMap: Map = new Map(); + private readonly __plugins: IPlugin[] = []; + private __negotiateChannel(channelName: string): void { + const { port1, port2 } = new MessageChannel(); + const channel = new Channel(channelName, port1); + this.__link.postMessage([channelName, port2], [port2]); // TODO: update communication protocol? + this.__channels.set(channelName, channel); + } + private __verifyAlive() { + if (!this.__alive) throw new ConductorInternalError("Conduit already terminated"); + } + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer { + this.__verifyAlive(); + const attachedChannels: IChannel[] = []; + for (const channelName of pluginClass.channelAttach) { + if (!this.__channels.has(channelName)) this.__negotiateChannel(channelName); + attachedChannels.push(this.__channels.get(channelName)!); // as the Channel has been negotiated + } + const plugin = new pluginClass(this, attachedChannels, ...arg); + + if (plugin.name !== undefined) { + if (this.__pluginMap.has(plugin.name)) throw new ConductorInternalError(`Plugin ${plugin.name} already registered`); + this.__pluginMap.set(plugin.name, plugin); + } + + this.__plugins.push(plugin); + + return plugin; + } + unregisterPlugin(plugin: IPlugin): void { + this.__verifyAlive(); + let p = 0; + for (let i = 0; i < this.__plugins.length; ++i) { + if (this.__plugins[p] === plugin) ++p; + this.__plugins[i] = this.__plugins[i + p]; + } + for (let i = this.__plugins.length - 1, e = this.__plugins.length - p; i >= e; --i) { + delete this.__plugins[i]; + } + if (plugin.name) { + this.__pluginMap.delete(plugin.name); + } + plugin.destroy?.(); + } + lookupPlugin(pluginName: string): IPlugin { + this.__verifyAlive(); + if (!this.__pluginMap.has(pluginName)) throw new ConductorInternalError(`Plugin ${pluginName} not registered`); + return this.__pluginMap.get(pluginName)!; // as the map has been checked + } + terminate(): void { + this.__verifyAlive(); + for (const plugin of this.__plugins) { + //this.unregisterPlugin(plugin); + plugin.destroy?.(); + } + this.__link.terminate?.(); + this.__alive = false; + } + private __handlePort(data: [string, MessagePort]) { // TODO: update communication protocol? + const [channelName, port] = data; + if (this.__channels.has(channelName)) { // uh-oh, we already have a port for this channel + const channel = this.__channels.get(channelName)!; // as the map has been checked + if (this.__parent) { // extract the data and discard the messageport; child's Channel will close it + channel.listenToPort(port); + } else { // replace our messageport; Channel will close it + channel.replacePort(port); + } + } else { // register the new channel + const channel = new Channel(channelName, port); + this.__channels.set(channelName, channel); + } + } + constructor(link: ILink, parent: boolean = false) { + this.__link = link; + link.addEventListener("message", e => this.__handlePort(e.data)); + this.__parent = parent; + } +} diff --git a/src/conduit/index.ts b/src/conduit/index.ts new file mode 100644 index 0000000..e045ea5 --- /dev/null +++ b/src/conduit/index.ts @@ -0,0 +1,4 @@ +export type { IChannel, IConduit, ILink, IChannelQueue, IPlugin, Subscriber } from "./types"; +export { Channel } from "./Channel"; +export { ChannelQueue } from "./ChannelQueue"; +export { Conduit } from "./Conduit"; diff --git a/src/conduit/rpc/index.ts b/src/conduit/rpc/index.ts new file mode 100644 index 0000000..02375ad --- /dev/null +++ b/src/conduit/rpc/index.ts @@ -0,0 +1,2 @@ +export { Remote } from "./types"; +export { makeRpc } from "./makeRpc"; diff --git a/src/conduit/rpc/makeRpc.ts b/src/conduit/rpc/makeRpc.ts new file mode 100644 index 0000000..4e7ef70 --- /dev/null +++ b/src/conduit/rpc/makeRpc.ts @@ -0,0 +1,59 @@ +import { IChannel } from "../types"; +import { IRpcMessage, Remote, RpcCallMessage, RpcErrorMessage, RpcMessageType, RpcReturnMessage } from "./types"; + +export function makeRpc(channel: IChannel, self: ISelf): Remote { + const waiting: [Function, Function][] = []; + let invocations = 0; + const otherCallbacks: Partial Promise>> = {}; + + channel.subscribe(async rpcMessage => { + switch (rpcMessage.type) { + case RpcMessageType.CALL: + { + const {fn, args, invokeId} = (rpcMessage as RpcCallMessage).data; + try { + // @ts-expect-error + const res = await self[fn as keyof ISelf](...args); + if (invokeId > 0) channel.send(new RpcReturnMessage(invokeId, res)); + } catch (err) { + if (invokeId > 0) channel.send(new RpcErrorMessage(invokeId, err)); + } + break; + } + case RpcMessageType.RETURN: + { + const {invokeId, res} = (rpcMessage as RpcReturnMessage).data; + waiting[invokeId]?.[0]?.(res); + delete waiting[invokeId]; + break; + } + case RpcMessageType.RETURN_ERR: + { + const {invokeId, err} = (rpcMessage as RpcErrorMessage).data; + waiting[invokeId]?.[1]?.(err); + delete waiting[invokeId]; + break; + } + } + }); + + return new Proxy(otherCallbacks, { // TODO: transferring functions + get(target, p, receiver) { + const cb = Reflect.get(target, p, receiver); + if (cb) return cb; + const newCallback = typeof p === "string" && p.charAt(0) === "$" + ? (...args: any[]) => { + channel.send(new RpcCallMessage(p, args, 0)); + } + : (...args: any[]) => { + const invokeId = ++invocations; + channel.send(new RpcCallMessage(p, args, invokeId)); + return new Promise((resolve, reject) => { + waiting[invokeId] = [resolve, reject]; + }); + } + Reflect.set(target, p, newCallback, receiver); + return newCallback; + }, + }) as Remote; +} diff --git a/src/conduit/rpc/types/IRpcMessage.ts b/src/conduit/rpc/types/IRpcMessage.ts new file mode 100644 index 0000000..685c2df --- /dev/null +++ b/src/conduit/rpc/types/IRpcMessage.ts @@ -0,0 +1,6 @@ +import { RpcMessageType } from "./RpcMessageType"; + +export interface IRpcMessage { + type: RpcMessageType; + data?: any; +} diff --git a/src/conduit/rpc/types/Remote.ts b/src/conduit/rpc/types/Remote.ts new file mode 100644 index 0000000..40b3d45 --- /dev/null +++ b/src/conduit/rpc/types/Remote.ts @@ -0,0 +1,11 @@ +export type Remote = { + [K in keyof IOther]: IOther[K] extends (...args: infer Args) => infer Ret + ? K extends `$${infer _N}` + ? Ret extends void + ? IOther[K] + : (...args: Args) => void + : Ret extends Promise + ? IOther[K] + : (...args: Args) => Promise + : never +} diff --git a/src/conduit/rpc/types/RpcCallMessage.ts b/src/conduit/rpc/types/RpcCallMessage.ts new file mode 100644 index 0000000..3f1ac61 --- /dev/null +++ b/src/conduit/rpc/types/RpcCallMessage.ts @@ -0,0 +1,11 @@ +import type { IRpcMessage } from "./IRpcMessage"; +import { RpcMessageType } from "./RpcMessageType"; + +export class RpcCallMessage implements IRpcMessage { + type = RpcMessageType.CALL; + readonly data: {fn: string | symbol, args: any[], invokeId: number}; + + constructor(fn: string | symbol, args: any[], invokeId: number) { + this.data = {fn, args, invokeId}; + } +} diff --git a/src/conduit/rpc/types/RpcErrorMessage.ts b/src/conduit/rpc/types/RpcErrorMessage.ts new file mode 100644 index 0000000..9fa0999 --- /dev/null +++ b/src/conduit/rpc/types/RpcErrorMessage.ts @@ -0,0 +1,11 @@ +import type { IRpcMessage } from "./IRpcMessage"; +import { RpcMessageType } from "./RpcMessageType"; + +export class RpcErrorMessage implements IRpcMessage { + type = RpcMessageType.RETURN_ERR; + readonly data: {invokeId: number, err: any}; + + constructor(invokeId: number, err: any) { + this.data = {invokeId, err}; + } +} diff --git a/src/conduit/rpc/types/RpcMessageType.ts b/src/conduit/rpc/types/RpcMessageType.ts new file mode 100644 index 0000000..0a6e0d6 --- /dev/null +++ b/src/conduit/rpc/types/RpcMessageType.ts @@ -0,0 +1,7 @@ +const enum RpcMessageType { + CALL, + RETURN, + RETURN_ERR +} + +export { RpcMessageType }; diff --git a/src/conduit/rpc/types/RpcReturnMessage.ts b/src/conduit/rpc/types/RpcReturnMessage.ts new file mode 100644 index 0000000..e4a206f --- /dev/null +++ b/src/conduit/rpc/types/RpcReturnMessage.ts @@ -0,0 +1,11 @@ +import type { IRpcMessage } from "./IRpcMessage"; +import { RpcMessageType } from "./RpcMessageType"; + +export class RpcReturnMessage implements IRpcMessage { + type = RpcMessageType.RETURN; + readonly data: {invokeId: number, res: any}; + + constructor(invokeId: number, res: any) { + this.data = {invokeId, res}; + } +} diff --git a/src/conduit/rpc/types/index.ts b/src/conduit/rpc/types/index.ts new file mode 100644 index 0000000..d7c959b --- /dev/null +++ b/src/conduit/rpc/types/index.ts @@ -0,0 +1,6 @@ +export type { IRpcMessage } from "./IRpcMessage"; +export type { Remote } from "./Remote"; +export { RpcCallMessage } from "./RpcCallMessage"; +export { RpcErrorMessage } from "./RpcErrorMessage"; +export { RpcMessageType } from "./RpcMessageType"; +export { RpcReturnMessage } from "./RpcReturnMessage"; diff --git a/src/conduit/types/AbstractPluginClass.ts b/src/conduit/types/AbstractPluginClass.ts new file mode 100644 index 0000000..65f9b0a --- /dev/null +++ b/src/conduit/types/AbstractPluginClass.ts @@ -0,0 +1,7 @@ +import { IChannel } from "./IChannel"; +import { IConduit } from "./IConduit"; +import { IPlugin } from "./IPlugin"; + +export type AbstractPluginClass = { + readonly channelAttach: string[]; +} & (abstract new (conduit: IConduit, channels: IChannel[], ...arg: Arg) => T); diff --git a/src/conduit/types/IChannel.ts b/src/conduit/types/IChannel.ts new file mode 100644 index 0000000..cefbd4b --- /dev/null +++ b/src/conduit/types/IChannel.ts @@ -0,0 +1,30 @@ +import type { Subscriber } from "./Subscriber"; + +export interface IChannel { + /** The name of the channel. */ + readonly name: string; + + /** + * Send a message through this channel. + * @param message The message to be sent. + * @param transfer An array of transferable objects to be sent with the message. + */ + send(message: T, transfer?: Transferable[]): void; + + /** + * Subscribe to messages on this channel. + * @param subscriber The function to be called when a message is received. + */ + subscribe(subscriber: Subscriber): void; + + /** + * Unsubscribe from messages on this channel. + * @param subscriber The function that was called when a message is received. + */ + unsubscribe(subscriber: Subscriber): void; + + /** + * Closes the channel, and frees any held resources. + */ + close(): void; +} diff --git a/src/conduit/types/IChannelQueue.ts b/src/conduit/types/IChannelQueue.ts new file mode 100644 index 0000000..209325e --- /dev/null +++ b/src/conduit/types/IChannelQueue.ts @@ -0,0 +1,29 @@ +export interface IChannelQueue { + /** The name of the message queue. */ + readonly name: string; + + /** + * Send a message through the underlying channel. + * @param message The message to be sent. + * @param transfer An array of transferable objects to be sent with the message. + */ + send(message: T, transfer?: Transferable[]): void; + + /** + * Receives a queued message, or waits until one arrives. + * @returns A promise resolving to the received message. + */ + receive(): Promise; + + /** + * Tries to receive a queued message. + * Does not wait for a message if the queue is empty. + * @returns The received message, or undefined if the queue is empty. + */ + tryReceive(): T | undefined; + + /** + * Closes the message queue. + */ + close(): void; +} diff --git a/src/conduit/types/IConduit.ts b/src/conduit/types/IConduit.ts new file mode 100644 index 0000000..ea3aeca --- /dev/null +++ b/src/conduit/types/IConduit.ts @@ -0,0 +1,27 @@ +import type { IPlugin } from "./IPlugin"; +import type { PluginClass } from "./PluginClass"; + +export interface IConduit { + /** + * Register a plugin with the conduit. + * @param pluginClass The plugin to be registered. + */ + registerPlugin(pluginClass: PluginClass, ...arg: Arg): NoInfer; + + /** + * Unregister a plugin from the conduit. + * @param plugin The plugin to be unregistered. + */ + unregisterPlugin(plugin: IPlugin): void; + + /** + * Look for a plugin with the given name. + * @param pluginName The name of the plugin to be searched for. + */ + lookupPlugin(pluginName: string): IPlugin; + + /** + * Shuts down the conduit. + */ + terminate(): void; +} diff --git a/src/conduit/types/ILink.ts b/src/conduit/types/ILink.ts new file mode 100644 index 0000000..d10cfd6 --- /dev/null +++ b/src/conduit/types/ILink.ts @@ -0,0 +1,5 @@ +export interface ILink { + postMessage: typeof Worker.prototype.postMessage; + addEventListener: typeof Worker.prototype.addEventListener; + terminate?: typeof Worker.prototype.terminate; +} diff --git a/src/conduit/types/IPlugin.ts b/src/conduit/types/IPlugin.ts new file mode 100644 index 0000000..a9e8d4c --- /dev/null +++ b/src/conduit/types/IPlugin.ts @@ -0,0 +1,9 @@ +export interface IPlugin { + /** The name of the plugin. Can be undefined for an unnamed plugin. */ + readonly name?: string; + + /** + * Perform any cleanup of the plugin (e.g. closing message queues). + */ + destroy?(): void; +} diff --git a/src/conduit/types/PluginClass.ts b/src/conduit/types/PluginClass.ts new file mode 100644 index 0000000..e03df88 --- /dev/null +++ b/src/conduit/types/PluginClass.ts @@ -0,0 +1,7 @@ +import { IChannel } from "./IChannel"; +import { IConduit } from "./IConduit"; +import type { IPlugin } from "./IPlugin"; + +export type PluginClass = { + readonly channelAttach: string[]; +} & (new (conduit: IConduit, channels: IChannel[], ...arg: Arg) => T); diff --git a/src/conduit/types/Subscriber.ts b/src/conduit/types/Subscriber.ts new file mode 100644 index 0000000..50cd74c --- /dev/null +++ b/src/conduit/types/Subscriber.ts @@ -0,0 +1,2 @@ +/** A subscriber of a channel. */ +export type Subscriber = (data: T) => void; diff --git a/src/conduit/types/index.ts b/src/conduit/types/index.ts new file mode 100644 index 0000000..3722252 --- /dev/null +++ b/src/conduit/types/index.ts @@ -0,0 +1,8 @@ +export type { AbstractPluginClass } from "./AbstractPluginClass"; +export type { IChannel } from "./IChannel"; +export type { IChannelQueue } from "./IChannelQueue"; +export type { IConduit } from "./IConduit"; +export type { ILink } from "./ILink"; +export type { IPlugin } from "./IPlugin"; +export type { PluginClass } from "./PluginClass"; +export type { Subscriber } from "./Subscriber"; diff --git a/src/conduit/util/checkIsPluginClass.ts b/src/conduit/util/checkIsPluginClass.ts new file mode 100644 index 0000000..74802a7 --- /dev/null +++ b/src/conduit/util/checkIsPluginClass.ts @@ -0,0 +1,12 @@ +import { IPlugin } from ".."; +import { AbstractPluginClass, PluginClass } from "../types"; + +/** + * Typechecking utility decorator. + * It is recommended that usage of this decorator is removed + * before or during the build process, as some tools + * (e.g. terser) do not have good support for class decorators. + * @param _pluginClass The Class to be typechecked. + */ +export function checkIsPluginClass(_pluginClass: PluginClass | AbstractPluginClass) { +} diff --git a/src/conduit/util/index.ts b/src/conduit/util/index.ts new file mode 100644 index 0000000..0c82e60 --- /dev/null +++ b/src/conduit/util/index.ts @@ -0,0 +1 @@ +export { checkIsPluginClass } from "./checkIsPluginClass"; diff --git a/src/cse-machine/ast-helper.ts b/src/cse-machine/ast-helper.ts new file mode 100644 index 0000000..9f2cffc --- /dev/null +++ b/src/cse-machine/ast-helper.ts @@ -0,0 +1,158 @@ +// astHelpers.ts +import type * as es from 'estree'; +import { StatementSequence } from './types'; +import { ControlItem } from './control'; + +/** + * Create a StatementSequence node. + */ +export const statementSequence = ( + body: es.Statement[], + loc?: es.SourceLocation | null +): StatementSequence => ({ + type: 'StatementSequence', + body, + loc, + innerComments: undefined, +}); + +export const isNode = (item: any): item is es.Node => { + return typeof item === 'object' && item !== null && 'type' in item; +}; + +export const isBlockStatement = (node: es.Node | StatementSequence): node is es.BlockStatement => { + return node.type === 'BlockStatement'; +}; + +export const hasDeclarations = (node: es.BlockStatement): boolean => { + return node.body.some(stmt => stmt.type === 'VariableDeclaration' || stmt.type === 'FunctionDeclaration'); +}; + +export const blockArrowFunction = ( + params: es.Identifier[], + body: es.Statement[] | es.BlockStatement | es.Expression, + loc?: es.SourceLocation | null +): es.ArrowFunctionExpression => ({ + type: 'ArrowFunctionExpression', + expression: false, + generator: false, + params, + body: Array.isArray(body) ? blockStatement(body) : body, + loc +}) + +export const blockStatement = ( + body: es.Statement[], + loc?: es.SourceLocation | null +): es.BlockStatement => ({ + type: 'BlockStatement', + body, + loc +}) + +export const constantDeclaration = ( + name: string, + init: es.Expression, + loc?: es.SourceLocation | null +) => declaration(name, 'declaration', init, loc) + +export const declaration = ( + name: string, + kind: AllowedDeclarations, + init: es.Expression, + loc?: es.SourceLocation | null +): pyVariableDeclaration => ({ + type: 'VariableDeclaration', + declarations: [ + { + type: 'VariableDeclarator', + id: identifier(name), + init + } + ], + kind: 'declaration', + loc +}) + +type AllowedDeclarations = 'declaration' | 'const' + +export interface pyVariableDeclaration { + type: "VariableDeclaration"; + declarations: pyVariableDeclarator[]; + kind: "declaration" | "const"; + loc?: es.SourceLocation | null | undefined; + range?: [number, number] | undefined; +} + +export interface pyVariableDeclarator { + type: "VariableDeclarator"; + id: Pattern; + init?: es.Expression | null | undefined; +} + +export type Pattern = es.Identifier | es.ObjectPattern | es.ArrayPattern | es.RestElement | es.AssignmentPattern | es.MemberExpression; + +export const identifier = (name: string, loc?: es.SourceLocation | null): es.Identifier => ({ + type: 'Identifier', + name, + loc +}) + +export const returnStatement = ( + argument: es.Expression, + loc?: es.SourceLocation | null +): es.ReturnStatement => ({ + type: 'ReturnStatement', + argument, + loc +}) + +export const hasReturnStatement = (block: es.BlockStatement | StatementSequence): boolean => { + let hasReturn = false + for (const statement of block.body) { + if (isReturnStatement(statement)) { + hasReturn = true + } else if (isIfStatement(statement)) { + // Parser enforces that if/else have braces (block statement) + hasReturn = hasReturn || hasReturnStatementIf(statement as es.IfStatement) + } else if (isBlockStatement(statement) || isStatementSequence(statement)) { + hasReturn = hasReturn && hasReturnStatement(statement) + } + } + return hasReturn +} + +export const isReturnStatement = (node: es.Node): node is es.ReturnStatement => { + return (node as es.ReturnStatement).type == 'ReturnStatement' +} + +export const isIfStatement = (node: es.Node): node is es.IfStatement => { + return (node as es.IfStatement).type == 'IfStatement' +} + +export const hasReturnStatementIf = (statement: es.IfStatement): boolean => { + let hasReturn = true + // Parser enforces that if/else have braces (block statement) + hasReturn = hasReturn && hasReturnStatement(statement.consequent as es.BlockStatement) + if (statement.alternate) { + if (isIfStatement(statement.alternate)) { + hasReturn = hasReturn && hasReturnStatementIf(statement.alternate as es.IfStatement) + } else if (isBlockStatement(statement.alternate) || isStatementSequence(statement.alternate)) { + hasReturn = hasReturn && hasReturnStatement(statement.alternate) + } + } + return hasReturn +} + +export const isStatementSequence = (node: ControlItem): node is StatementSequence => { + return (node as StatementSequence).type == 'StatementSequence' +} + +export const literal = ( + value: string | number | boolean | null, + loc?: es.SourceLocation | null +): es.Literal => ({ + type: 'Literal', + value, + loc +}) diff --git a/src/cse-machine/closure.ts b/src/cse-machine/closure.ts new file mode 100644 index 0000000..198db81 --- /dev/null +++ b/src/cse-machine/closure.ts @@ -0,0 +1,59 @@ +// closure.ts + +import * as es from 'estree' +import { Environment } from './environment' +import { Context } from './context' // 假设 Context 定义在 context.ts 中 +import { StatementSequence } from './types' +import { blockArrowFunction, blockStatement, hasReturnStatement, identifier, isBlockStatement, returnStatement } from './ast-helper' +import { ControlItem } from './control' + +export class Closure { + public originalNode?: es.ArrowFunctionExpression + + /** Unique ID defined for closure */ + //public readonly id: string + + /** Name of the constant declaration that the closure is assigned to */ + public declaredName?: string + + constructor( + public node: es.ArrowFunctionExpression, + public environment: Environment, + public context: Context, + public predefined: boolean = false +) { + this.originalNode = node + } + + static makeFromArrowFunction( + node: es.ArrowFunctionExpression, + environment: Environment, + context: Context, + dummyReturn: boolean = false, + predefined: boolean = false + ): Closure { + const functionBody: es.BlockStatement | StatementSequence = + !isBlockStatement(node.body) && !isStatementSequence(node.body) + ? blockStatement([returnStatement(node.body, node.body.loc)], node.body.loc) + : dummyReturn && !hasReturnStatement(node.body) + ? blockStatement( + [ + ...node.body.body, + returnStatement(identifier('undefined', node.body.loc), node.body.loc) + ], + node.body.loc + ) + : node.body + + const closure = new Closure(blockArrowFunction(node.params as es.Identifier[], functionBody, node.loc), + environment, context, predefined) + + closure.originalNode = node + + return closure + } +} + +export const isStatementSequence = (node: ControlItem): node is StatementSequence => { + return (node as StatementSequence).type == 'StatementSequence' +} diff --git a/src/cse-machine/context.ts b/src/cse-machine/context.ts new file mode 100644 index 0000000..176edb7 --- /dev/null +++ b/src/cse-machine/context.ts @@ -0,0 +1,178 @@ +import * as es from 'estree'; +import { Stash, Value } from './stash'; +import { Control, ControlItem } from './control'; +import { createSimpleEnvironment, createProgramEnvironment, Environment } from './environment'; +import { CseError } from './error'; +import { Heap } from './heap'; +import { + AppInstr, + Instr, + InstrType, + BranchInstr, + WhileInstr, + ForInstr, + Node, + StatementSequence +} from './types' +import { NativeStorage } from '../types'; + +export class Context { + public control: Control; + public stash: Stash; + //public environment: Environment; + public errors: CseError[] = []; + + runtime: { + break: boolean + debuggerOn: boolean + isRunning: boolean + environmentTree: EnvTree + environments: Environment[] + nodes: Node[] + control: Control | null + stash: Stash | null + objectCount: number + envStepsTotal: number + breakpointSteps: number[] + changepointSteps: number[] + } + + /** + * Used for storing the native context and other values + */ + nativeStorage: NativeStorage + + constructor(program?: es.Program | StatementSequence, context?: Context) { + this.control = new Control(program); + this.stash = new Stash(); + this.runtime = this.createEmptyRuntime(); + //this.environment = createProgramEnvironment(context || this, false); + if (this.runtime.environments.length === 0) { + const globalEnvironment = this.createGlobalEnvironment() + this.runtime.environments.push(globalEnvironment) + this.runtime.environmentTree.insert(globalEnvironment) + } + this.nativeStorage = { + builtins: new Map(), + previousProgramsIdentifiers: new Set(), + operators: new Map Value>(), + maxExecTime: 1000, + evaller: null, + loadedModules: {}, + loadedModuleTypes: {} + } + } + + createGlobalEnvironment = (): Environment => ({ + tail: null, + name: 'global', + head: {}, + heap: new Heap(), + id: '-1' + }) + + createEmptyRuntime = () => ({ + break: false, + debuggerOn: true, + isRunning: false, + environmentTree: new EnvTree(), + environments: [], + value: undefined, + nodes: [], + control: null, + stash: null, + objectCount: 0, + envSteps: -1, + envStepsTotal: 0, + breakpointSteps: [], + changepointSteps: [] + }) + + public reset(program?: es.Program | StatementSequence): void { + this.control = new Control(program); + this.stash = new Stash(); + //this.environment = createProgramEnvironment(this, false); + this.errors = []; + } + + public copy(): Context { + const newContext = new Context(); + newContext.control = this.control.copy(); + newContext.stash = this.stash.copy(); + //newContext.environments = this.copyEnvironment(this.environments); + return newContext; + } + + private copyEnvironment(env: Environment): Environment { + const newTail = env.tail ? this.copyEnvironment(env.tail) : null; + const newEnv: Environment = { + id: env.id, + name: env.name, + tail: newTail, + head: { ...env.head }, + heap: new Heap(), + callExpression: env.callExpression, + thisContext: env.thisContext + }; + return newEnv; + } +} + +export class EnvTree { + private _root: EnvTreeNode | null = null + private map = new Map() + + get root(): EnvTreeNode | null { + return this._root + } + + public insert(environment: Environment): void { + const tailEnvironment = environment.tail + if (tailEnvironment === null) { + if (this._root === null) { + this._root = new EnvTreeNode(environment, null) + this.map.set(environment, this._root) + } + } else { + const parentNode = this.map.get(tailEnvironment) + if (parentNode) { + const childNode = new EnvTreeNode(environment, parentNode) + parentNode.addChild(childNode) + this.map.set(environment, childNode) + } + } + } + + public getTreeNode(environment: Environment): EnvTreeNode | undefined { + return this.map.get(environment) + } +} + +export class EnvTreeNode { + private _children: EnvTreeNode[] = [] + + constructor(readonly environment: Environment, public parent: EnvTreeNode | null) {} + + get children(): EnvTreeNode[] { + return this._children + } + + public resetChildren(newChildren: EnvTreeNode[]): void { + this.clearChildren() + this.addChildren(newChildren) + newChildren.forEach(c => (c.parent = this)) + } + + private clearChildren(): void { + this._children = [] + } + + private addChildren(newChildren: EnvTreeNode[]): void { + this._children.push(...newChildren) + } + + public addChild(newChild: EnvTreeNode): EnvTreeNode { + this._children.push(newChild) + return newChild + } +} diff --git a/src/cse-machine/control.ts b/src/cse-machine/control.ts new file mode 100644 index 0000000..c394df5 --- /dev/null +++ b/src/cse-machine/control.ts @@ -0,0 +1,78 @@ +import { ExprNS, StmtNS } from '../ast-types'; +import { Token } from '../tokenizer'; +import type * as es from 'estree'; +import { Stack } from './stack'; +import { isNode, isBlockStatement, hasDeclarations, statementSequence } from './ast-helper'; +import { Environment } from './environment'; +import { Node, StatementSequence, Instr } from './types'; +import { isEnvDependent } from './utils'; + +export type ControlItem = (Node | Instr) & { + isEnvDependent?: boolean; + skipEnv?: boolean; +}; + +export class Control extends Stack { + private numEnvDependentItems: number + public constructor(program?: es.Program | StatementSequence) { + super() + this.numEnvDependentItems = 0 + // Load program into control stack + program ? this.push(program) : null + } + + public canAvoidEnvInstr(): boolean { + return this.numEnvDependentItems === 0 + } + + // For testing purposes + public getNumEnvDependentItems(): number { + return this.numEnvDependentItems + } + + public pop(): ControlItem | undefined { + const item = super.pop() + if (item !== undefined && isEnvDependent(item)) { + this.numEnvDependentItems-- + } + return item + } + + public push(...items: ControlItem[]): void { + const itemsNew: ControlItem[] = Control.simplifyBlocksWithoutDeclarations(...items) + itemsNew.forEach((item: ControlItem) => { + if (isEnvDependent(item)) { + this.numEnvDependentItems++ + } + }) + super.push(...itemsNew) + } + + /** + * Before pushing block statements on the control stack, we check if the block statement has any declarations. + * If not, the block is converted to a StatementSequence. + * @param items The items being pushed on the control. + * @returns The same set of control items, but with block statements without declarations converted to StatementSequences. + * NOTE: this function handles any case where StatementSequence has to be converted back into BlockStatement due to type issues + */ + private static simplifyBlocksWithoutDeclarations(...items: ControlItem[]): ControlItem[] { + const itemsNew: ControlItem[] = [] + items.forEach(item => { + if (isNode(item) && isBlockStatement(item) && !hasDeclarations(item)) { + // Push block body as statement sequence + const seq: StatementSequence = statementSequence(item.body, item.loc) + itemsNew.push(seq) + } else { + itemsNew.push(item) + } + }) + return itemsNew + } + + public copy(): Control { + const newControl = new Control() + const stackCopy = super.getStack() + newControl.push(...stackCopy) + return newControl + } +} diff --git a/src/cse-machine/dict.ts b/src/cse-machine/dict.ts new file mode 100644 index 0000000..a905e31 --- /dev/null +++ b/src/cse-machine/dict.ts @@ -0,0 +1,112 @@ +import * as es from 'estree' +import { isImportDeclaration, getModuleDeclarationSource } from './utils'; + +/** + * Python style dictionary + */ +export default class Dict { + constructor(private readonly internalMap = new Map()) {} + + public get size() { + return this.internalMap.size + } + + public [Symbol.iterator]() { + return this.internalMap[Symbol.iterator]() + } + + public get(key: K) { + return this.internalMap.get(key) + } + + public set(key: K, value: V) { + return this.internalMap.set(key, value) + } + + public has(key: K) { + return this.internalMap.has(key) + } + + /** + * Similar to how the python dictionary's setdefault function works: + * If the key is not present, it is set to the given value, then that value is returned + * Otherwise, `setdefault` returns the value stored in the dictionary without + * modifying it + */ + public setdefault(key: K, value: V) { + if (!this.has(key)) { + this.set(key, value) + } + + return this.get(key)! + } + + public update(key: K, defaultVal: V, updater: (oldV: V) => V) { + const value = this.setdefault(key, defaultVal) + const newValue = updater(value) + this.set(key, newValue) + return newValue + } + + public entries() { + return [...this.internalMap.entries()] + } + + public forEach(func: (key: K, value: V) => void) { + this.internalMap.forEach((v, k) => func(k, v)) + } + + /** + * Similar to `mapAsync`, but for an async mapping function that does not return any value + */ + public async forEachAsync(func: (k: K, v: V, index: number) => Promise): Promise { + await Promise.all(this.map((key, value, i) => func(key, value, i))) + } + + public map(func: (key: K, value: V, index: number) => T) { + return this.entries().map(([k, v], i) => func(k, v, i)) + } + + /** + * Using a mapping function that returns a promise, transform a map + * to another map with different keys and values. All calls to the mapping function + * execute asynchronously + */ + public mapAsync(func: (key: K, value: V, index: number) => Promise) { + return Promise.all(this.map((key, value, i) => func(key, value, i))) + } + + public flatMap(func: (key: K, value: V, index: number) => U[]) { + return this.entries().flatMap(([k, v], i) => func(k, v, i)) + } +} + +/** + * Convenience class for maps that store an array of values + */ +export class ArrayMap extends Dict { + public add(key: K, item: V) { + this.setdefault(key, []).push(item) + } + } + + export function filterImportDeclarations({ + body + }: es.Program): [ + ArrayMap, + Exclude[] + ] { + return body.reduce( + ([importNodes, otherNodes], node) => { + if (!isImportDeclaration(node)) return [importNodes, [...otherNodes, node]] + + const moduleName = getModuleDeclarationSource(node) + importNodes.add(moduleName, node) + return [importNodes, otherNodes] + }, + [new ArrayMap(), []] as [ + ArrayMap, + Exclude[] + ] + ) +} diff --git a/src/cse-machine/environment.ts b/src/cse-machine/environment.ts new file mode 100644 index 0000000..cf050fc --- /dev/null +++ b/src/cse-machine/environment.ts @@ -0,0 +1,120 @@ +import { Value } from './stash'; +import * as es from 'estree'; +import { Heap } from './heap'; +import { Context } from './context'; +import { Control } from './control'; +import { Closure } from './closure'; +import { isIdentifier } from './utils'; +import { Node } from './types'; + +export interface Frame { + [name: string]: any +} + +export interface Environment { + readonly id: string + name: string + tail: Environment | null + callExpression?: es.CallExpression + head: Frame + heap: Heap + thisContext?: Value +} + +export const uniqueId = (context: Context): string => { + return `${context.runtime.objectCount++}` +} + +export const createEnvironment = ( + context: Context, + closure: Closure, + args: Value[], + callExpression: es.CallExpression +): Environment => { + const environment: Environment = { + // TODO: name + name: '', + tail: closure.environment, + head: {}, + heap: new Heap(), + id: uniqueId(context), + callExpression: { + ...callExpression, + //arguments: args.map(ast.primitive) + } + } + + // console.info('closure.node.params:', closure.node.params); + // console.info('Number of params:', closure.node.params.length); + + closure.node.params.forEach((param, index) => { + if (isRestElement(param)) { + const array = args.slice(index) + handleArrayCreation(context, array, environment) + environment.head[(param.argument as es.Identifier).name] = array + } else { + environment.head[(param as es.Identifier).name] = args[index] + } + }) + return environment +} + +export const createSimpleEnvironment = ( + context: Context, + name: string, + tail: Environment | null = null +): Environment => { + return { + id: uniqueId(context), + name, + tail, + head: {}, + heap: new Heap(), + // callExpression 和 thisContext 可选,根据需要传递 + }; +}; + +export const createProgramEnvironment = (context: Context, isPrelude: boolean): Environment => { + return createSimpleEnvironment(context, isPrelude ? 'prelude' : 'programEnvironment'); +}; + +export const createBlockEnvironment = ( + context: Context, + name = 'blockEnvironment' +): Environment => { + return { + name, + tail: currentEnvironment(context), + head: {}, + heap: new Heap(), + id: uniqueId(context) + } +} + +export const isRestElement = (node: Node): node is es.RestElement => { + return (node as es.RestElement).type === 'RestElement'; +}; + +export const handleArrayCreation = ( + context: Context, + array: any[], + envOverride?: Environment +): void => { + const environment = envOverride ?? currentEnvironment(context); + Object.defineProperties(array, { + id: { value: uniqueId(context) }, + environment: { value: environment, writable: true } + }); + environment.heap.add(array as any); // 假设 heap.add 已定义 +}; + +export const currentEnvironment = (context: Context): Environment => { + return context.runtime.environments[0]; +}; + +export const popEnvironment = (context: Context) => context.runtime.environments.shift() + +export const pushEnvironment = (context: Context, environment: Environment) => { + context.runtime.environments.unshift(environment) + context.runtime.environmentTree.insert(environment) +} diff --git a/src/cse-machine/error.ts b/src/cse-machine/error.ts new file mode 100644 index 0000000..b147264 --- /dev/null +++ b/src/cse-machine/error.ts @@ -0,0 +1,7 @@ +export class CseError { + message: string; + constructor(message: string) { + this.message = message; + } +} + \ No newline at end of file diff --git a/src/cse-machine/heap.ts b/src/cse-machine/heap.ts new file mode 100644 index 0000000..4d3e53e --- /dev/null +++ b/src/cse-machine/heap.ts @@ -0,0 +1,54 @@ +import { Environment } from './environment'; +import { Closure } from './closure'; + +// Every array also has the properties `id` and `environment` for use in the frontend CSE Machine +export type EnvArray = any[] & { + readonly id: string + environment: Environment +} + +// Objects in the heap can only store arrays or closures +export type HeapObject = EnvArray | Closure + +/** + * The heap stores all objects in each environment. + */ +export class Heap { + private storage: Set | null = null + + public constructor() {} + + add(...items: HeapObject[]): void { + this.storage ??= new Set() + for (const item of items) { + this.storage.add(item) + } + } + + /** Checks the existence of `item` in the heap. */ + contains(item: any): boolean { + return this.storage?.has(item) ?? false + } + + /** Gets the number of items in the heap. */ + size(): number { + return this.storage?.size ?? 0 + } + + /** + * Removes `item` from current heap and adds it to `otherHeap`. + * If the current heap does not contain `item`, nothing happens. + * @returns whether the item transfer is successful + */ + move(item: HeapObject, otherHeap: Heap): boolean { + if (!this.contains(item)) return false + this.storage!.delete(item) + otherHeap.add(item) + return true + } + + /** Returns a copy of the heap's contents. */ + getHeap(): Set { + return new Set(this.storage) + } +} diff --git a/src/cse-machine/instrCreator.ts b/src/cse-machine/instrCreator.ts new file mode 100644 index 0000000..5caa50a --- /dev/null +++ b/src/cse-machine/instrCreator.ts @@ -0,0 +1,76 @@ +import { Environment } from "./environment"; +import { AppInstr, AssmtInstr, BinOpInstr, BranchInstr, EnvInstr, Instr, InstrType, Node, UnOpInstr } from "./types"; +import type * as es from 'estree'; + +export const popInstr = (srcNode: Node): Instr => ({ instrType: InstrType.POP, srcNode }) + +export const assmtInstr = ( + symbol: string, + constant: boolean, + declaration: boolean, + srcNode: Node +): AssmtInstr => ({ + instrType: InstrType.ASSIGNMENT, + symbol, + constant, + declaration, + srcNode +}) + +export const appInstr = (numOfArgs: number, srcNode: es.CallExpression): AppInstr => ({ + instrType: InstrType.APPLICATION, + numOfArgs, + srcNode +}) + +export const envInstr = (env: Environment, srcNode: Node): EnvInstr => ({ + instrType: InstrType.ENVIRONMENT, + env, + srcNode +}) + +export const markerInstr = (srcNode: Node): Instr => ({ + instrType: InstrType.MARKER, + srcNode +}) + +export const binOpInstr = (symbol: any, srcNode: Node): BinOpInstr => ({ + instrType: InstrType.BINARY_OP, + symbol, + srcNode +}) + +export const resetInstr = (srcNode: Node): Instr => ({ + instrType: InstrType.RESET, + srcNode +}) + +export const branchInstr = ( + consequent: es.Expression | es.Statement, + alternate: es.Expression | es.Statement | null | undefined, + srcNode: Node +): BranchInstr => ({ + instrType: InstrType.BRANCH, + consequent, + alternate, + srcNode +}) + +export const conditionalExpression = ( + test: es.Expression, + consequent: es.Expression, + alternate: es.Expression, + loc?: es.SourceLocation | null +): es.ConditionalExpression => ({ + type: 'ConditionalExpression', + test, + consequent, + alternate, + loc +}) + +export const unOpInstr = (symbol: es.UnaryOperator, srcNode: Node): UnOpInstr => ({ + instrType: InstrType.UNARY_OP, + symbol, + srcNode +}) diff --git a/src/cse-machine/interpreter.ts b/src/cse-machine/interpreter.ts new file mode 100644 index 0000000..91eb4f2 --- /dev/null +++ b/src/cse-machine/interpreter.ts @@ -0,0 +1,1161 @@ +/** + * This interpreter implements an explicit-control evaluator. + * + * Heavily adapted from https://github.com/source-academy/JSpike/ + */ + +/* tslint:disable:max-classes-per-file */ + +import * as es from 'estree' +import { Stack } from './stack' +import { Control, ControlItem } from './control'; +import { Stash, Value } from './stash'; +import { Environment, createBlockEnvironment, createEnvironment, createProgramEnvironment, currentEnvironment, popEnvironment, pushEnvironment } from './environment'; +import { Context } from './context'; +import { isNode, isBlockStatement, hasDeclarations, statementSequence, blockArrowFunction, constantDeclaration, pyVariableDeclaration, identifier, literal } from './ast-helper'; +import { envChanging,declareFunctionsAndVariables, handleSequence, defineVariable, getVariable, checkStackOverFlow, checkNumberOfArguments, isInstr, isSimpleFunction, isIdentifier, reduceConditional, valueProducing, handleRuntimeError, hasImportDeclarations, declareIdentifier } from './utils'; +import { AppInstr, AssmtInstr, BinOpInstr, BranchInstr, EnvInstr, Instr, InstrType, StatementSequence, UnOpInstr } from './types'; +import * as instr from './instrCreator' +import { Closure } from './closure'; +import { evaluateBinaryExpression, evaluateUnaryExpression } from './operators'; +import { conditionalExpression } from './instrCreator'; +import * as error from "../errors/errors" +import { ComplexLiteral, CSEBreak, None, PyComplexNumber, RecursivePartial, Representation, Result } from '../types'; +import { builtIns, builtInConstants } from '../stdlib'; +import { IOptions } from '..'; +import { CseError } from './error'; +import { filterImportDeclarations } from './dict'; +import { RuntimeSourceError } from '../errors/runtimeSourceError'; +import { Identifier } from '../conductor/types'; + +type CmdEvaluator = ( + command: ControlItem, + context: Context, + control: Control, + stash: Stash, + isPrelude: boolean +) => void + +let cseFinalPrint = ""; +export function addPrint(str: string) { + cseFinalPrint = cseFinalPrint + str + "\n"; +} + +/** + * Function that returns the appropriate Promise given the output of CSE machine evaluating, depending + * on whether the program is finished evaluating, ran into a breakpoint or ran into an error. + * @param context The context of the program. + * @param value The value of CSE machine evaluating the program. + * @returns The corresponding promise. + */ +export function CSEResultPromise(context: Context, value: Value): Promise { + return new Promise((resolve, reject) => { + if (value instanceof CSEBreak) { + resolve({ status: 'suspended-cse-eval', context }); + } else if (value instanceof CseError) { + resolve({ status: 'error' } as unknown as Result ); + } else { + //const rep: Value = { type: "string", value: cseFinalPrint }; + const representation = new Representation(value); + resolve({ status: 'finished', context, value, representation }) + } + }) +} + +/** + * Function to be called when a program is to be interpreted using + * the explicit control evaluator. + * + * @param program The program to evaluate. + * @param context The context to evaluate the program in. + * @param options Evaluation options. + * @returns The result of running the CSE machine. + */ +export function evaluate(program: es.Program, context: Context, options: RecursivePartial = {}): Value { + try { + // TODO: is undefined variables check necessary for Python? + // checkProgramForUndefinedVariables(program, context) + } catch (error: any) { + context.errors.push(new CseError(error.message)); + return { type: 'error', message: error.message }; + } + // TODO: should call transformer like in js-slang + // seq.transform(program) + + try { + context.runtime.isRunning = true + context.control = new Control(program); + context.stash = new Stash(); + // Adaptation for new feature + const result = runCSEMachine( + context, + context.control, + context.stash, + options.envSteps!, + options.stepLimit!, + options.isPrelude + ); + const rep: Value = { type: "string", value: cseFinalPrint }; + return rep; + } catch (error: any) { + context.errors.push(new CseError(error.message)); + return { type: 'error', message: error.message }; + } finally { + context.runtime.isRunning = false + } +} + +function evaluateImports(program: es.Program, context: Context) { + try { + const [importNodeMap] = filterImportDeclarations(program) + const environment = currentEnvironment(context) + for (const [moduleName, nodes] of importNodeMap) { + const functions = context.nativeStorage.loadedModules[moduleName] + for (const node of nodes) { + for (const spec of node.specifiers) { + declareIdentifier(context, spec.local.name, node, environment) + let obj: any + + switch (spec.type) { + case 'ImportSpecifier': { + if (spec.imported.type === 'Identifier') { + obj = functions[spec.imported.name]; + } else { + throw new Error(`Unexpected literal import: ${spec.imported.value}`); + } + //obj = functions[(spec.imported).name] + break + } + case 'ImportDefaultSpecifier': { + obj = functions.default + break + } + case 'ImportNamespaceSpecifier': { + obj = functions + break + } + } + + defineVariable(context, spec.local.name, obj, true, node) + } + } + } + } catch (error) { + handleRuntimeError(context, error as RuntimeSourceError) + } +} + +/** + * The primary runner/loop of the explicit control evaluator. + * + * @param context The context to evaluate the program in. + * @param control Points to the current Control stack. + * @param stash Points to the current Stash. + * @param envSteps Number of environment steps to run. + * @param stepLimit Maximum number of steps to execute. + * @param isPrelude Whether the program is the prelude. + * @returns The top value of the stash after execution. + */ +function runCSEMachine( + context: Context, + control: Control, + stash: Stash, + envSteps: number, + stepLimit: number, + isPrelude: boolean = false +): Value { + const eceState = generateCSEMachineStateStream( + context, + control, + stash, + envSteps, + stepLimit, + isPrelude + ); + + // Execute the generator until it completes + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const value of eceState) { + } + + // Return the value at the top of the storage as the result + const result = stash.peek(); + return result !== undefined ? result : { type: 'undefined' }; +} + +/** + * Generator function that yields the state of the CSE Machine at each step. + * + * @param context The context of the program. + * @param control The control stack. + * @param stash The stash storage. + * @param envSteps Number of environment steps to run. + * @param stepLimit Maximum number of steps to execute. + * @param isPrelude Whether the program is the prelude. + * @yields The current state of the stash, control stack, and step count. + */ +export function* generateCSEMachineStateStream( + context: Context, + control: Control, + stash: Stash, + envSteps: number, + stepLimit: number, + isPrelude: boolean = false +) { + + // steps: number of steps completed + let steps = 0 + + let command = control.peek() + + // Push first node to be evaluated into context. + // The typeguard is there to guarantee that we are pushing a node (which should always be the case) + if (command && isNode(command)) { + context.runtime.nodes.unshift(command) + } + + while (command) { + // For local debug only + // console.info('next command to be evaluated'); + // console.info(command); + + // Return to capture a snapshot of the control and stash after the target step count is reached + if (!isPrelude && steps === envSteps) { + yield { stash, control, steps } + return + } + // Step limit reached, stop further evaluation + if (!isPrelude && steps === stepLimit) { + break + } + + if (!isPrelude && envChanging(command)) { + // command is evaluated on the next step + // Hence, next step will change the environment + context.runtime.changepointSteps.push(steps + 1) + } + + control.pop() + if (isNode(command)) { + context.runtime.nodes.shift() + context.runtime.nodes.unshift(command) + //checkEditorBreakpoints(context, command) + cmdEvaluators[command.type](command, context, control, stash, isPrelude) + if (context.runtime.break && context.runtime.debuggerOn) { + // TODO + // We can put this under isNode since context.runtime.break + // will only be updated after a debugger statement and so we will + // run into a node immediately after. + // With the new evaluator, we don't return a break + // return new CSEBreak() + } + } else { + // Command is an instruction + cmdEvaluators[(command as Instr).instrType](command, context, control, stash, isPrelude) + } + + // Push undefined into the stack if both control and stash is empty + if (control.isEmpty() && stash.isEmpty()) { + //stash.push(undefined) + } + command = control.peek() + + steps += 1 + if (!isPrelude) { + context.runtime.envStepsTotal = steps + } + + // printEnvironmentVariables(context.runtime.environments); + + yield { stash, control, steps } + } +} + +function printEnvironmentVariables(environments: Environment[]): void { + console.info('----------------------------------------'); + environments.forEach(env => { + console.info(`Env: ${env.name} (ID: ${env.id})`); + + const variables = env.head; + const variableNames = Object.keys(variables); + + if (variableNames.length > 0) { + variableNames.forEach(varName => { + const descriptor = Object.getOwnPropertyDescriptor(env.head, varName); + if (descriptor) { + const value = descriptor.value.value; + console.info('value: ', value); + const valueStr = (typeof value === 'object' && value !== null) + ? JSON.stringify(value, null, 2) + : String(value); + console.info(` ${varName}: ${valueStr}`); + } else { + console.info(` ${varName}: None`); + } + }); + } else { + console.info(' no defined variables'); + } + }); +} + +const cmdEvaluators: { [type: string]: CmdEvaluator } = { + /** + * AST Nodes + */ + + Program: function ( + command: ControlItem, + context: Context, + control: Control, + stash: Stash, + isPrelude: boolean + ) { + // Clean up non-global, non-program, and non-preparation environments + + while ( + currentEnvironment(context).name !== 'global' && + currentEnvironment(context).name !== 'programEnvironment' && + currentEnvironment(context).name !== 'prelude' + ) { + popEnvironment(context) + } + + if (hasDeclarations(command as es.BlockStatement) || hasImportDeclarations(command as es.BlockStatement)) { + if (currentEnvironment(context).name != 'programEnvironment') { + const programEnv = createProgramEnvironment(context, isPrelude) + pushEnvironment(context, programEnv) + } + const environment = currentEnvironment(context) + evaluateImports(command as unknown as es.Program, context) + declareFunctionsAndVariables(context, command as es.BlockStatement, environment) + } + + if ((command as es.Program).body.length === 1) { + // If the program contains only a single statement, execute it immediately + const next = (command as es.Program).body[0]; + cmdEvaluators[next.type](next, context, control, stash, isPrelude); + } else { + // Push the block body as a sequence of statements onto the control stack + const seq: StatementSequence = statementSequence( + (command as es.Program).body as es.Statement[], + (command as es.Program).loc + ) as unknown as StatementSequence + control.push(seq); + } + }, + + BlockStatement: function ( + command: ControlItem, + context: Context, + control: Control + ) { + const next = control.peek(); + + // for some of the block statements, such as if, for, + // no need to create a new environment + + if(!command.skipEnv){ + // If environment instructions need to be pushed + if ( + next && + !(isInstr(next) && next.instrType === InstrType.ENVIRONMENT) && + !control.canAvoidEnvInstr() + ) { + control.push(instr.envInstr(currentEnvironment(context), command as es.BlockStatement)); + } + + // create new block environment (for function) + const environment = createBlockEnvironment(context, 'blockEnvironment'); + declareFunctionsAndVariables(context, command as es.BlockStatement, environment); + pushEnvironment(context, environment); + } + + // Push the block body onto the control stack as a sequence of statements + const seq: StatementSequence = statementSequence((command as es.BlockStatement).body, (command as es.BlockStatement).loc); + control.push(seq); + }, + + StatementSequence: function ( + command: ControlItem, + context: Context, + control: Control, + stash: Stash, + isPrelude: boolean + ) { + if ((command as StatementSequence).body.length === 1) { + // If the program contains only a single statement, execute it immediately + const next = (command as StatementSequence).body[0]; + cmdEvaluators[next.type](next, context, control, stash, isPrelude); + } else { + // Split and push individual nodes + control.push(...handleSequence((command as StatementSequence).body)); + } + }, + + // WhileStatement: function ( + // command: es.WhileStatement, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // if (hasBreakStatement(command.body as es.BlockStatement)) { + // control.push(instr.breakMarkerInstr(command)); + // } + // control.push(instr.whileInstr(command.test, command.body, command)); + // control.push(command.test); + // control.push(ast.identifier('undefined', command.loc)); // 如果没有循环执行,返回 undefined + // }, + + // ForStatement: function ( + // command: es.ForStatement, + // context: Context, + // control: Control + // ) { + // const init = command.init!; + // const test = command.test!; + // const update = command.update!; + + // if (init.type === 'VariableDeclaration' && init.kind === 'let') { + // const id = init.declarations[0].id as es.Identifier; + // const valueExpression = init.declarations[0].init!; + + // control.push( + // ast.blockStatement( + // [ + // init, + // ast.forStatement( + // ast.assignmentExpression(id, valueExpression, command.loc), + // test, + // update, + // ast.blockStatement( + // [ + // ast.variableDeclaration( + // [ + // ast.variableDeclarator( + // ast.identifier(`_copy_of_${id.name}`, command.loc), + // ast.identifier(id.name, command.loc), + // command.loc + // ) + // ], + // command.loc + // ), + // ast.blockStatement( + // [ + // ast.variableDeclaration( + // [ + // ast.variableDeclarator( + // ast.identifier(id.name, command.loc), + // ast.identifier(`_copy_of_${id.name}`, command.loc), + // command.loc + // ) + // ], + // command.loc + // ), + // command.body + // ], + // command.loc + // ) + // ], + // command.loc + // ), + // command.loc + // ) + // ], + // command.loc + // ) + // ); + // } else { + // if (hasBreakStatement(command.body as es.BlockStatement)) { + // control.push(instr.breakMarkerInstr(command)); + // } + // control.push(instr.forInstr(init, test, update, command.body, command)); + // control.push(test); + // control.push(instr.popInstr(command)); // Pop value from init assignment + // control.push(init); + // control.push(ast.identifier('undefined', command.loc)); // Return undefined if there is no loop execution + // } + // }, + + IfStatement: function ( + command: ControlItem, //es.IfStatement, + context: Context, + control: Control, + stash: Stash + ) { + control.push(...reduceConditional(command as es.IfStatement)); + }, + + ExpressionStatement: function ( + command: ControlItem,//es.ExpressionStatement, + context: Context, + control: Control, + stash: Stash, + isPrelude: boolean + ) { + cmdEvaluators[(command as es.ExpressionStatement).expression.type]((command as es.ExpressionStatement).expression, context, control, stash, isPrelude); + }, + + // DebuggerStatement: function ( + // command: es.DebuggerStatement, + // context: Context + // ) { + // context.runtime.break = true; + // }, + + VariableDeclaration: function ( + command: ControlItem, + context: Context, + control: Control + ) { + const declaration: es.VariableDeclarator = (command as es.VariableDeclaration).declarations[0]; + const id = declaration.id as es.Identifier; + const init = declaration.init!; + + control.push(instr.popInstr(command as es.VariableDeclaration)); + control.push(instr.assmtInstr(id.name, (command as es.VariableDeclaration).kind === 'const', true, command as es.VariableDeclaration)); + control.push(init); + }, + + FunctionDeclaration: function ( + command: ControlItem, //es.FunctionDeclaration, + context: Context, + control: Control + ) { + const lambdaExpression: es.ArrowFunctionExpression = blockArrowFunction( + (command as es.FunctionDeclaration).params as es.Identifier[], + (command as es.FunctionDeclaration).body, + (command as es.FunctionDeclaration).loc + ); + const lambdaDeclaration: pyVariableDeclaration = constantDeclaration( + (command as es.FunctionDeclaration).id!.name, + lambdaExpression, + (command as es.FunctionDeclaration).loc + ); + control.push(lambdaDeclaration as ControlItem); + }, + + ReturnStatement: function ( + command: ControlItem, //as es.ReturnStatement, + context: Context, + control: Control + ) { + const next = control.peek(); + if (next && isInstr(next) && next.instrType === InstrType.MARKER) { + control.pop(); + } else { + control.push(instr.resetInstr(command as es.ReturnStatement)); + } + if ((command as es.ReturnStatement).argument) { + control.push((command as es.ReturnStatement).argument!); + } + }, + + // ContinueStatement: function ( + // command: es.ContinueStatement, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // control.push(instr.contInstr(command)); + // }, + + // BreakStatement: function ( + // command: es.BreakStatement, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // control.push(instr.breakInstr(command)); + // }, + + ImportDeclaration: function () {}, + + /** + * Expressions + */ + + Literal: function ( + command: ControlItem, //es.Literal + context: Context, + control: Control, + stash: Stash + ) { + const literalValue = (command as es.Literal).value; + const bigintValue = (command as es.BigIntLiteral).bigint; + const complexValue = ((command as unknown) as ComplexLiteral).complex; + + if (literalValue !== undefined) { + let value: Value; + if (typeof literalValue === 'number') { + value = { type: 'number', value: literalValue }; + } else if (typeof literalValue === 'string') { + value = { type: 'string', value: literalValue }; + } else if (typeof literalValue === 'boolean') { + value = { type: 'bool', value: literalValue }; + //value = literalValue; + } else { + //handleRuntimeError(context, new CseError('Unsupported literal type')); + return; + } + stash.push(value); + } else if (bigintValue !== undefined) { + let fixedBigintValue = bigintValue.toString().replace(/_/g, ""); + let value: Value; + try { + value = { type: 'bigint', value: BigInt(fixedBigintValue) }; + } catch (e) { + //handleRuntimeError(context, new CseError('Invalid BigInt literal')); + return; + } + stash.push(value); + } else if (complexValue !== undefined) { + let value: Value; + let pyComplexNumber = new PyComplexNumber(complexValue.real, complexValue.imag); + try { + value = { type: 'complex', value: pyComplexNumber }; + } catch (e) { + //handleRuntimeError(context, new CseError('Invalid BigInt literal')); + return; + } + stash.push(value); + } else { + // TODO + // Error + } + + }, + + NoneType: function ( + command: ControlItem, //es.Literal + context: Context, + control: Control, + stash: Stash + ) { + stash.push({ type: 'NoneType', value: undefined }); + }, + + // AssignmentExpression: function ( + // command: es.AssignmentExpression, + // context: Context, + // control: Control + // ) { + // if (command.left.type === 'MemberExpression') { + // control.push(instr.arrAssmtInstr(command)); + // control.push(command.right); + // control.push(command.left.property); + // control.push(command.left.object); + // } else if (command.left.type === 'Identifier') { + // const id = command.left; + // control.push(instr.assmtInstr(id.name, false, false, command)); + // control.push(command.right); + // } + // }, + + // ArrayExpression: function ( + // command: es.ArrayExpression, + // context: Context, + // control: Control + // ) { + // const elems = command.elements as es.Expression[]; + // reverse(elems); + // const len = elems.length; + + // control.push(instr.arrLitInstr(len, command)); + // for (const elem of elems) { + // control.push(elem); + // } + // }, + + // MemberExpression: function ( + // command: es.MemberExpression, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // control.push(instr.arrAccInstr(command)); + // control.push(command.property); + // control.push(command.object); + // }, + + ConditionalExpression: function ( + command: ControlItem, //es.ConditionalExpression, + context: Context, + control: Control, + stash: Stash + ) { + control.push(...reduceConditional(command as es.ConditionalExpression)); + }, + + Identifier: function ( + command: ControlItem,//es.Identifier, + context: Context, + control: Control, + stash: Stash + ) { + if (builtInConstants.has((command as es.Identifier).name)) { + const builtinCons = builtInConstants.get((command as es.Identifier).name)!; + try { + stash.push(builtinCons); + return; + } catch (error) { + // Error + if (error instanceof Error) { + throw new Error(error.message); + } else { + throw new Error(); + } + // if (error instanceof RuntimeSourceError) { + // throw error; + // } else { + // throw new RuntimeSourceError(`Error in builtin function ${funcName}: ${error}`); + // } + } + } else { + stash.push(getVariable(context, (command as es.Identifier).name, (command as es.Identifier))); + } + }, + + UnaryExpression: function ( + command: ControlItem, //es.UnaryExpression, + context: Context, + control: Control + ) { + control.push(instr.unOpInstr((command as es.UnaryExpression).operator, command as es.UnaryExpression)); + control.push((command as es.UnaryExpression).argument); + }, + + BinaryExpression: function ( + command: ControlItem, //es.BinaryExpression, + context: Context, + control: Control + ) { + // currently for if statement + + control.push(instr.binOpInstr((command as es.BinaryExpression).operator, command as es.Node)); + control.push((command as es.BinaryExpression).right); + control.push((command as es.BinaryExpression).left); + }, + + LogicalExpression: function ( + command: ControlItem, //es.LogicalExpression, + context: Context, + control: Control + ) { + if ((command as es.LogicalExpression).operator === '&&') { + control.push( + conditionalExpression((command as es.LogicalExpression).left, (command as es.LogicalExpression).right, literal(false), (command as es.LogicalExpression).loc) + ); + } else { + control.push( + conditionalExpression((command as es.LogicalExpression).left, literal(true), (command as es.LogicalExpression).right, (command as es.LogicalExpression).loc) + ); + } + }, + + ArrowFunctionExpression: function ( + command: ControlItem,//es.ArrowFunctionExpression, + context: Context, + control: Control, + stash: Stash, + isPrelude: boolean + ) { + const closure: Closure = Closure.makeFromArrowFunction( + command as es.ArrowFunctionExpression, + currentEnvironment(context), + context, + true, + isPrelude + ); + stash.push(closure); + }, + + CallExpression: function ( + command: ControlItem,//es.CallExpression, + context: Context, + control: Control + ) { + // add + if (isIdentifier((command as es.CallExpression).callee)) { + let name = ((command as es.CallExpression).callee as es.Identifier).name; + if (name === '__py_adder' || name === '__py_minuser' || + name === '__py_multiplier' || name === '__py_divider' || + name === '__py_modder' || name === '__py_floorer' || + name === '__py_powerer') { + control.push(instr.binOpInstr((command as es.CallExpression).callee as es.Identifier, command as es.Node)) + control.push((command as es.CallExpression).arguments[1]) + control.push((command as es.CallExpression).arguments[0]) + return; + } + } + + control.push(instr.appInstr((command as es.CallExpression).arguments.length, command as es.CallExpression)); + for (let index = (command as es.CallExpression).arguments.length - 1; index >= 0; index--) { + control.push((command as es.CallExpression).arguments[index]); + } + control.push((command as es.CallExpression).callee); + }, + + // /** + // * Instructions + // */ + + [InstrType.RESET]: function ( + command: ControlItem, //Instr, + context: Context, + control: Control, + stash: Stash + ) { + const cmdNext: ControlItem | undefined = control.pop(); + if (cmdNext && (isNode(cmdNext) || (cmdNext as Instr).instrType !== InstrType.MARKER)) { + control.push(instr.resetInstr((command as Instr).srcNode)); + } + }, + + // [InstrType.WHILE]: function ( + // command: WhileInstr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const test = stash.pop(); + + // const error = rttc.checkIfStatement(command.srcNode, test, context.chapter); + // if (error) { + // handleRuntimeError(context, error); + // } + + // if (test) { + // control.push(command); + // control.push(command.test); + // if (hasContinueStatement(command.body as es.BlockStatement)) { + // control.push(instr.contMarkerInstr(command.srcNode)); + // } + // if (!valueProducing(command.body)) { + // control.push(ast.identifier('undefined', command.body.loc)); + // } + // control.push(command.body); + // control.push(instr.popInstr(command.srcNode)); // Pop previous body value + // } + // }, + + // [InstrType.FOR]: function ( + // command: ForInstr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const test = stash.pop(); + + // const error = rttc.checkIfStatement(command.srcNode, test, context.chapter); + // if (error) { + // handleRuntimeError(context, error); + // } + + // if (test) { + // control.push(command); + // control.push(command.test); + // control.push(instr.popInstr(command.srcNode)); // Pop value from update + // control.push(command.update); + // if (hasContinueStatement(command.body as es.BlockStatement)) { + // control.push(instr.contMarkerInstr(command.srcNode)); + // } + // if (!valueProducing(command.body)) { + // control.push(ast.identifier('undefined', command.body.loc)); + // } + // control.push(command.body); + // control.push(instr.popInstr(command.srcNode)); // Pop previous body value + // } + // }, + + [InstrType.ASSIGNMENT]: function ( + command: ControlItem, //AssmtInstr, + context: Context, + control: Control, + stash: Stash + ) { + if ((command as AssmtInstr).declaration) { + //if () + defineVariable( + context, + (command as AssmtInstr).symbol, + stash.peek()!, + (command as AssmtInstr).constant, + (command as AssmtInstr).srcNode as es.VariableDeclaration + ); + } else { + // second time definition + // setVariable( + // context, + // command.symbol, + // stash.peek(), + // command.srcNode as es.AssignmentExpression + // ); + } + }, + + [InstrType.UNARY_OP]: function ( + command: ControlItem, //UnOpInstr, + context: Context, + control: Control, + stash: Stash + ) { + const argument = stash.pop(); + // const error = rttc.checkUnaryExpression( + // command.srcNode, + // command.symbol as es.UnaryOperator, + // argument, + // context.chapter + // ); + // if (error) { + // handleRuntimeError(context, error); + // } + stash.push(evaluateUnaryExpression((command as UnOpInstr).symbol, argument)); + }, + + [InstrType.BINARY_OP]: function ( + command: ControlItem, //BinOpInstr, + context: Context, + control: Control, + stash: Stash + ) { + const right = stash.pop(); + const left = stash.pop(); + // const error = rttc.checkBinaryExpression( + // command.srcNode, + // command.symbol as es.BinaryOperator, + // context.chapter, + // left, + // right + // ); + // if (error) { + // handleRuntimeError(context, error); + // } + + if ((left.type === 'string' && right.type !== 'string') || + (left.type !== 'string' && right.type === 'string')){ + handleRuntimeError(context, new error.TypeConcatenateError(command as es.Node)); + } + + + stash.push(evaluateBinaryExpression(context, (command as BinOpInstr).symbol, left, right)); + + }, + + [InstrType.POP]: function ( + command: ControlItem,//Instr, + context: Context, + control: Control, + stash: Stash + ) { + stash.pop(); + }, + + [InstrType.APPLICATION]: function ( + command: ControlItem, //AppInstr, + context: Context, + control: Control, + stash: Stash + ) { + checkStackOverFlow(context, control); + const args: Value[] = []; + for (let index = 0; index < (command as AppInstr).numOfArgs; index++) { + args.unshift(stash.pop()!); + } + + const func: Closure = stash.pop(); + + if (!(func instanceof Closure)) { + //error + //handleRuntimeError(context, new errors.CallingNonFunctionValue(func, command.srcNode)) + } + + // continuation in python? + + // func instanceof Closure + if (func instanceof Closure) { + // Check for number of arguments mismatch error + checkNumberOfArguments(command, context, func, args, (command as AppInstr).srcNode) + + const next = control.peek() + + // Push ENVIRONMENT instruction if needed - if next control stack item + // exists and is not an environment instruction, OR the control only contains + // environment indepedent items + if ( + next && + !(isInstr(next) && next.instrType === InstrType.ENVIRONMENT) && + !control.canAvoidEnvInstr() + ) { + control.push(instr.envInstr(currentEnvironment(context), (command as AppInstr).srcNode)) + } + + // Create environment for function parameters if the function isn't nullary. + // Name the environment if the function call expression is not anonymous + if (args.length > 0) { + const environment = createEnvironment(context, (func as Closure), args, (command as AppInstr).srcNode) + pushEnvironment(context, environment) + } else { + context.runtime.environments.unshift((func as Closure).environment) + } + + // Handle special case if function is simple + if (isSimpleFunction((func as Closure).node)) { + // Closures convert ArrowExpressionStatements to BlockStatements + const block = (func as Closure).node.body as es.BlockStatement + const returnStatement = block.body[0] as es.ReturnStatement + control.push(returnStatement.argument ?? identifier('undefined', returnStatement.loc)) + } else { + if (control.peek()) { + // push marker if control not empty + control.push(instr.markerInstr((command as AppInstr).srcNode)) + } + control.push((func as Closure).node.body) + + // console.info((func as Closure).node.body); + } + + return + } + + // Value is a built-in function + let function_name = (((command as AppInstr).srcNode as es.CallExpression).callee as es.Identifier).name; + + if (builtIns.has(function_name)) { + const builtinFunc = builtIns.get(function_name)!; + + try { + stash.push(builtinFunc(args)); + return; + } catch (error) { + // Error + if (error instanceof Error) { + throw new Error(error.message); + } else { + throw new Error(); + } + // if (error instanceof RuntimeSourceError) { + // throw error; + // } else { + // throw new RuntimeSourceError(`Error in builtin function ${funcName}: ${error}`); + // } + } + } + }, + + [InstrType.BRANCH]: function ( + command: ControlItem,//BranchInstr, + context: Context, + control: Control, + stash: Stash + ) { + const test = stash.pop(); + + // const error = rttc.checkIfStatement(command.srcNode, test, context.chapter); + // if (error) { + // handleRuntimeError(context, error); + // } + + if (test.value) { + if (!valueProducing((command as BranchInstr).consequent)) { + control.push(identifier('undefined', (command as BranchInstr).consequent.loc)); + } + ((command as BranchInstr).consequent as ControlItem).skipEnv = true; + control.push((command as BranchInstr).consequent); + } else if ((command as BranchInstr).alternate) { + if (!valueProducing((command as BranchInstr).alternate!)) { + control.push(identifier('undefined', (command as BranchInstr).alternate!.loc)); + } + ((command as BranchInstr).alternate as ControlItem).skipEnv = true; + control.push((command as BranchInstr).alternate!); + } else { + control.push(identifier('undefined', (command as BranchInstr).srcNode.loc)); + } + }, + + [InstrType.ENVIRONMENT]: function ( + command: ControlItem, //EnvInstr, + context: Context + ) { + while (currentEnvironment(context).id !== (command as EnvInstr).env.id) { + popEnvironment(context); + } + }, + + // [InstrType.ARRAY_LITERAL]: function ( + // command: ArrLitInstr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const arity = command.arity; + // const array: any[] = []; + // for (let i = 0; i < arity; ++i) { + // array.unshift(stash.pop()); + // } + // handleArrayCreation(context, array); + // stash.push(array); + // }, + + // [InstrType.ARRAY_ACCESS]: function ( + // command: Instr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const index = stash.pop(); + // const array = stash.pop(); + // stash.push(array[index]); + // }, + + // [InstrType.ARRAY_ASSIGNMENT]: function ( + // command: Instr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const value = stash.pop(); + // const index = stash.pop(); + // const array = stash.pop(); + // array[index] = value; + // stash.push(value); + // }, + + // [InstrType.CONTINUE]: function ( + // command: Instr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const next = control.pop() as ControlItem; + // if (isInstr(next) && next.instrType === InstrType.CONTINUE_MARKER) { + // } else if (isInstr(next) && next.instrType === InstrType.ENVIRONMENT) { + // control.push(command); + // control.push(next); + // } else { + // control.push(command); + // } + // }, + + // [InstrType.CONTINUE_MARKER]: function () { + // }, + + // [InstrType.BREAK]: function ( + // command: Instr, + // context: Context, + // control: Control, + // stash: Stash + // ) { + // const next = control.pop() as ControlItem; + // if (isInstr(next) && next.instrType === InstrType.BREAK_MARKER) { + // } else if (isInstr(next) && next.instrType === InstrType.ENVIRONMENT) { + // control.push(command); + // control.push(next); + // } else { + // control.push(command); + // } + // }, + + // [InstrType.BREAK_MARKER]: function () { + // } +}; diff --git a/src/cse-machine/operators.ts b/src/cse-machine/operators.ts new file mode 100644 index 0000000..a98ca40 --- /dev/null +++ b/src/cse-machine/operators.ts @@ -0,0 +1,446 @@ +import * as es from "estree"; +import { handleRuntimeError, isIdentifier, pythonMod } from "./utils"; +import { Context } from "./context"; +import * as error from "../errors/errors" +import { PyComplexNumber } from "../types"; + +export type BinaryOperator = + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "<<" + | ">>" + | ">>>" + | "+" + | "-" + | "*" + | "/" + | "%" + | "**" + | "|" + | "^" + | "&" + | "in" + | "instanceof"; + + + +// export function evaluateBinaryExpression(operator: BinaryOperator, left: any, right: any) { +// switch (operator) { +// case '+': +// return left + right +// case '-': +// return left - right +// case '*': +// return left * right +// case '/': +// return left / right +// case '%': +// return left % right +// case '===': +// return left === right +// case '!==': +// return left !== right +// case '<=': +// return left <= right +// case '<': +// return left < right +// case '>': +// return left > right +// case '>=': +// return left >= right +// default: +// return undefined +// } +// } + +export function evaluateUnaryExpression(operator: es.UnaryOperator, value: any) { + if (operator === '!') { + if (value.type === 'bool') { + return { + type: 'bool', + value: !(Boolean(value.value)) + }; + } else { + // TODO: error + } + } else if (operator === '-') { + if (value.type === 'bigint') { + return { + type: 'bigint', + value: -value.value + }; + } else if (value.type === 'number') { + return { + type: 'number', + value: -Number(value.value) + }; + } else { + // TODO: error + } + // else if (value.type === 'bool') { + // return { + // type: 'bigint', + // value: Boolean(value.value)?BigInt(-1):BigInt(0) + // }; + // } + } else if (operator === 'typeof') { + // todo + return { + type: String, + value: typeof value.value + }; + } else { + return value; + } +} + +export function evaluateBinaryExpression(context: Context, identifier: any, left: any, right: any) { + //if(isIdentifier(identifier)){ + //if(identifier.name === '__py_adder') { + if (left.type === 'string' && right.type === 'string' && identifier.name === '__py_adder') { + if(isIdentifier(identifier) && identifier.name === '__py_adder') { + return { + type: 'string', + value: left.value + right.value + }; + } else { + let ret_type : any; + let ret_value : any; + if (identifier === '>') { + ret_value = left.value > right.value; + } else if(identifier === '>=') { + ret_value = left.value >= right.value; + } else if(identifier === '<') { + ret_value = left.value < right.value; + } else if(identifier === '<=') { + ret_value = left.value <= right.value; + } else if(identifier === '===') { + ret_value = left.value === right.value; + } else if(identifier === '!==') { + ret_value = left.value !== right.value; + } else { + // TODO: error + } + + return { + type: 'bool', + value: ret_value + }; + } + } else { + // numbers: only int and float, not bool + const numericTypes = ['number', 'bigint', 'complex']; //, 'bool' + if (!numericTypes.includes(left.type) || !numericTypes.includes(right.type)) { + // TODO: + //throw new Error('Placeholder: invalid operand types for addition'); + // console.info('not num or bigint', left.type, right.type); + } + + // if (left.type === 'bool') { + // left.type = 'bigint'; + // left.value = left.value?BigInt(1):BigInt(0); + // } + // if (right.type === 'bool') { + // right.type = 'bigint'; + // right.value = right.value?BigInt(1):BigInt(0); + // } + + let originalLeft = { type : left.type, value : left.value }; + let originalRight = { type : right.type, value : right.value }; + + if (left.type !== right.type) { + // left.type = 'number'; + // left.value = Number(left.value); + // right.type = 'number'; + // right.value = Number(right.value); + + if (left.type === 'complex' || right.type === 'complex') { + left.type = 'complex'; + right.type = 'complex'; + left.value = PyComplexNumber.fromValue(left.value); + right.value = PyComplexNumber.fromValue(right.value); + } else if (left.type === 'number' || right.type === 'number') { + left.type = 'number'; + right.type = 'number'; + left.value = Number(left.value); + right.value = Number(right.value); + } + } + + let ret_value : any; + let ret_type : any = left.type; + + if(isIdentifier(identifier)) { + if(identifier.name === '__py_adder') { + if (left.type === 'complex' || right.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.add(rightComplex); + } else { + ret_value = left.value + right.value; + } + } else if(identifier.name === '__py_minuser') { + if (left.type === 'complex' || right.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.sub(rightComplex); + } else { + ret_value = left.value - right.value; + } + } else if(identifier.name === '__py_multiplier') { + if (left.type === 'complex' || right.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.mul(rightComplex); + } else { + ret_value = left.value * right.value; + } + } else if(identifier.name === '__py_divider') { + if (left.type === 'complex' || right.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.div(rightComplex); + } else { + if(right.value !== 0) { + ret_type = 'number'; + ret_value = Number(left.value) / Number(right.value); + } else { + // TODO: divide by 0 error + } + } + } else if(identifier.name === '__py_modder') { + if (left.type === 'complex') { + // TODO: error + } + ret_value = pythonMod(left.value, right.value); + } else if(identifier.name === '__py_floorer') { + // TODO: floorer not in python now + ret_value = 0; + } else if(identifier.name === '__py_powerer') { + if (left.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + ret_value = leftComplex.pow(rightComplex); + } else { + if (left.type === 'bigint' && right.value < 0) { + ret_value = Number(left.value) ** Number(right.value); + ret_type = 'number'; + } else { + ret_value = left.value ** right.value; + } + } + } else { + // TODO: throw an error + } + } else { + ret_type = 'bool'; + + // one of them is complex, convert all to complex then compare + // for complex, only '==' and '!=' valid + if (left.type === 'complex') { + const leftComplex = PyComplexNumber.fromValue(left.value); + const rightComplex = PyComplexNumber.fromValue(right.value); + if (identifier === '===') { + ret_value = leftComplex.equals(rightComplex); + } else if (identifier === '!==') { + ret_value = !leftComplex.equals(rightComplex); + } else { + // TODO: error + } + } else if (originalLeft.type !== originalRight.type) { + let int_num : any; + let floatNum : any; + let compare_res; + if (originalLeft.type === 'bigint') { + int_num = originalLeft; + floatNum = originalRight; + compare_res = pyCompare(int_num, floatNum); + } else { + int_num = originalRight; + floatNum = originalLeft; + compare_res = -pyCompare(int_num, floatNum); + } + + if (identifier === '>') { + ret_value = compare_res > 0; + } else if(identifier === '>=') { + ret_value = compare_res >= 0; + } else if(identifier === '<') { + ret_value = compare_res < 0; + } else if(identifier === '<=') { + ret_value = compare_res <= 0; + } else if(identifier === '===') { + ret_value = compare_res === 0; + } else if(identifier === '!==') { + ret_value = compare_res !== 0; + } else { + // TODO: error + } + + + } else { + if (identifier === '>') { + ret_value = left.value > right.value; + } else if(identifier === '>=') { + ret_value = left.value >= right.value; + } else if(identifier === '<') { + ret_value = left.value < right.value; + } else if(identifier === '<=') { + ret_value = left.value <= right.value; + } else if(identifier === '===') { + ret_value = left.value === right.value; + } else if(identifier === '!==') { + ret_value = left.value !== right.value; + } else { + // TODO: error + } + } + + + } + + return { + type: ret_type, + value: ret_value + }; + } +} + +function pyCompare(int_num : any, float_num : any) { + // int_num.value < float_num.value => -1 + // int_num.value = float_num.value => 0 + // int_num.value > float_num.value => 1 + + // If float_num is positive Infinity, then int_num is considered smaller. + if (float_num.value === Infinity) { + return -1; + } + if (float_num.value === -Infinity) { + return 1; + } + + const signInt = (int_num.value < 0) ? -1 : (int_num.value > 0 ? 1 : 0); + const signFlt = Math.sign(float_num.value); // -1, 0, or 1 + + if (signInt < signFlt) return -1; // e.g. int<0, float>=0 => int < float + if (signInt > signFlt) return 1; // e.g. int>=0, float<0 => int > float + + // Both have the same sign (including 0). + // If both are zero, treat them as equal. + if (signInt === 0 && signFlt === 0) { + return 0; + } + + // Both are either positive or negative. + // If |int_num.value| is within 2^53, it can be safely converted to a JS number for an exact comparison. + const absInt = int_num.value < 0 ? -int_num.value : int_num.value; + const MAX_SAFE = 9007199254740991; // 2^53 - 1 + + if (absInt <= MAX_SAFE) { + // Safe conversion to double. + const intAsNum = Number(int_num.value); + const diff = intAsNum - float_num.value; + if (diff === 0) return 0; + return diff < 0 ? -1 : 1; + } + + // For large integers exceeding 2^53, we need to distinguish more carefully. + // General idea: Determine the order of magnitude of float_num.value (via log10) and compare it with + // the number of digits of int_num.value. An approximate comparison can indicate whether + // int_num.value is greater or less than float_num.value. + + // First, check if float_num.value is nearly zero (but not zero). + if (float_num.value === 0) { + // Although signFlt would be 0 and handled above, just to be safe: + return signInt; + } + + const absFlt = Math.abs(float_num.value); + // Determine the order of magnitude. + const exponent = Math.floor(Math.log10(absFlt)); + // For example, if float_num.value = 3.333333e49, exponent = 49, indicating roughly 50 digits in its integer part. + + // Get the decimal string representation of the absolute integer. + const intStr = absInt.toString(); + const intDigits = intStr.length; + + // If exponent + 1 is less than intDigits, then |int_num.value| has more digits + // and is larger (if positive) or smaller (if negative) than float_num.value. + // Conversely, if exponent + 1 is greater than intDigits, int_num.value has fewer digits. + const integerPartLen = exponent + 1; + if (integerPartLen < intDigits) { + // length of int_num.value is larger => all positive => int_num.value > float_num.value + // => all negative => int_num.value < float_num.value + return (signInt > 0) ? 1 : -1; + } else if (integerPartLen > intDigits) { + // length of int_num.value is smaller => all positive => int_num.value < float_num.value + // => all negative => int_num.value > float_num.value + return (signInt > 0) ? -1 : 1; + } else { + // (5.2) If the number of digits is the same, they may be extremely close. + // Method: Convert float_num.value into an approximate BigInt string and perform a lexicographical comparison. + const floatApproxStr = approximateBigIntString(absFlt, 30); + + const aTrim = intStr.replace(/^0+/, ''); + const bTrim = floatApproxStr.replace(/^0+/, ''); + + // If lengths differ after trimming, the one with more digits is larger. + if (aTrim.length > bTrim.length) { + return (signInt > 0) ? 1 : -1; + } else if (aTrim.length < bTrim.length) { + return (signInt > 0) ? -1 : 1; + } else { + // Same length: use lexicographical comparison. + const cmp = aTrim.localeCompare(bTrim); + if (cmp === 0) { + return 0; + } + // cmp>0 => aTrim > bTrim => aVal > bVal + return (cmp > 0) ? (signInt > 0 ? 1 : -1) + : (signInt > 0 ? -1 : 1); + } + } +} + +function approximateBigIntString(num: number, precision: number): string { + // Use scientific notation to obtain a string in the form "3.333333333333333e+49" + const s = num.toExponential(precision); + // Split into mantissa and exponent parts. + // The regular expression matches strings of the form: /^([\d.]+)e([+\-]\d+)$/ + const match = s.match(/^([\d.]+)e([+\-]\d+)$/); + if (!match) { + // For extremely small or extremely large numbers, toExponential() should follow this format. + // As a fallback, return Math.floor(num).toString() + return Math.floor(num).toString(); + } + let mantissaStr = match[1]; // "3.3333333333..." + const exp = parseInt(match[2], 10); // e.g. +49 + + // Remove the decimal point + mantissaStr = mantissaStr.replace('.', ''); + // Get the current length of the mantissa string + const len = mantissaStr.length; + // Calculate the required integer length: for exp ≥ 0, we want the integer part + // to have (1 + exp) digits. + const integerLen = 1 + exp; + if (integerLen <= 0) { + // This indicates num < 1 (e.g., exponent = -1, mantissa = "3" results in 0.xxx) + // For big integer comparison, such a number is very small, so simply return "0" + return "0"; + } + + if (len < integerLen) { + // The mantissa is not long enough; pad with zeros at the end. + return mantissaStr.padEnd(integerLen, '0'); + } + // If the mantissa is too long, truncate it (this is equivalent to taking the floor). + // Rounding could be applied if necessary, but truncation is sufficient for comparison. + return mantissaStr.slice(0, integerLen); +} + \ No newline at end of file diff --git a/src/cse-machine/stack.ts b/src/cse-machine/stack.ts new file mode 100644 index 0000000..9b9661f --- /dev/null +++ b/src/cse-machine/stack.ts @@ -0,0 +1,59 @@ +/** + * Stack is implemented for control and stash registers. + */ +interface IStack { + push(...items: T[]): void + pop(): T | undefined + peek(): T | undefined + size(): number + isEmpty(): boolean + getStack(): T[] +} + +export class Stack implements IStack { + // Bottom of the array is at index 0 + public storage: T[] = [] + + public constructor() {} + + public push(...items: T[]): void { + for (const item of items) { + this.storage.push(item) + } + } + + public pop(): T | undefined { + return this.storage.pop() + } + + public peek(): T | undefined { + if (this.isEmpty()) { + return undefined + } + return this.storage[this.size() - 1] + } + + public size(): number { + return this.storage.length + } + + public isEmpty(): boolean { + return this.size() == 0 + } + + public getStack(): T[] { + // return a copy of the stack's contents + return [...this.storage] + } + + public some(predicate: (value: T) => boolean): boolean { + return this.storage.some(predicate) + } + + // required for first-class continuations, + // which directly mutate this stack globally. + public setTo(otherStack: Stack): void { + this.storage = otherStack.storage + } +} + diff --git a/src/cse-machine/stash.ts b/src/cse-machine/stash.ts new file mode 100644 index 0000000..e28e496 --- /dev/null +++ b/src/cse-machine/stash.ts @@ -0,0 +1,92 @@ +// Value.ts +import { ExprNS, StmtNS } from '../ast-types'; +import { Closure } from './closure'; +import { Environment } from './environment'; +import { Stack } from './stack'; + +/** + * Value represents various runtime values in Python. + */ +export type Value = any +// | NumberValue +// | BoolValue +// | StringValue +// | FunctionValue +// | LambdaValue +// | MultiLambdaValue +// | ErrorValue +// | UndefinedValue +// | string +// | BigIntValue +// | pyClosureValue; + +export interface pyClosureValue { + type: "closure"; + closure: Closure; +} + +export interface BigIntValue { + type: 'bigint'; + value: bigint; +} + +export interface NumberValue { + type: 'number'; + value: number; +} + +export interface BoolValue { + type: 'bool'; + value: boolean; +} + +export interface StringValue { + type: 'string'; + value: string; +} + +export interface FunctionValue { + type: 'function'; + name: string; + params: string[]; + body: StmtNS.Stmt[]; + env: Environment; +} + +export interface LambdaValue { + type: 'lambda'; + parameters: string[]; + body: ExprNS.Expr; + env: Environment; +} + +export interface MultiLambdaValue { + type: 'multi_lambda'; + parameters: string[]; + body: StmtNS.Stmt[]; + varDecls: string[]; + env: Environment; +} + +export interface ErrorValue { + type: 'error'; + message: string; +} + +// TODO: Merge undefined and None. +export interface UndefinedValue { + type: 'undefined'; +} + +export class Stash extends Stack { + public constructor() { + super(); + } + + public copy(): Stash { + const newStash = new Stash(); + const stackCopy = super.getStack(); + newStash.push(...stackCopy); + return newStash; + } +} diff --git a/src/cse-machine/types.ts b/src/cse-machine/types.ts new file mode 100644 index 0000000..0810cf5 --- /dev/null +++ b/src/cse-machine/types.ts @@ -0,0 +1,118 @@ +import { ExprNS, StmtNS } from '../ast-types'; +import { Token } from '../tokenizer'; +import type * as es from 'estree'; +import { Stack } from './stack'; +import { isNode, isBlockStatement, hasDeclarations, statementSequence } from './ast-helper'; +import { Environment } from './environment'; + +export type Node = { isEnvDependent?: boolean } & ( + | es.Node + | StatementSequence +); + +export interface StatementSequence extends es.BaseStatement { + type: 'StatementSequence'; + body: es.Statement[]; + innerComments?: es.Comment[] | undefined; + // isEnvDependent?: boolean +} + +export enum InstrType { + RESET = 'Reset', + WHILE = 'While', + FOR = 'For', + ASSIGNMENT = 'Assignment', + ANN_ASSIGNMENT = 'AnnAssignment', + APPLICATION = 'Application', + UNARY_OP = 'UnaryOperation', + BINARY_OP = 'BinaryOperation', + BOOL_OP = 'BoolOperation', + COMPARE = 'Compare', + CALL = 'Call', + RETURN = 'Return', + BREAK = 'Break', + CONTINUE = 'Continue', + IF = 'If', + FUNCTION_DEF = 'FunctionDef', + LAMBDA = 'Lambda', + MULTI_LAMBDA = 'MultiLambda', + GROUPING = 'Grouping', + LITERAL = 'Literal', + VARIABLE = 'Variable', + TERNARY = 'Ternary', + PASS = 'Pass', + ASSERT = 'Assert', + IMPORT = 'Import', + GLOBAL = 'Global', + NONLOCAL = 'NonLocal', + Program = 'Program', + BRANCH = 'Branch', + POP = 'Pop', + ENVIRONMENT = 'environment', + MARKER = 'marker', +} + +interface BaseInstr { + instrType: InstrType + srcNode: Node + isEnvDependent?: boolean +} + +export interface WhileInstr extends BaseInstr { + test: es.Expression + body: es.Statement +} + +export interface ForInstr extends BaseInstr { + init: es.VariableDeclaration | es.Expression + test: es.Expression + update: es.Expression + body: es.Statement +} + +export interface AssmtInstr extends BaseInstr { + symbol: string + constant: boolean + declaration: boolean +} + +export interface UnOpInstr extends BaseInstr { + symbol: es.UnaryOperator +} + +export interface BinOpInstr extends BaseInstr { + symbol: es.Identifier +} + +export interface AppInstr extends BaseInstr { + numOfArgs: number + srcNode: es.CallExpression +} + +export interface BranchInstr extends BaseInstr { + consequent: es.Expression | es.Statement + alternate: es.Expression | es.Statement | null | undefined +} + +export interface EnvInstr extends BaseInstr { + env: Environment +} + +export interface ArrLitInstr extends BaseInstr { + arity: number +} + +export interface AssmtInstr extends BaseInstr { + symbol: string + constant: boolean + declaration: boolean +} + +export type Instr = + | BaseInstr + | WhileInstr + | AssmtInstr + | AppInstr + | BranchInstr + | EnvInstr + | ArrLitInstr \ No newline at end of file diff --git a/src/cse-machine/utils.ts b/src/cse-machine/utils.ts new file mode 100644 index 0000000..b27cfbc --- /dev/null +++ b/src/cse-machine/utils.ts @@ -0,0 +1,577 @@ +import { ExprNS, StmtNS } from '../ast-types'; +import { Token } from '../tokenizer'; +import type * as es from 'estree'; +import { Stack } from './stack'; +import { isNode, isBlockStatement, hasDeclarations } from './ast-helper'; +import { currentEnvironment, Environment } from './environment'; +import { Control, ControlItem } from './control'; +import { + AppInstr, + Instr, + InstrType, + BranchInstr, + WhileInstr, + ForInstr, + Node, + StatementSequence +} from './types' +import { Context } from './context' +import * as instr from './instrCreator' +import { Value } from './stash'; +import { Closure } from './closure'; +import { RuntimeSourceError } from '../errors/runtimeSourceError'; +import { CseError } from './error'; +import { MissingRequiredPositionalError, TooManyPositionalArgumentsError } from '../errors/errors'; + +export const isIdentifier = (node: Node): node is es.Identifier => { + return (node as es.Identifier).name !== undefined +} + +type PropertySetter = Map +type Transformer = (item: ControlItem) => ControlItem + +const setToTrue = (item: ControlItem): ControlItem => { + item.isEnvDependent = true + return item +} + +const setToFalse = (item: ControlItem): ControlItem => { + item.isEnvDependent = false + return item +} + +const propertySetter: PropertySetter = new Map([ + // AST Nodes + [ + 'Program', + (item: ControlItem) => { + const node = item as Node & es.Program; + node.isEnvDependent = node.body.some(elem => isEnvDependent(elem)); + return node; + } + ], + ['Literal', setToFalse], + ['ImportDeclaration', setToFalse], + ['BreakStatement', setToFalse], + ['ContinueStatement', setToFalse], + ['DebuggerStatement', setToFalse], + ['VariableDeclaration', setToTrue], + ['FunctionDeclaration', setToTrue], + ['ArrowFunctionExpression', setToTrue], + ['Identifier', setToTrue], + [ + 'LogicalExpression', + (item: ControlItem) => { + const node = item as Node & es.LogicalExpression; + node.isEnvDependent = isEnvDependent(node.left) || isEnvDependent(node.right); + return node; + } + ], + [ + 'BinaryExpression', + (item: ControlItem) => { + const node = item as Node & es.BinaryExpression; + node.isEnvDependent = isEnvDependent(node.left) || isEnvDependent(node.right); + return node; + } + ], + [ + 'UnaryExpression', + (item: ControlItem) => { + const node = item as Node & es.UnaryExpression; + node.isEnvDependent = isEnvDependent(node.argument); + return node; + } + ], + [ + 'ConditionalExpression', + (item: ControlItem) => { + const node = item as Node & es.ConditionalExpression; + node.isEnvDependent = + isEnvDependent(node.consequent) || + isEnvDependent(node.alternate) || + isEnvDependent(node.test); + return node; + } + ], + [ + 'MemberExpression', + (item: ControlItem) => { + const node = item as Node & es.MemberExpression; + node.isEnvDependent = isEnvDependent(node.property) || isEnvDependent(node.object); + return node; + } + ], + [ + 'ArrayExpression', + (item: ControlItem) => { + const node = item as Node & es.ArrayExpression; + node.isEnvDependent = node.elements.some(elem => isEnvDependent(elem)); + return node; + } + ], + [ + 'AssignmentExpression', + (item: ControlItem) => { + const node = item as Node & es.AssignmentExpression; + node.isEnvDependent = isEnvDependent(node.left) || isEnvDependent(node.right); + return node; + } + ], + [ + 'ReturnStatement', + (item: ControlItem) => { + const node = item as Node & es.ReturnStatement; + node.isEnvDependent = isEnvDependent(node.argument); + return node; + } + ], + [ + 'CallExpression', + (item: ControlItem) => { + const node = item as Node & es.CallExpression; + node.isEnvDependent = + isEnvDependent(node.callee) || node.arguments.some(arg => isEnvDependent(arg)); + return node; + } + ], + [ + 'ExpressionStatement', + (item: ControlItem) => { + const node = item as Node & es.ExpressionStatement; + node.isEnvDependent = isEnvDependent(node.expression); + return node; + } + ], + [ + 'IfStatement', + (item: ControlItem) => { + const node = item as Node & es.IfStatement; + node.isEnvDependent = + isEnvDependent(node.test) || + isEnvDependent(node.consequent) || + isEnvDependent(node.alternate); + return node; + } + ], + [ + 'ForStatement', + (item: ControlItem) => { + const node = item as Node & es.ForStatement; + node.isEnvDependent = + isEnvDependent(node.body) || + isEnvDependent(node.init) || + isEnvDependent(node.test) || + isEnvDependent(node.update); + return node; + } + ], + [ + 'WhileStatement', + (item: ControlItem) => { + const node = item as Node & es.WhileStatement; + node.isEnvDependent = isEnvDependent(node.body) || isEnvDependent(node.test); + return node; + } + ], + [ + 'BlockStatement', + (item: ControlItem) => { + const node = item as Node & es.BlockStatement; + node.isEnvDependent = node.body.some(stm => isEnvDependent(stm)); + return node; + } + ], + [ + 'StatementSequence', + (item: ControlItem) => { + const node = item as ControlItem & StatementSequence; + node.isEnvDependent = node.body.some(stm => isEnvDependent(stm)); + return node; + } + ], + ['ImportSpecifier', setToTrue], + ['ImportDefaultSpecifier', setToTrue], + + // InstrType + [InstrType.RESET, setToFalse], + [InstrType.UNARY_OP, setToFalse], + [InstrType.BINARY_OP, setToFalse], + [InstrType.CONTINUE, setToFalse], + [InstrType.ASSIGNMENT, setToTrue], + [ + InstrType.WHILE, + (item: ControlItem) => { + const instr = item as WhileInstr; + instr.isEnvDependent = isEnvDependent(instr.test) || isEnvDependent(instr.body); + return instr; + } + ], + [ + InstrType.FOR, + (item: ControlItem) => { + const instr = item as ForInstr; + instr.isEnvDependent = + isEnvDependent(instr.init) || + isEnvDependent(instr.test) || + isEnvDependent(instr.update) || + isEnvDependent(instr.body); + return instr; + } + ], + [ + InstrType.BRANCH, + (item: ControlItem) => { + const instr = item as BranchInstr; + instr.isEnvDependent = isEnvDependent(instr.consequent) || isEnvDependent(instr.alternate); + return instr; + } + ] + ]); + + export { propertySetter }; + + +/** + * Checks whether the evaluation of the given control item depends on the current environment. + * The item is also considered environment dependent if its evaluation introduces + * environment dependent items + * @param item The control item to be checked + * @return `true` if the item is environment depedent, else `false`. + */ +export function isEnvDependent(item: ControlItem | null | undefined): boolean { + if (item === null || item === undefined) { + return false + } + // If result is already calculated, return it + if (item.isEnvDependent !== undefined) { + return item.isEnvDependent + } + let setter: Transformer | undefined; + if (isNode(item)) { + setter = propertySetter.get(item.type); + } else if (isInstr(item)) { + setter = propertySetter.get(item.instrType); + } + + if (setter) { + return setter(item)?.isEnvDependent ?? false + } + + return false +} + +// function isInstr(item: ControlItem): item is Instr & { isEnvDependent?: boolean } { +// return (item as Instr).instrType !== undefined; +// } + +// export const envChanging = (command: ControlItem): boolean => { +// if (isNode(command)) { +// const type = command.type +// return ( +// type === 'Program' || +// type === 'BlockStatement' || +// type === 'ArrowFunctionExpression' || +// (type === 'ExpressionStatement' && command.expression.type === 'ArrowFunctionExpression') +// ) +// } else { +// const type = command.instrType +// return ( +// type === InstrType.ENVIRONMENT || +// type === InstrType.ARRAY_LITERAL || +// type === InstrType.ASSIGNMENT || +// type === InstrType.ARRAY_ASSIGNMENT || +// (type === InstrType.APPLICATION && (command as AppInstr).numOfArgs > 0) +// ) +// } +// } + +export const envChanging = (command: ControlItem): boolean => { + if (isNode(command)) { + const type = command.type; + return ( + type === 'Program' || + type === 'BlockStatement' || + type === 'ArrowFunctionExpression' || + (type === 'ExpressionStatement' && command.expression.type === 'ArrowFunctionExpression') + ); + } else if (isInstr(command)) { + const type = command.instrType; + return ( + false + ); + } else { + return false; + } +}; + +export function declareFunctionsAndVariables( + context: Context, + node: es.BlockStatement, + environment: Environment +) { + for (const statement of node.body) { + switch (statement.type) { + case 'VariableDeclaration': + declareVariables(context, statement, environment) + break + case 'FunctionDeclaration': + // FunctionDeclaration is always of type constant + declareIdentifier( + context, + (statement.id as es.Identifier).name, + statement, + environment, + true + ) + break + } + } +} + +function declareVariables( + context: Context, + node: es.VariableDeclaration, + environment: Environment +) { + for (const declaration of node.declarations) { + // Retrieve declaration type from node + const constant = node.kind === 'const' + declareIdentifier(context, (declaration.id as es.Identifier).name, node, environment, constant) + } +} + +export function declareIdentifier( + context: Context, + name: string, + node: Node, + environment: Environment, + constant: boolean = false +) { + if (environment.head.hasOwnProperty(name)) { + const descriptors = Object.getOwnPropertyDescriptors(environment.head) + + // return handleRuntimeError( + // context, + // new errors.VariableRedeclaration(node, name, descriptors[name].writable) + // ) + } + //environment.head[name] = constant ? UNASSIGNED_CONST : UNASSIGNED_LET + environment.head[name] = 'declaration' + + return environment +} + +export const handleSequence = (seq: es.Statement[]): ControlItem[] => { + const result: ControlItem[] = [] + let valueProduced = false + for (const command of seq) { + //if (!isImportDeclaration(command)) { + if (valueProducing(command)) { + // Value producing statements have an extra pop instruction + if (valueProduced) { + result.push(instr.popInstr(command)) + } else { + valueProduced = true + } + } + result.push(command) + //} + } + // Push statements in reverse order + return result.reverse() +} + +export const valueProducing = (command: Node): boolean => { + const type = command.type + return ( + type !== 'VariableDeclaration' && + type !== 'FunctionDeclaration' && + type !== 'ContinueStatement' && + type !== 'BreakStatement' && + type !== 'DebuggerStatement' && + (type !== 'BlockStatement' || command.body.some(valueProducing)) + ) +} + +export function defineVariable( + context: Context, + name: string, + value: Value, + constant = false, + node: es.VariableDeclaration | es.ImportDeclaration +) { + const environment = currentEnvironment(context) + + if (environment.head[name] !== 'declaration') { + // error + //return handleRuntimeError(context, new errors.VariableRedeclaration(node, name, !constant)) + } + + if (constant && value instanceof Closure) { + value.declaredName = name; + } + + Object.defineProperty(environment.head, name, { + value, + writable: !constant, + enumerable: true + }) + + return environment +} + +export const getVariable = (context: Context, name: string, node: es.Identifier) => { + let environment: Environment | null = currentEnvironment(context) + while (environment) { + if (environment.head.hasOwnProperty(name)) { + if ( + environment.head[name] === 'declaration' + ) { + //return handleRuntimeError(context, new errors.UnassignedVariable(name, node)) + } else { + return environment.head[name] + } + } else { + environment = environment.tail + } + } + //return handleRuntimeError(context, new errors.UndefinedVariable(name, node)) +} + +export const checkStackOverFlow = (context: Context, control: Control) => { + // todo +} + +export const checkNumberOfArguments = ( + command: ControlItem, + context: Context, + callee: Closure | Value, + args: Value[], + exp: es.CallExpression +) => { + if (callee instanceof Closure) { + // User-defined or Pre-defined functions + const params = callee.node.params + // console.info("params: ", params); + // console.info("args: ", args); + //const hasVarArgs = params[params.length - 1]?.type === 'RestElement' + + if (params.length > args.length) { + handleRuntimeError(context, new MissingRequiredPositionalError((command as es.Node), callee.declaredName!, params, args)); + } else if (params.length !== args.length) { + handleRuntimeError(context, new TooManyPositionalArgumentsError((command as es.Node), callee.declaredName!, params, args)); + } + //} + + // if (hasVarArgs ? params.length - 1 > args.length : params.length !== args.length) { + // // error + // // return handleRuntimeError( + // // context, + // // new errors.InvalidNumberOfArguments( + // // exp, + // // hasVarArgs ? params.length - 1 : params.length, + // // args.length, + // // hasVarArgs + // // ) + // // ) + // } + } else { + // Pre-built functions + const hasVarArgs = callee.minArgsNeeded != undefined + if (hasVarArgs ? callee.minArgsNeeded > args.length : callee.length !== args.length) { + // error + // return handleRuntimeError( + // context, + // new errors.InvalidNumberOfArguments( + // exp, + // hasVarArgs ? callee.minArgsNeeded : callee.length, + // args.length, + // hasVarArgs + // ) + // ) + } + } + return undefined +} + +export const isInstr = (command: ControlItem): command is Instr => { + return (command as Instr).instrType !== undefined +} + +export const isSimpleFunction = (node: any) => { + if (node.body.type !== 'BlockStatement' && node.body.type !== 'StatementSequence') { + return true + } else { + const block = node.body + return block.body.length === 1 && block.body[0].type === 'ReturnStatement' + } +} + +export const reduceConditional = ( + node: es.IfStatement | es.ConditionalExpression +): ControlItem[] => { + return [instr.branchInstr(node.consequent, node.alternate, node), node.test] +} + +export const handleRuntimeError = (context: Context, error: RuntimeSourceError) => { + context.errors.push(error) + + console.error(error.explain()); + console.error(error.elaborate()); + //console.log("Location:", `Line ${e.location.start.line}, Column ${e.location.start.column}`); + + throw error; +} + +export function pythonMod(a: any, b: any): any { + const mod = a % b; + if ((mod >= 0 && b > 0) || (mod <= 0 && b < 0)) { + return mod; + } else { + return mod + b; + } +} + +export function hasImportDeclarations(node: es.BlockStatement): boolean { + for (const statement of (node as unknown as es.Program).body) { + if (statement.type === 'ImportDeclaration') { + return true + } + } + return false +} + +export const isImportDeclaration = ( + node: es.Program['body'][number] +): node is es.ImportDeclaration => node.type === 'ImportDeclaration' + +export function getModuleDeclarationSource( + node: Exclude +): string { + assert( + typeof node.source?.value === 'string', + `Expected ${node.type} to have a source value of type string, got ${node.source?.value}` + ) + return node.source.value +} + +export class AssertionError extends RuntimeSourceError { + constructor(public readonly message: string) { + super() + } + + public explain(): string { + return this.message + } + + public elaborate(): string { + return 'Please contact the administrators to let them know that this error has occurred' + } +} + +export default function assert(condition: boolean, message: string): asserts condition { + if (!condition) { + throw new AssertionError(message) + } +} diff --git a/src/errors.ts b/src/errors.ts index 537a322..9f5ec76 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,8 +1,9 @@ import {Token} from "./tokenizer"; import {Position} from "estree"; -/*The offset is calculated as follows: - Current position is one after real position of end of token: 1 +/* + The offset is calculated as follows: + Current position is one after real position of end of token: 1 */ const MAGIC_OFFSET = 1; @@ -13,7 +14,6 @@ function escape(unsafe: string): string { return unsafe.replace(SPECIAL_CHARS, "\\$&"); } - /* Searches backwards and forwards till it hits a newline */ function getFullLine(source: string, current: number): string { let back: number = current; diff --git a/src/errors/errors.ts b/src/errors/errors.ts new file mode 100644 index 0000000..81cf410 --- /dev/null +++ b/src/errors/errors.ts @@ -0,0 +1,80 @@ +import * as es from 'estree' +import { ErrorType, SourceError } from '../types' +import { RuntimeSourceError } from './runtimeSourceError'; + +export class TypeConcatenateError extends RuntimeSourceError { + constructor(node: es.Node) { + super(node); + this.type = ErrorType.TYPE; + } + + public explain(): string { + return `TypeError: can only concatenate str (not "int") to str.`; + } + + public elaborate(): string { + return `You are trying to concatenate a string with an integer. To fix this, convert the integer to a string using str(), or ensure both operands are of the same type.`; + } +} + +export class MissingRequiredPositionalError extends RuntimeSourceError { + private functionName: string; + private missingParamCnt: number; + private missingParamName: string; + + constructor(node: es.Node, functionName: string, params: es.Pattern[], args: any) { + super(node); + this.type = ErrorType.TYPE; + this.functionName = functionName; + this.missingParamCnt = params.length - args.length; + const missingNames: string[] = []; + for (let i = args.length; i < params.length; i++) { + const param = params[i] as es.Identifier; + missingNames.push("\'"+param.name+"\'"); + } + this.missingParamName = this.joinWithCommasAndAnd(missingNames); + } + + public explain(): string { + return `TypeError: ${this.functionName}() missing ${this.missingParamCnt} required positional argument: ${this.missingParamName}`; + } + + public elaborate(): string { + return `You called ${this.functionName}() without providing the required positional argument ${this.missingParamName}. Make sure to pass all required arguments when calling ${this.functionName}.`; + } + + private joinWithCommasAndAnd(names: string[]): string { + if (names.length === 0) { + return ''; + } else if (names.length === 1) { + return names[0]; + } else if (names.length === 2) { + return `${names[0]} and ${names[1]}`; + } else { + const last = names.pop(); + return `${names.join(', ')} and ${last}`; + } + } +} + +export class TooManyPositionalArgumentsError extends RuntimeSourceError { + private functionName: string; + private expectedCount: number; + private givenCount: number; + + constructor(node: es.Node, functionName: string, params: es.Pattern[], args: any) { + super(node); + this.type = ErrorType.TYPE; + this.functionName = functionName; + this.expectedCount = params.length; + this.givenCount = args.length; + } + + public explain(): string { + return `TypeError: ${this.functionName}() takes ${this.expectedCount} positional arguments but ${this.givenCount} were given`; + } + + public elaborate(): string { + return `You called ${this.functionName}() with ${this.givenCount} positional arguments, but it only expects ${this.expectedCount}. Make sure to pass the correct number of arguments when calling ${this.functionName}.`; + } +} diff --git a/src/errors/runtimeSourceError.ts b/src/errors/runtimeSourceError.ts new file mode 100644 index 0000000..8d4b612 --- /dev/null +++ b/src/errors/runtimeSourceError.ts @@ -0,0 +1,36 @@ +import { ErrorSeverity, ErrorType, SourceError } from '../types' +import * as es from 'estree' + +// todo +// just put on here temporarily +export const UNKNOWN_LOCATION: es.SourceLocation = { + start: { + line: -1, + column: -1 + }, + end: { + line: -1, + column: -1 + } +} + +export class RuntimeSourceError implements SourceError { + public type = ErrorType.RUNTIME + public severity = ErrorSeverity.ERROR + public location: es.SourceLocation + public message = 'Error' + + constructor(node?: es.Node) { + this.location = node?.loc ?? UNKNOWN_LOCATION + } + + public explain() { + return '' + } + + public elaborate() { + return this.explain() + } +} + + diff --git a/src/index.ts b/src/index.ts index bc9598d..ad8b3aa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,139 +1,23 @@ -// -// // // Forbidden identifier -// // text = -// // ` -// // async def y(): -// // pass -// // `; -// // -// // Non four indent -// // let text = -// // ` -// // def x(): -// // pass -// // `; -// -// // // Unrecognised token -// // text = ` -// // ? -// // `; -// -// // Unterminated string -// // text = `\ -// // -// // "abc" "abcdef`; -// -// // // Forbidden operator -// // text =` -// // a @= b -// // ` -// -// // // Expected token -// // text = ` -// // def a(c, d) -// // pass -// // ` -// -// // // Expected else block -// // text = ` -// // if y: -// // pass -// // -// // `; -// -// // // Expected colon after lambda: -// // text = ` -// // x = lambda a -// // `; -// -// // // Expected import -// // text = ` -// // from x -// // `; -// -// // // Bad identifier -// // text = ` -// // def a(1, 2): -// // pass -// // `; -// -// // // Missing closing parentheses: -// // text = ` -// // def a(a, b: -// // pass -// // `; -// -// // // @TODO Invalid assign target -// // text = ` -// // -// // 1 = 2 def a(b, c): -// // pass -// // `; -// -// // Variable declaration hoisting -// // text = ` -// // x = 1 -// // def a(): -// // if True: -// // x = 1 -// // else: -// // y = 2 -// // def b(): -// // x = 1 -// // ` -// // // Undeclared variable -// // text = ` -// // x = display(a) -// // ` -// // Misspelled name -// // text = ` -// // displar(1) -// // ` -// -// // // Mispelled name 2 -// -// // text = ` -// // def y(param): -// // def z(): -// // var = display(barams) -// // ` -// -// // // Name reassignment -// -// // text = ` -// // x = 1 -// // while True: -// // pass -// // x = lambda a:a -// // `; -// -// // text = ` -// // # !x -// // not x -// // ` -// -// // text = ` -// // (lambda a:a)(1) -// // -// // `; -// -// // text = ` -// // (x)(1) -// // `; -// -// // text = ` -// // def a(b,c): -// // pass -// // `; -// /* Use as a command line script */ /* npm run start:dev -- test.py */ +/* npm run start:dev -- test.py tsc --maxErrors 1 */ import { Tokenizer } from "./tokenizer"; import { Parser } from "./parser"; import { Translator } from "./translator"; import { Program } from "estree"; import { Resolver } from "./resolver"; +import { Context } from './cse-machine/context'; +import { evaluate } from './cse-machine/interpreter'; +export * from './errors'; +import fs from "fs"; +import { ParserErrors, ResolverErrors, TokenizerErrors } from "./errors"; +import { Value } from "./cse-machine/stash"; +import { Finished, RecursivePartial, Result } from "./types"; +import { runCSEMachine } from "./runner/pyRunner"; +import { initialise } from "./conductor/runner/util/initialise"; +import { PyEvaluator } from "./conductor/runner/types/PyEvaluator"; +import path from "path"; export function parsePythonToEstreeAst(code: string, variant: number = 1, @@ -150,9 +34,6 @@ export function parsePythonToEstreeAst(code: string, return translator.resolve(ast) as unknown as Program } - -export * from './errors'; - // import {ParserErrors, ResolverErrors, TokenizerErrors} from "./errors"; // import fs from "fs"; // const BaseParserError = ParserErrors.BaseParserError; @@ -184,3 +65,178 @@ export * from './errors'; // } // } // } + +// if (require.main === module) { +// if (process.argv.length < 3) { +// console.error("Usage: npm run start:dev -- "); +// process.exit(1); +// } + +// const filePath = process.argv[2]; + +// try { +// const code = fs.readFileSync(filePath, "utf8") + "\n"; + +// console.log(`Parsing Python file: ${filePath}`); + +// // Test for parsePythonToEstreeAst +// const estreeAst = parsePythonToEstreeAst(code, 1, true); + +// console.log("Generated ESTree AST:"); +// console.dir(estreeAst, { depth: null }); + +// const result = evaluate(estreeAst, context, options); +// console.info('\n\n'); +// console.info(result); +// console.info(result.value); +// console.info((result as Value).value.toString()); +// console.info('done'); + + +// //console.log("Syntax and semantic check passed."); + +// // const rootNode = { +// // type: estreeAst.type, +// // sourceType: estreeAst.sourceType, +// // loc: estreeAst.loc +// // }; + +// // console.log('AST 根节点:', rootNode); +// } catch (e) { +// if ( +// e instanceof BaseTokenizerError || +// e instanceof BaseParserError || +// e instanceof BaseResolverError +// ) { +// console.error("Parsing Error:", e.message); +// } +// } +// console.log(process.versions.v8); + +// } + +export interface IOptions { + isPrelude: boolean, + envSteps: number, + stepLimit: number +}; + +export async function runInContext( + code: string, + context: Context, + options: RecursivePartial = {} +): Promise { + const estreeAst = parsePythonToEstreeAst(code, 1, true); + const result = runCSEMachine(estreeAst, context, options); + return result; +} + +//local test only +// const context = new Context(); +// const options: IOptions = { +// isPrelude: false, +// envSteps: 100000, +// stepLimit: 100000 +// }; +// import { promises as fs1 } from 'fs'; +// import * as os from 'os'; +// async function loadModulesFromServer(context: Context, baseURL: string): Promise { +// // 先获取 modules.json 文件 +// const modulesJsonUrl = `${baseURL}/modules.json`; +// const response = await fetch(modulesJsonUrl); +// if (!response.ok) { +// throw new Error(`Failed to load modules.json from ${modulesJsonUrl}`); +// } +// const modulesData: Record = await response.json(); + +// // modulesData 假定格式为 { moduleName1: {...}, moduleName2: {...}, ... } +// // 遍历每个模块名,加载对应模块 +// for (const moduleName in modulesData) { +// // 构造模块文件的 URL,假设文件名与模块名相同,并以 .js 结尾 +// const moduleUrl = `${baseURL}/bundles/${moduleName}.js`; +// const moduleResponse = await fetch(moduleUrl); +// if (!moduleResponse.ok) { +// console.warn(`Failed to load module ${moduleName} from ${moduleUrl}`); +// continue; +// } +// const moduleSource = await moduleResponse.text(); + +// // 评估模块文件,获取其导出对象 +// // 注意:这里使用 eval 仅作为示例,实际项目中应考虑安全和沙箱策略 +// // let moduleExports; +// // try { +// // moduleExports = eval(moduleSource); +// // } catch (e) { +// // console.error(`Error evaluating module ${moduleName}:`, e); +// // continue; +// // } + +// const tmpFile = path.join(os.tmpdir(), path.basename(moduleUrl)); +// fs1.writeFile(tmpFile, moduleSource); +// // 动态 import 使用 file:// 协议 +// const moduleExports = await import('file://' + tmpFile); +// // 将模块导出对象存入 nativeStorage.loadedModules +// context.nativeStorage.loadedModules[moduleName] = moduleExports; +// } +// console.info(context.nativeStorage); +// } + +// const BaseParserError = ParserErrors.BaseParserError; +// const BaseTokenizerError = TokenizerErrors.BaseTokenizerError; +// const BaseResolverError = ResolverErrors.BaseResolverError; +// async function getResult(code: string, +// context: Context, +// options: RecursivePartial = {}): Promise { +// const result = ; +// return result; +// } + +// if (require.main === module) { +// if (process.argv.length < 3) { +// console.error("Usage: npm run start:dev -- "); +// process.exit(1); +// } + +// const filePath = process.argv[2]; + +// try { +// const code = fs.readFileSync(filePath, "utf8") + "\n"; +// console.log(`Parsing Python file: ${filePath}`); +// const result = await runInContext(code, context, options); +// console.info(result); +// } catch (e) { + +// } +// //console.log(process.versions.v8); + +// } + +// if (require.main === module) { +// (async () => { +// if (process.argv.length < 3) { +// console.error("Usage: npm run start:dev -- "); +// process.exit(1); +// } + +// const filePath = process.argv[2]; + +// try { +// //await loadModulesFromServer(context, "http://localhost:8022"); + +// const code = fs.readFileSync(filePath, "utf8") + "\n"; +// console.log(`Parsing Python file: ${filePath}`); + +// const result = await runInContext(code, context, options); +// console.info(result); +// console.info((result as Finished).value); +// console.info((result as Finished).representation.toString((result as Finished).value)); + +// } catch (e) { +// console.error("Error:", e); +// } + +// })(); +// } + +const {runnerPlugin, conduit} = initialise(PyEvaluator); + diff --git a/src/modules/moduleTypes.ts b/src/modules/moduleTypes.ts new file mode 100644 index 0000000..562d1e4 --- /dev/null +++ b/src/modules/moduleTypes.ts @@ -0,0 +1,3 @@ +export type ModuleFunctions = { + [name: string]: any +} \ No newline at end of file diff --git a/src/parser.ts b/src/parser.ts index 51d7765..5cd6058 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -499,16 +499,19 @@ export class Parser { const startToken = this.peek(); if (this.match(TokenType.TRUE)) return new ExprNS.Literal(startToken, this.previous(), true); if (this.match(TokenType.FALSE)) return new ExprNS.Literal(startToken, this.previous(), false); - + if (this.match(TokenType.NONE)) return new ExprNS.None(startToken, this.previous()); if (this.match(TokenType.STRING)) { return new ExprNS.Literal(startToken, this.previous(), this.previous().lexeme); } if (this.match(TokenType.NUMBER)) { - return new ExprNS.Literal(startToken, this.previous(), Number(this.previous().lexeme)); + return new ExprNS.Literal(startToken, this.previous(), Number(this.previous().lexeme.replace(/_/g, ""))); } if (this.match(TokenType.BIGINT)) { return new ExprNS.BigIntLiteral(startToken, this.previous(), this.previous().lexeme); } + if (this.match(TokenType.COMPLEX)) { + return new ExprNS.Complex(startToken, this.previous(), this.previous().lexeme); + } if (this.match(TokenType.NAME, ...PSEUD_NAMES)) { return new ExprNS.Variable(startToken, this.previous(), this.previous()); diff --git a/src/resolver.ts b/src/resolver.ts index 6dcf27f..045a3af 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -5,7 +5,8 @@ import { Token } from "./tokenizer"; import { TokenType } from "./tokens"; import { ResolverErrors } from "./errors"; -const levenshtein = require('fast-levenshtein'); +import levenshtein from 'fast-levenshtein'; +// const levenshtein = require('fast-levenshtein'); const RedefineableTokenSentinel = new Token(TokenType.AT, "", 0, 0, 0); @@ -149,23 +150,20 @@ export class Resolver implements StmtNS.Visitor, ExprNS.Visitor { // The global environment this.environment = new Environment(source, null, new Map([ // misc library - ["get_time", new Token(TokenType.NAME, "get_time", 0, 0, 0)], + ["_int", new Token(TokenType.NAME, "_int", 0, 0, 0)], + ["_int_from_string", new Token(TokenType.NAME, "_int_from_string", 0, 0, 0)], + ["abs", new Token(TokenType.NAME, "abs", 0, 0, 0)], + ["char_at", new Token(TokenType.NAME, "char_at", 0, 0, 0)], + ["error", new Token(TokenType.NAME, "error", 0, 0, 0)], + ["input", new Token(TokenType.NAME, "input", 0, 0, 0)], + ["isinstance", new Token(TokenType.NAME, "isinstance", 0, 0, 0)], + ["max", new Token(TokenType.NAME, "max", 0, 0, 0)], + ["min", new Token(TokenType.NAME, "min", 0, 0, 0)], ["print", new Token(TokenType.NAME, "print", 0, 0, 0)], - ["raw_print", new Token(TokenType.NAME, "raw_print", 0, 0, 0)], + ["random_random", new Token(TokenType.NAME, "random_random", 0, 0, 0)], + ["round", new Token(TokenType.NAME, "round", 0, 0, 0)], ["str", new Token(TokenType.NAME, "str", 0, 0, 0)], - ["error", new Token(TokenType.NAME, "error", 0, 0, 0)], - ["prompt", new Token(TokenType.NAME, "prompt", 0, 0, 0)], - ["is_float", new Token(TokenType.NAME, "is_float", 0, 0, 0)], - ["is_int", new Token(TokenType.NAME, "is_int", 0, 0, 0)], - ["is_string", new Token(TokenType.NAME, "is_string", 0, 0, 0)], - ["is_function", new Token(TokenType.NAME, "is_function", 0, 0, 0)], - ["is_boolean", new Token(TokenType.NAME, "is_boolean", 0, 0, 0)], - ["parse_int", new Token(TokenType.NAME, "parse_int", 0, 0, 0)], - ["char_at", new Token(TokenType.NAME, "char_at", 0, 0, 0)], - ["arity", new Token(TokenType.NAME, "arity", 0, 0, 0)], - ["None", new Token(TokenType.NAME, "None", 0, 0, 0)], - ["NaN", new Token(TokenType.NAME, "NaN", 0, 0, 0)], - ["Infinity", new Token(TokenType.NAME, "Infinity", 0, 0, 0)], + ["time_time", new Token(TokenType.NAME, "time_time", 0, 0, 0)], // math constants ["math_pi", new Token(TokenType.NAME, "math_pi", 0, 0, 0)], @@ -175,7 +173,6 @@ export class Resolver implements StmtNS.Visitor, ExprNS.Visitor { ["math_tau", new Token(TokenType.NAME, "math_tau", 0, 0, 0)], // math library - ["math_abs", new Token(TokenType.NAME, "math_abs", 0, 0, 0)], ["math_acos", new Token(TokenType.NAME, "math_acos", 0, 0, 0)], ["math_acosh", new Token(TokenType.NAME, "math_acosh", 0, 0, 0)], ["math_asin", new Token(TokenType.NAME, "math_asin", 0, 0, 0)], @@ -185,31 +182,46 @@ export class Resolver implements StmtNS.Visitor, ExprNS.Visitor { ["math_atanh", new Token(TokenType.NAME, "math_atanh", 0, 0, 0)], ["math_cbrt", new Token(TokenType.NAME, "math_cbrt", 0, 0, 0)], ["math_ceil", new Token(TokenType.NAME, "math_ceil", 0, 0, 0)], - ["math_clz32", new Token(TokenType.NAME, "math_clz32", 0, 0, 0)], + ["math_comb", new Token(TokenType.NAME, "math_comb", 0, 0, 0)], + ["math_copysign", new Token(TokenType.NAME, "math_copysign", 0, 0, 0)], ["math_cos", new Token(TokenType.NAME, "math_cos", 0, 0, 0)], ["math_cosh", new Token(TokenType.NAME, "math_cosh", 0, 0, 0)], + ["math_degrees", new Token(TokenType.NAME, "math_degrees", 0, 0, 0)], + ["math_erf", new Token(TokenType.NAME, "math_erf", 0, 0, 0)], + ["math_erfc", new Token(TokenType.NAME, "math_erfc", 0, 0, 0)], ["math_exp", new Token(TokenType.NAME, "math_exp", 0, 0, 0)], + ["math_exp2", new Token(TokenType.NAME, "math_exp2", 0, 0, 0)], ["math_expm1", new Token(TokenType.NAME, "math_expm1", 0, 0, 0)], + ["math_fabs", new Token(TokenType.NAME, "math_fabs", 0, 0, 0)], + ["math_factorial", new Token(TokenType.NAME, "math_factorial", 0, 0, 0)], ["math_floor", new Token(TokenType.NAME, "math_floor", 0, 0, 0)], - ["math_fround", new Token(TokenType.NAME, "math_fround", 0, 0, 0)], - ["math_hypot", new Token(TokenType.NAME, "math_hypot", 0, 0, 0)], - ["math_imul", new Token(TokenType.NAME, "math_imul", 0, 0, 0)], + ["math_fma", new Token(TokenType.NAME, "math_fma", 0, 0, 0)], + ["math_fmod", new Token(TokenType.NAME, "math_fmod", 0, 0, 0)], + ["math_gamma", new Token(TokenType.NAME, "math_gamma", 0, 0, 0)], + ["math_gcd", new Token(TokenType.NAME, "math_gcd", 0, 0, 0)], + ["math_isfinite", new Token(TokenType.NAME, "math_isfinite", 0, 0, 0)], + ["math_isinf", new Token(TokenType.NAME, "math_isinf", 0, 0, 0)], + ["math_isnan", new Token(TokenType.NAME, "math_isnan", 0, 0, 0)], + ["math_isqrt", new Token(TokenType.NAME, "math_isqrt", 0, 0, 0)], + ["math_lcm", new Token(TokenType.NAME, "math_lcm", 0, 0, 0)], + ["math_ldexp", new Token(TokenType.NAME, "math_ldexp", 0, 0, 0)], + ["math_lgamma", new Token(TokenType.NAME, "math_lgamma", 0, 0, 0)], ["math_log", new Token(TokenType.NAME, "math_log", 0, 0, 0)], + ["math_log10", new Token(TokenType.NAME, "math_log10", 0, 0, 0)], ["math_log1p", new Token(TokenType.NAME, "math_log1p", 0, 0, 0)], ["math_log2", new Token(TokenType.NAME, "math_log2", 0, 0, 0)], - ["math_log10", new Token(TokenType.NAME, "math_log10", 0, 0, 0)], - ["math_max", new Token(TokenType.NAME, "math_max", 0, 0, 0)], - ["math_min", new Token(TokenType.NAME, "math_min", 0, 0, 0)], + ["math_nextafter", new Token(TokenType.NAME, "math_nextafter", 0, 0, 0)], + ["math_perm", new Token(TokenType.NAME, "math_perm", 0, 0, 0)], ["math_pow", new Token(TokenType.NAME, "math_pow", 0, 0, 0)], - ["math_random", new Token(TokenType.NAME, "math_random", 0, 0, 0)], - ["math_round", new Token(TokenType.NAME, "math_round", 0, 0, 0)], - ["math_sign", new Token(TokenType.NAME, "math_sign", 0, 0, 0)], + ["math_radians", new Token(TokenType.NAME, "math_radians", 0, 0, 0)], + ["math_remainder", new Token(TokenType.NAME, "math_remainder", 0, 0, 0)], ["math_sin", new Token(TokenType.NAME, "math_sin", 0, 0, 0)], ["math_sinh", new Token(TokenType.NAME, "math_sinh", 0, 0, 0)], ["math_sqrt", new Token(TokenType.NAME, "math_sqrt", 0, 0, 0)], ["math_tan", new Token(TokenType.NAME, "math_tan", 0, 0, 0)], ["math_tanh", new Token(TokenType.NAME, "math_tanh", 0, 0, 0)], ["math_trunc", new Token(TokenType.NAME, "math_trunc", 0, 0, 0)], + ["math_ulp", new Token(TokenType.NAME, "math_ulp", 0, 0, 0)] ])); this.functionScope = null; } @@ -442,9 +454,13 @@ export class Resolver implements StmtNS.Visitor, ExprNS.Visitor { this.resolve(expr.consequent); this.resolve(expr.alternative); } + visitNoneExpr(expr: ExprNS.None): void { + } visitLiteralExpr(expr: ExprNS.Literal): void { } visitBigIntLiteralExpr(expr: ExprNS.BigIntLiteral): void { } + visitComplexExpr(expr: ExprNS.Complex): void { + } } diff --git a/src/runner/pyRunner.ts b/src/runner/pyRunner.ts new file mode 100644 index 0000000..5b254da --- /dev/null +++ b/src/runner/pyRunner.ts @@ -0,0 +1,10 @@ +import { IOptions } from ".." +import { Context } from "../cse-machine/context" +import { CSEResultPromise, evaluate } from "../cse-machine/interpreter" +import { RecursivePartial, Result } from "../types" +import * as es from 'estree' + +export function runCSEMachine(program: es.Program, context: Context, options: RecursivePartial = {}): Promise { + const result = evaluate(program, context, options); + return CSEResultPromise(context, result); +} \ No newline at end of file diff --git a/src/scripts/jsdoc.sh b/src/scripts/jsdoc.sh new file mode 100644 index 0000000..cff1b6b --- /dev/null +++ b/src/scripts/jsdoc.sh @@ -0,0 +1,66 @@ +#! /usr/bin/env bash + +set -e + +JSDOC="script/jsdoc" +TMPL="docs/jsdoc/templates/template" +DST="docs/python" +MD="docs/md" +LIB="docs/lib" +SPECS="docs/python/specs" + +main() { + + if [ "$1" == "prepare" ]; then + prepare + elif [ "$1" == "clean" ]; then + clean + elif [[ "$(git rev-parse --show-toplevel 2> /dev/null)" -ef "$PWD" ]]; then + run + else + echo "Please run this command from the git root directory." + false # exit 1 + fi +} + +run() { + + # Source §1 + + ${JSDOC} -r -t ${TMPL} \ + -c docs/jsdoc/conf.json \ + -R ${MD}/README_1.md \ + -d ${DST}/"source_1"/ \ + ${LIB}/misc.js \ + ${LIB}/math.js + + # MISC + + ${JSDOC} -r -t ${TMPL} \ + -c docs/jsdoc/conf.json \ + -R ${MD}/README_MISC.md \ + -d ${DST}/MISC/ \ + ${LIB}/misc.js + + # MATH + + ${JSDOC} -r -t ${TMPL} \ + -c docs/jsdoc/conf.json \ + -R ${MD}/README_MATH.md \ + -d ${DST}/MATH/ \ + ${LIB}/math.js +} + +prepare() { + run + cp -r docs/images ${DST} ; \ + cd ${SPECS}; make; cp *.pdf ../source; cd ../.. +} + +clean() { + + rm -rf ${DST}/* + +} + +main $1 diff --git a/src/stdlib.ts b/src/stdlib.ts new file mode 100644 index 0000000..abe0b6f --- /dev/null +++ b/src/stdlib.ts @@ -0,0 +1,1770 @@ +import { ArrowFunctionExpression } from "estree"; +import { Closure } from "./cse-machine/closure"; +import { Value } from "./cse-machine/stash"; +// npm install mathjs +import { gamma, lgamma, erf } from 'mathjs'; +import { addPrint } from "./cse-machine/interpreter"; + +/* + Create a map to hold built-in constants. + Each constant is stored with a string key and its corresponding value object. +*/ +export const builtInConstants = new Map(); +const math_e = { type: 'number', value: Math.E }; +const math_inf = { type: 'number', value: Infinity }; +const math_nan = { type: 'number', value: NaN }; +const math_pi = { type: 'number', value: Math.PI }; +const math_tau = { type: 'number', value: 2 * Math.PI }; + +builtInConstants.set('math_e', math_e); +builtInConstants.set('math_inf', math_inf); +builtInConstants.set('math_nan', math_nan); +builtInConstants.set('math_pi', math_pi); +builtInConstants.set('math_tau', math_tau); + +/* + Create a map to hold built-in functions. + The keys are strings (function names) and the values are functions that can take any arguments. +*/ +export const builtIns = new Map any>(); +builtIns.set('_int', _int); +builtIns.set('_int_from_string', _int_from_string); +builtIns.set('abs', abs); +builtIns.set('char_at', char_at); +builtIns.set('error', error); +builtIns.set('input', input); +builtIns.set('isinstance', isinstance); +builtIns.set('math_acos', math_acos); +builtIns.set('math_acosh', math_acosh); +builtIns.set('math_asin', math_asin); +builtIns.set('math_asinh', math_asinh); +builtIns.set('math_atan', math_atan); +builtIns.set('math_atan2', math_atan2); +builtIns.set('math_atanh', math_atanh); +builtIns.set('math_cbrt', math_cbrt); +builtIns.set('math_ceil', math_ceil); +builtIns.set('math_comb', math_comb); +builtIns.set('math_copysign', math_copysign); +builtIns.set('math_cos', math_cos); +builtIns.set('math_cosh', math_cosh); +builtIns.set('math_degrees', math_degrees); +builtIns.set('math_erf', math_erf); +builtIns.set('math_erfc', math_erfc); +builtIns.set('math_exp', math_exp); +builtIns.set('math_exp2', math_exp2); +builtIns.set('math_expm1', math_expm1); +builtIns.set('math_fabs', math_fabs); +builtIns.set('math_factorial', math_factorial); +builtIns.set('math_floor', math_floor); +builtIns.set('math_fma', math_fma); +builtIns.set('math_fmod', math_fmod); +builtIns.set('math_gamma', math_gamma); +builtIns.set('math_lgamma', math_lgamma); +builtIns.set('math_gcd', math_gcd); +builtIns.set('math_isfinite', math_isfinite); +builtIns.set('math_isinf', math_isinf); +builtIns.set('math_isnan', math_isnan); +builtIns.set('math_isqrt', math_isqrt); +builtIns.set('math_lcm', math_lcm); +builtIns.set('math_ldexp', math_ldexp); +builtIns.set('math_log', math_log); +builtIns.set('math_log10', math_log10); +builtIns.set('math_log1p', math_log1p); +builtIns.set('math_log2', math_log2); +builtIns.set('math_nextafter', math_nextafter); +builtIns.set('math_perm', math_perm); +builtIns.set('math_pow', math_pow); +builtIns.set('math_radians', math_radians); +builtIns.set('math_remainder', math_remainder); +builtIns.set('math_sin', math_sin); +builtIns.set('math_sinh', math_sinh); +builtIns.set('math_sqrt', math_sqrt); +builtIns.set('math_tan', math_tan); +builtIns.set('math_tanh', math_tanh); +builtIns.set('math_trunc', math_trunc); +builtIns.set('math_ulp', math_ulp); +builtIns.set('max', max); +builtIns.set('min', min); +builtIns.set('print', print); +builtIns.set('random_random', random_random); +builtIns.set('round', round); +builtIns.set('str', str); +builtIns.set('time_time', time_time); + +export function _int(args: Value[]): Value { + if (args.length === 0) { + return { type: 'bigint', value: '0' }; + } + if (args.length > 1) { + throw new Error(`_int() expects at most 1 argument, but got ${args.length}`); + } + + const arg = args[0]; + // If the value is a number, use Math.trunc to truncate toward zero. + if (arg.type === 'number') { + const truncated = Math.trunc(arg.value); + return { type: 'bigint', value: BigInt(truncated) }; + } + // If the value is a bigint, simply return the same value. + if (arg.type === 'bigint') { + return { type: 'bigint', value: arg.value }; + } + + throw new Error(`_int() expects a numeric argument (number or bigint), but got ${arg.type}`); +} + +export function _int_from_string(args: Value[]): Value { + if (args.length < 1) { + throw new Error(`_int_from_string() expects at least 1 argument, but got 0`); + } + if (args.length > 2) { + throw new Error(`_int_from_string() expects at most 2 arguments, but got ${args.length}`); + } + + const strVal = args[0]; + if (strVal.type !== 'string') { + throw new Error( + `_int_from_string: first argument must be a string, got ${strVal.type}` + ); + } + + let base: number = 10; + if (args.length === 2) { + // The second argument must be either a bigint or a number (it will be converted to a number for uniform processing). + const baseVal = args[1]; + if (baseVal.type === 'bigint') { + base = Number(baseVal.value); + } else { + throw new Error( + `_int_from_string: second argument must be an integer (number or bigint), got ${baseVal.type}` + ); + } + } + + // base should be in between 2 and 36 + if (base < 2 || base > 36) { + throw new Error(`_int_from_string: base must be in [2..36], got ${base}`); + } + + let str = strVal.value as string; + str = str.trim(); + str = str.replace(/_/g, ''); + + // Parse the sign (determine if the value is positive or negative) + let sign: bigint = BigInt(1); + if (str.startsWith('+')) { + str = str.slice(1); + } else if (str.startsWith('-')) { + sign = BigInt(-1); + str = str.slice(1); + } + + // The remaining portion must consist of valid characters for the specified base. + const parsedNumber = parseInt(str, base); + if (isNaN(parsedNumber)) { + throw new Error(`_int_from_string: cannot parse "${strVal.value}" with base ${base}`); + } + + const result: bigint = sign * BigInt(parsedNumber); + + return { type: 'bigint', value: result }; +} + +export function abs(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`abs expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + switch (x.type) { + case 'bigint': { + const intVal = x.value; + const result: bigint = intVal < 0 ? -intVal : intVal; + return { type: 'int', value: result }; + } + case 'number': { + return { type: 'number', value: Math.abs(x.value) }; + } + case 'complex': { + // Calculate the modulus (absolute value) of a complex number. + const real = x.value.real; + const imag = x.value.imag; + const modulus = Math.sqrt(real * real + imag * imag); + return { type: 'number', value: modulus }; + } + default: + throw new Error(`abs: unsupported type ${x.type}`); + } +} + +function toStr(val: Value): string { + return String(val.value); +} + +export function error(args: Value[]): Value { + const output = "Error: " + args.map(arg => toStr(arg)).join(' ') + '\n'; + + throw new Error(output); +} + +export function isinstance(args: Value[]): Value { + if (args.length !== 2) { + throw new Error(`isinstance expects exactly 2 arguments, but got ${args.length}`); + } + + const obj = args[0]; + const classinfo = args[1]; + + let expectedType: string; + if (classinfo.type === 'string') { + switch (classinfo.value) { + case 'int': + expectedType = 'bigint'; + break; + case 'float': + expectedType = 'number'; + break; + case 'string': + expectedType = 'string'; + break; + case 'bool': + expectedType = 'bool'; + break; + case 'complex': + expectedType = 'complex'; + break; + case 'NoneType': + expectedType = 'NoneType'; + break; + default: + throw new Error(`isinstance: unknown type '${classinfo.value}'`); + } + } else { + // TODO: If the value is not in string format, additional handling can be added as needed. + throw new Error(`isinstance: second argument must be a string representing a type, got ${classinfo.type}`); + } + + const result = obj.type === expectedType; + + return { type: 'bool', value: result }; +} + +export function math_acos(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_acos expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_acos: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + if (num < -1 || num > 1) { + throw new Error(`math_acos: argument must be in the interval [-1, 1], but got ${num}`); + } + + const result = Math.acos(num); + return { type: 'number', value: result }; +} + +export function math_acosh(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_acosh expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_acosh: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + if (num < 1) { + throw new Error(`math_acosh: argument must be greater than or equal to 1, but got ${num}`); + } + + const result = Math.acosh(num); + return { type: 'number', value: result }; +} + +export function math_asin(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_asin expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_asin: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + if (num < -1 || num > 1) { + throw new Error(`math_asin: argument must be in the interval [-1, 1], but got ${num}`); + } + + const result = Math.asin(num); + return { type: 'number', value: result }; +} + +export function math_asinh(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_asinh expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_asinh: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = Math.asinh(num); + return { type: 'number', value: result }; +} + +export function math_atan(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_atan expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'int' && x.type !== 'bigint') { + throw new Error(`math_atan: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = Math.atan(num); + return { type: 'number', value: result }; +} + +export function math_atan2(args: Value[]): Value { + if (args.length !== 2) { + throw new Error(`math_atan2 expects exactly 2 arguments, but got ${args.length}`); + } + + const y = args[0]; + const x = args[1]; + if ( + (y.type !== 'number' && y.type !== 'bigint') || + (x.type !== 'number' && x.type !== 'bigint') + ) { + throw new Error(`math_atan2: both arguments must be a number, int, or bigint`); + } + + let yNum: number, xNum: number; + if (y.type === 'number') { + yNum = y.value; + } else { + yNum = Number(y.value); + } + + if (x.type === 'number') { + xNum = x.value; + } else { + xNum = Number(x.value); + } + + const result = Math.atan2(yNum, xNum); + return { type: 'number', value: result }; +} + +export function math_atanh(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_atanh expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_atanh: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + if (num <= -1 || num >= 1) { + throw new Error(`math_atanh: argument must be in the interval (-1, 1), but got ${num}`); + } + + const result = Math.atanh(num); + return { type: 'number', value: result }; +} + +export function math_cos(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_cos expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_cos: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = Math.cos(num); + return { type: 'number', value: result }; +} + +export function math_cosh(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_cosh expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_cosh: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = Math.cosh(num); + return { type: 'number', value: result }; +} + +export function math_degrees(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_degrees expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_degrees: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = num * 180 / Math.PI; + return { type: 'number', value: result }; +} + +export function math_erf(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_erf expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_erf: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const erfnum = erf(num); + + return { type: 'number', value: erfnum }; +} + +export function math_erfc(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_erfc expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_erfc: argument must be a number, int, or bigint, but got ${x.type}`); + } + + const erfc = 1 - math_erf(args[0]).value; + + return { type: 'number', value: erfc }; +} + +export function char_at(args: Value[]): Value { + if (args.length !== 2) { + throw new Error(`char_at expects exactly 2 arguments, but got ${args.length}`); + } + + const s = args[0]; + const i = args[1]; + + if (s.type !== 'string') { + throw new Error(`char_at: first argument must be a string, but got ${typeof s}`); + } + if (i.type !== 'number' && i.type !== 'bigint') { + throw new Error(`char_at: second argument must be a number, but got ${typeof i}`); + } + + const index = i.value; + + return { type: 'string', value: (s.value)[index]}; +} + +export function math_comb(args: Value[]): Value { + if (args.length !== 2) { + throw new Error(`comb expects exactly 2 arguments, but got ${args.length}`); + } + + const n = args[0]; + const k = args[1]; + + if (n.type !== 'bigint' || k.type !== 'bigint') { + throw new Error( + `comb: both arguments must be 'bigint', but got n=${n.type}, k=${k.type}` + ); + } + + const nVal = BigInt(n.value); + const kVal = BigInt(k.value); + + if (nVal < 0 || kVal < 0) { + throw new Error(`comb: n and k must be non-negative, got n=${nVal}, k=${kVal}`); + } + + if (kVal > nVal) { + return { type: 'bigint', value: BigInt(0) }; + } + + let result: bigint = BigInt(1); + let kk = kVal > nVal - kVal ? nVal - kVal : kVal; + + for (let i: bigint = BigInt(0); i < kk; i++) { + result = result * (nVal - i) / (i + BigInt(1)); + } + + return { type: 'bigint', value: result }; +} + +export function math_factorial(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`factorial expects exactly 1 argument, but got ${args.length}`); + } + + const n = args[0]; + + if (n.type !== 'bigint') { + throw new Error(`factorial: argument must be an integer (bigint), but got ${n.type}`); + } + + const nVal = BigInt(n.value); + + if (nVal < 0) { + throw new Error(`factorial: argument must be non-negative, but got ${nVal}`); + } + + // 0! = 1 + if (nVal === BigInt(0)) { + return { type: 'bigint', value: BigInt(1) }; + } + + let result: bigint = BigInt(1); + for (let i: bigint = BigInt(1); i <= nVal; i++) { + result *= i; + } + + return { type: 'bigint', value: result }; +} + +export function math_gcd(args: Value[]): Value { + if (args.length === 0) { + return { type: 'bigint', value: BigInt(0) }; + } + + const values = args.map((v, idx) => { + if (v.type !== 'bigint') { + throw new Error(`gcd: argument #${idx + 1} must be an integer (bigint), got ${v.type}`); + } + return BigInt(v.value); + }); + + const allZero = values.every(val => val === BigInt(0)); + if (allZero) { + return { type: 'bigint', value: BigInt(0) }; + } + + let currentGcd: bigint = values[0] < 0 ? -values[0] : values[0]; + for (let i = 1; i < values.length; i++) { + currentGcd = gcdOfTwo(currentGcd, values[i] < 0 ? -values[i] : values[i]); + if (currentGcd === BigInt(1)) { + break; + } + } + + return { type: 'bigint', value: currentGcd }; +} + +function gcdOfTwo(a: bigint, b: bigint): bigint { + let x: bigint = a; + let y: bigint = b; + while (y !== BigInt(0)) { + const temp = x % y; + x = y; + y = temp; + } + return x < 0 ? -x : x; +} + +export function math_isqrt(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`isqrt expects exactly 1 argument, but got ${args.length}`); + } + + const nValObj = args[0]; + if (nValObj.type !== 'bigint') { + throw new Error(`isqrt: argument must be a nonnegative integer (bigint), but got ${nValObj.type}`); + } + + const n: bigint = nValObj.value; + + if (n < 0) { + throw new Error(`isqrt: argument must be nonnegative, but got ${n}`); + } + + if (n < 2) { + return { type: 'bigint', value: n }; + } + + let low: bigint = BigInt(1); + let high: bigint = n; + + while (low < high) { + const mid = (low + high + BigInt(1)) >> BigInt(1); + const sq = mid * mid; + if (sq <= n) { + low = mid; + } else { + high = mid - BigInt(1); + } + } + + return { type: 'bigint', value: low }; +} + +export function math_lcm(args: Value[]): Value { + if (args.length === 0) { + return { type: 'bigint', value: BigInt(1) }; + } + + const values = args.map((val, idx) => { + if (val.type !== 'bigint') { + throw new Error(`lcm: argument #${idx + 1} must be a bigint, got ${val.type}`); + } + return BigInt(val.value); + }); + + if (values.some(v => v === BigInt(0))) { + return { type: 'bigint', value: BigInt(0) }; + } + + let currentLcm: bigint = absBigInt(values[0]); + for (let i = 1; i < values.length; i++) { + currentLcm = lcmOfTwo(currentLcm, absBigInt(values[i])); + if (currentLcm === BigInt(0)) { + break; + } + } + + return { type: 'bigint', value: currentLcm }; +} + +function lcmOfTwo(a: bigint, b: bigint): bigint { + const gcdVal: bigint = gcdOfTwo(a, b); + return BigInt((a / gcdVal) * b); +} + +function absBigInt(x: bigint): bigint { + return x < 0 ? -x : x; +} + +export function math_perm(args: Value[]): Value { + if (args.length < 1 || args.length > 2) { + throw new Error(`perm expects 1 or 2 arguments, but got ${args.length}`); + } + + const nValObj = args[0]; + if (nValObj.type !== 'bigint') { + throw new Error( + `perm: first argument n must be an integer (bigint), but got ${nValObj.type}` + ); + } + const n = BigInt(nValObj.value); + + let k = n; + if (args.length === 2) { + const kValObj = args[1]; + if (kValObj.type === 'null' || kValObj.type === 'undefined') { + k = n; + } else if (kValObj.type === 'bigint') { + k = BigInt(kValObj.value); + } else { + throw new Error( + `perm: second argument k must be an integer (bigint) or None, but got ${kValObj.type}` + ); + } + } + + if (n < 0 || k < 0) { + throw new Error(`perm: n and k must be non-negative, got n=${n}, k=${k}`); + } + + if (k > n) { + return { type: 'bigint', value: BigInt(0) }; + } + + let result: bigint = BigInt(1); + for (let i: bigint = BigInt(0); i < k; i++) { + result *= (n - i); + } + + return { type: 'bigint', value: result }; +} + +export function math_ceil(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`ceil expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + + if (x.type === 'bigint') { + return x; + } + + if (x.type === 'number') { + const numVal = x.value as number; + if (typeof numVal !== 'number') { + throw new Error(`ceil: value must be a JavaScript number, got ${typeof numVal}`); + } + const ceiled: bigint = BigInt(Math.ceil(numVal)); + return { type: 'bigint', value: ceiled }; + } + + throw new Error( + `ceil: unsupported type '${x.type}'. If simulating Python, implement x.__ceil__.` + ); +} + +export function math_fabs(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`fabs expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + + if (x.type === 'bigint') { + const bigVal: bigint = BigInt(x.value); + const absVal: number = bigVal < 0 ? -Number(bigVal) : Number(bigVal); + return { type: 'number', value: absVal }; + } + + if (x.type === 'number') { + const numVal: number = x.value as number; + if (typeof numVal !== 'number') { + throw new Error(`fabs: expected a JavaScript number, got ${typeof numVal}`); + } + const absVal: number = Math.abs(numVal); + return { type: 'number', value: absVal }; + } + + throw new Error(`fabs: unsupported type '${x.type}'. Implement x.__abs__ if needed.`); +} + +export function math_floor(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`floor expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + + if (x.type === 'bigint') { + return x; + } + + if (x.type === 'number') { + const numVal: number = x.value as number; + if (typeof numVal !== 'number') { + throw new Error(`floor: expected a JavaScript number, got ${typeof numVal}`); + } + const floored: bigint = BigInt(Math.floor(numVal)); + return { type: 'bigint', value: floored }; + } + + throw new Error( + `floor: unsupported type '${x.type}'. Implement x.__floor__ if needed.` + ); +} + +// Computes the product of a and b along with the rounding error using Dekker's algorithm. +function twoProd(a: number, b: number): { prod: number; err: number } { + const prod = a * b; + const c = 134217729; // 2^27 + 1 + const a_hi = (a * c) - ((a * c) - a); + const a_lo = a - a_hi; + const b_hi = (b * c) - ((b * c) - b); + const b_lo = b - b_hi; + const err = a_lo * b_lo - (((prod - a_hi * b_hi) - a_lo * b_hi) - a_hi * b_lo); + return { prod, err }; +} + +// Computes the sum of a and b along with the rounding error using Fast TwoSum. +function twoSum(a: number, b: number): { sum: number; err: number } { + const sum = a + b; + const v = sum - a; + const err = (a - (sum - v)) + (b - v); + return { sum, err }; +} + +// Performs a fused multiply-add operation: computes (x * y) + z with a single rounding. +function fusedMultiplyAdd(x: number, y: number, z: number): number { + const { prod, err: prodErr } = twoProd(x, y); + const { sum, err: sumErr } = twoSum(prod, z); + const result = sum + (prodErr + sumErr); + return result; +} + +function toNumber(val: Value): number { + if (val.type === 'bigint') { + return Number(val.value); + } else if (val.type === 'number') { + return val.value as number; + } else { + throw new Error(`unsupported type '${val.type}'`); + } +} + +export function math_fma(args: Value[]): Value { + if (args.length !== 3) { + throw new Error(`fma expects exactly 3 arguments, but got ${args.length}`); + } + + const xVal = toNumber(args[0]); + const yVal = toNumber(args[1]); + const zVal = toNumber(args[2]); + + // Special-case handling: According to the IEEE 754 standard, fma(0, inf, nan) + // and fma(inf, 0, nan) should return NaN. + if (isNaN(xVal) || isNaN(yVal) || isNaN(zVal)) { + return { type: 'number', value: NaN }; + } + if (xVal === 0 && !isFinite(yVal) && isNaN(zVal)) { + return { type: 'number', value: NaN }; + } + if (yVal === 0 && !isFinite(xVal) && isNaN(zVal)) { + return { type: 'number', value: NaN }; + } + + const result = fusedMultiplyAdd(xVal, yVal, zVal); + return { type: 'number', value: result }; +} + +export function math_fmod(args: Value[]): Value { + if (args.length !== 2) { + throw new Error(`fmod expects exactly 2 arguments, but got ${args.length}`); + } + + // Convert inputs to numbers + const xVal = toNumber(args[0]); + const yVal = toNumber(args[1]); + + // Divisor cannot be zero + if (yVal === 0) { + throw new Error("fmod: divisor (y) must not be zero"); + } + + // JavaScript's % operator behaves similarly to C's fmod + // in that the sign of the result is the same as the sign of x. + // For corner cases (NaN, Infinity), JavaScript remainder + // yields results consistent with typical C library fmod behavior. + const remainder = xVal % yVal; + + return { type: 'number', value: remainder }; +} + +function roundToEven(num: number): number { + const floorVal = Math.floor(num); + const ceilVal = Math.ceil(num); + const diffFloor = num - floorVal; + const diffCeil = ceilVal - num; + if (diffFloor < diffCeil) { + return floorVal; + } else if (diffCeil < diffFloor) { + return ceilVal; + } else { + return (floorVal % 2 === 0) ? floorVal : ceilVal; + } +} + +export function math_remainder(args: Value[]): Value { + if (args.length !== 2) { + throw new Error(`remainder expects exactly 2 arguments, but got ${args.length}`); + } + + const x = args[0]; + const y = args[1]; + + let xValue: number; + if (x.type === 'bigint') { + xValue = Number(x.value); + } else if (x.type === 'number') { + xValue = x.value as number; + } else { + throw new Error(`remainder: unsupported type '${x.type}' for first argument`); + } + + let yValue: number; + if (y.type === 'bigint') { + yValue = Number(y.value); + } else if (y.type === 'number') { + yValue = y.value as number; + } else { + throw new Error(`remainder: unsupported type '${y.type}' for second argument`); + } + + if (yValue === 0) { + throw new Error(`remainder: divisor y must not be zero`); + } + + const quotient = xValue / yValue; + const n = roundToEven(quotient); + const remainder = xValue - n * yValue; + + return { type: 'number', value: remainder }; +} + +export function math_trunc(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`trunc expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + + if (x.type === 'bigint') { + return x; + } + + if (x.type === 'number') { + const numVal: number = x.value as number; + if (typeof numVal !== 'number') { + throw new Error(`trunc: argument must be a number, got ${typeof numVal}`); + } + let truncated: number; + if (numVal === 0) { + truncated = 0; + } else if (numVal < 0) { + truncated = Math.ceil(numVal); + } else { + truncated = Math.floor(numVal); + } + return { type: 'bigint', value: BigInt(truncated) }; + } + + throw new Error(`trunc: unsupported type '${x.type}'. Implement x.__trunc__ if needed.`); +} + +export function math_copysign(args: Value[]): Value { + if (args.length !== 2) { + throw new Error(`copysign expects exactly 2 arguments, but got ${args.length}`); + } + + const [x, y] = args; + + if ((x.type !== 'number' && x.type !== 'bigint') || + (y.type !== 'number' && y.type !== 'bigint')) { + throw new Error(`copysign: both x and y must be of type 'number'`); + } + + const xVal = Number(x.value) as number; + const yVal = Number(y.value) as number; + + const absVal = Math.abs(xVal); + const isNegative = yVal < 0 || (Object.is(yVal, -0)); + const result = isNegative ? -absVal : absVal; + + return { type: 'number', value: Number(result) }; +} + +export function math_isfinite(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`isfinite expects exactly 1 argument, but got ${args.length}`); + } + + const xValObj = args[0]; + if (xValObj.type !== 'number') { + throw new Error(`isfinite: argument must be 'number', got '${xValObj.type}'`); + } + + const x = xValObj.value as number; + const result: boolean = Number.isFinite(x); + + return { type: 'bool', value: result }; +} + +export function math_isinf(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`isinf expects exactly 1 argument, but got ${args.length}`); + } + + const xValObj = args[0]; + if (xValObj.type !== 'number') { + throw new Error(`isinf: argument must be 'number', got '${xValObj.type}'`); + } + + const x = xValObj.value as number; + const result: boolean = (x === Infinity || x === -Infinity); + + return { type: 'bool', value: result }; +} + +export function math_isnan(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`isnan expects exactly 1 argument, but got ${args.length}`); + } + + const xValObj = args[0]; + if (xValObj.type !== 'number') { + throw new Error(`isnan: argument must be 'number', got '${xValObj.type}'`); + } + + const x = xValObj.value as number; + const result: boolean = Number.isNaN(x); + + return { type: 'bool', value: result }; +} + +export function math_ldexp(args: Value[]): Value { + if (args.length !== 2) { + throw new Error(`ldexp expects exactly 2 arguments, but got ${args.length}`); + } + + const xVal = toNumber(args[0]); + + if (args[1].type !== 'bigint') { + throw new Error(`ldexp: argument must be 'int', got '${args[1].type}'`); + } + const expVal = args[1].value; + + // Perform x * 2^expVal + // In JavaScript, 2**expVal may overflow or underflow, yielding Infinity or 0 respectively. + // That behavior parallels typical C library rules for ldexp. + const result = xVal * Math.pow(2, Number(expVal)); + + return { type: 'number', value: result }; +} + +export function math_nextafter(args: Value[]): Value { + // TODO: Implement math_nextafter using proper bit-level manipulation and handling special cases (NaN, Infinity, steps, etc.) + throw new Error("math_nextafter not implemented"); +} + +export function math_ulp(args: Value[]): Value { + // TODO: Implement math_ulp to return the unit in the last place (ULP) of the given floating-point number. + throw new Error("math_ulp not implemented"); +} + +export function math_cbrt(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_cbrt expects exactly 1 argument, but got ${args.length}`); + } + + const xVal = args[0]; + let x: number; + + if (xVal.type !== 'number') { + if (xVal.type === 'bigint') { + x = Number(xVal.value); + } else { + throw new Error(`math_cbrt: argument must be a number, got ${xVal.type}`); + } + } else { + x = xVal.value as number; + } + + const result = Math.cbrt(x); + + return { type: 'number', value: result }; +} + +export function math_exp(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_exp expects exactly 1 argument, but got ${args.length}`); + } + + const xVal = args[0]; + let x: number; + + if (xVal.type !== 'number') { + if (xVal.type === 'bigint') { + x = Number(xVal.value); + } else { + throw new Error(`math_cbrt: argument must be a number, got ${xVal.type}`); + } + } else { + x = xVal.value as number; + } + + const result = Math.exp(x); + return { type: 'number', value: result }; +} + +export function math_exp2(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_exp2 expects exactly 1 argument, but got ${args.length}`); + } + + const xVal = args[0]; + let x: number; + + if (xVal.type !== 'number') { + if (xVal.type === 'bigint') { + x = Number(xVal.value); + } else { + throw new Error(`math_cbrt: argument must be a number, got ${xVal.type}`); + } + } else { + x = xVal.value as number; + } + + const result = Math.pow(2, x); + return { type: 'number', value: result }; +} + +export function math_expm1(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_expm1 expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_expm1: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = Math.expm1(num); + return { type: 'number', value: result }; +} + +export function math_gamma(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`gamma expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`gamma: argument must be a number, int, or bigint, but got ${x.type}`); + } + + const z = toNumber(x); + const result = gamma(z); + + return { type: 'number', value: result }; +} + +export function math_lgamma(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`gamma expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`gamma: argument must be a number, int, or bigint, but got ${x.type}`); + } + + const z = toNumber(x); + const result = lgamma(z); + + return { type: 'number', value: result }; +} + +export function math_log(args: Value[]): Value { + if (args.length < 1 || args.length > 2) { + throw new Error(`math_log expects 1 or 2 arguments, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_log: first argument must be a number, int, or bigint, but got ${x.type}`); + } + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + if (num <= 0) { + throw new Error(`math_log: argument must be positive, but got ${num}`); + } + + if (args.length === 1) { + return { type: 'number', value: Math.log(num) }; + } + + const baseArg = args[1]; + if (baseArg.type !== 'number' && baseArg.type !== 'int' && baseArg.type !== 'bigint') { + throw new Error(`math_log: base argument must be a number, int, or bigint, but got ${baseArg.type}`); + } + let baseNum: number; + if (baseArg.type === 'number') { + baseNum = baseArg.value; + } else { + baseNum = Number(baseArg.value); + } + if (baseNum <= 0) { + throw new Error(`math_log: base must be positive, but got ${baseNum}`); + } + + const result = Math.log(num) / Math.log(baseNum); + return { type: 'number', value: result }; +} + +export function math_log10(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_log10 expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_log10: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + if (num <= 0) { + throw new Error(`math_log10: argument must be positive, but got ${num}`); + } + + const result = Math.log10(num); + return { type: 'number', value: result }; +} + +export function math_log1p(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_log1p expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_log1p: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + if (1 + num <= 0) { + throw new Error(`math_log1p: 1 + argument must be positive, but got 1 + ${num} = ${1 + num}`); + } + + const result = Math.log1p(num); + return { type: 'number', value: result }; +} + +export function math_log2(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_log2 expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_log2: argument must be a number, int, or bigint, but got ${x.type}`); + } + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + if (num <= 0) { + throw new Error(`math_log2: argument must be positive, but got ${num}`); + } + + const result = Math.log2(num); + return { type: 'number', value: result }; +} + +export function math_pow(args: Value[]): Value { + if (args.length !== 2) { + throw new Error(`math_pow expects exactly 2 arguments, but got ${args.length}`); + } + + const base = args[0]; + const exp = args[1]; + + if ((base.type !== 'number' && base.type !== 'bigint') || + (exp.type !== 'number' && exp.type !== 'bigint')) { + throw new Error(`math_pow: both arguments must be a number or bigint`); + } + + let baseNum: number; + if (base.type === 'number') { + baseNum = base.value; + } else { // 'bigint' + baseNum = Number(base.value); + } + + let expNum: number; + if (exp.type === 'number') { + expNum = exp.value; + } else { + expNum = Number(exp.value); + } + + const result = Math.pow(baseNum, expNum); + return { type: 'number', value: result }; +} + +export function math_radians(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_radians expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_radians: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let deg: number; + if (x.type === 'number') { + deg = x.value; + } else { + deg = Number(x.value); + } + + const radians = deg * Math.PI / 180; + return { type: 'number', value: radians }; +} + +export function math_sin(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_sin expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_sin: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = Math.sin(num); + return { type: 'number', value: result }; +} + +export function math_sinh(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_sinh expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_sinh: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = Math.sinh(num); + return { type: 'number', value: result }; +} + +export function math_tan(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_tan expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_tan: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = Math.tan(num); + return { type: 'number', value: result }; +} + +export function math_tanh(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_tanh expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'bigint') { + throw new Error(`math_tanh: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + const result = Math.tanh(num); + return { type: 'number', value: result }; +} + +export function math_sqrt(args: Value[]): Value { + if (args.length !== 1) { + throw new Error(`math_sqrt expects exactly 1 argument, but got ${args.length}`); + } + + const x = args[0]; + if (x.type !== 'number' && x.type !== 'int' && x.type !== 'bigint') { + throw new Error(`math_sqrt: argument must be a number, int, or bigint, but got ${x.type}`); + } + + let num: number; + if (x.type === 'number') { + num = x.value; + } else { + num = Number(x.value); + } + + if (num < 0) { + throw new Error(`math_sqrt: argument must be non-negative, but got ${num}`); + } + + const result = Math.sqrt(num); + return { type: 'number', value: result }; +} + +export function max(args: Value[]): Value { + if (args.length < 2) { + throw new Error(`max expects at least 2 arguments, but got ${args.length}`); + } + + const numericTypes = ['bigint', 'number']; + const firstType = args[0].type; + let isNumeric = numericTypes.includes(firstType); + let isString = firstType === 'string'; + + for (let i = 1; i < args.length; i++) { + const t = args[i].type; + if (isNumeric && !numericTypes.includes(t)) { + throw new Error(`max: all arguments must be mutually comparable (all numeric or all string)`); + } + if (isString && t !== 'string') { + throw new Error(`max: all arguments must be mutually comparable (all numeric or all string)`); + } + } + + let useFloat = false; + if (isNumeric) { + for (const arg of args) { + if (arg.type === 'number') { + useFloat = true; + break; + } + } + } + + let maxIndex = 0; + if (isNumeric) { + if (useFloat) { + let maxVal: number = Number(args[0].value); + for (let i = 1; i < args.length; i++) { + const curr: number = Number(args[i].value); + if (curr > maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } else { + let maxVal: bigint = args[0].value; + for (let i = 1; i < args.length; i++) { + const curr: bigint = args[i].value; + if (curr > maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } + } else if (isString) { + let maxVal = args[0].value as string; + for (let i = 1; i < args.length; i++) { + const curr = args[i].value as string; + if (curr > maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } else { + throw new Error(`max: unsupported type ${firstType}`); + } + + return args[maxIndex]; +} + +export function min(args: Value[]): Value { + if (args.length < 2) { + throw new Error(`min expects at least 2 arguments, but got ${args.length}`); + } + + const numericTypes = ['bigint', 'number']; + const firstType = args[0].type; + let isNumeric = numericTypes.includes(firstType); + let isString = firstType === 'string'; + + for (let i = 1; i < args.length; i++) { + const t = args[i].type; + if (isNumeric && !numericTypes.includes(t)) { + throw new Error(`min: all arguments must be mutually comparable (all numeric or all string)`); + } + if (isString && t !== 'string') { + throw new Error(`min: all arguments must be mutually comparable (all numeric or all string)`); + } + } + + let useFloat = false; + if (isNumeric) { + for (const arg of args) { + if (arg.type === 'number') { + useFloat = true; + break; + } + } + } + + let maxIndex = 0; + if (isNumeric) { + if (useFloat) { + let maxVal: number = Number(args[0].value); + for (let i = 1; i < args.length; i++) { + const curr: number = Number(args[i].value); + if (curr < maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } else { + let maxVal: bigint = args[0].value; + for (let i = 1; i < args.length; i++) { + const curr: bigint = args[i].value; + if (curr < maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } + } else if (isString) { + let maxVal = args[0].value as string; + for (let i = 1; i < args.length; i++) { + const curr = args[i].value as string; + if (curr < maxVal) { + maxVal = curr; + maxIndex = i; + } + } + } else { + throw new Error(`min: unsupported type ${firstType}`); + } + + return args[maxIndex]; +} + +export function random_random(args: Value[]): Value { + if (args.length !== 0) { + throw new Error(`random_random expects exactly 0 arguments, but got ${args.length}`); + } + const result = Math.random(); + return { type: 'number', value: result }; +} + +export function round(args: Value[]): Value { + if (args.length < 1 || args.length > 2) { + throw new Error(`round expects 1 or 2 arguments, but got ${args.length}`); + } + + const numArg = args[0]; + if (numArg.type !== 'number' && numArg.type !== 'bigint') { + throw new Error(`round: first argument must be a number, int, or bigint, but got ${numArg.type}`); + } + + let ndigitsArg = { type: 'bigint', value: BigInt(0) }; + if (args.length === 2 && args[1].type !== 'NoneType') { + ndigitsArg = args[1]; + } + + if (numArg.type === 'number') { + let numberValue: number = numArg.value; + if (ndigitsArg.value > 0) { + const shifted = Number(numberValue.toFixed(Number(ndigitsArg.value))); + return { type: 'number', value: shifted }; + } else if (ndigitsArg.value === BigInt(0)) { + const shifted = Math.round(numArg.value); + return { type: 'bigint', value: BigInt(shifted) }; + } else { + const shifted = Math.round(numArg.value / (10 ** (-Number(ndigitsArg.value)))) * (10 ** (-Number(ndigitsArg.value))); + return { type: 'number', value: shifted }; + } + } else { + if (ndigitsArg.value >= 0) { + return numArg; + } else { + const shifted: bigint = numArg.value / (BigInt(10) ** (-ndigitsArg.value)) * (BigInt(10) ** (-ndigitsArg.value)); + return { type: 'bigint', value: shifted }; + } + } +} + +export function time_time(args: Value[]): Value { + if (args.length !== 0) { + throw new Error(`time_time expects 0 arguments, but got ${args.length}`); + } + const currentTime = Date.now(); + return { type: 'number', value: currentTime }; +} + +function toPythonFloat(num: number): string { + //num = Number(num); + //console.info(typeof(num)); + if (Object.is(num, -0)) { + return "-0.0"; + } + if (num === 0) { + return "0.0"; + } + + if (num === Infinity) { + return "inf"; + } + if (num === -Infinity) { + return "-inf"; + } + + if (Number.isNaN(num)) { + return "nan"; + } + + if (Math.abs(num) >= 1e16 || (num !== 0 && Math.abs(num) < 1e-4)) { + return num.toExponential().replace(/e([+-])(\d)$/, 'e$10$2'); + } + if (Number.isInteger(num)) { + return num.toFixed(1).toString(); + } + return num.toString(); +} + +export function toPythonString(obj: Value): string { + let ret: any; + if ((obj as Value).type === 'bigint' || (obj as Value).type === 'complex') { + ret = (obj as Value).value.toString(); + } else if ((obj as Value).type === 'number') { + ret = toPythonFloat((obj as Value).value); + } else if ((obj as Value).type === 'bool') { + if ((obj as Value).value === true) { + return "True"; + } else { + return "False"; + } + } else if ((obj as Value).type === 'error') { + return (obj as Value).message; + } else if ((obj as unknown as Closure).node) { + for (let name in (obj as unknown as Closure).environment!.head) { + if ((obj as unknown as Closure).environment!.head[name] === obj) { + return ''; + } + } + } else if ((obj as Value) === undefined || (obj as Value).value === undefined) { + ret = 'None'; + } else { + ret = (obj as Value).value.toString(); + } + return ret; +} + +export function str(args: Value[]): Value { + if (args.length === 0) { + return { type: 'string', value: "" }; + } + const obj = args[0]; + const result = toPythonString(obj); + return { type: 'string', value: result }; +} + +export function input(args: Value[]): Value { + // TODO: + // nodejs + // readline + // distinguish between browser and commandline +} + +export function print(args: Value[]) { + // Convert each argument using toPythonString (an assumed helper function). + const pieces = args.map(arg => toPythonString(arg)); + // Join them with spaces. + const output = pieces.join(' '); + // Actually print to console (you can replace this with any desired output). + // console.info(output); + addPrint(output); + //return { type: 'string', value: output }; +} + \ No newline at end of file diff --git a/src/tests/cse-machine-arithmetic-operations.test.ts b/src/tests/cse-machine-arithmetic-operations.test.ts new file mode 100644 index 0000000..144c8b6 --- /dev/null +++ b/src/tests/cse-machine-arithmetic-operations.test.ts @@ -0,0 +1,1195 @@ +import { Value } from "../cse-machine/stash"; +import { runCSEMachine } from "./utils"; +import { toPythonString } from "../stdlib"; + +// add +test('Operation: python adding 2 int (ts adding 2 bigint)', () => { + const code = ` +a = 200 +b = 300 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('500'); +}); + +test('Operation: python adding 2 infinite int (ts adding 2 infinite bigint)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 66666666666666666666666666666666666666666666666666 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('99999999999999999999999999999999999999999999999999'); +}); + +test('Operation: python adding 2 minus infinite int (ts adding 2 minus infinite bigint)', () => { + const code = ` +a = -33333333333333333333333333333333333333333333333333 +b = -66666666666666666666666666666666666666666666666666 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-99999999999999999999999999999999999999999999999999'); +}); + +test('Operation: python adding 2 float (ts adding 2 number)', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('223.4561'); +}); + +test('Operation: python adding near infinite float (ts adding near infinite number)', () => { + const code = ` +a = 1.7976931348623157e308 +b = 1e292 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python adding infinite float (ts adding infinite number)', () => { + const code = ` +a = 1e309 +b = 100.001 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python adding near minus infinite float (ts adding minus infinite number)', () => { + const code = ` +a = -1.7976931348623157e308 +b = -1e292 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-inf'); +}); + +test('Operation: python adding minus infinite float (ts adding minus infinite number)', () => { + const code = ` +a = -1e309 +b = -1.0 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-inf'); +}); + +test('Operation: python adding near zero float (ts adding near zero number)', () => { + const code = ` +a = 1e-323 +b = -1e-323 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0'); +}); + +test('Operation: python add complex', () => { + const code = ` +a = 9 + 13J +b = 5.234e10 + 3e-7J +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(52340000009+13.0000003j)'); +}); + +// py convers all type to float then calculate +test('Operation: python adding int and float (ts adding bigint and number)', () => { + const code = ` +a = 10000000 +b = 123.45678 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000123.45678'); +}); + +test('Operation: python adding infinite int and float (ts adding bigint and number)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 0.3 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('3.333333333333333e+49'); +}); + +test('Operation: python adding int and infinite float (ts adding bigint and number)', () => { + const code = ` +a = 1e309 +b = 100 +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python adding int and complex', () => { + const code = ` +a = 3333333 +b = 46572.01 + 7.0J +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(3379905.01+7j)'); +}); + +test('Operation: python adding infinite int and complex', () => { + const code = ` +a = 333333333333333333333333333333333333333333 +b = 46572.01 + 7.0J +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(3.3333333333333332e+41+7j)'); +}); + +test('Operation: python adding float and complex', () => { + const code = ` +a = 5.0 +b = 46572.01 + 7.0J +x = a + b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(46577.01+7j)'); +}); + +// minus +test('Operation: python minus 2 int (ts minus 2 bigint)', () => { + const code = ` +a = 200 +b = 300 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-100'); +}); + +test('Operation: python minus 2 infinite int (ts minus 2 infinite bigint)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 66666666666666666666666666666666666666666666666666 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-33333333333333333333333333333333333333333333333333'); +}); + +test('Operation: python minus 2 minus infinite int (ts minus 2 minus infinite bigint)', () => { + const code = ` +a = -33333333333333333333333333333333333333333333333333 +b = -66666666666666666666666666666666666666666666666666 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('33333333333333333333333333333333333333333333333333'); +}); + +test('Operation: python minus 2 float (ts minus 2 number)', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('23.4559'); +}); + +test('Operation: python minus near infinite float (ts minus near infinite number)', () => { + const code = ` +a = 1.7976931348623157e308 +b = -1e292 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python minus infinite float (ts minus infinite number)', () => { + const code = ` +a = 1e309 +b = -100.001 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python minus near minus infinite float (ts minus minus infinite number)', () => { + const code = ` +a = -1.7976931348623157e308 +b = 1e292 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-inf'); +}); + +test('Operation: python minus infinite float (ts minus minus infinite number)', () => { + const code = ` +a = -1e309 +b = 1.0 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-inf'); +}); + +test('Operation: python minus near zero float (ts minus near zero number)', () => { + const code = ` +a = 1e-323 +b = 1e-323 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0'); +}); + +test('Operation: python minus complex', () => { + const code = ` +a = 9 + 13J +b = 5.234e10 + 3e-7J +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(-52339999991+12.9999997j)'); +}); + +// py convers all type to float then calculate +test('Operation: python minus int and float (ts minus bigint and number)', () => { + const code = ` +a = 10000000 +b = 123.45678 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('9999876.54322'); +}); + +test('Operation: python minus infinite int and float (ts minus bigint and number)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 0.3 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('3.333333333333333e+49'); +}); + +test('Operation: python minus int and infinite float (ts minus bigint and number)', () => { + const code = ` +a = 1e309 +b = -100 +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python minus int and complex', () => { + const code = ` +a = 3333333 +b = 46572.01 + 7.0J +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(3286760.99-7j)'); +}); + +test('Operation: python minus infinite int and complex', () => { + const code = ` +a = 333333333333333333333333333333333333333333 +b = 46572.01 + 7.0J +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(3.3333333333333332e+41-7j)'); +}); + +test('Operation: python minus float and complex', () => { + const code = ` +a = 5.0 +b = 46572.01 + 7.0J +x = a - b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(-46567.01-7j)'); +}); + +// multiply +test('Operation: python multiply 2 int (ts multiply 2 bigint)', () => { + const code = ` +a = 200 +b = 300 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('60000'); +}); + +test('Operation: python multiply 2 infinite int (ts multiply 2 infinite bigint)', () => { + const code = ` +a = 33333333333333333333 +b = 66666666666666666666 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('2222222222222222222177777777777777777778'); +}); + +test('Operation: python multiply 2 minus infinite int (ts multiply 2 minus infinite bigint)', () => { + const code = ` +a = -33333333333333333333 +b = -66666666666666666666 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('2222222222222222222177777777777777777778'); +}); + +test('Operation: python multiply 2 float (ts multiply 2 number)', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('12345.6123456'); +}); + +test('Operation: python multiply near infinite float (ts multiply near infinite number)', () => { + const code = ` +a = 1.7976931348623157e308 +b = 1.2 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python multiply infinite float (ts multiply infinite number)', () => { + const code = ` +a = 1e309 +b = -100 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-inf'); +}); + +test('Operation: python multiply near minus infinite float (ts multiply near minus infinite number)', () => { + const code = ` +a = -1.7976931348623157e308 +b = 1.001 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-inf'); +}); + +test('Operation: python multiply infinite float (ts multiply minus infinite number)', () => { + const code = ` +a = -1e309 +b = -1 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python mulpitly near zero float (ts multiply near zero number)', () => { + const code = ` +a = 1e-323 +b = 0.1 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0'); +}); + +test('Operation: python mulpitly complex', () => { + const code = ` +a = 1.413567e7 + 9e-3j +b = 3.00 + 7J +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(42407009.937+98949690.027j)'); +}); + +// py convers all type to float then calculate +test('Operation: python multiply int and float (ts multiply bigint and number)', () => { + const code = ` +a = 10000000 +b = 123.45678 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1234567800.0'); +}); + +test('Operation: python multiply infinite int and float (ts multiply bigint and number)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 0.3 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1e+49'); +}); + +test('Operation: python multiply int and infinite float (ts multiply bigint and number)', () => { + const code = ` +a = 1e309 +b = 1 +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python multiply int and complex', () => { + const code = ` +a = 3333333 +b = 46572.01 + 7.0J +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(155240017809.33002+23333331j)'); +}); + +test('Operation: python multiply infinite int and complex', () => { + const code = ` +a = 333333333333333333333333333333333333333333 +b = 46572.01 + 7.0J +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(1.5524003333333333e+46+2.3333333333333332e+42j)'); +}); + +test('Operation: python multiply float and complex', () => { + const code = ` +a = 5.0 +b = 46572.01 + 7.0J +x = a * b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(232860.05000000002+35j)'); +}); + +//divide +test('Operation: python divide 2 int (ts divide 2 bigint)', () => { + const code = ` +a = 200 +b = 300 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.6666666666666666'); +}); + +test('Operation: python divide 2 infinite int (ts divide 2 infinite bigint)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 3 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1.1111111111111111e+49'); +}); + +test('Operation: python divide 2 minus infinite int (ts divide 2 minus infinite bigint)', () => { + const code = ` +a = -3333333333333333333333333333333333333333 +b = -6666666666666666666666666666666666666666 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.5'); +}); + +test('Operation: python divide 2 float (ts divide 2 number)', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1.2345587654412344'); +}); + +test('Operation: python divide near infinite float (ts divide near infinite number)', () => { + const code = ` +a = 1.7976931348623157e308 +b = 0.99 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python divide infinite float (ts divide infinite number)', () => { + const code = ` +a = 1e309 +b = -1 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-inf'); +}); + +test('Operation: python divide near minus infinite float (ts divide near minus infinite number)', () => { + const code = ` +a = -1.7976931348623157e308 +b = 0.99 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-inf'); +}); + +test('Operation: python divide infinite float (ts divide minus infinite number)', () => { + const code = ` +a = -1e309 +b = -1 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python divide near zero float (ts divide near zero number)', () => { + const code = ` +a = 1e-323 +b = 10.0 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0'); +}); + +test('Operation: python divide complex', () => { + const code = ` +a = 1.345654234 + 7.7J +b = 1e7 + 5e4j +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(1.3841196310092247e-07+7.693079401844954e-07j)'); +}); + +// py convers all type to float then calculate +test('Operation: python divide int and float (ts divide bigint and number)', () => { + const code = ` +a = 10000000 +b = 123.45678 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('81000.00664200055'); +}); + +test('Operation: python divide infinite int and float (ts divide bigint and number)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 99999 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('3.3333666670000034e+44'); +}); + +test('Operation: python divide int and infinite float (ts divide bigint and number)', () => { + const code = ` +a = 1e309 +b = 1 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Operation: python multiply int and complex', () => { + const code = ` +a = 3333333 +b = 46572.01 + 7.0J +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(71.57373977835243-0.010757881793129974j)'); +}); + +test('Operation: python divide infinite int and complex', () => { + const code = ` +a = 46572.01 + 7.0J +b = 333333333333333333333333333333333333333333 +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(1.3971603e-37+2.1e-41j)'); +}); + +test('Operation: python divide float and complex', () => { + const code = ` +a = 5.0 +b = 46572.01 + 7.0J +x = a / b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(0.00010736062040359069-1.6136824303377388e-08j)'); +}); + +// mod +test('Operation: python mod 2 int (ts mod 2 bigint)', () => { + const code = ` +a = 200 +b = 66 +x = a % b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('2'); +}); + +test('Operation: python mod 2 infinite int (ts mod 2 infinite bigint)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 2 +x = a % b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1'); +}); + +test('Operation: python mod 2 minus infinite int (ts mod 2 minus infinite bigint)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = -2 +x = a % b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-1'); +}); + +test('Operation: python mod 2 float (ts mod 2 number)', () => { + const code = ` +a = 123.456 +b = 33.33 +x = a % b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('23.466000000000008'); +}); + +test('Operation: python mod near infinite float (ts mod near infinite number)', () => { + const code = ` +a = 1.7976931348623157e308 +b = 1.5 +x = a % b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.5'); +}); + +test('Operation: python mod near minus infinite float (ts mod near minus infinite number)', () => { + const code = ` +a = -1.7976931348623157e308 +b = 0.1 +x = a % b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.04999999999999996'); +}); + +test('Operation: python mod near zero float (ts mod near zero number)', () => { + const code = ` +a = 1e-323 +b = 10.0 +x = a % b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1e-323'); +}); + +// py convers all type to float then calculate +test('Operation: python mod int and float (ts mod bigint and number)', () => { + const code = ` +a = 10000000 +b = 123.45678 +x = a % b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.8200000004165986'); +}); + +test('Operation: python mod infinite int and float (ts mod bigint and number)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 2.0 +x = a % b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0'); +}); + +// power +test('Operation: python power 2 int (ts power 2 bigint)', () => { + const code = ` +a = 12 +b = 5 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('248832'); +}); + +test('Operation: python power 2 infinite int (ts power 2 infinite bigint)', () => { + const code = ` +a = 3333333333 +b = 11 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('564502926326723004369252654481870988519703974662500635066053616487982861691138799979677863582222674445517'); +}); + +test('Operation: python power 2 int (exponent minus than 0)', () => { + const code = ` +a = 3 +b = -11 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('5.645029269476762e-06'); +}); + +test('Operation: python power 2 minus infinite int (ts power 2 minus infinite bigint)', () => { + const code = ` +a = -33333333333333333333333333333333333333333333333333 +b = 2 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1111111111111111111111111111111111111111111111111088888888888888888888888888888888888888888888888889'); +}); + +test('Operation: python power 2 float (ts power 2 number)', () => { + const code = ` +a = 123.456 +b = 33.33 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('5.129814729698658e+69'); +}); + +test('Operation: python power near infinite float (ts power near infinite number)', () => { + const code = ` +a = 1.7976931348623157e308 +b = 1.0 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1.7976931348623157e+308'); +}); + +test('Operation: python power near minus infinite float (ts power near minus infinite number)', () => { + const code = ` +a = 1.7976931348623157e308 +b = -2 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0'); +}); + +test('Operation: python power near zero float (ts power near zero number)', () => { + const code = ` +a = 1e-323 +b = 10.0 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0'); +}); + +// py convers all type to float then calculate +test('Operation: python power int and float (ts power bigint and number)', () => { + const code = ` +a = 10000000 +b = 1.45678 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('15756508932.502234'); +}); + +test('Operation: python power infinite int and float (ts power bigint and number)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 2.0 +x = a ** b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1.111111111111111e+99'); +}); + +test('Operation: complex base ^ float exponent', () => { + const code = ` +a = 3.0 + 0j +b = 2.0 +x = a ** b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(-7+24j)'); +}); + +test('Operation: real float base ^ complex exponent', () => { + const code = ` +a = 2.3269000001 +b = 9.354649e-3 + 1.36574432j +x = a ** b +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(0.4085772300464849+0.9214069843584557j)'); +}); + +test('Operation: complex ^ complex', () => { + const code = ` +a = 1.253e7 + 2.3483725e-17j +b = 3.332134 - 4347657487892.2j +x = a ** b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(2.2284387180224344e+22-4.474930181022476e+23j)'); +}); + +// string concatenation +test('Operation: string concatenation', () => { + const code = ` +a = 'source' +b = 'academy' +x = a + b +x +`; + const result = runCSEMachine(code); + expect((result as Value).value).toBe('sourceacademy'); +}); + +test('Operation: string concatenation', () => { + const code = ` +a = 'source' +b = '' +x = a + b +x +`; + const result = runCSEMachine(code); + expect((result as Value).value).toBe('source'); +}); + +test('Operation: string concatenation', () => { + const code = ` +a = '' +b = '' +x = a + b +x +`; + const result = runCSEMachine(code); + expect((result as Value).value).toBe(''); +}); + +// Priority +test('Operation: python precedence (+ vs *)', () => { + const code = ` +a = 2 + 3 * 4 +a +`; + // 3 * 4 = 12, then 2 + 12 => 14 + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('14'); +}); + +test('Operation: python precedence ((+)+*)', () => { + const code = ` +a = (2 + 3) * 4 +a +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('20'); +}); + +test('Operation: python precedence (** vs *)', () => { + const code = ` +a = 3 ** 2 * 2 +a +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('18'); +}); + +test('Operation: python precedence (**) with parentheses', () => { + const code = ` +a = 3 ** (2 * 2) +a +`; + // (2*2)=4, 3^4=81 + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('81'); +}); + +test('Operation: python precedence (- vs /)', () => { + const code = ` +a = 10 - 4 / 2 +a +`; + // 4/2=2, then 10-2=8 + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('8.0'); +}); + +test('Operation: python precedence parentheses (- vs /)', () => { + const code = ` +a = (10 - 4) / 2 +a +`; + // (10-4)=6, then 6/2=3 + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('3.0'); +}); + +test('Operation: python precedence (% vs *)', () => { + const code = ` +a = 10 % 3 * 4 +a +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('4'); +}); + +test('Operation: python precedence (% with parentheses)', () => { + const code = ` +a = 10 % (3 * 4) +a +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10'); +}); + +test('Operation: python precedence (+ vs **)', () => { + const code = ` +a = 2 + 3 ** 2 +a +`; + // 3**2=9, then 2+9=11 + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('11'); +}); + +test('Operation: python precedence ((+) vs **)', () => { + const code = ` +a = (2 + 3) ** 2 +a +`; + // (2+3)=5, then 5^2=25 + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('25'); +}); + +test('Operation: python precedence chaining ** (right-associativity)', () => { + const code = ` +a = 2 ** 3 ** 2 +a +`; + // 3**2=9, then 2**9=512 + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('512'); +}); + +test('Operation: python precedence (**) left vs right', () => { + const code = ` +a = (2 ** 3) ** 2 +a +`; + // (2**3)=8, then 8**2=64 + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('64'); +}); diff --git a/src/tests/cse-machine-basic-types.test.ts b/src/tests/cse-machine-basic-types.test.ts new file mode 100644 index 0000000..f61ec1a --- /dev/null +++ b/src/tests/cse-machine-basic-types.test.ts @@ -0,0 +1,683 @@ +import { Value } from "../cse-machine/stash"; +import { runCSEMachine } from "./utils"; +import { toPythonString } from "../stdlib"; + +test('Variable definition: int (ts bigint)', () => { + const code = ` +x = 10000 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000'); +}); + +test('Variable definition: int zero (ts bigint)', () => { + const code = ` +x = 0 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0'); +}); + +test('Variable definition: int minus zero (ts bigint)', () => { + const code = ` +x = -0 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0'); +}); + +test('Variable definition: infinite int (ts bigint)', () => { + const code = ` +x = 99999999999999999999999999999999999999999999999999 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('99999999999999999999999999999999999999999999999999'); +}); + +test('Variable definition: infinite negative int (ts bigint)', () => { + const code = ` +x = -99999999999999999999999999999999999999999999999999 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-99999999999999999999999999999999999999999999999999'); +}); + +test('Variable definition: binary', () => { + const code = ` +x = 0b1011 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('11'); +}); + +test('Variable definition: octal', () => { + const code = ` +x = 0o345 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('229'); +}); + +test('Variable definition: hexadecimal', () => { + const code = ` +x = 0xFF +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('255'); +}); + +test('Variable definition: simple float (ts number)', () => { + const code = ` +x = 123.456 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('123.456'); +}); + +test('Variable definition: float zero (ts number)', () => { + const code = ` +x = 0.00 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0'); +}); + +test('Variable definition: float minus zero (ts number)', () => { + const code = ` +x = -0.00 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-0.0'); +}); + +test('Variable definition: scientific notation float (ts number)', () => { + const code = ` +x = 1.23456e3 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1234.56'); +}); + +test('Variable definition: near infinite float (ts number)', () => { + const code = ` +x = 1.7976931348623157e308 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1.7976931348623157e+308'); +}); + +test('Variable definition: near infinite negative float (ts number)', () => { + const code = ` +x = -1.7976931348623157e308 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-1.7976931348623157e+308'); +}); + +test('Variable definition: infinite float (ts number)', () => { + const code = ` +x = 1e309 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('inf'); +}); + +test('Variable definition: minus infinite float (ts number)', () => { + const code = ` +x = -1e309 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-inf'); +}); + +test('Variable definition: near infinite small float (ts number)', () => { + const code = ` +x = 1e-323 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1e-323'); +}); + +test('Variable definition: near minus infinite small float (ts number)', () => { + const code = ` +x = -1e-323 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-1e-323'); +}); + +test('Variable definition: infinite small float (ts number)', () => { + const code = ` +x = 1e-324 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0'); +}); + +test('Variable definition: minus infinite small float (ts number)', () => { + const code = ` +x = -1e-324 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-0.0'); +}); + +test('Variable definition: single quotes', () => { + const code = ` +x = 'single_quoted_string' +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('single_quoted_string'); +}); + +test('Variable definition: double quotes', () => { + const code = ` +x = "double_quoted_string" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('double_quoted_string'); +}); + +test('Variable definition: empty single quotes', () => { + const code = ` +x = '' +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe(''); +}); + +test('Variable definition: empty double quotes', () => { + const code = ` +x = "" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe(''); +}); + +test('cnmVariable definition: string with common escape sequences', () => { + const code = ` +x = "Line1\\nLine2\\tTabbed" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Line1\nLine2\tTabbed"); +}); + +test('Variable definition: multiline triple quotes', () => { + const code = ` +x = """Hello +World""" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Hello\nWorld"); +}); + +test('Variable definition: triple-quoted string with multiple lines', () => { + const code = ` +x = """Line1 +Line2 +Line3""" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Line1\nLine2\nLine3"); +}); + +test('String with \n (newline)', () => { + const code = ` +x = "Line1\\nLine2" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Line1\nLine2"); +}); + +test('String with \t (horizontal tab)', () => { + const code = ` +x = "Tabbed\\tString" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Tabbed\tString"); +}); + +test('String with \r (carriage return)', () => { + const code = ` +x = "Carriage\\rReturn" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Carriage\rReturn"); +}); + +test('String with \b (backspace)', () => { + const code = ` +x = "Back\\bspace" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Back\bspace"); +}); + +test('String with \a (bell/alarm)', () => { + const code = ` +x = "Alert\\aSound" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Alert\aSound"); +}); + +test('String with \f (form feed)', () => { + const code = ` +x = "Form\\fFeed" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Form\fFeed"); +}); + +test('String with \v (vertical tab)', () => { + const code = ` +x = "Vertical\\vTab" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Vertical\vTab"); +}); + +test('String with \\ (backslash)', () => { + const code = ` +x = "Escape\\\\Backslash" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Escape\\Backslash"); +}); + +test('String with \' (escaped single quote)', () => { + const code = ` +x = 'It\\'s a single quote' +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("It\'s a single quote"); +}); + +test('String with \" (escaped double quote)', () => { + const code = ` +x = "He said: \\"Hello\\"" +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('He said: \"Hello\"'); +}); + +test('Nested string', () => { + const code = ` +x = 'He said: "Hello"' +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('He said: \"Hello\"'); +}); + +test('Nested 3 quote string', () => { + const code = ` +x = '''He said: "Hello" +''hi'' ''' +x + `; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('He said: \"Hello\" \n\'\'hi\'\' '); +}); + +test('Variable definition: unicode charactors', () => { + const code = ` +x = '你好 こんにちは' +x +`; + + const result = runCSEMachine(code); + expect((result as Value).value).toBe('你好 こんにちは'); +}); + +test('Variable definition: bool true', () => { + const code = ` +x = True +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Variable definition: bool false', () => { + const code = ` +x = False +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Variable definition: python None', () => { + const code = ` +x = None +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('None'); +}); + +// float representation +test('Float representation: non-scientific notation upper limit', () => { + const code = ` +x = 1e16 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1e+16'); +}); + +test('Float representation: near non-scientific notation upper limit 1', () => { + const code = ` +x = 1e16-1 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1e+16'); +}); + +test('Float representation: near non-scientific notation upper limit 2', () => { + const code = ` +x = 1e16-10 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('9999999999999990.0'); +}); + +test('Float representation: non-scientific notation', () => { + const code = ` +x = 1.344326524463e7 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('13443265.24463'); +}); + +test('Float representation: non-scientific notation lower limit', () => { + const code = ` +x = 9.9999e-5 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('9.9999e-05'); +}); + +test('Float representation: near non-scientific notation lower limit', () => { + const code = ` +x = 1e-4 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0.0001'); +}); + +test('Float representation: non-scientific notation minus', () => { + const code = ` +x = -4.56731549e-3 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-0.00456731549'); +}); + +test('Float representation: scientific notation', () => { + const code = ` +x = 9357645728394584323840993590459437.0 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('9.357645728394584e+33'); +}); + +test('Float representation: scientific notation larger than e-09', () => { + const code = ` +x = 0.000000006452754367285356 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('6.452754367285356e-09'); +}); + +test('Float representation: scientific notation smaller than e-09', () => { + const code = ` +x = 0.00000000006452754367285356 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('6.452754367285356e-11'); +}); + +// complex +test('Complex definition: 0j (pure imaginary zero)', () => { + const code = ` +x = 0.0j +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0j'); +}); + +test('Complex definition: pure imaginary', () => { + const code = ` +x = 3j +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('3j'); +}); + +test('Complex definition: real + imaginary', () => { + const code = ` +x = 2 + 3j +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(2+3j)'); +}); + +test('Complex definition: float real + float imaginary', () => { + const code = ` +x = 2.5 + 4.5j +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(2.5+4.5j)'); +}); + +test('Complex definition: float real + float imaginary (representation)', () => { + const code = ` +x = 2.0 + 4.5j +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(2+4.5j)'); +}); + +test('Complex definition: float real + float imaginary within non-scientific notation boundary', () => { + const code = ` +x = 1.346758e9 + 4.5999999999e-3j +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(1346758000+0.0045999999999j)'); +}); + +test('Complex definition: float real + float imaginary near non-scientific notation boundary', () => { + const code = ` +x = 1e16-100 + 1e-4j +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(9999999999999900+0.0001j)'); +}); + +test('Complex definition: float real + float imaginary of non-scientific notation boundary', () => { + const code = ` +x = 1e16 + 9.999e-5j +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(1e+16+9.999e-05j)'); +}); + +test('Complex definition: float real + float imaginary within scientific notation boundary', () => { + const code = ` +x = 1.346758e123 - 4.5999999999e-8j +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(1.346758e+123-4.5999999999e-08j)'); +}); + +test('Complex definition: infinity real + float imaginary', () => { + const code = ` +x = 1.346758e999 - 4.5999999999e-8j +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('(inf-4.5999999999e-08j)'); +}); + +test('Float definition', () => { + const code = ` +x = 1. +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1.0'); +}); + +test('Int definition with underscore', () => { + const code = ` +x = 1_000_000 +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1000000'); +}); + +test('Float definition with underscores (simple)', () => { + const code = ` +x = 1_000.0 +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1000.0'); +}); + +test('Float definition with underscores (fraction and exponent)', () => { + const code = ` +x = 1_2.4_67e-3_5 +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1.2467e-34'); +}); + +test('Integer with underscores (bigint-like)', () => { + const code = ` +x = 123_456_789_012_345 +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('123456789012345'); +}); + +test('Float with underscores (positive exponent)', () => { + const code = ` +x = 9_87_654.321e+1_0 # should be x = 9_87_654.321e+1_0 +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('9876543210000000.0'); +}); + +test('Float with underscores (negative exponent)', () => { + const code = ` +x = 3.1_41_59_26e-0_5 +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('3.1415926e-05'); +}); diff --git a/src/tests/cse-machine-block.test.ts b/src/tests/cse-machine-block.test.ts new file mode 100644 index 0000000..b9d3abf --- /dev/null +++ b/src/tests/cse-machine-block.test.ts @@ -0,0 +1,34 @@ +import { Value } from "../cse-machine/stash"; +import { runCSEMachine } from "./utils"; +import { toPythonString } from "../stdlib"; + +test('Function call creates a new environment', () => { + const code = ` +x = 1 +def func(): + x = 2 + +func() +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1'); +}); + +test('If statement does not create a new environment', () => { + const code = ` +flag = True +x = 100 +if flag: + y = 200 +else: + z = 0 + +res = x + y +res +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('300'); +}); diff --git a/src/tests/cse-machine-built-ins.test.ts b/src/tests/cse-machine-built-ins.test.ts new file mode 100644 index 0000000..4b3b221 --- /dev/null +++ b/src/tests/cse-machine-built-ins.test.ts @@ -0,0 +1,1595 @@ +import { Value } from "../cse-machine/stash"; +import { toPythonString } from "../stdlib"; +import { runCSEMachine } from "./utils"; + +// _int +test('No argument defaults to 0', () => { + const code = ` +_int() +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0'); +}); + +test('Positive integer input', () => { + const code = ` +_int(42) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('42'); +}); + +test('Negative integer input', () => { + const code = ` +_int(-42) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-42'); +}); + +test('Zero input returns 0', () => { + const code = ` +_int(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('0'); +}); + +test('Positive float is truncated toward 0', () => { + const code = ` +_int(3.9) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('3'); +}); + +test('Negative float is truncated toward 0', () => { + const code = ` +_int(-3.9) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-3'); +}); + +test('Large positive integer input', () => { + const code = ` +_int(987654321098765432109876543210987654321098765432109876543210) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('987654321098765432109876543210987654321098765432109876543210'); +}); + +test('Large negative integer input', () => { + const code = ` +_int(-987654321098765432109876543210987654321098765432109876543210) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-987654321098765432109876543210987654321098765432109876543210'); +}); + +test('Large float truncated toward 0', () => { + const code = ` +_int(-9876543210987654321098765432109876543210987654321098765432.10) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('-9876543210987653968469877154705327859942496456145853480960'); +}); + +// _int_from_string +test('Default base (decimal) with a simple number string', () => { + const code = ` +_int_from_string("123") +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('123'); +}); + +test('Explicit default base (decimal) with a simple number string', () => { + const code = ` +_int_from_string("456", 10) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('456'); +}); + +test('Whitespace around number in decimal', () => { + const code = ` +_int_from_string(" 42 ", 10) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('42'); +}); + +test('Underscores in decimal string', () => { + const code = ` +_int_from_string("1_234_567", 10) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1234567'); +}); + +test('Binary base=2', () => { + const code = ` +_int_from_string("1011", 2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('11'); +}); + +test('Octal base=8', () => { + const code = ` +_int_from_string("377", 8) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('255'); +}); + +test('Hex base=16', () => { + const code = ` +_int_from_string("FF", 16) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('255'); +}); + +test('Base=36', () => { + const code = ` +_int_from_string("Z", 36) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('35'); +}); + +// abs +test('abs of a positive integer', () => { + const code = ` +abs(5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("5"); +}); + +test('abs of a negative integer', () => { + const code = ` +abs(-10) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("10"); +}); + +test('abs of zero integer', () => { + const code = ` +abs(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0"); +}); + +test('abs of a positive float', () => { + const code = ` +abs(3.14) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.14"); +}); + +test('abs of a negative float', () => { + const code = ` +abs(-2.718) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("2.718"); +}); + +test('abs of minus float zero', () => { + const code = ` +abs(-0.0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('abs of complex with positive real, positive imag', () => { + const code = ` +abs(3+4j) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("5.0"); +}); + +test('abs of complex with negative real, positive imag', () => { + const code = ` +abs(-5+12j) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("13.0"); +}); + +test('abs of complex zero', () => { + const code = ` +abs(0+0j) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +// char_at +test('char_at with valid index (beginning of string)', () => { + const code = ` +char_at("hello", 0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("h"); +}); + +test('char_at with valid index (end of string)', () => { + const code = ` +char_at("hello", 4) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("o"); +}); + +test('char_at with valid index (middle of string)', () => { + const code = ` +char_at("hello", 1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("e"); +}); + +test('char_at with index equal to string length => None', () => { + const code = ` +char_at("hello", 5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("None"); +}); + +test('char_at with index > string length => None', () => { + const code = ` +char_at("hello", 10) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("None"); +}); + +test('char_at with empty string', () => { + const code = ` +char_at("", 0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("None"); +}); + +// error +test('error with single string argument throws an exception', () => { + const code = ` +error("Something went wrong!") +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Error: Something went wrong!\n"); +}); + +test('error with multiple arguments throws an exception', () => { + const code = ` +error(404, "Not Found") +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("Error: 404 Not Found\n"); +}); + +// isinstance +test('isinstance(42, int) => True', () => { + const code = ` +isinstance(42, 'int') +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('isinstance(3.14, float) => True', () => { + const code = ` +isinstance(3.14, 'float') +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('isinstance("hello", string) => True', () => { + const code = ` +isinstance("hello", 'string') +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('isinstance(2+3j, complex) => True', () => { + const code = ` +isinstance(2+3j, 'complex') +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('isinstance(None, NoneType) => True', () => { + const code = ` +isinstance(None, 'NoneType') +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('isinstance(True, bool) => True', () => { + const code = ` +isinstance(True, 'bool') +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('isinstance("hello", int) => False', () => { + const code = ` +isinstance("hello", 'int') +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("False"); +}); + +// math_acos +test('math_acos(1) => 0', () => { + const code = ` +math_acos(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_acos(0) => pi/2', () => { + const code = ` +math_acos(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.5707963267948966"); +}); + +// math_acosh +test('math_acosh(1) => 0', () => { + const code = ` +math_acosh(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_acosh(2) => ~1.316957', () => { + const code = ` +math_acosh(2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.3169578969248166"); +}); + +// math_asin +test('math_asin(0) => 0', () => { + const code = ` +math_asin(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_asin(1) => pi/2', () => { + const code = ` +math_asin(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.5707963267948966"); +}); + +//math_asinh +test('math_asinh(0) => 0', () => { + const code = ` +math_asinh(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_asinh(1) => ~0.881373', () => { + const code = ` +math_asinh(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.881373587019543"); +}); + +// math_atan +test('math_atan(0) => 0', () => { + const code = ` +math_atan(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_atan(1) => pi/4', () => { + const code = ` +math_atan(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.7853981633974483"); +}); + +// math_atan2 +test('math_atan2(0, 1) => 0', () => { + const code = ` +math_atan2(0, 1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_atan2(1, 3)', () => { + const code = ` +math_atan2(1, 3) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.3217505543966422"); +}); + +// math_atanh +test('math_atanh(0) => 0', () => { + const code = ` +math_atanh(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_atanh(0.5) => ~0.549306', () => { + const code = ` +math_atanh(0.5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.5493061443340549"); +}); + +// math_cbrt +test('math_cbrt: perfect cube positive (27 => 3)', () => { + const code = ` +math_cbrt(27) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.0"); +}); + +test('math_cbrt: perfect cube negative (-8 => -2)', () => { + const code = ` +math_cbrt(-8) +`; + const result = runCSEMachine(code); + // -8 的立方根为 -2 + expect(toPythonString(result as Value)).toBe("-2.0"); +}); + +test('math_cbrt: zero (0 => 0)', () => { + const code = ` +math_cbrt(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_cbrt: non-perfect cube positive (2)', () => { + const code = ` +math_cbrt(2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.2599210498948732"); +}); + +// math_ceil +test('math_ceil: integer input (3 => 3)', () => { + const code = ` +math_ceil(3) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3"); +}); + +test('math_ceil: positive float (3.14 => 4)', () => { + const code = ` +math_ceil(3.14) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("4"); +}); + +test('math_ceil: negative float (-3.14 => -3)', () => { + const code = ` +math_ceil(-3.14) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-3"); +}); + +test('math_ceil: zero (0 => 0)', () => { + const code = ` +math_ceil(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0"); +}); + +// math_comb(n, k) +test('math_comb: when k > n returns 0', () => { + const code = ` +math_comb(3, 5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0"); +}); + +test('math_comb: when k equals n returns 1', () => { + const code = ` +math_comb(5, 5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1"); +}); + +test('math_comb: choosing 0 items returns 1', () => { + const code = ` +math_comb(7, 0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1"); +}); + +test('math_comb: choose 2 items out of 5 returns 10', () => { + const code = ` +math_comb(5, 2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("10"); +}); + +// math_copysign +test('math_copysign: positive x and negative y returns -x', () => { + const code = ` +math_copysign(3.14, -0.00000005657789) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-3.14"); +}); + +test('math_copysign: negative x and positive y returns positive magnitude', () => { + const code = ` +math_copysign(-5, 1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("5.0"); +}); + +// math_cos +test('math_cos: cosine of 0 radians returns 1', () => { + const code = ` +math_cos(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.0"); +}); + +test('math_cos: cosine of pi returns -1', () => { + const code = ` +math_cos(3.141592653589793) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-1.0"); +}); + +// math_cosh(x) +test('math_cosh: hyperbolic cosine of 0 returns 1', () => { + const code = ` +math_cosh(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.0"); +}); + +test('math_cosh: hyperbolic cosine of 1 returns approximately 1.5430806348152437', () => { + const code = ` +math_cosh(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.5430806348152437"); +}); + +// math_degrees(x) +test('math_degrees: convert 0 radians to 0 degrees', () => { + const code = ` +math_degrees(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_degrees: convert pi/2 radians to 90 degrees', () => { + const code = ` +math_degrees(1.5707963267948966) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("90.0"); +}); + +test('math_degrees: convert pi/2 radians to ~45 degrees', () => { + const code = ` +math_degrees(0.8) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("45.836623610465864"); +}); + +// math_erf(x) +test('math_erf: erf(0) returns 0', () => { + const code = ` +math_erf(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_erf: erf(1) returns approximately 0.8427007929497148', () => { + const code = ` +math_erf(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.8427007929497148"); +}); + +test('math_erf: erf(0.3) returns approximately 0.32862675945912734', () => { + const code = ` +math_erf(0.3) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.32862675945912734"); +}); + +// math_exp(x) +test('math_exp: exp(0) returns 1', () => { + const code = ` +math_exp(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.0"); +}); + +test('math_exp: exp(1) returns approximately 2.718281828459045', () => { + const code = ` +math_exp(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("2.718281828459045"); +}); + +test('math_exp: exp(1.5) returns approximately 4.4816890703380645', () => { + const code = ` +math_exp(1.5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("4.4816890703380645"); +}); + +// math_exp2 +test('math_exp2: exp2(0) returns 1', () => { + const code = ` +math_exp2(0) +`; +const result = runCSEMachine(code); +expect(toPythonString(result as Value)).toBe("1.0"); +}); + +test('math_exp2: exp2(1) returns 2', () => { + const code = ` +math_exp2(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("2.0"); +}); + +test('math_exp2: exp2(1.5) returns 2.8284271247461903', () => { + const code = ` +math_exp2(1.5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("2.8284271247461903"); +}); + +// math_expm1(x) +test('math_expm1: expm1(0) returns 0', () => { + const code = ` +math_expm1(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_expm1: expm1(1) returns approximately 1.7182818284590453', () => { + const code = ` +math_expm1(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.7182818284590453"); +}); + +test('math_expm1: expm1(1.5)', () => { + const code = ` +math_expm1(1.5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.481689070338065"); +}); + +// math_fabs +test('math_fabs: fabs of a negative integer returns float', () => { + const code = ` +math_fabs(-3) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.0"); +}); + +test('math_fabs: fabs of a positive float returns same value', () => { + const code = ` +math_fabs(4.2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("4.2"); +}); + +test('math_fabs: fabs of 0 returns 0.0', () => { + const code = ` +math_fabs(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +// math_factorial +test('math_factorial: factorial of 0 returns 1', () => { + const code = ` +math_factorial(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1"); +}); + +test('math_factorial: factorial of 5 returns 120', () => { + const code = ` +math_factorial(5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("120"); +}); + +// math_floor +test('math_floor: floor of 3.7 returns 3', () => { + const code = ` +math_floor(3.7) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3"); +}); + +test('math_floor: floor of -3.2 returns -4', () => { + const code = ` +math_floor(-3.2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-4"); +}); + +test('math_floor: floor of 5 returns 5', () => { + const code = ` +math_floor(5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("5"); +}); + +// math_gcd +test('math_gcd: no arguments returns 0', () => { + const code = ` +math_gcd() +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0"); +}); + +test('math_gcd: all zeros returns 0', () => { + const code = ` +math_gcd(0, 0, 0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0"); +}); + +test('math_gcd: not all zeros', () => { + const code = ` +math_gcd(0, 0, 2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("2"); +}); + +test('math_gcd: gcd of 12 and 18 returns 6', () => { + const code = ` +math_gcd(12, 18) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("6"); +}); + +test('math_gcd: gcd with negative numbers returns positive gcd', () => { + const code = ` +math_gcd(-12, 18) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("6"); +}); + +test('math_gcd: gcd of 20, 30, and 50 returns 10', () => { + const code = ` +math_gcd(20, 30, 50) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("10"); +}); + +// math_isfinite +test('math_isfinite: finite number returns True', () => { + const code = ` +math_isfinite(3.14) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('math_isfinite: positive infinity returns False', () => { + const code = ` +math_isfinite(1e309) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("False"); +}); + +test('math_isfinite: negative infinity returns False', () => { + const code = ` +math_isfinite(-1e309) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("False"); +}); + +// isinf +test('math_isinf: finite number returns False', () => { + const code = ` +math_isinf(3.14) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("False"); +}); + +test('math_isinf: positive infinity returns True', () => { + const code = ` +math_isinf(1e309) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('math_isinf: negative infinity returns True', () => { + const code = ` +math_isinf(-1e309) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('math_isinf: infinity returns True', () => { + const code = ` +math_isinf(math_inf) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +// math_isnan +test('math_isnan: finite number returns False', () => { + const code = ` +math_isnan(3.14) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("False"); +}); + +test('math_isnan: nan returns True', () => { + const code = ` +math_isnan(math_nan) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +// math_isqrt +test('math_isqrt: isqrt(0) returns 0', () => { + const code = ` +math_isqrt(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0"); +}); + +test('math_isqrt: isqrt(10) returns 3', () => { + const code = ` +math_isqrt(10) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3"); +}); + +// math_lcm +test('math_lcm: no arguments returns 1', () => { + const code = ` +math_lcm() +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1"); +}); + +test('math_lcm: all zeros returns 0', () => { + const code = ` +math_lcm(0, 0, 0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0"); +}); + +test('math_lcm: lcm of 3 and 4 returns 12', () => { + const code = ` +math_lcm(3, 4) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("12"); +}); + +test('math_lcm: lcm of -3 and 4 returns 12', () => { + const code = ` +math_lcm(-3, 4) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("12"); +}); + +// math_log +test('math_log: natural logarithm returns correct value for one argument', () => { + const code = ` +math_log(20) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("2.995732273553991"); +}); + +test('math_log: logarithm with given base returns correct value', () => { + const code = ` +math_log(20, 2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("4.321928094887363"); +}); + +// math_log10 +test('math_log10: base-10 logarithm returns correct value', () => { + const code = ` +math_log10(20) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.3010299956639813"); +}); + +// math_log1p +test('math_log1p: logarithm of 1+x returns correct value for x = 1', () => { + const code = ` +math_log1p(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.6931471805599453"); +}); + +test('math_log1p: logarithm of 1+0 returns 0', () => { + const code = ` +math_log1p(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +// math_log2 +test('math_log2: base-2 logarithm returns correct value', () => { + const code = ` +math_log2(8) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.0"); +}); + +// math_perm +test('math_perm: when k > n returns 0', () => { + const code = ` +math_perm(3, 5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0"); +}); + +test('math_perm: when k equals 0 returns 1', () => { + const code = ` +math_perm(5, 0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1"); +}); + +test('math_perm: general case, math_perm(5, 3) returns 60', () => { + const code = ` +math_perm(5, 3) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("60"); +}); + +// math_pow +test('math_pow: 2 raised to 3 returns 8.0', () => { + const code = ` +math_pow(2, 3) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("8.0"); +}); + +test('math_pow: 2 raised to -1 returns 0.5', () => { + const code = ` +math_pow(2, -1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.5"); +}); + +test('math_pow: 2 raised to 0.7 returns ~1.62450479', () => { + const code = ` +math_pow(2, 0.7) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.624504792712471"); +}); + +// math_radians +test('math_radians: 0 degrees returns 0', () => { + const code = ` +math_radians(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_radians: 180 degrees returns pi', () => { + const code = ` +math_radians(180) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.141592653589793"); +}); + +test('math_radians: 90 degrees returns pi/2', () => { + const code = ` +math_radians(90) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.5707963267948966"); +}); + +test('math_radians: 45 degrees returns pi/4', () => { + const code = ` +math_radians(45) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.7853981633974483"); +}); + +// math_remainder +test('math_remainder: remainder(5, 3) returns -1.0', () => { + const code = ` +math_remainder(5, 3) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-1.0"); +}); + +test('math_remainder: remainder(7, 2) returns -1.0', () => { + const code = ` +math_remainder(7, 2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-1.0"); +}); + +test('math_remainder: remainder(-5, 3) returns 1.0', () => { + const code = ` +math_remainder(-5, 3) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.0"); +}); + +// math_sin +test('math_sin: sine of 0 returns 0', () => { + const code = ` +math_sin(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_sin: sine of pi/2 returns 1.0', () => { + const code = ` +math_sin(1.5707963267948966) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.0"); +}); + +// math_sinh +test('math_sinh: hyperbolic sine of 0 returns 0', () => { + const code = ` +math_sinh(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_sinh: hyperbolic sine of 1 returns approximately 1.1752011936438014', () => { + const code = ` +math_sinh(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.1752011936438014"); +}); + +// math_sqrt +test('math_sqrt: square root of 4 returns 2.0', () => { + const code = ` +math_sqrt(4) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("2.0"); +}); + +test('math_sqrt: square root of 2 returns approximately 1.4142135623730951', () => { + const code = ` +math_sqrt(2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.4142135623730951"); +}); + +// math_tan +test('math_tan: tangent of 0 returns 0', () => { + const code = ` +math_tan(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_tan: tangent of pi/4 returns 0.9999999999999999', () => { + const code = ` +math_tan(0.7853981633974483) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.9999999999999999"); +}); + +// math_tanh +test('math_tanh: hyperbolic tangent of 0 returns 0', () => { + const code = ` +math_tanh(0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('math_tanh: hyperbolic tangent of 1 returns approximately 0.7615941559557649', () => { + const code = ` +math_tanh(1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.7615941559557649"); +}); + +// math_trunc +test('math_trunc: trunc of a positive number returns its integer part', () => { + const code = ` +math_trunc(3.7) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3"); +}); + +test('math_trunc: trunc of a negative number returns its integer part', () => { + const code = ` +math_trunc(-3.7) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-3"); +}); + +// max +test('max: integers - returns the largest integer', () => { + const code = ` +max(7, 3, 9, 1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("9"); +}); + +test('max: floats - returns the largest float', () => { + const code = ` +max(2.5, 3.1, 3.1, 1.8) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.1"); +}); + +test('max: strings - returns the largest string', () => { + const code = ` +max("apple", "banana", "cherry") +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("cherry"); +}); + +// min +test('min: integers - returns the smallest integer', () => { + const code = ` +min(7, 3, 9, 1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1"); +}); + +test('min: floats - returns the smallest float', () => { + const code = ` +min(2.5, 3.1, 1.8, 1.8) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.8"); +}); + +test('min: strings - returns the smallest string', () => { + const code = ` +min("apple", "banana", "cherry") +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("apple"); +}); + +// round +test('round: round(3.14159, 2) returns 3.14', () => { + const code = ` +round(3.14159, 2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.14"); +}); + +test('round: round(3.14159, 0) returns 3.0', () => { + const code = ` +round(3.14159, 0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3"); +}); + +test('round: round(3.14159) returns 3.0', () => { + const code = ` +round(3.14159) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3"); +}); + +test('round: round(-2.5) returns -2.0', () => { + const code = ` +round(-2.5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-2"); +}); + +test('round: round(327485.244154, -3) returns 327000.0', () => { + const code = ` +round(327485.244154, -3) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("327000.0"); +}); + +test('round', () => { + const code = ` +round(327485.244154, 0) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("327485"); +}); + +// str +test('str: no argument returns empty string', () => { + const code = ` +str() +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe(""); +}); + +test('str: integer conversion', () => { + const code = ` +str(123) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("123"); +}); + +test('str: float conversion', () => { + const code = ` +str(3.14) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.14"); +}); + +test('str: boolean conversion', () => { + const code = ` +str(True) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("True"); +}); + +test('str: string conversion (idempotent)', () => { + const code = ` +str("hello") +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("hello"); +}); + +test('str: function conversion', () => { + const code = ` +def f(): + return +str(f) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe(""); +}); + +test('str: nan conversion', () => { + const code = ` +str(math_nan) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("nan"); +}); + +test('str: inf conversion', () => { + const code = ` +str(math_inf) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("inf"); +}); + +test('str: None conversion', () => { + const code = ` +str(None) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("None"); +}); + +// math_fma +test('math_fma: fused multiply-add for simple positive numbers returns 10.0', () => { + const code = ` +math_fma(2, 3, 4) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("10.0"); +}); + +test('math_fma: fused multiply-add with negative multiplier returns -2.0', () => { + const code = ` +math_fma(-2, 3, 4) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-2.0"); +}); + +test('math_fma: fused multiply-add for (1e16, 1e-16, -1) returns 0.0', () => { + // Why??? + const code = ` +math_fma(1e16, 1e-16, -1) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-2.0902213275965396e-17"); +}); + +test('math_fma: fused multiply-add for (1.5, 2.5, 3.5) returns 7.25', () => { + const code = ` +math_fma(1.5, 2.5, 3.5) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("7.25"); +}); + +test('math_fma: fused multiply-add with 0, infinity, nan returns nan', () => { + const code = ` +math_fma(0, math_inf, math_nan) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("nan"); +}); + +test('math_fma: fused multiply-add with infinity, 0, nan returns nan', () => { + const code = ` +math_fma(math_inf, 0, math_nan) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("nan"); +}); + +test('math_fma: better than * +', () => { + const code = ` +x = 1.0000000000000002 +y = 1e16 +z = -1e16 +math_fma(x, y, z) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("2.220446049250313"); +}); + +test('math_fmod: integer remainder (5 % 2)', () => { + const code = ` +x = 5 +y = 2 +math_fmod(x, y) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.0"); +}); + +test('math_fmod: negative dividend (-5.5 % 2) => -1.5', () => { + const code = ` +x = -5.5 +y = 2 +math_fmod(x, y) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("-1.5"); +}); + +test('math_fmod: Infinity % 2 => NaN', () => { + const code = ` +x = 1e999999999 # Infinity +y = 2 +math_fmod(x, y) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("nan"); +}); + +test('math_ldexp: integer scale up (3.14 * 2^2)', () => { + const code = ` +x = 3.14 +i = 2 +math_ldexp(x, i) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("12.56"); +}); + +test('math_ldexp: negative exponent (3.14 * 2^-2)', () => { + const code = ` +x = 3.14 +i = -2 +math_ldexp(x, i) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.785"); +}); + +test('math_ldexp: bigint (3.14, 10)', () => { + const code = ` +x = 3.14 +i = 10 +math_ldexp(x, i) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3215.36"); +}); + +test('math_gamma: basic integer input (math_gamma(1) = 1)', () => { + const code = ` +x = 1 +math_gamma(x) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.0"); +}); + +test('math_gamma: integer input (math_gamma(5) = 24)', () => { + const code = ` +x = 5 +math_gamma(x) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("24.0"); +}); + +test('math_gamma: non-integer input (math_gamma(2.5))', () => { + const code = ` +x = 2.5 +math_gamma(x) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("1.329340388179137"); +}); + +test('lgamma: integer input lgamma(1) = ln(Gamma(1)) = 0', () => { + const code = ` +x = 1 +math_lgamma(x) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.0"); +}); + +test('lgamma: integer input lgamma(5) = ln(Gamma(5)) = ln(24)', () => { + const code = ` +x = 5 +math_lgamma(x) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("3.1780538303479444"); +}); + +test('lgamma: fractional input (0.5)', () => { + const code = ` +x = 0.5 +math_lgamma(x) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("0.5723649429247004"); +}); + +test('lgamma: large input ~ potential overflow', () => { + const code = ` +x = 1000 +math_lgamma(x) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe("5905.220423209181"); +}); diff --git a/src/tests/cse-machine-conditional-expressions.test.ts b/src/tests/cse-machine-conditional-expressions.test.ts new file mode 100644 index 0000000..ae8131a --- /dev/null +++ b/src/tests/cse-machine-conditional-expressions.test.ts @@ -0,0 +1,121 @@ +import { Value } from "../cse-machine/stash"; +import { runCSEMachine } from "./utils"; +import { toPythonString } from "../stdlib"; + +test('if-else statement with simple logical expression and ends with if', () => { + const code = ` +a = True +if a: + x1 = 1 +else: + x2 = 2 +x1 +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1'); +}); + +test('if-else statement with simple logical expression and ends with else', () => { + const code = ` +a = True +if not a: + x1 = 1 +else: + x2 = 2 +x2 +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('2'); +}); + +// test('if-else statement with complex logical expression', () => { +// const code = ` +// a = True +// b = False +// c = True +// d = False +// if a and b or c and not d: # (a and b) or (c and (not d)) +// x1 = 1 +// else: +// x2 = 2 +// x1 +// `; + +// const result = runCSEMachine(code); +// expect(toPythonString(result as Value)).toBe('1'); +// }); + +test('if-elif-else statement and ends with if', () => { + const code = ` +a = True +b = False +if a: + x1 = 1 +elif b: + x2 = 2 +else: + x3 = 3 +x1 +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1'); +}); + +test('if-elif-else statement and ends with elif', () => { + const code = ` +a = True +b = False +if not a: + x1 = 1 +elif not b: + x2 = 2 +else: + x3 = 3 +x2 +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('2'); +}); + +test('if-elif-else statement and ends with else', () => { + const code = ` +a = True +b = False +if not a: + x1 = 1 +elif b: + x2 = 2 +else: + x3 = 3 +x3 +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('3'); +}); + +test('Conditional expression and ends with if', () => { + const code = ` +a = True +c = 1 if a else 2 +c +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('1'); +}); + +test('Conditional expression and ends with if', () => { + const code = ` +a = True +c = 1 if not a else 2 +c +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('2'); +}); \ No newline at end of file diff --git a/src/tests/cse-machine-functions.test.ts b/src/tests/cse-machine-functions.test.ts new file mode 100644 index 0000000..fcddb99 --- /dev/null +++ b/src/tests/cse-machine-functions.test.ts @@ -0,0 +1,79 @@ +import { Value } from "../cse-machine/stash"; +import { runCSEMachine } from "./utils"; +import { toPythonString } from "../stdlib"; + +test('Simple function declaration and call', () => { + const code = ` +def func(): + return 'sourceacademy' + +result = func() +result +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('sourceacademy'); +}); + +test('Function with parameters', () => { + const code = ` +def add_numbers(a, b): + return a + b + +result = add_numbers(100, 200) +result +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('300'); +}); + +test('Function called as parameter', () => { + const code = ` +def ret_a(): + return 100 +def add_numbers(a, b): + return a + b + +result = add_numbers(ret_a(), 200) +result +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('300'); +}); + +test('Function defined in another function', () => { + const code = ` +def func_1(a): + def func_2(): + return 200 + return a + func_2() + +result = func_1(100) +result +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('300'); +}); + +test('Recursive function', () => { + const code = ` +def sum_1(term, a, next, b): + return 0 if a > b else term(a) + sum_1(term, next(a), next, b) + +def pi_sum(a, b): + def pi_term(x): + return 1 / (x * (x + 2)) + def pi_next(x): + return x + 4 + return sum_1(pi_term, a , pi_next, b) + +res = 8 * pi_sum(1, 1000) +res +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('3.139592655589783'); +}); \ No newline at end of file diff --git a/src/tests/cse-machine-logical-operations.test.ts b/src/tests/cse-machine-logical-operations.test.ts new file mode 100644 index 0000000..e04cb31 --- /dev/null +++ b/src/tests/cse-machine-logical-operations.test.ts @@ -0,0 +1,1857 @@ +import { Value } from "../cse-machine/stash"; +import {runCSEMachine} from "./utils"; +import { toPythonString } from "../stdlib"; + +test('Operation: python comparing 2 int', () => { + const code = ` +a = 200 +b = 300 +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 int (negative, positive)', () => { + const code = ` +a = -100 +b = 0 +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 big int', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 66666666666666666666666666666666666666666666666666 +x = a > b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 minus big int', () => { + const code = ` +a = -33333333333333333333333333333333333333333333333333 +b = -66666666666666666666666666666666666666666666666666 +x = a > b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 float', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a > b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing near infinite float', () => { + const code = ` +a = 1.7976931348623157e308 +b = 1.7976931348623156e308 +x = a > b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing infinite float with finite float', () => { + const code = ` +a = 1e309 # => inf in Python +b = 1e292 +x = a > b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing infinite float with infinite float', () => { + const code = ` +a = 1e310 # => inf +b = 1e309 # => inf +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing negative infinite float with finite float', () => { + const code = ` +a = -1e309 # => -inf +b = -1e292 +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing near zero float', () => { + const code = ` +a = 1e-323 +b = 0 +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing int and float', () => { + const code = ` +a = 100 +b = 123.456 +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and float', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 3.3333333333333333333333333e49 +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and infinite float', () => { + const code = ` +a = 10 ** 10000 +b = 1e309 # => inf +x = a > b +x +`; + + // in real world 1e10000 > 1e309 + // but in python 1e10000 < 1e309 = Infinity + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (simple)', () => { + const code = ` +a = "abc" +b = "abd" +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (case sensitive)', () => { + const code = ` +a = "abc" +b = "ABC" +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (length difference)', () => { + const code = ` +a = "abc" +b = "ab" +x = a > b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (empty string)', () => { + const code = ` +a = "" +b = "abcdef" +x = a > b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +// >= +test('Operation: python comparing 2 int (simple greater)', () => { + const code = ` +a = 300 +b = 200 +x = a >= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 int (equal)', () => { + const code = ` +a = 200 +b = 200 +x = a >= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 int (negative)', () => { + const code = ` +a = -100 +b = 0 +x = a >= b +x +`; + // -100 >= 0 => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 big int (greater)', () => { + const code = ` +a = 66666666666666666666666666666666666666666666666666 +b = 33333333333333333333333333333333333333333333333333 +x = a >= b +x +`; + // a > b => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 big int (equal)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 33333333333333333333333333333333333333333333333333 +x = a >= b +x +`; + // a == b => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 minus big int', () => { + const code = ` +a = -33333333333333333333333333333333333333333333333333 +b = -66666666666666666666666666666666666666666666666666 +x = a >= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 float (greater)', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a >= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 float (equal)', () => { + const code = ` +a = 123.456 +b = 123.456 +x = a >= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing near infinite float', () => { + const code = ` +a = 1.7976931348623157e308 +b = 1.7976931348623156e308 +x = a >= b +x +`; + // a > b => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing infinite float with finite float', () => { + const code = ` +a = 1e309 # => inf in Python +b = 1e292 +x = a >= b +x +`; + // inf >= finite => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing infinite float with infinite float (equal)', () => { + const code = ` +a = 1e310 # => inf +b = 1e311 # => inf +x = a >= b +x +`; + // inf >= inf => True (they are equal infinities) + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing negative infinite float with finite float', () => { + const code = ` +a = -1e309 # => -inf +b = -1e292 +x = a >= b +x +`; + // -inf >= negative finite => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing int and float (greater)', () => { + const code = ` +a = 200 +b = 123.456 +x = a >= b +x +`; + // 200 >= 123.456 => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing int and float (equal)', () => { + const code = ` +a = 100 +b = 100.0 +x = a >= b +x +`; + // 100 >= 100.0 => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing int and float (less)', () => { + const code = ` +a = 100 +b = 123.456 +x = a >= b +x +`; + // 100 >= 123.456 => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and float (greater)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 3.3333333333333333333333333e49 +x = a >= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and float (greater)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 3.3333333333333333333333333e49 +x = b >= a +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and float (equal)', () => { + const code = ` +a = 9007199254740992 +b = 9007199254740992.0 +x = a >= b +x +`; + // Python sees them as equal => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and infinite float', () => { + const code = ` +a = 10 ** 10000 +b = 1e309 # => inf +x = a >= b +x +`; + // Real world: 10^10000 >> 10^309 + // But in Python, 1e309 => inf => any finite number < inf => => a < inf => => False for >= + // => a >= inf => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (simple greater)', () => { + const code = ` +a = "abd" +b = "abc" +x = a >= b +x +`; + // "abd" >= "abc" => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (equal)', () => { + const code = ` +a = "hello" +b = "hello" +x = a >= b +x +`; + // "hello" == "hello" => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (case sensitive)', () => { + const code = ` +a = "abc" +b = "ABC" +x = a >= b +x +`; + // 'a'(97) > 'A'(65) => "abc" > "ABC" => so >= => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (length difference)', () => { + const code = ` +a = "ab" +b = "abc" +x = a >= b +x +`; + // "ab" < "abc" => so a>=b => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (empty string)', () => { + const code = ` +a = "ab" +b = "" +x = a >= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +// < +test('Operation: python comparing 2 int', () => { + const code = ` +a = 200 +b = 300 +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 int (negative, positive)', () => { + const code = ` +a = -100 +b = 0 +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 big int', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 66666666666666666666666666666666666666666666666666 +x = a < b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 minus big int', () => { + const code = ` +a = -33333333333333333333333333333333333333333333333333 +b = -66666666666666666666666666666666666666666666666666 +x = b < a +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 float', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a < b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing near infinite float', () => { + const code = ` +a = 1.7976931348623156e308 +b = 1.7976931348623157e308 +x = a < b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing infinite float with finite float', () => { + const code = ` +a = 1e309 # => inf in Python +b = 1e292 +x = a < b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing infinite float with infinite float', () => { + const code = ` +a = 1e310 # => inf +b = 1e309 # => inf +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing negative infinite float with finite float', () => { + const code = ` +a = -1e309 # => -inf +b = -1e292 +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing near zero float', () => { + const code = ` +a = 1e-323 +b = 0 +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing int and float', () => { + const code = ` +a = 100 +b = 123.456 +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and float', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 3.3333333333333333333333333e49 +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and infinite float', () => { + const code = ` +a = 10 ** 10000 +b = 1e309 # => inf +x = a < b +x +`; + + // in real world 1e10000 > 1e309 + // but in python 1e10000 < 1e309 = Infinity + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (simple)', () => { + const code = ` +a = "abc" +b = "abd" +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (case sensitive)', () => { + const code = ` +a = "abc" +b = "ABC" +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (length difference)', () => { + const code = ` +a = "abc" +b = "ab" +x = a < b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (empty string)', () => { + const code = ` +a = "" +b = "abcdef" +x = a < b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +// >= +test('Operation: python comparing 2 int (simple greater)', () => { + const code = ` +a = 300 +b = 200 +x = a <= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 int (equal)', () => { + const code = ` +a = 200 +b = 200 +x = a <= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 int (negative)', () => { + const code = ` +a = -100 +b = 0 +x = a <= b +x +`; + // -100 >= 0 => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 big int (greater)', () => { + const code = ` +a = 66666666666666666666666666666666666666666666666666 +b = 33333333333333333333333333333333333333333333333333 +x = a <= b +x +`; + // a > b => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 big int (equal)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 33333333333333333333333333333333333333333333333333 +x = a <= b +x +`; + // a == b => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 minus big int', () => { + const code = ` +a = -33333333333333333333333333333333333333333333333333 +b = -66666666666666666666666666666666666666666666666666 +x = a <= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 float (greater)', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a <= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 float (equal)', () => { + const code = ` +a = 123.456 +b = 123.456 +x = a <= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing near infinite float', () => { + const code = ` +a = 1.7976931348623157e308 +b = 1.7976931348623156e308 +x = a <= b +x +`; + // a > b => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing infinite float with finite float', () => { + const code = ` +a = 1e309 # => inf in Python +b = 1e292 +x = a <= b +x +`; + // inf >= finite => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing infinite float with infinite float (equal)', () => { + const code = ` +a = 1e310 # => inf +b = 1e311 # => inf +x = a <= b +x +`; + // inf >= inf => True (they are equal infinities) + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing negative infinite float with finite float', () => { + const code = ` +a = -1e309 # => -inf +b = -1e292 +x = a <= b +x +`; + // -inf >= negative finite => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing int and float (greater)', () => { + const code = ` +a = 200 +b = 123.456 +x = a <= b +x +`; + // 200 >= 123.456 => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing int and float (equal)', () => { + const code = ` +a = 100 +b = 100.0 +x = a <= b +x +`; + // 100 >= 100.0 => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing int and float (less)', () => { + const code = ` +a = 100 +b = 123.456 +x = a <= b +x +`; + // 100 >= 123.456 => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and float (greater)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 3.3333333333333333333333333e49 +x = a <= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and float (greater)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 3.3333333333333333333333333e49 +x = b <= a +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and float (equal)', () => { + const code = ` +# pick a big int that can be exactly represented as float +# e.g. 2^53 = 9007199254740992 => float(2^53) is still integer in python, but 2^53+1 won't be +a = 9007199254740992 +b = 9007199254740992.0 +x = a <= b +x +`; + // Python sees them as equal => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and infinite float', () => { + const code = ` +a = 10 ** 10000 +b = 1e309 # => inf +x = a <= b +x +`; + // Real world: 10^10000 >> 10^309 + // But in Python, 1e309 => inf => any finite number < inf => => a < inf => => False for >= + // => a >= inf => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (simple greater)', () => { + const code = ` +a = "abd" +b = "abc" +x = a <= b +x +`; + // "abd" >= "abc" => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (equal)', () => { + const code = ` +a = "hello" +b = "hello" +x = a <= b +x +`; + // "hello" == "hello" => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (case sensitive)', () => { + const code = ` +a = "abc" +b = "ABC" +x = a <= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (length difference)', () => { + const code = ` +a = "ab" +b = "abc" +x = a <= b +x +`; + // "ab" < "abc" => so a>=b => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (empty string)', () => { + const code = ` +a = "ab" +b = "" +x = a <= b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +// equal +test('Operation: python comparing 2 int (equal)', () => { + const code = ` +a = 200 +b = 200 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 int (not equal)', () => { + const code = ` +a = 200 +b = 300 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing negative int and positive int', () => { +const code = ` +a = -100 +b = 0 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 big int (equal)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 33333333333333333333333333333333333333333333333333 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 big int (not equal)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 66666666666666666666666666666666666666666666666666 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 minus big int (not equal)', () => { + const code = ` +a = -33333333333333333333333333333333333333333333333333 +b = -66666666666666666666666666666666666666666666666666 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 float (equal)', () => { + const code = ` +a = 123.456 +b = 123.456 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 float (not equal)', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing infinite float with infinite float (both +inf)', () => { + const code = ` +a = 1e309 # => inf +b = 1e310 # => inf +x = a == b +x +`; + // inf == inf => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing -inf with +inf', () => { + const code = ` +a = -1e309 # => -inf +b = 1e309 # => inf +x = a == b +x +`; + // -inf != inf => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing int and float (equal)', () => { + const code = ` +a = 100 +b = 100.0 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing int and float (not equal)', () => { + const code = ` +a = 100 +b = 123.456 +x = a == b +x +`; + // 100 != 123.456 => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and float (not equal)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 3.333333333333333e+49 +x = a == b +x +`; + // 100 != 123.456 => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and float (equal)', () => { + const code = ` +a = 9007199254740992 +b = 9007199254740992.0 +x = a == b +x +`; + // Python sees them as the same numeric value => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and float (not equal)', () => { + const code = ` +a = 9007199254740992 +b = 9007199254740992.01 +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and float (not equal)', () => { + const code = ` +a = 10**5 +b = 1.00001e5 +x = a == b +x +`; + // 10^5 = 100000, 1.00001e5 = 100001 => Not equal => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and infinite float', () => { + const code = ` +a = 10 ** 10000 +b = 1e10000 # => inf +x = a == b +x +`; + // a is a huge but finite integer, b is Infinity => Not equal => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +// string +test('Operation: python comparing 2 string (equal)', () => { + const code = ` +a = "hello" +b = "hello" +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (case sensitive)', () => { + const code = ` +a = "abc" +b = "ABC" +x = a == b +x +`; + // 'abc' != 'ABC' => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (length difference)', () => { + const code = ` +a = "abc" +b = "ab" +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 empty string', () => { + const code = ` +a = "" +b = "" +x = a == b +x +`; + // "" == "" => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +// complex +test('Operation: python comparing 2 complex', () => { + const code = ` +a = 3 + 4j +b = 3.0 + 4.00J +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 complex (imag not equal)', () => { + const code = ` +a = 3 + 5.3467j +b = 3.0 + 4.00J +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 complex (real not equal)', () => { + const code = ` +a = 6 + 4j +b = 3.0 + 4.00J +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 complex (imag zero)', () => { + const code = ` +a = 3 + 0.0j +b = 3.0 + 0j +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 complex (real zero)', () => { + const code = ` +a = 9j +b = 0 + 9.0j +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 complex (zero)', () => { + const code = ` +a = 0.0j +b = 0j +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 complex', () => { + const code = ` +a = 3333333333333333333333333333333333333333333333333 + 1j +b = 3.3333333333333334e48 + 1j +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 complex (big int mismatch in imag)', () => { + const code = ` +c = 1 + 9007199254740992j +d = 1 + 9007199254740994j +x = c == d +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + + +test('Operation: python comparing 2 complex', () => { + const code = ` +a = 1 + 9007199254740992j +b = 1.00 + 9007199254740992.1j +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 complex', () => { + const code = ` +a = -1e324 + 1j +b = -1e345 + 1j +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 complex (imag part mismatch)', () => { + const code = ` +a = 3.333333333333333e48 + 1j +b = 3.333333333333333e48 + 1.0000000000001j +x = a == b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +// not equal +test('Operation: python comparing 2 int (equal)', () => { + const code = ` +a = 200 +b = 200 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 int (not equal)', () => { + const code = ` +a = 200 +b = 300 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing negative int and positive int', () => { +const code = ` +a = -100 +b = 0 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 big int (equal)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 33333333333333333333333333333333333333333333333333 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 big int (not equal)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 66666666666666666666666666666666666666666666666666 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 minus big int (not equal)', () => { + const code = ` +a = -33333333333333333333333333333333333333333333333333 +b = -66666666666666666666666666666666666666666666666666 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 float (equal)', () => { + const code = ` +a = 123.456 +b = 123.456 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 float (not equal)', () => { + const code = ` +a = 123.456 +b = 100.0001 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing infinite float with infinite float (both +inf)', () => { + const code = ` +a = 1e309 # => inf +b = 1e310 # => inf +x = a != b +x +`; + // inf == inf => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing -inf with +inf', () => { + const code = ` +a = -1e309 # => -inf +b = 1e309 # => inf +x = a != b +x +`; + // -inf != inf => False + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing int and float (equal)', () => { + const code = ` +a = 100 +b = 100.0 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing int and float (not equal)', () => { + const code = ` +a = 100 +b = 123.456 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and float (not equal)', () => { + const code = ` +a = 33333333333333333333333333333333333333333333333333 +b = 3.333333333333333e49 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and float (equal)', () => { + const code = ` +a = 9007199254740992 +b = 9007199254740992.0 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and float (not equal)', () => { + const code = ` +a = 9007199254740992 +b = 9007199254740992.1 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing big int and float (not equal)', () => { + const code = ` +a = 10**5 +b = 1.00001e5 +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing big int and infinite float', () => { + const code = ` +a = 10 ** 10000 +b = 1e10000 # => inf +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +// string +test('Operation: python comparing 2 string (equal)', () => { + const code = ` +a = "hello" +b = "hello" +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 string (case sensitive)', () => { + const code = ` +a = "abc" +b = "ABC" +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 string (length difference)', () => { + const code = ` +a = "abc" +b = "ab" +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 empty string', () => { + const code = ` +a = "" +b = "" +x = a != b +x +`; + // "" != "" => True + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +// complex +test('Operation: python comparing 2 complex', () => { + const code = ` +a = 3 + 4j +b = 3.0 + 4.00J +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 complex (imag not equal)', () => { + const code = ` +a = 3 + 5.3467j +b = 3.0 + 4.00J +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 complex (real not equal)', () => { + const code = ` +a = 6 + 4j +b = 3.0 + 4.00J +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python comparing 2 complex (imag zero)', () => { + const code = ` +a = 3 + 0.0j +b = 3.0 + 0j +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 complex (real zero)', () => { + const code = ` +a = 9j +b = 0 + 9.0j +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 complex (zero)', () => { + const code = ` +a = 0.0j +b = 0j +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 complex', () => { + const code = ` +a = 3333333333333333333333333333333333333333333333333 + 1j +b = 3.3333333333333334e48 + 1j +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 complex (big int mismatch in imag)', () => { + const code = ` +c = 1 + 9007199254740992j +d = 1 + 9007199254740994j +x = c != d +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + + +test('Operation: python comparing 2 complex', () => { + const code = ` +a = 1 + 9007199254740992j +b = 1.00 + 9007199254740992.1j +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 complex', () => { + const code = ` +a = -1e324 + 1j +b = -1e345 + 1j +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python comparing 2 complex (imag part mismatch)', () => { + const code = ` +a = 3.333333333333333e48 + 1j +b = 3.333333333333333e48 + 1.0000000000001j +x = a != b +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +// and (bool) +test('Logical operation: python and', () => { + const code = ` +a = True +b = True +x = a and b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Logical operation: python and', () => { + const code = ` +a = True +b = False +x = a and b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Logical operation: python and', () => { + const code = ` +a = False +b = True +x = a and b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Logical operation: python and', () => { + const code = ` +a = False +b = False +x = a and b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +// or +test('Logical operation: python or', () => { + const code = ` +a = True +b = True +x = a or b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Logical operation: python or', () => { + const code = ` +a = True +b = False +x = a or b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Logical operation: python or', () => { + const code = ` +a = False +b = True +x = a or b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Logical operation: python or', () => { + const code = ` +a = False +b = False +x = a or b +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +// not +test('Logical operation: python not with bool (True)', () => { + const code = ` +a = True +x = not a +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Logical operation: python not with bool (False)', () => { + const code = ` +a = False +x = not a +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python logical precedence #1 (True or not False and False)', () => { + const code = ` +a = True or not False and False +x = a +x +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python logical precedence #2 (True and not True or False)', () => { + const code = ` +a = True and not True or False +x = a +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); + +test('Operation: python logical precedence #3 (not True and True or True)', () => { + const code = ` +a = not True and True or True +x = a +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('True'); +}); + +test('Operation: python logical precedence #4 (not (True and True) or False)', () => { + const code = ` +a = not (True and True) or False +x = a +x +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('False'); +}); diff --git a/src/tests/cse-machine.test.ts b/src/tests/cse-machine.test.ts new file mode 100644 index 0000000..83db829 --- /dev/null +++ b/src/tests/cse-machine.test.ts @@ -0,0 +1,166 @@ +import { Value } from "../cse-machine/stash"; +import { runCSEMachine } from "./utils"; +import { toPythonString } from "../stdlib"; + +test('Simple tail call returns work in Python', () => { + const code = ` +def f(x, y): + if x <= 0: + return y + else: + return f(x-1, y+1) + +f(5000, 5000) +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000'); +}); + +test('Tail call in conditional expressions work', () => { + const code = ` +def f(x, y): + return y if x <= 0 else f(x - 1, y + 1) + +f(5000, 5000) +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000'); +}); + +test('Tail call in boolean operators work', () => { + const code = ` +def f(x, y): + if x <= 0: + return y + else: + return False or f(x - 1, y + 1) + +f(5000, 5000) +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000'); +}); + +test('Tail call in nested mix of conditional expressions boolean operators work', () => { + const code = ` +def f(x, y): + return y if x <= 0 else (False or f(x - 1, y + 1) if x > 0 else 'unreachable') + +f(5000, 5000) +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000'); +}); + +test('Tail calls in arrow functions work', () => { + const code = ` +def f(x, y): + return y if x <= 0 else f(x - 1, y + 1) + +f(5000, 5000) +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000'); +}); + +test('Tail calls in arrow block functions work', () => { + const code = ` +def f(x, y): + if x <= 0: + return y + else: + return f(x - 1, y + 1) + +f(5000, 5000) +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000'); +}); + +test('Tail calls in mutual recursion work', () => { + const code = ` +def f(x, y): + if x <= 0: + return y + else: + return g(x - 1, y + 1) + +def g(x, y): + if x <= 0: + return y + else: + return f(x - 1, y + 1) + +f(5000, 5000) +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000'); +}); + +test('Tail calls in mutual recursion with arrow functions work', () => { + const code = ` +def f(x, y): + return y if x <= 0 else g(x - 1, y + 1) + +def g(x, y): + return y if x <= 0 else f(x - 1, y + 1) + +f(5000, 5000) +`; + + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('10000'); +}); + +test('Tail calls in mixed tail-call/non-tail-call recursion work', () => { + const code = ` +def f(x, y, z): + if x <= 0: + return y + else: + return f(x - 1, y + f(0, z, 0), z) + +f(5000, 5000, 2) +`; + const result = runCSEMachine(code); + expect(toPythonString(result as Value)).toBe('15000'); +}); + +// test('const uses block scoping instead of function scoping', () => { +// const code = ` +// def test(): +// x = True +// if True: +// x_local = False +// else: +// x_local = False +// return x + +// test() +// `; +// const result = runCSEMachine(code); +// expect((result as Value).value).toBe(true); +// }); + +// test('let uses block scoping instead of function scoping', () => { +// const code = ` +// def test(): +// x = True +// if True: +// x_local = False +// else: +// x_local = False +// return x + +// test() +// `; +// const result = runCSEMachine(code); +// expect((result as Value).value).toBe(true); +// }); diff --git a/src/tests/utils.ts b/src/tests/utils.ts index 8850ddf..3351f87 100644 --- a/src/tests/utils.ts +++ b/src/tests/utils.ts @@ -1,5 +1,6 @@ import { Expression, + Program, Statement, } from "estree"; @@ -10,6 +11,11 @@ import {Translator} from '../translator'; import {StmtNS} from "../ast-types"; import Stmt = StmtNS.Stmt; +import { Value } from "../cse-machine/stash"; +import { Context } from "../cse-machine/context"; +import { evaluate } from "../cse-machine/interpreter"; +import { PyComplexNumber } from "../types"; + export function toPythonAst(text: string): Stmt { const script = text + '\n' const tokenizer = new Tokenizer(script) @@ -35,4 +41,58 @@ export function toEstreeAstAndResolve(text: string): Expression | Statement { const ast = toPythonAst(text); new Resolver(text, ast).resolve(ast); return new Translator(text).resolve(ast); -} \ No newline at end of file +} + +// new feature for cse machine +export function runCSEMachine(code: string): Value { + //const estreeAst = toPythonAstAndResolve(text) as unknown as Program; + const script = code + '\n' + const tokenizer = new Tokenizer(script) + const tokens = tokenizer.scanEverything() + const pyParser = new Parser(script, tokens) + const ast = pyParser.parse() + new Resolver(script, ast).resolve(ast); + const translator = new Translator(script) + const estreeAst = translator.resolve(ast) as unknown as Program + + const context = new Context(); + const options = { + isPrelude: false, + envSteps: 1000000, + stepLimit: 1000000 + }; + + const result = evaluate(estreeAst, context, options); + return result; +} + +export function toPythonFloat(num: number): string { + if (Object.is(num, -0)) { + return "-0.0"; + } + if (num === 0) { + return "0.0"; + } + + if (num === Infinity) { + return "inf"; + } + if (num === -Infinity) { + return "-inf"; + } + + if (Math.abs(num) >= 1e16 || (num !== 0 && Math.abs(num) < 1e-4)) { + return num.toExponential().replace(/e([+-])(\d)$/, 'e$10$2'); + } + if (Number.isInteger(num)) { + return num.toFixed(1).toString(); + } + return num.toString(); +} + + +// export function toPythonComplex(complex: PyComplexNumber){ +// if (complex.real === 0.0) { +// return complex.imag +// } +// } diff --git a/src/tokenizer.ts b/src/tokenizer.ts index 046d5ec..6600dba 100644 --- a/src/tokenizer.ts +++ b/src/tokenizer.ts @@ -158,6 +158,38 @@ export class Tokenizer { return res; } + private lexemeBuffer: string = ""; + + private advanceString(record: boolean) { + const res = this.source[this.current]; + if (this.peek() == '\n') { + this.line += 1; + } + this.current += 1; + this.col += 1; + if (record) { + this.lexemeBuffer += res; + } + return res; + } + + private getBuffer() { + console.info(this.lexemeBuffer); + } + + private addBuffer(c: string) { + this.lexemeBuffer += c; + } + + private subtractBufferForThreeQuoteString(): boolean { + if (this.lexemeBuffer.length >= 3) { + this.lexemeBuffer = this.lexemeBuffer.slice(0, -3); + return true; + } else { + return false; + } + } + /* Single character lookahead. */ private peek(): string { return this.isAtEnd() ? '\0' : this.source[this.current]; @@ -184,7 +216,8 @@ export class Tokenizer { // Remove starting and ending quotes when slicing // Ensures that string is parsed properly const lexeme = this.source.slice(this.start + 1, this.current - 1); - this.tokens.push(new Token(type, lexeme, line, col, this.current - lexeme.length)) + this.tokens.push(new Token(type, this.lexemeBuffer, line, col, this.current - lexeme.length)) + this.lexemeBuffer = ""; } private addMultiLineStringToken(type: TokenType) { @@ -192,7 +225,8 @@ export class Tokenizer { const col = this.col; // Remove three starting and ending quotes when slicing const lexeme = this.source.slice(this.start + 3, this.current - 3); - this.tokens.push(new Token(type, lexeme, line, col, this.current - lexeme.length)) + this.tokens.push(new Token(type, this.lexemeBuffer, line, col, this.current - lexeme.length)) + this.lexemeBuffer = ""; } // Checks that the current character matches a pattern. If so the character is consumed, else nothing is consumed. private matches(pattern: string): boolean { @@ -208,6 +242,13 @@ export class Tokenizer { } } + private isLegalUnicode(c: string): boolean { + if (this.isDelimiter(c)) { + return false; + } + return c.length === 1 && !/^\p{Nd}$/u.test(c); + } + private isAlpha(c: string): boolean { return /^[A-Za-z]$/i.test(c); } @@ -228,8 +269,16 @@ export class Tokenizer { return /^[0-1]/.test(c); } + // TODO: unicode private isIdentifier(c: string): boolean { - return c === '_' || this.isAlpha(c) || this.isDigit(c); + if (/\s/.test(c)) { + return false; + } + return c === '_' || this.isAlpha(c) || this.isDigit(c) || this.isLegalUnicode(c); + } + + private isDelimiter(c: string): boolean { + return /[\p{P}\p{S}]/u.test(c); } private baseNumber() { @@ -242,6 +291,7 @@ export class Tokenizer { while (this.isHexa(this.peek())) { this.advance(); } + this.addToken(TokenType.BIGINT); break; case 'o': this.advance(); @@ -251,6 +301,7 @@ export class Tokenizer { while (this.isOcta(this.peek())) { this.advance(); } + this.addToken(TokenType.BIGINT); break; case 'b': this.advance(); @@ -260,6 +311,7 @@ export class Tokenizer { while (this.isBinary(this.peek())) { this.advance(); } + this.addToken(TokenType.BIGINT); break; default: while (this.isDigit(this.peek())) { @@ -267,22 +319,41 @@ export class Tokenizer { } if (this.peek() !== '.' && this.peek() !== 'e') { + // if ends with j and J then complex number + if (this.peek() === 'j' || this.peek() === 'J') { + this.advance(); + this.addToken(TokenType.COMPLEX); + return; + } + this.addToken(TokenType.BIGINT); return; } if (this.peek() === '.') { this.advance(); + if (this.peek() === '_') { + // TODO: + // throw new error + throw new Error('_ after .'); + } while (this.isDigit(this.peek())) { this.advance(); } } + + if (this.peek() === '_') { + this.advance(); + } if (this.peek() === 'e') { this.advance(); if (this.peek() === '-') { this.advance(); } + if (this.peek() === '+') { + this.advance(); + } if (!this.isDigit(this.peek())) { throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current); } @@ -290,41 +361,93 @@ export class Tokenizer { this.advance(); } } + + // if ends with j and J then complex number + if (this.peek() === 'j' || this.peek() === 'J') { + this.advance(); + this.addToken(TokenType.COMPLEX); + } else { + this.addToken(TokenType.NUMBER); + } } - this.addToken(TokenType.NUMBER); } - private number() { - while (this.isDigit(this.peek())) { - this.advance(); + private number(c: string) { + while ((this.isDigit(this.peek()) || this.peek() === '_') && c !== '.') { + if (this.peek() === '_') { + this.advance(); + if (!this.isDigit(this.peek())) { + throw new Error("Invalid use of underscore in number"); + } + } else { + this.advance(); + } } - if (this.peek() !== '.' && this.peek() !== 'e') { + if (this.peek() !== '.' && this.peek() !== 'e' && c !== '.') { + // if ends with j and J then complex number + if (this.peek() === 'j' || this.peek() === 'J') { + this.advance(); + this.addToken(TokenType.COMPLEX); + return; + } + this.addToken(TokenType.BIGINT); return; } + // Fractional part - if (this.peek() === '.') { + if ((this.peek() === '.' && c !== '.') || (this.peek() !== '.' && c === '.')) { this.advance(); - while (this.isDigit(this.peek())) { - this.advance(); + if (this.peek() === '_') { + // TODO: + // throw new error + throw new Error('_ after .'); + } + while (this.isDigit(this.peek()) || this.peek() === '_') { + if (this.peek() === '_') { + this.advance(); + if (!this.isDigit(this.peek())) { + throw new Error("Invalid use of underscore in number"); + } + } else { + this.advance(); + } } } + // Exponent part if (this.peek() === 'e') { this.advance(); if (this.peek() === '-') { this.advance(); } + if (this.peek() === '+') { + this.advance(); + } if (!this.isDigit(this.peek())) { throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current); } - while (this.isDigit(this.peek())) { - this.advance(); + while (this.isDigit(this.peek()) || this.peek() === '_') { + if (this.peek() === '_') { + this.advance(); + if (!this.isDigit(this.peek())) { + throw new Error("Invalid use of underscore in number"); + } + } else { + this.advance(); + } } } - this.addToken(TokenType.NUMBER); + // if ends with j and J then complex number + if (this.peek() === 'j' || this.peek() === 'J') { + this.advance(); + this.addToken(TokenType.COMPLEX); + } else { + this.addToken(TokenType.NUMBER); + } + //this.addToken(TokenType.NUMBER); } private name() { @@ -472,29 +595,129 @@ export class Tokenizer { break; } this.advance(); // third quote consumed - while (this.peek() != quote && !this.isAtEnd()) { - this.advance(); // advance until ending quote found - } - if (this.isAtEnd()) { - throw new TokenizerErrors.UnterminatedStringError(this.line, - this.col, this.source, this.start, this.current); - } - this.advance(); // consume first ending quote - if (this.peek() != quote) { - throw new TokenizerErrors.UnterminatedStringError(this.line, - this.col, this.source, this.start, this.current); - } - this.advance(); // consume second ending quote - if (this.peek() != quote) { - throw new TokenizerErrors.UnterminatedStringError(this.line, - this.col, this.source, this.start, this.current); + let quote_sum = 0; + while (true) { + while (this.peek() != quote && !this.isAtEnd()) { + quote_sum = 0; + if (this.peek() === '\\') { + this.advanceString(false); + switch(this.peek()) { + case '\n': + break; + case '\\': + this.addBuffer('\\'); + break; + case '\'': + this.addBuffer('\''); + break; + case '\"': + this.addBuffer('\"'); + break; + case 'a': + this.addBuffer('\a'); + break; + case 'b': + this.addBuffer('\b'); + break; + case 'f': + this.addBuffer('\f'); + break; + case 'n': + this.addBuffer('\n'); + break; + case 'r': + this.addBuffer('\r'); + break; + case 't': + this.addBuffer('\t'); + break; + case 'v': + this.addBuffer('\v'); + break; + default: + throw new Error("SyntaxWarning: invalid escape sequence"); + } + this.advanceString(false); + } else { + this.advanceString(true); + } + //this.advance(); // advance until ending quote found + } + if (this.isAtEnd()) { + throw new TokenizerErrors.UnterminatedStringError(this.line, + this.col, this.source, this.start, this.current); + } + if (this.peek() == quote) { + this.advanceString(true); + quote_sum++; + } + //this.advance(); // consume first ending quote + // if (this.peek() != quote) { + // throw new TokenizerErrors.UnterminatedStringError(this.line, + // this.col, this.source, this.start, this.current); + // } + // this.advance(); + if (quote_sum === 3) { + this.subtractBufferForThreeQuoteString(); + // console.info('endof3quote'); + // this.getBuffer(); + break; + } } - this.advance(); // consume third ending quote + + // // consume second ending quote + // if (this.peek() != quote) { + // throw new TokenizerErrors.UnterminatedStringError(this.line, + // this.col, this.source, this.start, this.current); + // } + // this.advance(); // consume third ending quote this.addMultiLineStringToken(TokenType.STRING); } else { // other case, single-line string - while (this.peek() != quote && this.peek() != '\n' && !this.isAtEnd()) { - this.advance(); + while (this.peek() !== quote && this.peek() !== '\n' && !this.isAtEnd()) { + if (this.peek() === '\\') { + this.advanceString(false); + switch(this.peek()) { + case '\n': + break; + case '\\': + this.addBuffer('\\'); + break; + case '\'': + this.addBuffer('\''); + break; + case '\"': + this.addBuffer('\"'); + break; + case 'a': + this.addBuffer('\a'); + break; + case 'b': + this.addBuffer('\b'); + break; + case 'f': + this.addBuffer('\f'); + break; + case 'n': + this.addBuffer('\n'); + break; + case 'r': + this.addBuffer('\r'); + break; + case 't': + this.addBuffer('\t'); + break; + case 'v': + this.addBuffer('\v'); + break; + default: + throw new Error("SyntaxWarning: invalid escape sequence"); + } + this.advanceString(false); + } else { + this.advanceString(true); + } } + // should look for \\ if (this.peek() === '\n' || this.isAtEnd()) { throw new TokenizerErrors.UnterminatedStringError(this.line, this.col, this.source, this.start, this.current); } @@ -516,7 +739,8 @@ export class Tokenizer { case '7': case '8': case '9': - this.number(); + case '.': + this.number(c); break; //// Everything else case '(': @@ -578,7 +802,8 @@ export class Tokenizer { break; default: // Identifier start - if (c === '_' || this.isAlpha(c)) { + // TODO: unicode + if (c === '_' || this.isAlpha(c) || this.isLegalUnicode(c)) { this.name(); break; } diff --git a/src/tokens.ts b/src/tokens.ts index a69d2c7..cc84361 100644 --- a/src/tokens.ts +++ b/src/tokens.ts @@ -33,6 +33,7 @@ export enum TokenType { LESSEQUAL, GREATEREQUAL, DOUBLESTAR, + COMPLEX, // Special identifiers AND, OR, diff --git a/src/translator.ts b/src/translator.ts index dc570e8..f6e014f 100644 --- a/src/translator.ts +++ b/src/translator.ts @@ -41,6 +41,7 @@ import { WhileStatement } from "estree"; import { TranslatorErrors } from "./errors"; +import { ComplexLiteral, None } from "./types"; // import { isEmpty } from "lodash"; export interface EstreePosition { @@ -364,7 +365,8 @@ export class Translator implements StmtNS.Visitor, ExprNS.Visitor, ExprNS.Visitor= 0) ? "+" : ""; + + // return `(${this.real}${sign}${this.imag}j)`; + return `(${this.toPythonComplexFloat(this.real)}${sign}${this.toPythonComplexFloat(this.imag)}j)`; + } + + private toPythonComplexFloat(num: number){ + if (num === Infinity) { + return "inf"; + } + if (num === -Infinity) { + return "-inf"; + } + + if (Math.abs(num) >= 1e16 || (num !== 0 && Math.abs(num) < 1e-4)) { + return num.toExponential().replace(/e([+-])(\d)$/, 'e$10$2'); + } + return num.toString(); + } + + public equals(other: PyComplexNumber): boolean { + return (Number(this.real) === Number(other.real) && Number(this.imag) === Number(other.imag)); + } +} + +export interface None extends es.BaseNode { + type: 'NoneType'; + loc?: es.SourceLocation; +} + +export interface ComplexLiteral extends es.BaseNode { + type: 'Literal'; + complex: { + real: number; + imag: number; + } + loc?: es.SourceLocation; +} + +/** + * Helper type to recursively make properties that are also objects + * partial + * + * By default, `Partial>` is equivalent to `Array`. For this type, `Array` will be + * transformed to Array> instead + */ +export type RecursivePartial = + T extends Array + ? Array> + : T extends Record + ? Partial<{ + [K in keyof T]: RecursivePartial + }> + : T + +export type Result = Finished | Error | SuspendedCseEval // | Suspended + +// TODO: should allow debug +// export interface Suspended { +// status: 'suspended' +// it: IterableIterator +// scheduler: Scheduler +// context: Context +// } + +export interface SuspendedCseEval { + status: 'suspended-cse-eval' + context: Context +} + +export interface Finished { + status: 'finished' + context: Context + value: Value + representation: Representation // if the returned value needs a unique representation, + // (for example if the language used is not JS), + // the display of the result will use the representation + // field instead +} + +// export class Representation { +// constructor(public representation: string) {} +// toString() { +// return this.representation +// } +// } + +export class Representation { + constructor(public representation: string) {} + + toString(value: any): string { + // call str(value) in stdlib + // TODO: mapping + const result = toPythonString(value); + return result; + } +} + +export interface NativeStorage { + builtins: Map + previousProgramsIdentifiers: Set + operators: Map Value> + maxExecTime: number + evaller: null | ((program: string) => Value) + /* + the first time evaller is used, it must be used directly like `eval(code)` to inherit + surrounding scope, so we cannot set evaller to `eval` directly. subsequent assignments to evaller will + close in the surrounding values, so no problem + */ + loadedModules: Record + loadedModuleTypes: Record> +} diff --git a/tsconfig.json b/tsconfig.json index 4506b8a..40c22a2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,11 @@ { "exclude": [ - "jest.config.js" + "docs", + "jest.config.js", + "node_modules", + "dist", + "src/tests", + "rollup.config.js" ], "compilerOptions": { /* Visit https://aka.ms/tsconfig to read more about this file */ @@ -15,7 +20,7 @@ /* Language and Environment */ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - "lib": ["es6"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "lib": ["es6", "dom"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ @@ -28,9 +33,9 @@ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ + "module": "ESNext",//"commonjs", /* Specify what module code is generated. */ "rootDir": "src", /* Specify the root folder within your source files. */ - // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ @@ -38,7 +43,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - "resolveJsonModule": true, /* Enable importing .json files. */ + //"resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ /* JavaScript Support */ @@ -52,7 +57,7 @@ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "build", /* Specify an output folder for all emitted files. */ + "outDir": "dist", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */