@danielsimonjr/mathts-expression 0.10.3 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -2
- package/dist/compiler/compile.d.ts.map +1 -1
- package/dist/evaluator/evaluate.d.ts.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +819 -256
- package/dist/limits.d.ts +18 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/node/ArrayNode.d.ts.map +1 -1
- package/dist/node/AssignmentNode.d.ts.map +1 -1
- package/dist/node/ConditionalNode.d.ts +124 -124
- package/dist/node/ConditionalNode.d.ts.map +1 -1
- package/dist/node/FunctionNode.d.ts.map +1 -1
- package/dist/node/IndexNode.d.ts.map +1 -1
- package/dist/node/Node.d.ts +15 -0
- package/dist/node/Node.d.ts.map +1 -1
- package/dist/node/ObjectNode.d.ts.map +1 -1
- package/dist/node/OperatorNode.d.ts +2 -2
- package/dist/node/OperatorNode.d.ts.map +1 -1
- package/dist/node/RangeNode.d.ts +70 -70
- package/dist/node/RangeNode.d.ts.map +1 -1
- package/dist/node/RelationalNode.d.ts +120 -120
- package/dist/node/RelationalNode.d.ts.map +1 -1
- package/dist/node/utils/stringSubset.d.ts +9 -2
- package/dist/node/utils/stringSubset.d.ts.map +1 -1
- package/dist/parse.d.ts.map +1 -1
- package/dist/scalar-builder.d.ts +4 -4
- package/dist/scalar-enumerate.d.ts +48 -0
- package/dist/scalar-enumerate.d.ts.map +1 -0
- package/dist/scalar-structure.d.ts +167 -0
- package/dist/scalar-structure.d.ts.map +1 -0
- package/dist/transform/and.transform.d.ts.map +1 -1
- package/dist/transform/bitAnd.transform.d.ts.map +1 -1
- package/dist/transform/bitOr.transform.d.ts.map +1 -1
- package/dist/transform/cumsum.transform.d.ts.map +1 -1
- package/dist/transform/filter.transform.d.ts +4 -4
- package/dist/transform/filter.transform.d.ts.map +1 -1
- package/dist/transform/forEach.transform.d.ts.map +1 -1
- package/dist/transform/mapSlices.transform.d.ts +1 -1
- package/dist/transform/mapSlices.transform.d.ts.map +1 -1
- package/dist/transform/or.transform.d.ts.map +1 -1
- package/dist/transform/utils/dimToZeroBase.d.ts +4 -1
- package/dist/transform/utils/dimToZeroBase.d.ts.map +1 -1
- package/dist/transform/utils/prepareTransformArgs.d.ts +23 -0
- package/dist/transform/utils/prepareTransformArgs.d.ts.map +1 -0
- package/dist/transform/utils/shortCircuitBinary.d.ts +21 -0
- package/dist/transform/utils/shortCircuitBinary.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/node/RangeNode.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ interface Dependencies {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const createRangeNode: import("../utils/factory.js").FactoryFunction<Dependencies, {
|
|
12
12
|
new (start: MathNode, end: MathNode, step?: MathNode | null): {
|
|
13
|
-
get isNode(): boolean;
|
|
14
13
|
evaluate(scope?: Record<string, unknown>): unknown;
|
|
15
14
|
compile(): import("./Node.js").CompiledExpression;
|
|
16
15
|
_ifNode(node: unknown): {
|
|
@@ -381,40 +380,6 @@ export declare const createRangeNode: import("../utils/factory.js").FactoryFunct
|
|
|
381
380
|
getIdentifier(): string;
|
|
382
381
|
getContent(): any;
|
|
383
382
|
};
|
|
384
|
-
equals(other: {
|
|
385
|
-
get type(): string;
|
|
386
|
-
get isNode(): boolean;
|
|
387
|
-
evaluate(scope?: Record<string, unknown>): unknown;
|
|
388
|
-
compile(): import("./Node.js").CompiledExpression;
|
|
389
|
-
_compile(_math: Record<string, unknown>, _argNames: Record<string, boolean>): (scope: Map<string, unknown>, args: Record<string, unknown>, context: unknown) => unknown;
|
|
390
|
-
forEach(_callback: (child: any, path: string, parent: any) => void): void;
|
|
391
|
-
map(_callback: (child: any, path: string, parent: any) => any): any;
|
|
392
|
-
_ifNode(node: unknown): any;
|
|
393
|
-
traverse(callback: (node: any, path: string | null, parent: any | null) => void): void;
|
|
394
|
-
transform(callback: (node: any, path: string | null, parent: any | null) => any): any;
|
|
395
|
-
filter(callback: (node: any, path: string | null, parent: any | null) => boolean): any[];
|
|
396
|
-
clone(): any;
|
|
397
|
-
cloneDeep(): any;
|
|
398
|
-
equals(other: any | null | undefined): boolean;
|
|
399
|
-
toString(options?: import("./Node.js").StringOptions): string;
|
|
400
|
-
_toString(_options?: import("./Node.js").StringOptions): string;
|
|
401
|
-
toJSON(): Record<string, unknown>;
|
|
402
|
-
toHTML(options?: import("./Node.js").StringOptions): string;
|
|
403
|
-
_toHTML(_options?: import("./Node.js").StringOptions): string;
|
|
404
|
-
toTex(options?: import("./Node.js").StringOptions): string;
|
|
405
|
-
toMarkdown(options?: {
|
|
406
|
-
inline?: boolean;
|
|
407
|
-
} & import("./Node.js").StringOptions): string;
|
|
408
|
-
toDOT(options?: {
|
|
409
|
-
name?: string;
|
|
410
|
-
}): string;
|
|
411
|
-
toMathML(): string;
|
|
412
|
-
_toMathML(): string;
|
|
413
|
-
_toTex(_options?: import("./Node.js").StringOptions): string;
|
|
414
|
-
_getCustomString(options?: import("./Node.js").StringOptions): string | undefined;
|
|
415
|
-
getIdentifier(): string;
|
|
416
|
-
getContent(): any;
|
|
417
|
-
} | null | undefined): boolean;
|
|
418
383
|
start: MathNode;
|
|
419
384
|
end: MathNode;
|
|
420
385
|
step: MathNode | null;
|
|
@@ -482,6 +447,41 @@ export declare const createRangeNode: import("../utils/factory.js").FactoryFunct
|
|
|
482
447
|
* @returns str
|
|
483
448
|
*/
|
|
484
449
|
_toTex(options?: StringOptions): string;
|
|
450
|
+
get isNode(): boolean;
|
|
451
|
+
equals(other: {
|
|
452
|
+
get type(): string;
|
|
453
|
+
get isNode(): boolean;
|
|
454
|
+
evaluate(scope?: Record<string, unknown>): unknown;
|
|
455
|
+
compile(): import("./Node.js").CompiledExpression;
|
|
456
|
+
_compile(_math: Record<string, unknown>, _argNames: Record<string, boolean>): (scope: Map<string, unknown>, args: Record<string, unknown>, context: unknown) => unknown;
|
|
457
|
+
forEach(_callback: (child: any, path: string, parent: any) => void): void;
|
|
458
|
+
map(_callback: (child: any, path: string, parent: any) => any): any;
|
|
459
|
+
_ifNode(node: unknown): any;
|
|
460
|
+
traverse(callback: (node: any, path: string | null, parent: any | null) => void): void;
|
|
461
|
+
transform(callback: (node: any, path: string | null, parent: any | null) => any): any;
|
|
462
|
+
filter(callback: (node: any, path: string | null, parent: any | null) => boolean): any[];
|
|
463
|
+
clone(): any;
|
|
464
|
+
cloneDeep(): any;
|
|
465
|
+
equals(other: any | null | undefined): boolean;
|
|
466
|
+
toString(options?: import("./Node.js").StringOptions): string;
|
|
467
|
+
_toString(_options?: import("./Node.js").StringOptions): string;
|
|
468
|
+
toJSON(): Record<string, unknown>;
|
|
469
|
+
toHTML(options?: import("./Node.js").StringOptions): string;
|
|
470
|
+
_toHTML(_options?: import("./Node.js").StringOptions): string;
|
|
471
|
+
toTex(options?: import("./Node.js").StringOptions): string;
|
|
472
|
+
toMarkdown(options?: {
|
|
473
|
+
inline?: boolean;
|
|
474
|
+
} & import("./Node.js").StringOptions): string;
|
|
475
|
+
toDOT(options?: {
|
|
476
|
+
name?: string;
|
|
477
|
+
}): string;
|
|
478
|
+
toMathML(): string;
|
|
479
|
+
_toMathML(): string;
|
|
480
|
+
_toTex(_options?: import("./Node.js").StringOptions): string;
|
|
481
|
+
_getCustomString(options?: import("./Node.js").StringOptions): string | undefined;
|
|
482
|
+
getIdentifier(): string;
|
|
483
|
+
getContent(): any;
|
|
484
|
+
} | null | undefined): boolean;
|
|
485
485
|
toString(options?: import("./Node.js").StringOptions): string;
|
|
486
486
|
toHTML(options?: import("./Node.js").StringOptions): string;
|
|
487
487
|
toTex(options?: import("./Node.js").StringOptions): string;
|
|
@@ -543,7 +543,6 @@ export declare const createRangeNode: import("../utils/factory.js").FactoryFunct
|
|
|
543
543
|
end: MathNode;
|
|
544
544
|
step?: MathNode | null;
|
|
545
545
|
}): {
|
|
546
|
-
get isNode(): boolean;
|
|
547
546
|
evaluate(scope?: Record<string, unknown>): unknown;
|
|
548
547
|
compile(): import("./Node.js").CompiledExpression;
|
|
549
548
|
_ifNode(node: unknown): {
|
|
@@ -914,40 +913,6 @@ export declare const createRangeNode: import("../utils/factory.js").FactoryFunct
|
|
|
914
913
|
getIdentifier(): string;
|
|
915
914
|
getContent(): any;
|
|
916
915
|
};
|
|
917
|
-
equals(other: {
|
|
918
|
-
get type(): string;
|
|
919
|
-
get isNode(): boolean;
|
|
920
|
-
evaluate(scope?: Record<string, unknown>): unknown;
|
|
921
|
-
compile(): import("./Node.js").CompiledExpression;
|
|
922
|
-
_compile(_math: Record<string, unknown>, _argNames: Record<string, boolean>): (scope: Map<string, unknown>, args: Record<string, unknown>, context: unknown) => unknown;
|
|
923
|
-
forEach(_callback: (child: any, path: string, parent: any) => void): void;
|
|
924
|
-
map(_callback: (child: any, path: string, parent: any) => any): any;
|
|
925
|
-
_ifNode(node: unknown): any;
|
|
926
|
-
traverse(callback: (node: any, path: string | null, parent: any | null) => void): void;
|
|
927
|
-
transform(callback: (node: any, path: string | null, parent: any | null) => any): any;
|
|
928
|
-
filter(callback: (node: any, path: string | null, parent: any | null) => boolean): any[];
|
|
929
|
-
clone(): any;
|
|
930
|
-
cloneDeep(): any;
|
|
931
|
-
equals(other: any | null | undefined): boolean;
|
|
932
|
-
toString(options?: import("./Node.js").StringOptions): string;
|
|
933
|
-
_toString(_options?: import("./Node.js").StringOptions): string;
|
|
934
|
-
toJSON(): Record<string, unknown>;
|
|
935
|
-
toHTML(options?: import("./Node.js").StringOptions): string;
|
|
936
|
-
_toHTML(_options?: import("./Node.js").StringOptions): string;
|
|
937
|
-
toTex(options?: import("./Node.js").StringOptions): string;
|
|
938
|
-
toMarkdown(options?: {
|
|
939
|
-
inline?: boolean;
|
|
940
|
-
} & import("./Node.js").StringOptions): string;
|
|
941
|
-
toDOT(options?: {
|
|
942
|
-
name?: string;
|
|
943
|
-
}): string;
|
|
944
|
-
toMathML(): string;
|
|
945
|
-
_toMathML(): string;
|
|
946
|
-
_toTex(_options?: import("./Node.js").StringOptions): string;
|
|
947
|
-
_getCustomString(options?: import("./Node.js").StringOptions): string | undefined;
|
|
948
|
-
getIdentifier(): string;
|
|
949
|
-
getContent(): any;
|
|
950
|
-
} | null | undefined): boolean;
|
|
951
916
|
start: MathNode;
|
|
952
917
|
end: MathNode;
|
|
953
918
|
step: MathNode | null;
|
|
@@ -1015,6 +980,41 @@ export declare const createRangeNode: import("../utils/factory.js").FactoryFunct
|
|
|
1015
980
|
* @returns str
|
|
1016
981
|
*/
|
|
1017
982
|
_toTex(options?: StringOptions): string;
|
|
983
|
+
get isNode(): boolean;
|
|
984
|
+
equals(other: {
|
|
985
|
+
get type(): string;
|
|
986
|
+
get isNode(): boolean;
|
|
987
|
+
evaluate(scope?: Record<string, unknown>): unknown;
|
|
988
|
+
compile(): import("./Node.js").CompiledExpression;
|
|
989
|
+
_compile(_math: Record<string, unknown>, _argNames: Record<string, boolean>): (scope: Map<string, unknown>, args: Record<string, unknown>, context: unknown) => unknown;
|
|
990
|
+
forEach(_callback: (child: any, path: string, parent: any) => void): void;
|
|
991
|
+
map(_callback: (child: any, path: string, parent: any) => any): any;
|
|
992
|
+
_ifNode(node: unknown): any;
|
|
993
|
+
traverse(callback: (node: any, path: string | null, parent: any | null) => void): void;
|
|
994
|
+
transform(callback: (node: any, path: string | null, parent: any | null) => any): any;
|
|
995
|
+
filter(callback: (node: any, path: string | null, parent: any | null) => boolean): any[];
|
|
996
|
+
clone(): any;
|
|
997
|
+
cloneDeep(): any;
|
|
998
|
+
equals(other: any | null | undefined): boolean;
|
|
999
|
+
toString(options?: import("./Node.js").StringOptions): string;
|
|
1000
|
+
_toString(_options?: import("./Node.js").StringOptions): string;
|
|
1001
|
+
toJSON(): Record<string, unknown>;
|
|
1002
|
+
toHTML(options?: import("./Node.js").StringOptions): string;
|
|
1003
|
+
_toHTML(_options?: import("./Node.js").StringOptions): string;
|
|
1004
|
+
toTex(options?: import("./Node.js").StringOptions): string;
|
|
1005
|
+
toMarkdown(options?: {
|
|
1006
|
+
inline?: boolean;
|
|
1007
|
+
} & import("./Node.js").StringOptions): string;
|
|
1008
|
+
toDOT(options?: {
|
|
1009
|
+
name?: string;
|
|
1010
|
+
}): string;
|
|
1011
|
+
toMathML(): string;
|
|
1012
|
+
_toMathML(): string;
|
|
1013
|
+
_toTex(_options?: import("./Node.js").StringOptions): string;
|
|
1014
|
+
_getCustomString(options?: import("./Node.js").StringOptions): string | undefined;
|
|
1015
|
+
getIdentifier(): string;
|
|
1016
|
+
getContent(): any;
|
|
1017
|
+
} | null | undefined): boolean;
|
|
1018
1018
|
toString(options?: import("./Node.js").StringOptions): string;
|
|
1019
1019
|
toHTML(options?: import("./Node.js").StringOptions): string;
|
|
1020
1020
|
toTex(options?: import("./Node.js").StringOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeNode.d.ts","sourceRoot":"","sources":["../../src/node/RangeNode.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C,KAAK,eAAe,GAAG,CACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,OAAO,KACb,OAAO,CAAC;AAEb,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAQD,UAAU,YAAY;IACpB,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ,CAAC;CAC5C;AAKD,eAAO,MAAM,eAAe;
|
|
1
|
+
{"version":3,"file":"RangeNode.d.ts","sourceRoot":"","sources":["../../src/node/RangeNode.ts"],"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;;;;;;;;;;;;;;;;;;;;;;;;eA5JzE,QAAQ;aACV,QAAQ;cACP,QAAQ,GAAG,IAAI;oBAwBT,MAAM;2BAGC,OAAO;QAI1B;;;WAGG;oBACS,OAAO;QASnB;;;;;;;;;;;;WAYG;uBACY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe;QA8B3F;;;WAGG;0BACe,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAW,KAAK,IAAI,GAAG,IAAI;QAQnF;;;;;WAKG;sBACW,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAW,KAAK,QAAQ;QAQ5E;;WAEG;;QAKH;;;;WAIG;4BACiB,aAAa,GAAG,MAAM;QAU1C;;WAEG;kBACO;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,QAAQ,CAAC;YAAC,GAAG,EAAE,QAAQ,CAAC;YAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;SAAE;QAoBnF;;;;WAIG;0BACe,aAAa,GAAG,MAAM;QAYxC;;;;WAIG;yBACc,aAAa,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkC5C,CAAC"}
|
|
@@ -247,6 +247,66 @@ export declare const createRelationalNode: import("../utils/factory.js").Factory
|
|
|
247
247
|
getIdentifier(): string;
|
|
248
248
|
getContent(): any;
|
|
249
249
|
};
|
|
250
|
+
conditionals: string[];
|
|
251
|
+
params: MathNode[];
|
|
252
|
+
get type(): string;
|
|
253
|
+
get isRelationalNode(): boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Compile a node into a JavaScript function.
|
|
256
|
+
* This basically pre-calculates as much as possible and only leaves open
|
|
257
|
+
* calculations which depend on a dynamic scope with variables.
|
|
258
|
+
* @param math - Math.js namespace with functions and constants.
|
|
259
|
+
* @param argNames - An object with argument names as key and `true`
|
|
260
|
+
* as value. Used in the SymbolNode to optimize
|
|
261
|
+
* for arguments from user assigned functions
|
|
262
|
+
* (see FunctionAssignmentNode) or special symbols
|
|
263
|
+
* like `end` (see IndexNode).
|
|
264
|
+
* @returns Returns a function which can be called like:
|
|
265
|
+
* evalNode(scope: Object, args: Object, context: *)
|
|
266
|
+
*/
|
|
267
|
+
_compile(math: Record<string, unknown>, argNames: Record<string, boolean>): CompileFunction;
|
|
268
|
+
/**
|
|
269
|
+
* Execute a callback for each of the child nodes of this node
|
|
270
|
+
* @param callback
|
|
271
|
+
*/
|
|
272
|
+
forEach(callback: (child: MathNode, path: string, parent: /*elided*/ any) => void): void;
|
|
273
|
+
/**
|
|
274
|
+
* Create a new RelationalNode whose children are the results of calling
|
|
275
|
+
* the provided callback function for each child of the original node.
|
|
276
|
+
* @param callback
|
|
277
|
+
* @returns Returns a transformed copy of the node
|
|
278
|
+
*/
|
|
279
|
+
map(callback: (child: MathNode, path: string, parent: /*elided*/ any) => MathNode): /*elided*/ any;
|
|
280
|
+
/**
|
|
281
|
+
* Create a clone of this node, a shallow copy
|
|
282
|
+
*/
|
|
283
|
+
clone(): /*elided*/ any;
|
|
284
|
+
/**
|
|
285
|
+
* Get string representation.
|
|
286
|
+
* @param options
|
|
287
|
+
* @returns str
|
|
288
|
+
*/
|
|
289
|
+
_toString(options?: StringOptions): string;
|
|
290
|
+
/**
|
|
291
|
+
* Get a JSON representation of the node
|
|
292
|
+
*/
|
|
293
|
+
toJSON(): {
|
|
294
|
+
mathjs: string;
|
|
295
|
+
conditionals: string[];
|
|
296
|
+
params: MathNode[];
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Get HTML representation
|
|
300
|
+
* @param options
|
|
301
|
+
* @returns str
|
|
302
|
+
*/
|
|
303
|
+
_toHTML(options?: StringOptions): string;
|
|
304
|
+
/**
|
|
305
|
+
* Get the MathML representation of this node.
|
|
306
|
+
* @returns str
|
|
307
|
+
*/
|
|
308
|
+
_toMathML(): string;
|
|
309
|
+
_toTex(options?: StringOptions): string;
|
|
250
310
|
filter(callback: (node: {
|
|
251
311
|
get type(): string;
|
|
252
312
|
get isNode(): boolean;
|
|
@@ -415,66 +475,6 @@ export declare const createRelationalNode: import("../utils/factory.js").Factory
|
|
|
415
475
|
getIdentifier(): string;
|
|
416
476
|
getContent(): any;
|
|
417
477
|
} | null | undefined): boolean;
|
|
418
|
-
conditionals: string[];
|
|
419
|
-
params: MathNode[];
|
|
420
|
-
get type(): string;
|
|
421
|
-
get isRelationalNode(): boolean;
|
|
422
|
-
/**
|
|
423
|
-
* Compile a node into a JavaScript function.
|
|
424
|
-
* This basically pre-calculates as much as possible and only leaves open
|
|
425
|
-
* calculations which depend on a dynamic scope with variables.
|
|
426
|
-
* @param math - Math.js namespace with functions and constants.
|
|
427
|
-
* @param argNames - An object with argument names as key and `true`
|
|
428
|
-
* as value. Used in the SymbolNode to optimize
|
|
429
|
-
* for arguments from user assigned functions
|
|
430
|
-
* (see FunctionAssignmentNode) or special symbols
|
|
431
|
-
* like `end` (see IndexNode).
|
|
432
|
-
* @returns Returns a function which can be called like:
|
|
433
|
-
* evalNode(scope: Object, args: Object, context: *)
|
|
434
|
-
*/
|
|
435
|
-
_compile(math: Record<string, unknown>, argNames: Record<string, boolean>): CompileFunction;
|
|
436
|
-
/**
|
|
437
|
-
* Execute a callback for each of the child nodes of this node
|
|
438
|
-
* @param callback
|
|
439
|
-
*/
|
|
440
|
-
forEach(callback: (child: MathNode, path: string, parent: /*elided*/ any) => void): void;
|
|
441
|
-
/**
|
|
442
|
-
* Create a new RelationalNode whose children are the results of calling
|
|
443
|
-
* the provided callback function for each child of the original node.
|
|
444
|
-
* @param callback
|
|
445
|
-
* @returns Returns a transformed copy of the node
|
|
446
|
-
*/
|
|
447
|
-
map(callback: (child: MathNode, path: string, parent: /*elided*/ any) => MathNode): /*elided*/ any;
|
|
448
|
-
/**
|
|
449
|
-
* Create a clone of this node, a shallow copy
|
|
450
|
-
*/
|
|
451
|
-
clone(): /*elided*/ any;
|
|
452
|
-
/**
|
|
453
|
-
* Get string representation.
|
|
454
|
-
* @param options
|
|
455
|
-
* @returns str
|
|
456
|
-
*/
|
|
457
|
-
_toString(options?: StringOptions): string;
|
|
458
|
-
/**
|
|
459
|
-
* Get a JSON representation of the node
|
|
460
|
-
*/
|
|
461
|
-
toJSON(): {
|
|
462
|
-
mathjs: string;
|
|
463
|
-
conditionals: string[];
|
|
464
|
-
params: MathNode[];
|
|
465
|
-
};
|
|
466
|
-
/**
|
|
467
|
-
* Get HTML representation
|
|
468
|
-
* @param options
|
|
469
|
-
* @returns str
|
|
470
|
-
*/
|
|
471
|
-
_toHTML(options?: StringOptions): string;
|
|
472
|
-
/**
|
|
473
|
-
* Get the MathML representation of this node.
|
|
474
|
-
* @returns str
|
|
475
|
-
*/
|
|
476
|
-
_toMathML(): string;
|
|
477
|
-
_toTex(options?: StringOptions): string;
|
|
478
478
|
toString(options?: import("./Node.js").StringOptions): string;
|
|
479
479
|
toHTML(options?: import("./Node.js").StringOptions): string;
|
|
480
480
|
toTex(options?: import("./Node.js").StringOptions): string;
|
|
@@ -771,6 +771,66 @@ export declare const createRelationalNode: import("../utils/factory.js").Factory
|
|
|
771
771
|
getIdentifier(): string;
|
|
772
772
|
getContent(): any;
|
|
773
773
|
};
|
|
774
|
+
conditionals: string[];
|
|
775
|
+
params: MathNode[];
|
|
776
|
+
get type(): string;
|
|
777
|
+
get isRelationalNode(): boolean;
|
|
778
|
+
/**
|
|
779
|
+
* Compile a node into a JavaScript function.
|
|
780
|
+
* This basically pre-calculates as much as possible and only leaves open
|
|
781
|
+
* calculations which depend on a dynamic scope with variables.
|
|
782
|
+
* @param math - Math.js namespace with functions and constants.
|
|
783
|
+
* @param argNames - An object with argument names as key and `true`
|
|
784
|
+
* as value. Used in the SymbolNode to optimize
|
|
785
|
+
* for arguments from user assigned functions
|
|
786
|
+
* (see FunctionAssignmentNode) or special symbols
|
|
787
|
+
* like `end` (see IndexNode).
|
|
788
|
+
* @returns Returns a function which can be called like:
|
|
789
|
+
* evalNode(scope: Object, args: Object, context: *)
|
|
790
|
+
*/
|
|
791
|
+
_compile(math: Record<string, unknown>, argNames: Record<string, boolean>): CompileFunction;
|
|
792
|
+
/**
|
|
793
|
+
* Execute a callback for each of the child nodes of this node
|
|
794
|
+
* @param callback
|
|
795
|
+
*/
|
|
796
|
+
forEach(callback: (child: MathNode, path: string, parent: /*elided*/ any) => void): void;
|
|
797
|
+
/**
|
|
798
|
+
* Create a new RelationalNode whose children are the results of calling
|
|
799
|
+
* the provided callback function for each child of the original node.
|
|
800
|
+
* @param callback
|
|
801
|
+
* @returns Returns a transformed copy of the node
|
|
802
|
+
*/
|
|
803
|
+
map(callback: (child: MathNode, path: string, parent: /*elided*/ any) => MathNode): /*elided*/ any;
|
|
804
|
+
/**
|
|
805
|
+
* Create a clone of this node, a shallow copy
|
|
806
|
+
*/
|
|
807
|
+
clone(): /*elided*/ any;
|
|
808
|
+
/**
|
|
809
|
+
* Get string representation.
|
|
810
|
+
* @param options
|
|
811
|
+
* @returns str
|
|
812
|
+
*/
|
|
813
|
+
_toString(options?: StringOptions): string;
|
|
814
|
+
/**
|
|
815
|
+
* Get a JSON representation of the node
|
|
816
|
+
*/
|
|
817
|
+
toJSON(): {
|
|
818
|
+
mathjs: string;
|
|
819
|
+
conditionals: string[];
|
|
820
|
+
params: MathNode[];
|
|
821
|
+
};
|
|
822
|
+
/**
|
|
823
|
+
* Get HTML representation
|
|
824
|
+
* @param options
|
|
825
|
+
* @returns str
|
|
826
|
+
*/
|
|
827
|
+
_toHTML(options?: StringOptions): string;
|
|
828
|
+
/**
|
|
829
|
+
* Get the MathML representation of this node.
|
|
830
|
+
* @returns str
|
|
831
|
+
*/
|
|
832
|
+
_toMathML(): string;
|
|
833
|
+
_toTex(options?: StringOptions): string;
|
|
774
834
|
filter(callback: (node: {
|
|
775
835
|
get type(): string;
|
|
776
836
|
get isNode(): boolean;
|
|
@@ -939,66 +999,6 @@ export declare const createRelationalNode: import("../utils/factory.js").Factory
|
|
|
939
999
|
getIdentifier(): string;
|
|
940
1000
|
getContent(): any;
|
|
941
1001
|
} | null | undefined): boolean;
|
|
942
|
-
conditionals: string[];
|
|
943
|
-
params: MathNode[];
|
|
944
|
-
get type(): string;
|
|
945
|
-
get isRelationalNode(): boolean;
|
|
946
|
-
/**
|
|
947
|
-
* Compile a node into a JavaScript function.
|
|
948
|
-
* This basically pre-calculates as much as possible and only leaves open
|
|
949
|
-
* calculations which depend on a dynamic scope with variables.
|
|
950
|
-
* @param math - Math.js namespace with functions and constants.
|
|
951
|
-
* @param argNames - An object with argument names as key and `true`
|
|
952
|
-
* as value. Used in the SymbolNode to optimize
|
|
953
|
-
* for arguments from user assigned functions
|
|
954
|
-
* (see FunctionAssignmentNode) or special symbols
|
|
955
|
-
* like `end` (see IndexNode).
|
|
956
|
-
* @returns Returns a function which can be called like:
|
|
957
|
-
* evalNode(scope: Object, args: Object, context: *)
|
|
958
|
-
*/
|
|
959
|
-
_compile(math: Record<string, unknown>, argNames: Record<string, boolean>): CompileFunction;
|
|
960
|
-
/**
|
|
961
|
-
* Execute a callback for each of the child nodes of this node
|
|
962
|
-
* @param callback
|
|
963
|
-
*/
|
|
964
|
-
forEach(callback: (child: MathNode, path: string, parent: /*elided*/ any) => void): void;
|
|
965
|
-
/**
|
|
966
|
-
* Create a new RelationalNode whose children are the results of calling
|
|
967
|
-
* the provided callback function for each child of the original node.
|
|
968
|
-
* @param callback
|
|
969
|
-
* @returns Returns a transformed copy of the node
|
|
970
|
-
*/
|
|
971
|
-
map(callback: (child: MathNode, path: string, parent: /*elided*/ any) => MathNode): /*elided*/ any;
|
|
972
|
-
/**
|
|
973
|
-
* Create a clone of this node, a shallow copy
|
|
974
|
-
*/
|
|
975
|
-
clone(): /*elided*/ any;
|
|
976
|
-
/**
|
|
977
|
-
* Get string representation.
|
|
978
|
-
* @param options
|
|
979
|
-
* @returns str
|
|
980
|
-
*/
|
|
981
|
-
_toString(options?: StringOptions): string;
|
|
982
|
-
/**
|
|
983
|
-
* Get a JSON representation of the node
|
|
984
|
-
*/
|
|
985
|
-
toJSON(): {
|
|
986
|
-
mathjs: string;
|
|
987
|
-
conditionals: string[];
|
|
988
|
-
params: MathNode[];
|
|
989
|
-
};
|
|
990
|
-
/**
|
|
991
|
-
* Get HTML representation
|
|
992
|
-
* @param options
|
|
993
|
-
* @returns str
|
|
994
|
-
*/
|
|
995
|
-
_toHTML(options?: StringOptions): string;
|
|
996
|
-
/**
|
|
997
|
-
* Get the MathML representation of this node.
|
|
998
|
-
* @returns str
|
|
999
|
-
*/
|
|
1000
|
-
_toMathML(): string;
|
|
1001
|
-
_toTex(options?: StringOptions): string;
|
|
1002
1002
|
toString(options?: import("./Node.js").StringOptions): string;
|
|
1003
1003
|
toHTML(options?: import("./Node.js").StringOptions): string;
|
|
1004
1004
|
toTex(options?: import("./Node.js").StringOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationalNode.d.ts","sourceRoot":"","sources":["../../src/node/RelationalNode.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C,KAAK,eAAe,GAAG,CACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,OAAO,KACb,OAAO,CAAC;AAEb,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,KAAK,GAAG,IAAI,EAA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BACY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe;QA4B3F;;;WAGG;0BACe,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,KAAK,IAAI,GAAG,IAAI;QAOxF;;;;;WAKG;sBAES,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,KAAK,QAAQ;QAW/E;;WAEG;;QAKH;;;;WAIG;4BACiB,aAAa,GAAG,MAAM;QAU1C;;WAEG;kBACO;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,MAAM,EAAE,CAAC;YAAC,MAAM,EAAE,QAAQ,EAAE,CAAA;SAAE;QAmBxE;;;;WAIG;0BACe,aAAa,GAAG,MAAM;QAkBxC;;;WAGG;qBACU,MAAM;yBAaF,aAAa,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe5C,CAAC"}
|
|
@@ -13,12 +13,19 @@ export interface IndexLike {
|
|
|
13
13
|
dimension(dim: number): number | string | DimensionRange;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Retrieve a subset of a string
|
|
16
|
+
* Retrieve a subset of a string.
|
|
17
|
+
*
|
|
17
18
|
* @param str - string from which to get a substring
|
|
18
19
|
* @param index - An index or list of indices (character positions)
|
|
20
|
+
* @param invalidIndexMessage - TypeError text when `index` fails `isIndex`.
|
|
21
|
+
* Default `'Index expected'`. The functions `subset` string getter passes
|
|
22
|
+
* `'Invalid index: must be an Index or Index-like object'`.
|
|
19
23
|
* @returns substring
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* getStringSubset('ab', {} as never) // throws TypeError('Index expected')
|
|
20
27
|
*/
|
|
21
|
-
export declare function getStringSubset(str: string, index: IndexLike): string;
|
|
28
|
+
export declare function getStringSubset(str: string, index: IndexLike, invalidIndexMessage?: string): string;
|
|
22
29
|
/**
|
|
23
30
|
* Replace a substring in a string
|
|
24
31
|
* @param str - string to be replaced
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringSubset.d.ts","sourceRoot":"","sources":["../../../src/node/utils/stringSubset.ts"],"names":[],"mappings":"AAIA,6CAA6C;AAC7C,UAAU,cAAc;IACtB,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAClE,IAAI,IAAI,MAAM,EAAE,CAAC;CAClB;AAED,+CAA+C;AAC/C,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,IAAI,OAAO,CAAC;IACpB,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,GAAG,IAAI,MAAM,EAAE,CAAC;IAChB,GAAG,IAAI,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC;CAC1D;AAED
|
|
1
|
+
{"version":3,"file":"stringSubset.d.ts","sourceRoot":"","sources":["../../../src/node/utils/stringSubset.ts"],"names":[],"mappings":"AAIA,6CAA6C;AAC7C,UAAU,cAAc;IACtB,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAClE,IAAI,IAAI,MAAM,EAAE,CAAC;CAClB;AAED,+CAA+C;AAC/C,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,IAAI,OAAO,CAAC;IACpB,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,GAAG,IAAI,MAAM,EAAE,CAAC;IAChB,GAAG,IAAI,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC;CAC1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,EAChB,mBAAmB,SAAmB,GACrC,MAAM,CAgCR;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CA0ER"}
|
package/dist/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;kFACkF;AAClF,KAAK,eAAe,GAAG,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,QAAQ,CAAC;AAK5D;8BAC8B;AAC9B,UAAU,aAAa;IAIrB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,QAAQ,CAAC;IACjD,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,QAAQ,EAAE,CAAC;IACr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E,eAAe,CAAC;IACjC,YAAY,EAAE,eAAe,CAAC;IAC9B,sBAAsB,EAAE,eAAe,CAAC;IACxC,YAAY,EAAE,eAAe,CAAC;IAC9B,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,eAAe,CAAC;IAC5B,YAAY,EAAE,eAAe,CAAC;IAC9B,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,eAAe,CAAC;IAC3B,cAAc,EAAE,eAAe,CAAC;IAChC,UAAU,EAAE,eAAe,CAAC;CAC7B;AA4CD,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACzC;AAED,eAAO,MAAM,WAAW,gFAs4DvB,CAAC"}
|
package/dist/scalar-builder.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public scalar-expression builder.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* formula
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
4
|
+
* Builds {@link ScalarNode} trees for numeric evaluation without parsing a
|
|
5
|
+
* formula string. `call('ln', x)` and a `transcendental` node whose `fn` is
|
|
6
|
+
* `ln` store MathTS natural `log`. `call('log', x)` and `fn: 'log'` store
|
|
7
|
+
* `log10`. `log10` and `log2` stay themselves.
|
|
8
8
|
*
|
|
9
9
|
* The node returned by {@link ScalarBuilder.call} and {@link ScalarBuilder.from}
|
|
10
10
|
* already carries the lowered MathTS name on `fn`. Passing that node through
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic bounded enumeration of {@link ScalarNode} trees from a
|
|
3
|
+
* {@link ScalarGrammar}. Home: `expression/src/scalar-enumerate.ts` (D-1:
|
|
4
|
+
* no `@danielsimonjr/mathts-symbolic-search` package). Before merge, run
|
|
5
|
+
* `bun run docs:deps` and `bun run docs:graph -- cycles`; a cycle is an import bug.
|
|
6
|
+
*
|
|
7
|
+
* Constraint checking is centralized in {@link scalarGrammarAccepts}; the generator
|
|
8
|
+
* applies `admit` only at yield time (and optionally when choosing child subtrees).
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import { type LoweredScalarFn, type ScalarNode, type ScalarOperator } from './scalar-builder.js';
|
|
13
|
+
/** Search-space descriptor for scalar expression enumeration. */
|
|
14
|
+
export interface ScalarGrammar {
|
|
15
|
+
readonly variables: readonly string[];
|
|
16
|
+
readonly parameters?: readonly string[];
|
|
17
|
+
readonly literals?: readonly number[];
|
|
18
|
+
readonly binary: readonly ScalarOperator[];
|
|
19
|
+
readonly unary: readonly LoweredScalarFn[];
|
|
20
|
+
readonly maxSize: number;
|
|
21
|
+
readonly maxDepth?: number;
|
|
22
|
+
readonly argumentLimits?: Readonly<Record<string, readonly number[]>>;
|
|
23
|
+
readonly nesting?: Readonly<Record<string, Readonly<Record<string, number>>>>;
|
|
24
|
+
readonly admit?: (node: ScalarNode) => boolean;
|
|
25
|
+
readonly admitMonotone?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Caps on how many trees {@link enumerateScalars} may yield. */
|
|
28
|
+
export interface EnumerationBudget {
|
|
29
|
+
readonly maxCandidates: number;
|
|
30
|
+
readonly maxWallClockMs?: number;
|
|
31
|
+
}
|
|
32
|
+
/** Why {@link enumerateScalars} stopped yielding. */
|
|
33
|
+
export type EnumerationStop = 'exhausted-space' | 'candidate-limit' | 'time-limit' | 'cancelled';
|
|
34
|
+
/**
|
|
35
|
+
* Whether `node` satisfies the grammar's structural rules (operators, symbols,
|
|
36
|
+
* size/depth budgets, argument limits, nesting). Does not invoke `admit`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function scalarGrammarAccepts(grammar: ScalarGrammar, node: ScalarNode): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Yields distinct scalar trees in non-decreasing {@link scalarSize}, deduplicated
|
|
41
|
+
* by {@link scalarCanonicalKey}. Visit order is deterministic and does not use a RNG.
|
|
42
|
+
*
|
|
43
|
+
* The abort signal and the wall clock are read before every yield and also every
|
|
44
|
+
* {@link INTERRUPT_CHECK_INTERVAL} candidates that produce no yield, so a grammar
|
|
45
|
+
* whose `admit` rejects almost everything still stops when asked.
|
|
46
|
+
*/
|
|
47
|
+
export declare function enumerateScalars(grammar: ScalarGrammar, budget: EnumerationBudget, signal?: AbortSignal): Generator<ScalarNode, EnumerationStop>;
|
|
48
|
+
//# sourceMappingURL=scalar-enumerate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalar-enumerate.d.ts","sourceRoot":"","sources":["../src/scalar-enumerate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAI7B,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,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