bit2 0.0.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/dist/bit2.d.ts +229 -0
- package/dist/bit2.js +1 -0
- package/dist/src/bx/biEval.d.ts +6 -0
- package/dist/src/bx/biEval.js +59 -0
- package/dist/src/bx/biEval.js.map +1 -0
- package/dist/src/common/Exp.d.ts +53 -0
- package/dist/src/common/Exp.js +44 -0
- package/dist/src/common/Exp.js.map +1 -0
- package/dist/src/common/PrettyPrint.d.ts +4 -0
- package/dist/src/common/PrettyPrint.js +32 -0
- package/dist/src/common/PrettyPrint.js.map +1 -0
- package/dist/src/common/Print.d.ts +3 -0
- package/dist/src/common/Print.js +73 -0
- package/dist/src/common/Print.js.map +1 -0
- package/dist/src/core/AST.d.ts +92 -0
- package/dist/src/core/AST.js +47 -0
- package/dist/src/core/AST.js.map +1 -0
- package/dist/src/core/PrettyPrint.d.ts +2 -0
- package/dist/src/core/PrettyPrint.js +64 -0
- package/dist/src/core/PrettyPrint.js.map +1 -0
- package/dist/src/core/Print.d.ts +3 -0
- package/dist/src/core/Print.js +77 -0
- package/dist/src/core/Print.js.map +1 -0
- package/dist/src/fuse/Fuse.d.ts +23 -0
- package/dist/src/fuse/Fuse.js +1436 -0
- package/dist/src/fuse/Fuse.js.map +1 -0
- package/dist/src/fuse/Print.d.ts +2 -0
- package/dist/src/fuse/Print.js +22 -0
- package/dist/src/fuse/Print.js.map +1 -0
- package/dist/src/fuse/Update.d.ts +19 -0
- package/dist/src/fuse/Update.js +3 -0
- package/dist/src/fuse/Update.js.map +1 -0
- package/dist/src/lambda/AST.d.ts +23 -0
- package/dist/src/lambda/AST.js +3 -0
- package/dist/src/lambda/AST.js.map +1 -0
- package/dist/src/lambda/Evaluation.d.ts +4 -0
- package/dist/src/lambda/Evaluation.js +98 -0
- package/dist/src/lambda/Evaluation.js.map +1 -0
- package/dist/src/lambda/Print.d.ts +2 -0
- package/dist/src/lambda/Print.js +31 -0
- package/dist/src/lambda/Print.js.map +1 -0
- package/dist/src/lambdalize/lambdalize.d.ts +3 -0
- package/dist/src/lambdalize/lambdalize.js +94 -0
- package/dist/src/lambdalize/lambdalize.js.map +1 -0
- package/dist/src/lambdalize/unLambdalize.d.ts +3 -0
- package/dist/src/lambdalize/unLambdalize.js +59 -0
- package/dist/src/lambdalize/unLambdalize.js.map +1 -0
- package/dist/src/partial/AST.d.ts +86 -0
- package/dist/src/partial/AST.js +3 -0
- package/dist/src/partial/AST.js.map +1 -0
- package/dist/src/partial/Print.d.ts +6 -0
- package/dist/src/partial/Print.js +93 -0
- package/dist/src/partial/Print.js.map +1 -0
- package/dist/src/partialEval/peval.d.ts +11 -0
- package/dist/src/partialEval/peval.js +322 -0
- package/dist/src/partialEval/peval.js.map +1 -0
- package/dist/src/partialEval/unpeval.d.ts +4 -0
- package/dist/src/partialEval/unpeval.js +360 -0
- package/dist/src/partialEval/unpeval.js.map +1 -0
- package/dist/src/surface/AST.d.ts +57 -0
- package/dist/src/surface/AST.js +3 -0
- package/dist/src/surface/AST.js.map +1 -0
- package/dist/src/surface/Parser.d.ts +4 -0
- package/dist/src/surface/Parser.js +314 -0
- package/dist/src/surface/Parser.js.map +1 -0
- package/dist/src/translate/Translate.d.ts +3 -0
- package/dist/src/translate/Translate.js +91 -0
- package/dist/src/translate/Translate.js.map +1 -0
- package/dist/src/utils/Utils.d.ts +2 -0
- package/dist/src/utils/Utils.js +7 -0
- package/dist/src/utils/Utils.js.map +1 -0
- package/dist/test/bx/biEval.test.d.ts +1 -0
- package/dist/test/bx/biEval.test.js +41 -0
- package/dist/test/bx/biEval.test.js.map +1 -0
- package/dist/test/bx/test.d.ts +1 -0
- package/dist/test/bx/test.js +29 -0
- package/dist/test/bx/test.js.map +1 -0
- package/dist/test/core/0.simple.test.d.ts +4 -0
- package/dist/test/core/0.simple.test.js +68 -0
- package/dist/test/core/0.simple.test.js.map +1 -0
- package/dist/test/core/1.core.test.d.ts +2 -0
- package/dist/test/core/1.core.test.js +30 -0
- package/dist/test/core/1.core.test.js.map +1 -0
- package/dist/test/core/core.test.d.ts +1 -0
- package/dist/test/core/core.test.js +28 -0
- package/dist/test/core/core.test.js.map +1 -0
- package/dist/test/fuse/branchnop.test.d.ts +1 -0
- package/dist/test/fuse/branchnop.test.js +47 -0
- package/dist/test/fuse/branchnop.test.js.map +1 -0
- package/dist/test/fuse/bulk.test.d.ts +1 -0
- package/dist/test/fuse/bulk.test.js +111 -0
- package/dist/test/fuse/bulk.test.js.map +1 -0
- package/dist/test/fuse/const.test.d.ts +1 -0
- package/dist/test/fuse/const.test.js +118 -0
- package/dist/test/fuse/const.test.js.map +1 -0
- package/dist/test/fuse/exp.test.d.ts +1 -0
- package/dist/test/fuse/exp.test.js +225 -0
- package/dist/test/fuse/exp.test.js.map +1 -0
- package/dist/test/fuse/lambda.test.d.ts +1 -0
- package/dist/test/fuse/lambda.test.js +139 -0
- package/dist/test/fuse/lambda.test.js.map +1 -0
- package/dist/test/fuse/loop.test.d.ts +1 -0
- package/dist/test/fuse/loop.test.js +39 -0
- package/dist/test/fuse/loop.test.js.map +1 -0
- package/dist/test/fuse/seq.test.d.ts +1 -0
- package/dist/test/fuse/seq.test.js +64 -0
- package/dist/test/fuse/seq.test.js.map +1 -0
- package/dist/test/fuse/space.test.d.ts +1 -0
- package/dist/test/fuse/space.test.js +136 -0
- package/dist/test/fuse/space.test.js.map +1 -0
- package/dist/test/lambda/evaluation.test.d.ts +1 -0
- package/dist/test/lambda/evaluation.test.js +24 -0
- package/dist/test/lambda/evaluation.test.js.map +1 -0
- package/dist/test/lambda/lambda.test.d.ts +1 -0
- package/dist/test/lambda/lambda.test.js +45 -0
- package/dist/test/lambda/lambda.test.js.map +1 -0
- package/dist/test/lambdalize/lambdalize.test.d.ts +1 -0
- package/dist/test/lambdalize/lambdalize.test.js +23 -0
- package/dist/test/lambdalize/lambdalize.test.js.map +1 -0
- package/dist/test/lambdalize/unLambdalize.test.d.ts +1 -0
- package/dist/test/lambdalize/unLambdalize.test.js +35 -0
- package/dist/test/lambdalize/unLambdalize.test.js.map +1 -0
- package/dist/test/partial/partial.test.d.ts +1 -0
- package/dist/test/partial/partial.test.js +35 -0
- package/dist/test/partial/partial.test.js.map +1 -0
- package/dist/test/partialEval/peval.test.d.ts +1 -0
- package/dist/test/partialEval/peval.test.js +29 -0
- package/dist/test/partialEval/peval.test.js.map +1 -0
- package/dist/test/partialEval/unPeval.test.d.ts +1 -0
- package/dist/test/partialEval/unPeval.test.js +40 -0
- package/dist/test/partialEval/unPeval.test.js.map +1 -0
- package/dist/test/surface/AST.test.d.ts +1 -0
- package/dist/test/surface/AST.test.js +41 -0
- package/dist/test/surface/AST.test.js.map +1 -0
- package/dist/test/translate/translate.test.d.ts +1 -0
- package/dist/test/translate/translate.test.js +45 -0
- package/dist/test/translate/translate.test.js.map +1 -0
- package/package.json +49 -0
package/dist/bit2.d.ts
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
export type Expr = Constant | Variable | BinaryOperation | UnaryOperation | FieldAccess | ArrayLiteral | FreezeExp | ObjectLiteral;
|
2
|
+
export interface Constant {
|
3
|
+
type: "constant";
|
4
|
+
value: number | boolean | string | [
|
5
|
+
] | null | ObjectLiteral;
|
6
|
+
}
|
7
|
+
export interface Variable {
|
8
|
+
type: "variable";
|
9
|
+
name: string;
|
10
|
+
}
|
11
|
+
export interface BinaryOperation {
|
12
|
+
type: "binary";
|
13
|
+
operator: BinaryOperator;
|
14
|
+
left: Expr;
|
15
|
+
right: Expr;
|
16
|
+
}
|
17
|
+
export interface UnaryOperation {
|
18
|
+
type: "unary";
|
19
|
+
operator: UnaryOperator;
|
20
|
+
operand: Expr;
|
21
|
+
}
|
22
|
+
export interface FieldAccess {
|
23
|
+
type: "field";
|
24
|
+
object: Expr;
|
25
|
+
field: string;
|
26
|
+
}
|
27
|
+
export interface ArrayLiteral {
|
28
|
+
type: "array";
|
29
|
+
elements: Expr[];
|
30
|
+
}
|
31
|
+
export interface ObjectLiteral {
|
32
|
+
type: "object";
|
33
|
+
fields: {
|
34
|
+
[key: string]: Constant;
|
35
|
+
};
|
36
|
+
}
|
37
|
+
export interface FreezeExp {
|
38
|
+
type: "freeze";
|
39
|
+
expression: Expr;
|
40
|
+
}
|
41
|
+
export type BinaryOperator = "+" | "-" | "*" | "/" | "&&" | "||" | ">" | "<" | ">=" | "<=" | "!=";
|
42
|
+
export type UnaryOperator = "not";
|
43
|
+
export type TermNode = ConstNode | SpaceNode | DeclareNode | AssignNode | ExpNode | SeqNode | IfThenElseNode | LoopNode | CallNode | NopNode | BotNode | EndNode | LambdaWithExpr;
|
44
|
+
export interface ConstNode {
|
45
|
+
type: "const";
|
46
|
+
value: string;
|
47
|
+
}
|
48
|
+
export interface SpaceNode {
|
49
|
+
type: "space";
|
50
|
+
width: number;
|
51
|
+
}
|
52
|
+
export interface DeclareNode {
|
53
|
+
type: "declare";
|
54
|
+
name: Variable;
|
55
|
+
value: Expr;
|
56
|
+
}
|
57
|
+
export interface AssignNode {
|
58
|
+
type: "assign";
|
59
|
+
name: Variable;
|
60
|
+
value: Expr;
|
61
|
+
}
|
62
|
+
export interface ExpNode {
|
63
|
+
type: "exp";
|
64
|
+
expression: Expr;
|
65
|
+
}
|
66
|
+
export interface SeqNode {
|
67
|
+
type: "seq";
|
68
|
+
nodes: TermNode[];
|
69
|
+
}
|
70
|
+
export interface IfThenElseNode {
|
71
|
+
type: "ite";
|
72
|
+
condition: Expr;
|
73
|
+
trueBranch: TermNode;
|
74
|
+
falseBranch: TermNode;
|
75
|
+
}
|
76
|
+
export interface LoopNode {
|
77
|
+
type: "loop";
|
78
|
+
lst: Expr;
|
79
|
+
separator: SepNode;
|
80
|
+
front: FrontNode;
|
81
|
+
rear: RearNode;
|
82
|
+
body: Lambda;
|
83
|
+
}
|
84
|
+
export interface NopNode {
|
85
|
+
type: "nop";
|
86
|
+
}
|
87
|
+
export interface BotNode {
|
88
|
+
type: "bot";
|
89
|
+
}
|
90
|
+
export interface EndNode {
|
91
|
+
type: "end";
|
92
|
+
}
|
93
|
+
export interface SepNode {
|
94
|
+
type: "sep";
|
95
|
+
value: string;
|
96
|
+
}
|
97
|
+
export interface FrontNode {
|
98
|
+
type: "front";
|
99
|
+
value: string;
|
100
|
+
}
|
101
|
+
export interface RearNode {
|
102
|
+
type: "rear";
|
103
|
+
value: string;
|
104
|
+
}
|
105
|
+
export interface Lambda {
|
106
|
+
type: "lambda";
|
107
|
+
variable: Variable;
|
108
|
+
body: TermNode;
|
109
|
+
}
|
110
|
+
export interface LambdaWithExpr {
|
111
|
+
type: "lambdawithexpr";
|
112
|
+
variable: Variable;
|
113
|
+
body: TermNode;
|
114
|
+
exp: Expr;
|
115
|
+
}
|
116
|
+
export interface CallNode {
|
117
|
+
type: "call";
|
118
|
+
func: TermNode;
|
119
|
+
args: {
|
120
|
+
[key: string]: Expr;
|
121
|
+
};
|
122
|
+
}
|
123
|
+
interface ConstNode$1 {
|
124
|
+
type: "const";
|
125
|
+
value: string;
|
126
|
+
}
|
127
|
+
interface SpaceNode$1 {
|
128
|
+
type: "space";
|
129
|
+
width: number;
|
130
|
+
}
|
131
|
+
interface ExpNode$1 {
|
132
|
+
type: "exp";
|
133
|
+
binding: Binding;
|
134
|
+
}
|
135
|
+
interface NopNode$1 {
|
136
|
+
type: "nop";
|
137
|
+
}
|
138
|
+
export interface BranchStartNode {
|
139
|
+
type: "branchstart";
|
140
|
+
condition: Binding;
|
141
|
+
trueBranch: TermNode;
|
142
|
+
falseBranch: TermNode;
|
143
|
+
}
|
144
|
+
export interface BranchEndNode {
|
145
|
+
type: "branchend";
|
146
|
+
}
|
147
|
+
export interface LoopItemMarker {
|
148
|
+
type: "loopitem";
|
149
|
+
lst: Expr;
|
150
|
+
}
|
151
|
+
export interface LoopFrontNode {
|
152
|
+
type: "loopfront";
|
153
|
+
lst: Expr;
|
154
|
+
value: string;
|
155
|
+
body: Lambda;
|
156
|
+
separator: SepNode;
|
157
|
+
}
|
158
|
+
export interface LoopRearNode {
|
159
|
+
type: "looprear";
|
160
|
+
lst: Expr;
|
161
|
+
value: string;
|
162
|
+
}
|
163
|
+
interface EndNode$1 {
|
164
|
+
type: "end";
|
165
|
+
}
|
166
|
+
interface BotNode$1 {
|
167
|
+
type: "bot";
|
168
|
+
}
|
169
|
+
export interface CallStartNode {
|
170
|
+
type: "callstart";
|
171
|
+
name: string;
|
172
|
+
}
|
173
|
+
export interface CallEndNode {
|
174
|
+
type: "callend";
|
175
|
+
}
|
176
|
+
export type Binding = [
|
177
|
+
Expr,
|
178
|
+
Value
|
179
|
+
];
|
180
|
+
export type Value = number | boolean | string | null | ObjectValue | Value[];
|
181
|
+
export interface ObjectValue {
|
182
|
+
type: "object";
|
183
|
+
fields: {
|
184
|
+
[key: string]: any;
|
185
|
+
};
|
186
|
+
}
|
187
|
+
type TermNode$1 = ConstNode$1 | SpaceNode$1 | SepNode | ExpNode$1 | SeqNode$1 | LambdaAppNode | BranchStartNode | BranchEndNode | LoopFrontNode | LoopRearNode | EndNode$1 | NopNode$1 | BotNode$1 | CallStartNode | CallEndNode;
|
188
|
+
interface SeqNode$1 {
|
189
|
+
type: "seq";
|
190
|
+
nodes: TermNode$1[];
|
191
|
+
}
|
192
|
+
export interface LambdaAppNode {
|
193
|
+
type: "lambda";
|
194
|
+
variable: Variable;
|
195
|
+
body: TermNode$1;
|
196
|
+
binding: Binding;
|
197
|
+
marker: Marker;
|
198
|
+
}
|
199
|
+
export type Marker = LoopItemMarker | DeclareMarker | AssignMarker;
|
200
|
+
export interface DeclareMarker {
|
201
|
+
type: "declare";
|
202
|
+
}
|
203
|
+
export interface AssignMarker {
|
204
|
+
type: "assign";
|
205
|
+
}
|
206
|
+
export type UpdateOperation = {
|
207
|
+
type: "insert";
|
208
|
+
str: string;
|
209
|
+
position: number;
|
210
|
+
} | {
|
211
|
+
type: "delete";
|
212
|
+
str: string;
|
213
|
+
position: number;
|
214
|
+
} | {
|
215
|
+
type: "replace";
|
216
|
+
str1: string;
|
217
|
+
str2: string;
|
218
|
+
position: number;
|
219
|
+
} | {
|
220
|
+
type: "bulk";
|
221
|
+
operations: UpdateOperation[];
|
222
|
+
} | {
|
223
|
+
type: "id";
|
224
|
+
};
|
225
|
+
export declare function evaluateToLambdaAST(core: TermNode): TermNode$1;
|
226
|
+
export declare function forward(str: string): string;
|
227
|
+
export declare function backward(str: string, operation: UpdateOperation): string[];
|
228
|
+
|
229
|
+
export {};
|
package/dist/bit2.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.MyLibrary=n():e.MyLibrary=n()}(this,(()=>(()=>{"use strict";var e={612:function(e,n,t){var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t);var o=Object.getOwnPropertyDescriptor(n,t);o&&!("get"in o?!n.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,r,o)}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&r(n,e,t);return o(n,e),n};Object.defineProperty(n,"__esModule",{value:!0}),n.evaluateToLambdaAST=h,n.forward=function(e){let n=p.parse(e),t=u.translate(n);return l.evaluateTermNode(h(t))},n.backward=function(e,n){let t=p.parse(e),r=h(u.translate(t)),o=(0,y.fuse)({},n,r).map((({newTermNode:e,remainingOperation:n})=>{let t=(0,g.flatten)((0,b.unLambdalize)(e)),r=c.flatten(c.unPartialEval(t));return d.printAST(r),f.printToSurface(r)}));return Array.from(new Set(o))};const a=t(446),s=t(619),l=i(t(238)),c=i(t(887)),p=i(t(577)),u=i(t(775)),d=i(t(765)),f=i(t(69)),y=t(963),b=t(784),g=t(446);function h(e){const n=new Map,[t,r]=(0,a.partialEval)(n,e);return(0,s.lambdalize)(r)}},75:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.findVariablesAndFields=function(e){let n=[],t=[];return function e(r){switch(r.type){case"variable":n.push(r);break;case"field":"variable"===r.object.type?t.push({variable:r.object,field:r.field}):e(r.object);break;case"binary":e(r.left),e(r.right);break;case"unary":e(r.operand);break;case"array":r.elements.forEach(e);break;case"object":Object.values(r.fields).forEach(e);break;case"freeze":e(r.expression)}}(e),{variables:n,fields:t}}},143:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.prettyPrint=function e(n){switch(n.type){case"constant":return String(n.value);case"variable":return n.name;case"binary":return e(n.left)+n.operator+e(n.right);case"unary":return n.operator+e(n.operand);case"field":return e(n.object)+"."+n.field;case"array":return"["+n.elements.map((n=>e(n))).join(",")+"]";case"freeze":return"!"+e(n.expression);default:return""}},n.prettyPrintBinaryOperator=function(e){return e},n.prettyPrintUnaryOperator=function(e){return e}},235:(e,n)=>{function t(e,n){if(null===e)console.log(`${n}null`);else if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)console.log(`${n}${e}`);else if("object"==typeof e){console.log(`${n}{`);const r=e;for(const e in r)if(r.hasOwnProperty(e)){const o=n+" ";console.log(`${o}${e}:`),t(r[e],o+" ")}console.log(`${n}}`)}else{if("constant"!=typeof e)throw new Error("Unhandled value type: "+typeof e);t(e.value,n+" ")}}Object.defineProperty(n,"__esModule",{value:!0}),n.printExpression=function e(n,r=""){switch(n.type){case"constant":t(n.value,r+" ");break;case"variable":console.log(`${r}Variable: ${n.name}`);break;case"binary":console.log(`${r}BinaryOperation: ${n.operator}`),e(n.left,r+" "),e(n.right,r+" ");break;case"unary":console.log(`${r}UnaryOperation: ${n.operator}`),e(n.operand,r+" ");break;case"field":console.log(`${r}FieldAccess: ${n.field}`),e(n.object,r+" ");break;case"array":console.log(`${r}ArrayLiteral:`),n.elements.forEach((n=>e(n,r+" ")));break;case"object":console.log(`${r}ObjectLiteral:`),Object.keys(n.fields).forEach((e=>{console.log(`${r}${e} = ${n.fields[e].value}`)}));break;case"freeze":console.log(`${r}Freeze:`),e(n.expression,r+" ")}},n.printConstantValue=t},454:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.seq=function(...e){return{type:"seq",nodes:e}},n.constNode=function(e){return{type:"const",value:e}},n.space=function(e){return{type:"space",width:e}},n.declare=function(e,n){return{type:"declare",name:e,value:n}},n.exp=function(e){return{type:"exp",expression:e}},n.loop=function(e,n,t,r,o){return{type:"loop",lst:e,separator:n,front:t,rear:r,body:o}},n.ite=function(e,n,t){return{type:"ite",condition:e,trueBranch:n,falseBranch:t}},n.assign=function(e,n){return{type:"assign",name:e,value:n}},n.nop=function(){return{type:"nop"}},n.bot=function(){return{type:"bot"}},n.end=function(){return{type:"end"}}},69:function(e,n,t){var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t);var o=Object.getOwnPropertyDescriptor(n,t);o&&!("get"in o?!n.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,r,o)}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&r(n,e,t);return o(n,e),n};Object.defineProperty(n,"__esModule",{value:!0}),n.printToSurface=function e(n){let t="";switch(n.type){case"const":return n.value;case"space":return" ".repeat(n.width);case"declare":return t="«",t+="var ",t+=a.prettyPrint(n.name),t+="=",t+=a.prettyPrint(n.value),t+="»",t;case"assign":return t="«",t+=a.prettyPrint(n.name),t+="=",t+=a.prettyPrint(n.value),t+="»",t;case"exp":return t="«",t+=a.prettyPrint(n.expression),t+="»",t;case"seq":return n.nodes.map((n=>e(n))).join("");case"ite":return t="«if "+a.prettyPrint(n.condition)+"»\n",t+=e(n.trueBranch),t+="«endif»\n",t;case"loop":return t="«for "+a.prettyPrint(n.body.variable)+" :"+a.prettyPrint(n.lst)+"»\n",t+=e(n.body.body),t+="«endfor»\n",t;default:return""}return""};const a=i(t(143))},765:function(e,n,t){var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t);var o=Object.getOwnPropertyDescriptor(n,t);o&&!("get"in o?!n.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,r,o)}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&r(n,e,t);return o(n,e),n};Object.defineProperty(n,"__esModule",{value:!0}),n.printAST=s,n.printLambda=l;const a=i(t(235));function s(e,n=""){switch(e.type){case"const":console.log(`${n}Const: ${e.value}`);break;case"space":console.log(`${n}Space: ${e.width}`);break;case"declare":console.log(`${n}Declare: ${e.name.name} =`),a.printExpression(e.value,n+" ");break;case"assign":console.log(`${n}Assign: ${e.name.name} =`),a.printExpression(e.value,n+" ");break;case"exp":console.log(`${n}Exp:`),a.printExpression(e.expression,n+" ");break;case"seq":console.log(`${n}Seq:`),e.nodes.forEach((e=>s(e,n+" ")));break;case"ite":console.log(`${n}If-Then-Else: if`),a.printExpression(e.condition,n+" "),console.log(`${n}Then:`),s(e.trueBranch,n+" "),console.log(`${n}Else:`),s(e.falseBranch,n+" ");break;case"loop":console.log(`${n}Loop:`),a.printExpression(e.lst,n+" "),console.log(`${n}Separator: ${e.separator.value}`),console.log(`${n}Front: ${e.front.value}`),console.log(`${n}Rear: ${e.rear.value}`),l(e.body,n+" ");break;case"call":console.log(`${n}Call:`),s(e.func,n+" "),Object.keys(e.args).forEach((t=>{console.log(`${n} ${t} =`),a.printExpression(e.args[t],n+" ")}));break;case"nop":console.log(`${n}Nop`);break;case"bot":console.log(`${n}Bot`);break;case"end":console.log(`${n}End`)}}function l(e,n=""){console.log(`${n}Lambda: ${e.variable.name}`),s(e.body,n+" ")}},963:function(e,n,t){var r=this&&this.__rest||function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t};Object.defineProperty(n,"__esModule",{value:!0}),n.fuse=c,n.fuseExp=p,n.valueToConstantExpr=b,n.printEnvironment=function(e){console.log("{\n");for(const n in e)if(e.hasOwnProperty(n)){const[t,r]=e[n];console.log(`${n}: {`),console.log(" val: "),(0,s.printValue)(t," "),console.log(",marks: ["),r.forEach(((e,n)=>{(0,s.printValue)(e," "),n<r.length-1&&console.log(", ")})),console.log("]\n },\n")}console.log("}")},n.fuseBulk=g;const o=t(63),i=t(75),a=t(446),s=t(893),l=t(238);function c(e,n,t){if("const"!==t.type&&"sep"!==t.type&&"loopfront"!==t.type&&"looprear"!==t.type||"string"!=typeof t.value)if("space"===t.type)switch(n.type){case"insert":const{str:r,position:i}=n;if(0==t.width)return[{newEnv:e,newTermNode:t,remainingOperation:n},{newEnv:Object.assign({},e),newTermNode:{type:"seq",nodes:[{type:"const",value:r},t]},remainingOperation:{type:"id"}}];if(0==i){let n=[{newEnv:e,newTermNode:{type:"seq",nodes:[{type:"const",value:r},t]},remainingOperation:{type:"id"}}];return(0,o.isWhitespace)(r)&&n.push({newEnv:Object.assign({},e),newTermNode:{type:"space",width:t.width+r.length},remainingOperation:{type:"id"}}),n}if(i<t.width){if((0,o.isWhitespace)(r))return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{width:r.length+t.width}),remainingOperation:{type:"id"}}];throw new Error(`Cannot insert non-space between space term: ${n}`)}if(i===t.width){console.log("postion === term.width:",i,t.width);let n=[{newEnv:e,newTermNode:t,remainingOperation:{type:"insert",str:r,position:i-t.width}}];return(0,o.isWhitespace)(r)&&(console.log("no: ",r),n.push({newEnv:Object.assign({},e),newTermNode:Object.assign(Object.assign({},t),{width:t.width+r.length}),remainingOperation:{type:"id"}})),n}{const n=i-t.width;return[{newEnv:e,newTermNode:t,remainingOperation:{type:"insert",str:r,position:n}}]}case"delete":const{str:a,position:s}=n;if(0!==s){if(s<t.width&&s+a.length<=t.width){const n=t.width-a.length;return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{width:n}),remainingOperation:{type:"id"}}]}if(s<t.width&&s+a.length>t.width){const n=s,r=a.substring(t.width-s);return[{newEnv:e,newTermNode:{type:"space",width:n},remainingOperation:{type:"delete",str:r,position:0}}]}{const n=s-t.width;return[{newEnv:e,newTermNode:t,remainingOperation:{type:"delete",str:a,position:n}}]}}if((0,o.isWhitespace)(a)&&a.length<=t.width){const n=t.width-a.length;return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{width:n}),remainingOperation:{type:"id"}}]}if(a.length>t.width){const n=a.slice(t.width);return[{newEnv:e,newTermNode:{type:"bot"},remainingOperation:{type:"delete",str:n,position:0}},{newEnv:Object.assign({},e),newTermNode:Object.assign(Object.assign({},t),{width:0}),remainingOperation:{type:"delete",str:n,position:0}}]}case"replace":const{str1:l,str2:c,position:p}=n;if(0!==p){if(p<t.width&&p+l.length<=t.width){if((0,o.isWhitespace)(c))return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{width:c.length+t.width-l.length}),remainingOperation:{type:"id"}}];{const n=" ".repeat(p)+c+" ".repeat(t.width-(p+l.length));return[{newEnv:e,newTermNode:{type:"const",value:n},remainingOperation:{type:"id"}}]}}if(p<t.width&&p+l.length>t.width){const n=" ".repeat(p),r=t.width-p,o=c.substring(0,r),i=l.substring(r),a=c.substring(r);return[{newEnv:e,newTermNode:{type:"const",value:n+o},remainingOperation:{type:"replace",str1:i,str2:a,position:0}}]}{const n=p-t.width;return[{newEnv:e,newTermNode:t,remainingOperation:{type:"replace",str1:l,str2:c,position:n}}]}}if(l.length<=t.width){if((0,o.isWhitespace)(c)){const n=t.width-l.length+c.length;return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{width:n}),remainingOperation:{type:"id"}}]}return[{newEnv:e,newTermNode:{type:"seq",nodes:[{type:"const",value:c},Object.assign(Object.assign({},t),{width:t.width-l.length})]},remainingOperation:{type:"id"}}]}if(l.length>t.width){const n=c.slice(0,t.width),r=l.slice(t.width),o=c.slice(t.width);return[{newEnv:e,newTermNode:{type:"const",value:n},remainingOperation:{type:"replace",str1:r,str2:o,position:0}}]}case"bulk":return g(e,n,t);case"id":return[{newEnv:e,newTermNode:t,remainingOperation:{type:"id"}}];default:throw new Error(`Unhandled operation type: ${n}`)}else if("exp"===t.type){const s=t.binding,l=s[0],y=s[1],b="number"==typeof(a=y)||"boolean"==typeof a||"string"==typeof a?String(a):"Unknown";switch(n.type){case"insert":const{str:a,position:s}=n;if(0===s){let n=[];if(n.push({newEnv:e,newTermNode:{type:"seq",nodes:[{type:"const",value:a},t]},remainingOperation:{type:"id"}}),!(0,o.containsNewlineOrSpace)(a)){let r=a+b;try{let o=u(r,y),{newEnv:i,newExp:a}=p(Object.assign({},e),o,l);n.push({newEnv:i,newTermNode:Object.assign(Object.assign({},t),{binding:[a,o]}),remainingOperation:{type:"id"}})}catch(e){}}return n}if(s<b.length){const n=u(b.slice(0,s)+a+b.slice(s),y);let{newEnv:r,newExp:o}=p(e,n,l);return[{newEnv:r,newTermNode:Object.assign(Object.assign({},t),{binding:[o,n]}),remainingOperation:{type:"id"}}]}if(s==b.length){let r=[];if(!(0,o.containsNewlineOrSpace)(a)){const n=b+a;try{const o=u(n,y);let{newEnv:i,newExp:a}=p(Object.assign({},e),o,l);r.push({newEnv:i,newTermNode:Object.assign(Object.assign({},t),{binding:[a,o]}),remainingOperation:{type:"id"}})}catch(e){console.error(e)}}let i=Object.assign({},e);return l.name&&(i[l.name]=[y,[y]]),r.push({newEnv:i,newTermNode:t,remainingOperation:Object.assign(Object.assign({},n),{position:0})}),r}{const r=s-b.length;if(l.name){let n=l.name;e[n]=[y,[y]]}return[{newEnv:e,newTermNode:t,remainingOperation:Object.assign(Object.assign({},n),{position:r})}]}case"delete":const{str:h,position:w}=n;if(0===w){if(h.length<b.length){const n=u(b.slice(h.length),y);let{newEnv:r,newExp:o}=p(e,n,l);return[{newEnv:r,newTermNode:Object.assign(Object.assign({},t),{binding:[o,n]}),remainingOperation:{type:"id"}}]}if(h.length==b.length){if(l.name){let n=l.name;if("string"==typeof y){let{newEnv:r,newExp:o}=p(Object.assign({},e),"",l);return[{newEnv:r,newTermNode:Object.assign(Object.assign({},t),{binding:[o,""]}),remainingOperation:{type:"id"}},{newEnv:d(e,n),newTermNode:{type:"bot"},remainingOperation:{type:"id"}}]}return[{newEnv:d(e,n),newTermNode:{type:"bot"},remainingOperation:{type:"id"}}]}if(l){let n=l.object.name,t=l.field,r=e[n][0],o=e[n][1][0];if(0==o.fields[t].length){let i=f(r,t),a=f(o,t),s=d(e,n);return s[n]=[i,[a]],[{newEnv:s,newTermNode:{type:"bot"},remainingOperation:{type:"id"}}]}throw new Error(`field has been updaeted, cannot be remvoed: ${t}$`)}}else if(h.length>b.length){let n=h.slice(0,b.length),r=h.slice(b.length),o=c(e,{type:"delete",str:n,position:0},t),i={type:"delete",str:r,position:0};return o.forEach((e=>{e.remainingOperation=i})),o}}else{if(w+h.length<=b.length){const n=u(b.slice(0,w)+b.slice(w+h.length),y);let{newEnv:r,newExp:o}=p(e,n,l);return[{newEnv:r,newTermNode:Object.assign(Object.assign({},t),{binding:[o,n]}),remainingOperation:{type:"id"}}]}if(w<=b.length&&w+h.length>b.length){const n=b.slice(0,w),r=h.slice(b.length-w),o=u(n,y);let{newEnv:i,newExp:a}=p(e,o,l);return[{newEnv:i,newTermNode:Object.assign(Object.assign({},t),{binding:[a,o]}),remainingOperation:{type:"delete",str:r,position:0}}]}if(w>b.length){const n=w-b.length;let[{newEnv:r,newTermNode:o,remainingOperation:i}]=c(e,{type:"id"},t);return[{newEnv:r,newTermNode:o,remainingOperation:{type:"delete",str:h,position:n}}]}}case"replace":const{str1:m,str2:v,position:O}=n;if(0===O){if(b.startsWith(m)){const n=u(v+b.slice(m.length),y);let{newEnv:r,newExp:o}=p(e,n,l);return[{newEnv:r,newTermNode:Object.assign(Object.assign({},t),{binding:[o,n]}),remainingOperation:{type:"id"}}]}throw new Error(`unsupported replacement: ${m}; ${b}`)}if(O>b.length){const r=O-b.length;let[{newEnv:o,newTermNode:i,remainingOperation:a}]=c(e,{type:"id"},t);return[{newEnv:o,newTermNode:i,remainingOperation:Object.assign(Object.assign({},n),{position:r})}]}throw new Error("Unsupported replacement");case"bulk":return g(e,n,t);case"id":let{variables:E,fields:j}=(0,i.findVariablesAndFields)(l);return E.forEach((n=>{e=function(e,n){if(!(e.name in n))throw new Error(`Variable ${e.name} not found in environment.`);let t=n[e.name][0],r=d(n,e.name);return r[e.name]=[t,[t]],r}(n,e)})),j.forEach((({variable:n,field:t})=>{e=function(e,n,t){let o=n.name;if(!(o in t))throw new Error(`Variable ${o} not found in environment.`);let i=t[o][0],a=function(e,n,t){const o=e.fields,i=n,a=(o[i],r(o,["symbol"==typeof i?i:i+""]));return a[n]=t.fields[n],{type:"object",fields:a}}(t[o][1][0],e,i),s=d(t,o);return s[o]=[i,[a]],s}(t,n,e)})),[{newEnv:e,newTermNode:t,remainingOperation:{type:"id"}}];default:throw new Error(`Unhandled operation type: ${n}`)}}else{if("lambda"===t.type){let r=t.marker;if("loopitem"===r.type){let o=t.variable.name,i=t.binding[0],a=t.binding[1],s=Object.assign({},e);s[o]=[a,[]];let l="";if(!r.lst)throw new Error("exp is not a Variable with a name property in loopitem's marker");{let e=r.lst.name;l=e+"_new"}return c(s,n,t.body).map((({newEnv:n,newTermNode:r,remainingOperation:a})=>{let s=n[o][0],c=e[l][0];c.push(s),e[l]=[c,[c]];let{newEnv:u,newExp:d}=p(e,s,i);return{newEnv:u,newTermNode:{type:"lambda",variable:t.variable,body:r,binding:[d,s],marker:t.marker},remainingOperation:a}}))}{let r=t.variable.name,o=t.binding[0],i=t.binding[1],a=Object.assign({},e);return a[r]=[i,[]],c(a,n,t.body).map((({newEnv:n,newTermNode:i,remainingOperation:a})=>{let s=n[r][0];delete n[r];let l=function(e,n){let t=Object.assign({},e);for(const e in n)n.hasOwnProperty(e)&&(t[e]=n[e]);return t}(e,n),{newEnv:c,newExp:u}=p(l,s,o);return{newEnv:c,newTermNode:{type:"lambda",variable:t.variable,body:i,binding:[u,s],marker:t.marker},remainingOperation:a}}))}}if("branchstart"!==t.type&&"branchend"!==t.type&&"nop"!==t.type){if("seq"===t.type){if("bulk"===n.type)return g(e,n,t);const r=t.nodes;let o=[{newEnv:e,newTermNode:{type:"seq",nodes:[]},remainingOperation:n}];for(const e of r){const n=[];for(const t of o){const r=c(t.newEnv,t.remainingOperation,e);for(const e of r){const r=("seq"===t.newTermNode.type?t.newTermNode.nodes:[t.newTermNode]).concat("seq"===e.newTermNode.type?e.newTermNode.nodes:[e.newTermNode]);n.push({newEnv:e.newEnv,newTermNode:{type:"seq",nodes:r},remainingOperation:e.remainingOperation})}}o=n}return o.map((e=>({newEnv:e.newEnv,newTermNode:"seq"===e.newTermNode.type&&1===e.newTermNode.nodes.length?e.newTermNode.nodes[0]:e.newTermNode,remainingOperation:e.remainingOperation})))}if("end"===t.type)return[{newEnv:e,newTermNode:t,remainingOperation:n}];throw new Error("Operation can only be applied to ConstNode with string value")}{let r=[];switch(r.push({newEnv:e,newTermNode:t,remainingOperation:n}),n.type){case"insert":const{str:o,position:i}=n;0===i&&r.push({newEnv:e,newTermNode:{type:"seq",nodes:[{type:"const",value:o},t]},remainingOperation:{type:"id"}});case"delete":case"replace":return r;case"bulk":return g(e,n,t);default:throw new Error(`Unhandled operation type: ${n}`)}}}else{if("loopfront"===t.type){let n=t.lst;if(!n.name)throw new Error("exp is not a Variable with a name property in loopfront");{let t=n.name;e[t+"_new"]=[[],[]]}}else if("looprear"===t.type){let n=t.lst;if(!n.name)throw new Error("exp is not a Variable with a name property in loopfront");{let t=n.name;e[t]=e[t+"_new"]}}const r=t.value;switch(n.type){case"insert":const{str:o,position:i}=n;if(0===r.length)return[{newEnv:e,newTermNode:t,remainingOperation:n},{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{value:o}),remainingOperation:{type:"id"}}];if(0===i)return[{newEnv:Object.assign({},e),newTermNode:Object.assign(Object.assign({},t),{value:o+r}),remainingOperation:{type:"id"}},{newEnv:Object.assign({},e),newTermNode:{type:"seq",nodes:[{type:"const",value:o},t]},remainingOperation:{type:"id"}}];if(i<r.length){const n=r.slice(0,i)+o+r.slice(i);return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{value:n}),remainingOperation:{type:"id"}}]}if(i===r.length)return[{newEnv:Object.assign({},e),newTermNode:Object.assign(Object.assign({},t),{value:r+o}),remainingOperation:{type:"id"}},{newEnv:Object.assign({},e),newTermNode:t,remainingOperation:{type:"insert",str:o,position:i-r.length}}];{const n=i-r.length;return[{newEnv:e,newTermNode:t,remainingOperation:{type:"insert",str:o,position:n}}]}case"delete":const{str:a,position:s}=n;if(0!==s){if(s<r.length&&s+a.length<=r.length){const n=r.slice(0,s)+r.slice(s+a.length);return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{value:n}),remainingOperation:{type:"id"}}]}if(s<r.length&&s+a.length>r.length){const n=r.substring(0,s),t=a.substring(r.length-s);return[{newEnv:e,newTermNode:{type:"const",value:n},remainingOperation:{type:"delete",str:t,position:0}}]}{const n=s-r.length;return[{newEnv:e,newTermNode:t,remainingOperation:{type:"delete",str:a,position:n}}]}}if(r.startsWith(a)&&a.length<=r.length){const n=r.slice(a.length);let o=[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{value:n}),remainingOperation:{type:"id"}}];return a.length===r.length&&o.push({newEnv:Object.assign({},e),newTermNode:{type:"bot"},remainingOperation:{type:"id"}}),o}if(a.startsWith(r)&&a.length>r.length){const n=a.slice(r.length);return[{newEnv:e,newTermNode:{type:"bot"},remainingOperation:{type:"delete",str:n,position:0}},{newEnv:Object.assign({},e),newTermNode:Object.assign(Object.assign({},t),{value:""}),remainingOperation:{type:"delete",str:n,position:0}}]}case"replace":const{str1:l,str2:c,position:p}=n;if(0!==p){if(p<r.length&&p+l.length<=r.length){const n=r.slice(0,p)+c+r.slice(p+l.length);return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{value:n}),remainingOperation:{type:"id"}}]}if(p<r.length&&p+l.length>r.length){const n=r.substring(0,p),t=r.substring(p),o=c.substring(0,t.length),i=l.substring(t.length),a=c.substring(t.length);return[{newEnv:e,newTermNode:{type:"const",value:n+o},remainingOperation:{type:"replace",str1:i,str2:a,position:0}}]}{const n=p-r.length;return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{value:r}),remainingOperation:{type:"replace",str1:l,str2:c,position:n}}]}}if(r.startsWith(l)&&l.length<=r.length){const n=c+r.slice(l.length);return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{value:n}),remainingOperation:{type:"id"}}]}if(l.startsWith(r)&&l.length>r.length){const n=c.slice(0,r.length),o=l.slice(r.length),i=c.slice(r.length);return[{newEnv:e,newTermNode:Object.assign(Object.assign({},t),{value:n}),remainingOperation:{type:"replace",str1:o,str2:i,position:0}}]}case"bulk":return g(e,n,t);case"id":return[{newEnv:e,newTermNode:t,remainingOperation:{type:"id"}}];default:throw new Error(`Unhandled operation type: ${n}`)}}var a}function p(e,n,t){switch(t.type){case"constant":return{newEnv:e,newExp:b(n)};case"variable":if(!(t.name in e))throw new Error(`Variable ${t.name} not found in environment.`);const[o,i]=e[t.name];if(0===i.length){const r=Object.assign({},e);return r[t.name]=[n,[n]],{newEnv:r,newExp:t}}if(1===i.length&&i[0]===n)return{newEnv:e,newExp:t};throw new Error(`Fail, variable cannot be updated to different value ${t.name}, previous: ${i[0]}, new: ${n}`);case"freeze":let[s,l]=(0,a.evaluateExpr)(y(e),t.expression);if(l!==n)throw new Error(`Fail, freezed expression cannot be changed, old: ${n}, new: ${l}`);return{newEnv:e,newExp:t};case"field":const c=t.object;if("variable"===c.type&&c.name in e){const[o,i]=e[c.name];if("object"===o.type){const a={type:"object",fields:Object.assign(Object.assign({},o.fields),{[t.field]:n})},s=function(e,n,t){const o=e.fields,i=n,a=(o[i],r(o,["symbol"==typeof i?i:i+""]));return a[n]=[t],{type:"object",fields:a}}(i[0],t.field,n),l=Object.assign({},e);return l[c.name]=[a,[s]],{newEnv:l,newExp:t}}throw new Error("Field access's value is not an object")}throw new Error("Field access not start with variable.");case"binary":let u=y(e),[d,f]=(0,a.evaluateExpr)(u,t.left);if("number"==typeof n){if("number"!=typeof n||null===n)throw new Error("Value must be a non-null number");switch(t.operator){case"+":let r=p(e,n-f,t.right);return{newEnv:r.newEnv,newExp:Object.assign(Object.assign({},t),{right:r.newExp})};case"-":let o=p(e,f-n,t.right);return{newEnv:o.newEnv,newExp:Object.assign(Object.assign({},t),{right:o.newExp})};case"*":let i=p(e,n/f,t.right);return{newEnv:i.newEnv,newExp:Object.assign(Object.assign({},t),{right:i.newExp})};case"/":let a=p(e,f/n,t.right);return{newEnv:a.newEnv,newExp:Object.assign(Object.assign({},t),{right:a.newExp})}}}case"unary":return{newEnv:e,newExp:t};default:throw new Error(`Unsupported expression type: ${t.type}`)}}function u(e,n){if("number"==typeof n){const n=parseFloat(e);if(isNaN(n))throw new Error("convert to number fail: ${s}");return n}if("boolean"==typeof n){if("true"===e)return!0;if("false"===e)return!1;throw new Error("convert to boolean fail: ${s}")}if("string"==typeof n)return e;throw new Error("Unsupported type: "+typeof n)}function d(e,n){const t=Object.assign({},e);return delete t[n],t}function f(e,n){const t=e.fields,o=n;return t[o],{type:"object",fields:r(t,["symbol"==typeof o?o:o+""])}}function y(e){const n=new Map;for(const t in e)e.hasOwnProperty(t)&&n.set(t,e[t][0]);return n}function b(e){if(null===e||"number"==typeof e||"boolean"==typeof e||"string"==typeof e)return{type:"constant",value:e};if(Array.isArray(e))return{type:"constant",value:e.map((e=>b(e)))};if("object"===e.type){const n=e,t={};for(const e in n.fields)n.fields.hasOwnProperty(e)&&(t[e]=b(n.fields[e]));return{type:"constant",value:{type:"object",fields:t}}}throw new Error("Unhandled value type: "+typeof e)}function g(e,n,t){if("id"===n.type)return c(e,n,t);if("bulk"!==n.type||!n.operations)throw new Error("Invalid bulk operation");if(0==n.operations.length)return[{newEnv:e,newTermNode:t,remainingOperation:{type:"id"}}];if("seq"===t.type&&0==t.nodes.length)return[{newEnv:e,newTermNode:t,remainingOperation:n}];const[r,...o]=n.operations;if("seq"===t.type){const r=t.nodes[0],o=t.nodes.slice(1),i=g(e,n,r),a=[];for(const e of i){const n=g(e.newEnv,e.remainingOperation,{type:"seq",nodes:o});for(const t of n){let n=[];"seq"!=t.newTermNode.type?n.push(t.newTermNode):n=t.newTermNode.nodes,a.push({newEnv:t.newEnv,newTermNode:{type:"seq",nodes:[e.newTermNode,...n]},remainingOperation:t.remainingOperation})}}return a}return"lambda"===t.type?c(e,n,t):"insert"===r.type||"delete"===r.type||"replace"===r.type?(r.position,c(e,r,t).map((e=>{let n=e.remainingOperation;if("id"===n.type||"insert"===n.type||"delete"===n.type||"replace"===n.type){let n=(0,l.evaluateTermNode)(e.newTermNode).length;const t=o.map((e=>{if("id"===e.type)return e;if("position"in e)return Object.assign(Object.assign({},e),{position:e.position-n});throw new Error("All operations must have positions")}));let r={type:"bulk",operations:[e.remainingOperation,...t]};return[{newEnv:e.newEnv,newTermNode:e.newTermNode,remainingOperation:r}]}throw new Error("nested bulk current not supported")})).reduce(((e,n)=>e.concat(n)),[])):"id"===r.type?g(e,{type:"bulk",operations:o},t):[]}},238:(e,n)=>{function t(e){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return e.toString();if("object"===e.type){const n=e;let r="{";for(const e in n.fields)n.fields.hasOwnProperty(e)&&(r+=`${e}: ${t(n.fields[e])}, `);return r.length>1&&(r=r.slice(0,-2)),r+="}",r}if(Array.isArray(e)){const n=e;let r="[";for(const e of n)r+=`${t(e)}, `;return r.length>1&&(r=r.slice(0,-2)),r+="]",r}throw new Error("Unhandled value type: "+typeof e)}Object.defineProperty(n,"__esModule",{value:!0}),n.evaluateTermNode=function e(n){switch(n.type){case"const":case"sep":case"loopfront":case"looprear":return n.value;case"space":return" ".repeat(n.width);case"exp":return String(t(n.binding[1]));case"seq":return n.nodes.map((n=>e(n))).join("");case"lambda":return e(n.body);case"branchstart":case"branchend":case"end":case"bot":case"nop":return"";default:throw new Error(`Unhandled term node type: ${n.type}`)}},n.printValue=t},619:(e,n)=>{function t(e){let n=e.type;if("seq"===n)return r(e);if("declare"===n||"assign"===n)throw new Error("declare|assign node shall not be visible here.");if("lambda"===n){let n=e,r=t(n.body);return{type:"lambda",variable:n.variable,body:r,binding:n.binding,marker:n.marker}}return e}function r(e){let n=e.nodes,i=[];for(let e=0;e<n.length;e++){let a=n[e];if("declare"===a.type||"assign"===a.type){let t=a,[s,l]=o(n,e+1),{nodes:c}=r({type:"seq",nodes:s}),p=c.pop();if(void 0===p)throw new Error("Expected the last element to be a BranchEndNode, but the array was empty.");"branchend"!==(null==p?void 0:p.type)&&c.push(p);let u={type:"lambda",variable:t.name,body:{type:"seq",nodes:c},binding:t.value,marker:{type:a.type}};i.push(u),"branchend"===(null==p?void 0:p.type)&&i.push({type:"branchend"}),e=l}else i.push(t(a))}return{type:"seq",nodes:i}}function o(e,n){let t=[],r=0;for(let o=n;o<e.length;o++){if("branchstart"===e[o].type)r++;else if("branchend"===e[o].type){if(0===r)return t.push(e[o]),[t,o];r--}if("end"===e[o].type)return t.push(e[o]),[t,o];t.push(e[o])}return[t,e.length-1]}Object.defineProperty(n,"__esModule",{value:!0}),n.lambdalize=t},784:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.unLambdalize=function e(n){switch(n.type){case"lambda":{const{variable:t,body:r,binding:o,marker:i}=n;let a;switch(i.type){case"declare":return a=e(r),{type:"seq",nodes:[{type:"declare",name:t,value:o},a]};case"assign":return a=e(r),{type:"seq",nodes:[{type:"assign",name:t,value:o},a]};default:return{type:"lambda",variable:t,body:e(r),binding:o,marker:i}}}case"seq":return{type:"seq",nodes:n.nodes.map(e)};default:return n}}},893:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.printNode=function e(n,t=""){switch(console.log(t+n.type),n.type){case"const":case"sep":console.log(t+" Value: "+n.value);break;case"space":console.log(t+" Width: "+n.width);break;case"declare":case"assign":console.log(t+" Name: "+n.name.name),o(n.value,t+" ");break;case"exp":o(n.binding,t+" ");break;case"seq":n.nodes.forEach((n=>e(n,t+" ")));break;case"branchstart":o(n.condition,t+" ");break;case"loopfront":console.log(t+" front: "+n.value);break;case"looprear":console.log(t+" rear: "+n.value);break;case"lambda":console.log(t+" Variable: "+n.variable.name),e(n.body,t+" "),o(n.binding,t+" "),a(n.marker,t+" ");break;case"callstart":console.log(t+" Name: "+n.name);break;case"end":console.log(`${t} End`)}},n.printBinding=o,n.printValue=i,n.printMarker=a;const r=t(235);function o(e,n){(0,r.printExpression)(e[0],n),i(e[1],n)}function i(e,n){if(null===e)console.log(`${n}null`);else if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)console.log(`${n}${e}`);else{if("object"!=typeof e)throw new Error("Unhandled value type: "+typeof e);{console.log(`${n}{`);const t=e;for(const e in t)if(t.hasOwnProperty(e)){const r=n+" ";console.log(`${r}${e}:`),i(t[e],r+" ")}console.log(`${n}}`)}}}function a(e,n=""){console.log(n+e.type)}},446:(e,n)=>{function t(e,n){switch(n.type){case"constant":return[e,n.value];case"variable":const r=e.get(n.name);if(void 0===r)throw new Error(`Variable '${n.name}' not found in environment`);return[e,r];case"binary":let[o,i]=t(e,n.left),[a,s]=t(o,n.right);switch(n.operator){case"+":return[a,i+s];case"-":return[a,i-s];case"*":return[a,i*s];case"/":return[a,i/s];case"&&":return[a,i&&s];case"||":return[a,i||s];case">":return[a,i>s];case"<":return[a,i<s];case">=":return[a,i>=s];case"<=":return[a,i<=s];default:throw new Error("Unsupported binary operator")}case"unary":let[l,c]=t(e,n.operand);if("not"===n.operator)return[l,!c];throw new Error("Unsupported unary operator");case"field":let[p,u]=t(e,n.object);if("string"!=typeof u&&("object"!=typeof u||null===u))throw new Error(`Cannot access field '${n.field}' from non-object`);const d=u[n.field];if(void 0===d)throw new Error(`Field '${n.field}' not found in object`);return[p,d];case"array":let f=[],y=e;for(const e of n.elements){let[n,r]=t(y,e);f.push(r),y=n}return[y,f];case"object":let b={},g=e;for(const e in n.fields)if(n.fields.hasOwnProperty(e)){let[r,o]=t(g,n.fields[e]);b[e]=o,g=r}return[g,b];case"freeze":return t(e,n.expression);default:throw new Error("Unhandled expression type")}}Object.defineProperty(n,"__esModule",{value:!0}),n.partialEval=function e(n,r){switch(r.type){case"const":return[n,{type:"const",value:r.value}];case"space":return[n,{type:"space",width:r.width}];case"declare":const[o,i]=t(n,r.value);return o.set(r.name.name,i),[o,{type:"declare",name:r.name,value:[r.value,i]}];case"assign":const[a,s]=t(n,r.value);return a.set(r.name.name,s),[a,{type:"assign",name:r.name,value:[r.value,s]}];case"exp":const[l,c]=t(n,r.expression);return[l,{type:"exp",binding:[r.expression,c]}];case"seq":let p=n;const u=[];for(const n of r.nodes){const[t,r]=e(p,n);u.push(r),p=t}return[p,{type:"seq",nodes:u}];case"ite":const[d,f]=t(n,r.condition);if(!0===f){const[n,t]=e(d,r.trueBranch);return[n,{type:"seq",nodes:[{type:"branchstart",condition:[r.condition,f],trueBranch:r.trueBranch,falseBranch:r.falseBranch},t,{type:"branchend"}]}]}if(!1===f){const[n,t]=e(d,r.falseBranch);return[n,{type:"seq",nodes:[{type:"branchstart",condition:[r.condition,f],trueBranch:r.trueBranch,falseBranch:r.falseBranch},t,{type:"branchend"}]}]}throw new Error(`Condition does not evaluate to boolean: ${f}`);case"loop":const{lst:y,separator:b,front:g,rear:h,body:w}=r,[m,v]=t(n,y);if(Array.isArray(v)&&0===v.length)return[m,{type:"seq",nodes:[{type:"loopfront",lst:y,value:g.value,body:w,separator:b},{type:"looprear",lst:y,value:h.value}]}];if(Array.isArray(v)&&1===v.length){const t=v[0],r=w.variable.name,o=new Map(n);o.set(r,t);const[i,a]=e(o,w.body);return[i,{type:"seq",nodes:[{type:"loopfront",lst:y,value:g.value,body:w,separator:b},a,{type:"looprear",lst:y,value:h.value}]}]}if(Array.isArray(v)&&v.length>1){let t=new Map(n),o=[];for(let n=0;n<v.length;n++){const i=v[n],a=w.variable.name;t.set(a,i);const[s,l]=e(t,w.body);t=s,o.push({type:"lambda",variable:w.variable,body:l,binding:[{type:"constant",value:i},i],marker:{type:"loopitem",lst:y}}),n<v.length-1&&o.push(r.separator)}return[t,{type:"seq",nodes:[{type:"loopfront",lst:y,value:g.value,body:w,separator:b},...o,{type:"looprear",lst:y,value:h.value}]}]}throw new Error("Unsupported type or value for e_arr: "+typeof v);case"nop":return[n,{type:"nop"}];case"bot":return[n,{type:"bot"}];case"end":return[n,{type:"end"}];default:throw new Error(`Unhandled term node type: ${r.type}`)}},n.evaluateExpr=t,n.flatten=function e(n){return"seq"===n.type?{type:"seq",nodes:n.nodes.map((n=>e(n))).flatMap((e=>"seq"===e.type?e.nodes:[e]))}:"lambda"===n.type?Object.assign(Object.assign({},n),{body:e(n.body)}):n}},887:function(e,n,t){var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t);var o=Object.getOwnPropertyDescriptor(n,t);o&&!("get"in o?!n.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,r,o)}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&r(n,e,t);return o(n,e),n};Object.defineProperty(n,"__esModule",{value:!0}),n.unPartialEval=function e(n){switch(n.type){case"const":return a.constNode(n.value);case"space":return a.space(n.width);case"declare":return a.declare(n.name,s(n.value));case"assign":return a.assign(n.name,s(n.value));case"exp":return a.exp(s(n.binding));case"nop":return a.nop();case"end":return a.end();case"bot":return a.bot();case"seq":return function(n){const t=n.nodes,r=[];for(let n=0;n<t.length;n++){const o=t[n];if("branchstart"===o.type){const i=o.condition[0],s=(o.condition[1],o.trueBranch),l=o.falseBranch,c=[];for(let r=n+1;r<t.length&&"branchend"!==t[r].type;r++)c.push(e(t[r]));i?r.push(a.ite(i,{type:"seq",nodes:c},l)):r.push(a.ite(i,s,{type:"seq",nodes:c})),n+=c.length+1}else if("loopfront"===o.type){let i=o,s={type:"looprear",value:""};const l=[];for(let r=n+1;r<t.length;r++){const n=t[r];if("looprear"===n.type){s=n;break}l.push(e(t[r]))}if(""!==i.value||""!==s.value||0!=l.length&&!c(l))if(0==l.length||c(l))r.push(a.loop(i.lst,i.separator,{type:"front",value:o.value},{type:"rear",value:s.value},i.body));else if(1==l.length){let e=l[0];if("lambdawithexpr"!==e.type)throw new Error("Must be lambda in loopitem");r.push(a.loop(i.lst,i.separator,{type:"front",value:o.value},{type:"rear",value:s.value},u(e)))}else{let e=f(l);if(!h(e))throw new Error(" x.t in loop seq, ts are not equal");r.push(a.loop(i.lst,i.separator,{type:"front",value:o.value},{type:"rear",value:s.value},u(e[0])))}else r.push(a.bot());n+=l.length+1}else r.push(e(o))}return a.seq(...r)}(n);case"lambda":return function(n){let{variable:t,body:r,binding:o,marker:i}=n;return{type:"lambdawithexpr",variable:t,body:e(r),exp:(a=o[1],Array.isArray(a)?{type:"array",elements:a.map(p)}:{type:"array",elements:[p(a)]})};var a}(n);default:throw new Error(`Unknown node type: ${n.type}`)}},n.flatten=function e(n){return"seq"===n.type?{type:"seq",nodes:n.nodes.map((n=>e(n))).flatMap((e=>"seq"===e.type?e.nodes:[e]))}:"ite"===n.type?Object.assign(Object.assign({},n),{trueBranch:e(n.trueBranch),falseBranch:e(n.falseBranch)}):"loop"===n.type?Object.assign(Object.assign({},n),{body:Object.assign(Object.assign({},n.body),{body:e(n.body.body)})}):n};const a=i(t(454));function s(e){return e[0]}function l(e){return"bot"===e.type}function c(e){return e.every(l)}function p(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null===e)return{type:"constant",value:e};if(Array.isArray(e))return{type:"array",elements:e.map(p)};if("object"===e.type){const n={};for(const t in e.fields)if(e.fields.hasOwnProperty(t)){const r=e.fields[t];n[t]={type:"constant",value:r}}return{type:"object",fields:n}}throw new Error("Unsupported Value type")}function u(e){return{type:"lambda",variable:e.variable,body:e.body}}function d(e){return"lambdawithexpr"===e.type}function f(e){return e.filter(d).filter((e=>!l(e.body)))}function y(e,n){return e.name===n.name}function b(e,n){if(e.type!==n.type)return!1;switch(e.type){case"constant":const t=e,r=n;return"object"==typeof t.value&&"object"==typeof r.value?b(t.value,r.value):t.value===r.value;case"variable":return e.name===n.name;case"binary":const o=e,i=n;return o.operator===i.operator&&b(o.left,i.left)&&b(o.right,i.right);case"unary":const a=e,s=n;return a.operator===s.operator&&b(a.operand,s.operand);case"field":const l=e,c=n;return l.field===c.field&&b(l.object,c.object);case"array":const p=e,u=n;return p.elements.length===u.elements.length&&p.elements.every(((e,n)=>b(e,u.elements[n])));case"object":const d=e,f=n,y=Object.keys(d.fields),g=Object.keys(f.fields);return y.length===g.length&&y.every((e=>f.fields.hasOwnProperty(e)&&b(d.fields[e],f.fields[e])));case"freeze":return b(e.expression,n.expression);default:return!1}}function g(e,n){if(e.type!==n.type)return!1;switch(e.type){case"const":return e.value===n.value;case"space":return e.width===n.width;case"declare":const t=e,r=n;return y(t.name,r.name)&&b(t.value,r.value);case"assign":const o=e,i=n;return y(o.name,i.name)&&b(o.value,i.value);case"exp":return b(e.expression,n.expression);case"seq":const a=e.nodes,s=n.nodes;return a.length===s.length&&a.every(((e,n)=>g(e,s[n])));case"ite":const l=e,c=n;return b(l.condition,c.condition)&&g(l.trueBranch,c.trueBranch)&&g(l.falseBranch,c.falseBranch);case"loop":const p=e,u=n;return b(p.lst,u.lst)&&p.separator.value===u.separator.value&&p.front.value===u.front.value&&p.rear.value===u.rear.value&&function(e,n){return y(e.variable,n.variable)&&g(e.body,n.body)}(p.body,u.body);case"nop":case"bot":case"end":return!0;case"call":const d=e,f=n;return g(d.func,f.func)&&Object.keys(d.args).length===Object.keys(f.args).length&&Object.keys(d.args).every((e=>b(d.args[e],f.args[e])));case"lambdawithexpr":const h=e,w=n;return y(h.variable,w.variable)&&g(h.body,w.body);default:return!1}}function h(e){if(0===e.length)return!0;const n=e[0];return e.every((e=>{return r=n,y((t=e).variable,r.variable)&&g(t.body,r.body);var t,r}))}},577:(e,n)=>{function t(e){const n=/«[^»]*»/g;let t;const r=[];let o=0;for(;null!==(t=n.exec(e));)o<t.index&&r.push(e.slice(o,t.index)),r.push(t[0]),o=n.lastIndex;return o<e.length&&r.push(e.slice(o)),r}function r(e){var n,t,i;const a=[];let s=0;for(;s<e.length;){const l=e[s];if("string"==typeof l&&l.startsWith("«")&&l.endsWith("»")){const c=l.slice(1,-1).trim(),[p]=c.split(" ");switch(p.toUpperCase()){case"VAR":const l=c.split("=");a.push({type:"Directive",content:{type:"declare",name:l[0].split(" ")[1].trim(),expr:o(l[1].trim())}});break;case"IF":const p=c.match(/IF\s+(.*?)\s*»/);if(p){const n=[],t=[];let i=1,l=s+1;for(;l<e.length&&i>0;){const r=e[l];if("string"==typeof r&&r.startsWith("«"))if(r.includes("ENDIF")){if(i--,0===i)break}else if(r.includes("IF"))i++;else if(r.includes("ELSE")&&1===i){i=0,l++;continue}i>0?n.push(r):t.push(r),l++}const c=r(n),u=r(t);s=l,a.push({type:"Directive",content:{type:"if",expr:o(p[1].trim()),thenBranch:c,elseBranch:u}})}break;case"FOR":const u=/(\bfor\b|\bin\b|\bseparator\b|\bfront\b|\brear\b|[\[\],])|(\w+)|"([^"]*)"|\[([^\]]*)\]/gi,d=[];let f;for(;null!==(f=u.exec(c));)f[1]&&d.push(f[1]),f[2]&&d.push(f[2]),f[3]&&d.push(f[3]),f[4]&&d.push(f[4]);const y=c.match(/separator\s*"([^"]*)"/i);y&&y[1]&&d.push("separator",y[1]);const b=c.match(/front\s*(?:\[([^\]]*)\])?/i);b&&b[1]&&d.push("front",b[1]);const g=c.match(/rear\s*(?:\[([^\]]*)\])?/i);if(g&&g[1]&&d.push("rear",g[1]),d){const l=[];let c=1,p=s+1;for(;p<e.length&&c>0;){const n=e[p];if("string"==typeof n&&n.startsWith("«"))if(n.includes("ENDFOR")){if(c--,0===c)break}else n.includes("FOR")&&c++;c>0&&l.push(n),p++}const u=r(l);s=p,a.push({type:"Directive",content:{type:"for",name:d[1].trim(),expr:o(d[3].trim()),separator:{type:"separator",value:(null===(n=d[5])||void 0===n?void 0:n.trim())||""},front:{type:"front",value:(null===(t=d[7])||void 0===t?void 0:t.trim())||""},rear:{type:"rear",value:(null===(i=d[9])||void 0===i?void 0:i.trim())||""},fragment:u}})}break;default:if(c.includes("=")){const e=c.split("=");a.push({type:"Directive",content:{type:"assign",name:e[0].split(" ")[0].trim(),expr:o(e[1].trim())}})}else a.push({type:"Directive",content:{type:"exp",expr:o(c)}})}}else a.push(l);s++}return 1===a.length?a[0]:{type:"fragmentList",fragments:a}}function o(e){const n=function(e){const n=/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|(&&|\|\||[<>!=]=|[{}[\](),.:;!+\-*/<>])|(\s+)|([^\s{}[\](),.:;!+\-*/<>!=&|]+)/g,t=[];let r;for(;null!==(r=n.exec(e));)void 0!==r[1]?t.push(`"${r[1]}"`):void 0!==r[2]?t.push(`'${r[2]}'`):void 0!==r[3]?t.push(r[3]):void 0!==r[5]&&t.push(r[5]);return t}(e);let t=0;function r(){if("("===n[t]){t++;const e=o();if(")"===n[t])return t++,e;throw new Error("Mismatched parentheses")}if("["===n[t]){t++;const e=[];for(;"]"!==n[t];)","===n[t]?t++:e.push(o());return t++,{type:"array",elements:e}}if("{"===n[t]){t++;const e={};for(;"}"!==n[t];)if(","===n[t])t++;else{const r=n[t++];if(":"!==n[t])throw new Error("Expected colon in object literal");{t++;const n=o();e[r]=n}}return t++,{type:"object",fields:e}}if(!isNaN(Number(n[t])))return{type:"constant",value:Number(n[t++])};if(/^['"].*['"]$/.test(n[t]))return{type:"constant",value:n[t++].slice(1,-1)};if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n[t]))return{type:"variable",name:n[t++]};if("!"===n[t])return t++,{type:"freeze",expression:r()};throw new Error(`Unexpected token: ${n[t]}`)}function o(){let e=r();for(;["+","-","*","/","&&","||",">","<",">=","<=","!="].includes(n[t]);)e={type:"binary",operator:n[t++],left:e,right:r()};return e}return o()}Object.defineProperty(n,"__esModule",{value:!0}),n.parse=function(e){return r(t(e))},n.tokenize=t,n.parseTokens=r},775:function(e,n,t){var r=this&&this.__createBinding||(Object.create?function(e,n,t,r){void 0===r&&(r=t);var o=Object.getOwnPropertyDescriptor(n,t);o&&!("get"in o?!n.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(e,r,o)}:function(e,n,t,r){void 0===r&&(r=t),e[r]=n[t]}),o=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&r(n,e,t);return o(n,e),n};Object.defineProperty(n,"__esModule",{value:!0}),n.translate=function(e){const n=s(e);return a.seq(...n)};const a=i(t(454));function s(e){if("string"==typeof e)return function(e){const n=[];let t="";for(let r of e)" "===r?(t.length>0&&(n.push(a.constNode(t)),t=""),n.push(a.space(1))):t+=r;return t.length>0&&n.push(a.constNode(t)),n}(e);switch(e.type){case"Directive":switch(e.content.type){case"declare":return[a.declare({type:"variable",name:e.content.name},e.content.expr)];case"assign":return[a.assign({type:"variable",name:e.content.name},e.content.expr)];case"exp":return[a.exp(e.content.expr)];case"if":return[a.ite(e.content.expr,{type:"seq",nodes:s(e.content.thenBranch)},l(e.content.elseBranch))];case"for":return[a.loop(e.content.expr,{type:"sep",value:e.content.separator.value},{type:"front",value:e.content.front.value},{type:"rear",value:e.content.rear.value},{type:"lambda",variable:{type:"variable",name:e.content.name},body:{type:"seq",nodes:s(e.content.fragment)}})];default:throw new Error(`Unknown directive: ${e}`)}case"fragmentList":return e.fragments.flatMap(s);default:throw new Error(`Unknown fragment: ${e}`)}}function l(e){if((n=e)&&"if"===n.type){const n=e;return a.ite(n.expr,{type:"seq",nodes:s(n.thenBranch)},l(n.elseBranch))}return function(e){return e&&"bot"===e.type}(e)?a.bot():{type:"seq",nodes:s(e)};var n}},63:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isWhitespace=function(e){return/^( +)$/.test(e)},n.containsNewlineOrSpace=function(e){return/[\n\s]/.test(e)}}},n={};return function t(r){var o=n[r];if(void 0!==o)return o.exports;var i=n[r]={exports:{}};return e[r].call(i.exports,i,i.exports,t),i.exports}(612)})()));
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import * as CoreAST from "../core/AST";
|
2
|
+
import * as LambdaAST from "../lambda/AST";
|
3
|
+
import { UpdateOperation } from "../../src/fuse/Update";
|
4
|
+
export declare function evaluateToLambdaAST(core: CoreAST.TermNode): LambdaAST.TermNode;
|
5
|
+
export declare function forward(str: string): string;
|
6
|
+
export declare function backward(str: string, operation: UpdateOperation): string[];
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
3
|
+
if (mod && mod.__esModule) return mod;
|
4
|
+
var result = {};
|
5
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
6
|
+
result["default"] = mod;
|
7
|
+
return result;
|
8
|
+
};
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
+
const peval_1 = require("../partialEval/peval");
|
11
|
+
const lambdalize_1 = require("../lambdalize/lambdalize");
|
12
|
+
const Evaluation = __importStar(require("../lambda/Evaluation"));
|
13
|
+
const UnEvaluation = __importStar(require("../../src/partialEval/unpeval"));
|
14
|
+
const Parser = __importStar(require("../surface/Parser"));
|
15
|
+
const Translator = __importStar(require("../translate/Translate"));
|
16
|
+
const CorePretty = __importStar(require("../core/PrettyPrint"));
|
17
|
+
const Fuse_1 = require("../../src/fuse/Fuse");
|
18
|
+
const unLambdalize_1 = require("../../src/lambdalize/unLambdalize");
|
19
|
+
const peval_2 = require("../../src/partialEval/peval");
|
20
|
+
function evaluateToLambdaAST(core) {
|
21
|
+
const initialEnvironment = new Map();
|
22
|
+
const [_, partialNode] = peval_1.partialEval(initialEnvironment, core);
|
23
|
+
// console.log("----------------------------");
|
24
|
+
// PartialPrint.printNode(partialNode);
|
25
|
+
const lambdaAST = lambdalize_1.lambdalize(partialNode);
|
26
|
+
// console.log("----------------------------");
|
27
|
+
// LambdaPrint.printNode(lambdaAST);
|
28
|
+
return lambdaAST;
|
29
|
+
}
|
30
|
+
exports.evaluateToLambdaAST = evaluateToLambdaAST;
|
31
|
+
function forward(str) {
|
32
|
+
let surface = Parser.parse(str);
|
33
|
+
let core = Translator.translate(surface);
|
34
|
+
// CorePrint.printAST(core);
|
35
|
+
let result = Evaluation.evaluateTermNode(evaluateToLambdaAST(core));
|
36
|
+
return result;
|
37
|
+
}
|
38
|
+
exports.forward = forward;
|
39
|
+
function backward(str, operation) {
|
40
|
+
let surface = Parser.parse(str);
|
41
|
+
let core = Translator.translate(surface);
|
42
|
+
let lambdaAST = evaluateToLambdaAST(core);
|
43
|
+
// LambdaPrint.printNode(lambdaAST,"");
|
44
|
+
let env = {};
|
45
|
+
return Fuse_1.fuse(env, operation, lambdaAST)
|
46
|
+
.map(({ newTermNode: newTerm, remainingOperation: newOp }) => {
|
47
|
+
let partialAST = peval_2.flatten(unLambdalize_1.unLambdalize(newTerm));
|
48
|
+
// console.log("--------updatedPartialAST------------");
|
49
|
+
// PartialPrint.printNode(partialAST);
|
50
|
+
let updatedCoreAST = UnEvaluation.flatten(UnEvaluation.unPartialEval(partialAST));
|
51
|
+
// console.log("--------updatedCoreAST------------");
|
52
|
+
// CorePrint.printAST(updatedCoreAST);
|
53
|
+
let surfaceText = CorePretty.printToSurface(updatedCoreAST);
|
54
|
+
// console.log("result in backward:\n", surfaceText);
|
55
|
+
return surfaceText;
|
56
|
+
});
|
57
|
+
}
|
58
|
+
exports.backward = backward;
|
59
|
+
//# sourceMappingURL=biEval.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"biEval.js","sourceRoot":"","sources":["../../../src/bx/biEval.ts"],"names":[],"mappings":";;;;;;;;;AAGA,gDAAmD;AACnD,yDAAsD;AACtD,iEAAmD;AACnD,4EAA8D;AAC9D,0DAA4C;AAC5C,mEAAqD;AAErD,gEAAkD;AAOlD,8CAA0E;AAE1E,oEAAiE;AACjE,uDAAsD;AAGtD,SAAgB,mBAAmB,CAAC,IAAsB;IACxD,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAe,CAAC;IAClD,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,mBAAW,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IAC/D,+CAA+C;IAC/C,uCAAuC;IACvC,MAAM,SAAS,GAAG,uBAAU,CAAC,WAAW,CAAC,CAAC;IAC1C,+CAA+C;IAC/C,oCAAoC;IACpC,OAAO,SAAS,CAAC;AACnB,CAAC;AATD,kDASC;AAGD,SAAgB,OAAO,CAAC,GAAW;IACjC,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IACxC,4BAA4B;IAC5B,IAAI,MAAM,GAAG,UAAU,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,0BAMC;AAGD,SAAgB,QAAQ,CAAC,GAAW,EAAE,SAA0B;IAC9D,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IACxC,IAAI,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACzC,uCAAuC;IACvC,IAAI,GAAG,GAAgB,EAAE,CAAC;IAC1B,OAAO,WAAI,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC;SACrC,GAAG,CAAC,CAAC,EAAC,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAC,EAAE,EAAE;QACzD,IAAI,UAAU,GAAG,eAAO,CAAC,2BAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QAChD,wDAAwD;QACxD,sCAAsC;QACtC,IAAI,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;QAClF,qDAAqD;QACrD,sCAAsC;QACtC,IAAI,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAC5D,qDAAqD;QACrD,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAlBD,4BAkBC"}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
export type Expr = Constant | Variable | BinaryOperation | UnaryOperation | FieldAccess | ArrayLiteral | FreezeExp | ObjectLiteral;
|
2
|
+
export interface Constant {
|
3
|
+
type: 'constant';
|
4
|
+
value: number | boolean | string | [] | null | ObjectLiteral;
|
5
|
+
}
|
6
|
+
export interface Variable {
|
7
|
+
type: 'variable';
|
8
|
+
name: string;
|
9
|
+
}
|
10
|
+
export interface BinaryOperation {
|
11
|
+
type: 'binary';
|
12
|
+
operator: BinaryOperator;
|
13
|
+
left: Expr;
|
14
|
+
right: Expr;
|
15
|
+
}
|
16
|
+
export interface UnaryOperation {
|
17
|
+
type: 'unary';
|
18
|
+
operator: UnaryOperator;
|
19
|
+
operand: Expr;
|
20
|
+
}
|
21
|
+
export interface FieldAccess {
|
22
|
+
type: 'field';
|
23
|
+
object: Expr;
|
24
|
+
field: string;
|
25
|
+
}
|
26
|
+
export interface ArrayLiteral {
|
27
|
+
type: 'array';
|
28
|
+
elements: Expr[];
|
29
|
+
}
|
30
|
+
export interface ObjectLiteral {
|
31
|
+
type: 'object';
|
32
|
+
fields: {
|
33
|
+
[key: string]: Constant;
|
34
|
+
};
|
35
|
+
}
|
36
|
+
export interface FreezeExp {
|
37
|
+
type: 'freeze';
|
38
|
+
expression: Expr;
|
39
|
+
}
|
40
|
+
export interface FunctionCall {
|
41
|
+
type: 'function';
|
42
|
+
func: Expr;
|
43
|
+
args: Expr[];
|
44
|
+
}
|
45
|
+
export type BinaryOperator = '+' | '-' | '*' | '/' | '&&' | '||' | '>' | '<' | '>=' | '<=' | '!=';
|
46
|
+
export type UnaryOperator = 'not';
|
47
|
+
export declare function findVariablesAndFields(exp: Expr): {
|
48
|
+
variables: Variable[];
|
49
|
+
fields: {
|
50
|
+
variable: Variable;
|
51
|
+
field: string;
|
52
|
+
}[];
|
53
|
+
};
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
function findVariablesAndFields(exp) {
|
4
|
+
let variables = [];
|
5
|
+
let fields = [];
|
6
|
+
function traverse(node) {
|
7
|
+
switch (node.type) {
|
8
|
+
case 'variable':
|
9
|
+
variables.push(node);
|
10
|
+
break;
|
11
|
+
case 'field':
|
12
|
+
if (node.object.type === 'variable') {
|
13
|
+
fields.push({ variable: node.object, field: node.field });
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
traverse(node.object);
|
17
|
+
}
|
18
|
+
break;
|
19
|
+
case 'binary':
|
20
|
+
traverse(node.left);
|
21
|
+
traverse(node.right);
|
22
|
+
break;
|
23
|
+
case 'unary':
|
24
|
+
traverse(node.operand);
|
25
|
+
break;
|
26
|
+
case 'array':
|
27
|
+
node.elements.forEach(traverse);
|
28
|
+
break;
|
29
|
+
case 'object':
|
30
|
+
Object.values(node.fields).forEach(traverse);
|
31
|
+
break;
|
32
|
+
case 'freeze':
|
33
|
+
traverse(node.expression);
|
34
|
+
break;
|
35
|
+
// Add other cases as needed
|
36
|
+
default:
|
37
|
+
break;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
traverse(exp);
|
41
|
+
return { variables, fields };
|
42
|
+
}
|
43
|
+
exports.findVariablesAndFields = findVariablesAndFields;
|
44
|
+
//# sourceMappingURL=Exp.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Exp.js","sourceRoot":"","sources":["../../../src/common/Exp.ts"],"names":[],"mappings":";;AAgEA,SAAgB,sBAAsB,CAAC,GAAS;IAC9C,IAAI,SAAS,GAAe,EAAE,CAAC;IAC/B,IAAI,MAAM,GAA4C,EAAE,CAAC;IAEzD,SAAS,QAAQ,CAAC,IAAU;QAC1B,QAAQ,IAAI,CAAC,IAAI,EAAE;YACjB,KAAK,UAAU;gBACb,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACrB,MAAM;YACR,KAAK,OAAO;gBACV,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;oBACnC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;iBAC3D;qBAAM;oBACL,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;iBACvB;gBACD,MAAM;YACR,KAAK,QAAQ;gBACX,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACpB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM;YACR,KAAK,OAAO;gBACV,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;YACR,KAAK,OAAO;gBACV,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAChC,MAAM;YACR,KAAK,QAAQ;gBACX,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAC7C,MAAM;YACR,KAAK,QAAQ;gBACX,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC1B,MAAM;YACR,4BAA4B;YAC5B;gBACE,MAAM;SACT;IACH,CAAC;IAED,QAAQ,CAAC,GAAG,CAAC,CAAC;IACd,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC;AAxCD,wDAwCC"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
function prettyPrint(node) {
|
4
|
+
switch (node.type) {
|
5
|
+
case 'constant':
|
6
|
+
return String(node.value);
|
7
|
+
case 'variable':
|
8
|
+
return node.name;
|
9
|
+
case 'binary':
|
10
|
+
return prettyPrint(node.left) + prettyPrintBinaryOperator(node.operator) + prettyPrint(node.right);
|
11
|
+
case 'unary':
|
12
|
+
return prettyPrintUnaryOperator(node.operator) + prettyPrint(node.operand);
|
13
|
+
case 'field':
|
14
|
+
return prettyPrint(node.object) + "." + node.field;
|
15
|
+
case 'array':
|
16
|
+
return "[" + node.elements.map(ele => prettyPrint(ele)).join(",") + "]";
|
17
|
+
case 'freeze':
|
18
|
+
return "!" + prettyPrint(node.expression);
|
19
|
+
default:
|
20
|
+
return "";
|
21
|
+
}
|
22
|
+
}
|
23
|
+
exports.prettyPrint = prettyPrint;
|
24
|
+
function prettyPrintBinaryOperator(node) {
|
25
|
+
return node;
|
26
|
+
}
|
27
|
+
exports.prettyPrintBinaryOperator = prettyPrintBinaryOperator;
|
28
|
+
function prettyPrintUnaryOperator(node) {
|
29
|
+
return node;
|
30
|
+
}
|
31
|
+
exports.prettyPrintUnaryOperator = prettyPrintUnaryOperator;
|
32
|
+
//# sourceMappingURL=PrettyPrint.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"PrettyPrint.js","sourceRoot":"","sources":["../../../src/common/PrettyPrint.ts"],"names":[],"mappings":";;AAEA,SAAgB,WAAW,CAAC,IAAa;IACvC,QAAO,IAAI,CAAC,IAAI,EAAC;QACf,KAAK,UAAU;YACb,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,KAAK,UAAU;YACb,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,yBAAyB,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrG,KAAK,OAAO;YACV,OAAO,wBAAwB,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7E,KAAK,OAAO;YACV,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,GAAC,GAAG,GAAC,IAAI,CAAC,KAAK,CAAC;QACjD,KAAK,OAAO;YACV,OAAO,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAA,EAAE,CAAA,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;QACxE,KAAK,QAAQ;YACX,OAAO,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C;YACE,OAAO,EAAE,CAAC;KACb;AACH,CAAC;AAnBD,kCAmBC;AAED,SAAgB,yBAAyB,CAAC,IAAwB;IAChE,OAAO,IAAI,CAAC;AACd,CAAC;AAFD,8DAEC;AAED,SAAgB,wBAAwB,CAAC,IAAuB;IAC9D,OAAO,IAAI,CAAC;AACd,CAAC;AAFD,4DAEC"}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
function printExpression(expr, indent = '') {
|
4
|
+
switch (expr.type) {
|
5
|
+
case 'constant':
|
6
|
+
printConstantValue(expr.value, indent + ' ');
|
7
|
+
break;
|
8
|
+
case 'variable':
|
9
|
+
console.log(`${indent}Variable: ${expr.name}`);
|
10
|
+
break;
|
11
|
+
case 'binary':
|
12
|
+
console.log(`${indent}BinaryOperation: ${expr.operator}`);
|
13
|
+
printExpression(expr.left, indent + ' ');
|
14
|
+
printExpression(expr.right, indent + ' ');
|
15
|
+
break;
|
16
|
+
case 'unary':
|
17
|
+
console.log(`${indent}UnaryOperation: ${expr.operator}`);
|
18
|
+
printExpression(expr.operand, indent + ' ');
|
19
|
+
break;
|
20
|
+
case 'field':
|
21
|
+
console.log(`${indent}FieldAccess: ${expr.field}`);
|
22
|
+
printExpression(expr.object, indent + ' ');
|
23
|
+
break;
|
24
|
+
case 'array':
|
25
|
+
console.log(`${indent}ArrayLiteral:`);
|
26
|
+
expr.elements.forEach(element => printExpression(element, indent + ' '));
|
27
|
+
break;
|
28
|
+
case 'object':
|
29
|
+
console.log(`${indent}ObjectLiteral:`);
|
30
|
+
Object.keys(expr.fields).forEach(field => {
|
31
|
+
console.log(`${indent}${field} = ${expr.fields[field].value}`);
|
32
|
+
});
|
33
|
+
break;
|
34
|
+
case 'freeze':
|
35
|
+
console.log(`${indent}Freeze:`);
|
36
|
+
printExpression(expr.expression, indent + ' ');
|
37
|
+
break;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
exports.printExpression = printExpression;
|
41
|
+
// Function to print Value with indent
|
42
|
+
function printConstantValue(value, indent) {
|
43
|
+
if (value === null) {
|
44
|
+
console.log(`${indent}null`);
|
45
|
+
}
|
46
|
+
else if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string') {
|
47
|
+
console.log(`${indent}${value}`);
|
48
|
+
}
|
49
|
+
else if (typeof value === 'object') {
|
50
|
+
// Assume value is an ObjectLiteral
|
51
|
+
console.log(`${indent}{`);
|
52
|
+
const objectValue = value; // Type assertion to ensure correct indexing
|
53
|
+
for (const key in objectValue) {
|
54
|
+
if (objectValue.hasOwnProperty(key)) {
|
55
|
+
const newIndent = indent + " ";
|
56
|
+
console.log(`${newIndent}${key}:`);
|
57
|
+
//@ts-ignore
|
58
|
+
printConstantValue(objectValue[key], newIndent + " ");
|
59
|
+
}
|
60
|
+
}
|
61
|
+
console.log(`${indent}}`);
|
62
|
+
// @ts-ignore
|
63
|
+
}
|
64
|
+
else if (typeof value === 'constant') {
|
65
|
+
const constantValue = value; // Type assertion to ensure correct indexing
|
66
|
+
printConstantValue(constantValue.value, indent + ' ');
|
67
|
+
}
|
68
|
+
else {
|
69
|
+
throw new Error(`Unhandled value type: ${typeof value}`);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
exports.printConstantValue = printConstantValue;
|
73
|
+
//# sourceMappingURL=Print.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Print.js","sourceRoot":"","sources":["../../../src/common/Print.ts"],"names":[],"mappings":";;AAEA,SAAgB,eAAe,CAAC,IAAU,EAAE,SAAiB,EAAE;IAC7D,QAAQ,IAAI,CAAC,IAAI,EAAE;QACf,KAAK,UAAU;YACX,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,CAAC;YAC7C,MAAM;QACV,KAAK,UAAU;YACX,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,aAAa,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAC/C,MAAM;QACV,KAAK,QAAQ;YACT,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,oBAAoB,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC1D,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;YAC1C,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;YAC3C,MAAM;QACV,KAAK,OAAO;YACR,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,mBAAmB,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YACzD,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;YAC7C,MAAM;QACV,KAAK,OAAO;YACR,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,gBAAgB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACnD,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;YAC5C,MAAM;QACV,KAAK,OAAO;YACR,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,eAAe,CAAC,CAAC;YACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;YAC1E,MAAM;QACV,KAAK,QAAQ;YACT,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,gBAAgB,CAAC,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACrC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,KAAK,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;YACH,MAAM;QACV,KAAK,QAAQ;YACT,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC;YAChC,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;YAChD,MAAM;KACb;AACH,CAAC;AApCD,0CAoCC;AAGD,sCAAsC;AACtC,SAAgB,kBAAkB,CAAC,KAAU,EAAE,MAAc;IAC3D,IAAI,KAAK,KAAK,IAAI,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,MAAM,CAAC,CAAC;KAChC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7F,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC;KACpC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAClC,mCAAmC;QACnC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;QAC1B,MAAM,WAAW,GAAG,KAAsB,CAAC,CAAC,4CAA4C;QACxF,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE;YAC3B,IAAI,WAAW,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;gBACjC,MAAM,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;gBAChC,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,GAAG,GAAG,CAAC,CAAC;gBACnC,YAAY;gBACZ,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC,CAAC;aAC1D;SACJ;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;QAC1B,aAAa;KAChB;SAAM,IAAI,OAAO,KAAK,KAAK,UAAU,EAAC;QACrC,MAAM,aAAa,GAAG,KAAiB,CAAC,CAAC,4CAA4C;QACrF,kBAAkB,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,CAAC;KACvD;SACI;QACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,KAAK,EAAE,CAAC,CAAC;KAC5D;AACH,CAAC;AA1BD,gDA0BC"}
|