@elyx-code/project-logic-tree 0.0.6124 → 0.0.6126
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.
|
@@ -50,7 +50,7 @@ export interface IOutputMapTransfer extends IOutputMap_meta, IChildEntityTransfe
|
|
|
50
50
|
export interface IOutputMapGenerationTarget extends IChildEntityGenerationTarget, IValueWritingEntityGenerationTarget {
|
|
51
51
|
id: EntityId;
|
|
52
52
|
type: EntityType.OutputMap;
|
|
53
|
-
declaration
|
|
53
|
+
declaration?: EntityId | null;
|
|
54
54
|
parent: EntityId;
|
|
55
55
|
}
|
|
56
56
|
export interface IOutputMapShallowTransfer extends IOutputMap_meta, IChildEntityShallowTransfer, IValueWritingEntityShallowTransfer {
|
package/dist/index.js
CHANGED
|
@@ -36855,7 +36855,7 @@ const Te = class Te {
|
|
|
36855
36855
|
(u) => u !== i.Condition
|
|
36856
36856
|
).includes(o.type)) {
|
|
36857
36857
|
const u = o.outputs.find(
|
|
36858
|
-
(c) => c.declaration.id === D(n.declaration)
|
|
36858
|
+
(c) => c.declaration.id === (n.declaration ? D(n.declaration) : null)
|
|
36859
36859
|
);
|
|
36860
36860
|
if (u)
|
|
36861
36861
|
a.push(
|
|
@@ -36870,7 +36870,7 @@ You can't edit output-map entities as they need to match their return declaratio
|
|
|
36870
36870
|
})
|
|
36871
36871
|
);
|
|
36872
36872
|
else {
|
|
36873
|
-
const c = t.get(n.declaration);
|
|
36873
|
+
const c = n.declaration ? t.get(n.declaration) : null;
|
|
36874
36874
|
if (c && $e.includes(o.type)) {
|
|
36875
36875
|
const y = $r(o), h = y.dataType, E = (l = y.dataType) == null ? void 0 : l.entity;
|
|
36876
36876
|
h ? E ? E.type === i.ActionDescriptor ? a.push(
|
|
@@ -37175,7 +37175,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
|
|
|
37175
37175
|
};
|
|
37176
37176
|
}
|
|
37177
37177
|
toShallowJSON(e = N) {
|
|
37178
|
-
var n, a;
|
|
37178
|
+
var n, a, s;
|
|
37179
37179
|
let t = this.id;
|
|
37180
37180
|
return (n = e.seenEntityMaps) != null && n.has(this.id) && (t = e.seenEntityMaps.get(this.id)), {
|
|
37181
37181
|
id: t,
|
|
@@ -37184,9 +37184,9 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
|
|
|
37184
37184
|
index: this.index,
|
|
37185
37185
|
parentRelationType: this.parentRelationType,
|
|
37186
37186
|
defaultValue: ((a = this.defaultValue) == null ? void 0 : a.toReference(e)) || null,
|
|
37187
|
-
declaration: this.declaration.toReference(e),
|
|
37187
|
+
declaration: (s = this.declaration) == null ? void 0 : s.toReference(e),
|
|
37188
37188
|
writesValues: this.writesValues.map(
|
|
37189
|
-
(
|
|
37189
|
+
(o) => o.toReference(e)
|
|
37190
37190
|
),
|
|
37191
37191
|
parent: this.parent.toReference(e)
|
|
37192
37192
|
};
|
|
@@ -37200,10 +37200,11 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
|
|
|
37200
37200
|
]);
|
|
37201
37201
|
}
|
|
37202
37202
|
toGenerationTarget() {
|
|
37203
|
+
var e;
|
|
37203
37204
|
return {
|
|
37204
37205
|
id: this.id,
|
|
37205
37206
|
type: this.type,
|
|
37206
|
-
declaration: this.declaration.id,
|
|
37207
|
+
declaration: ((e = this.declaration) == null ? void 0 : e.id) || null,
|
|
37207
37208
|
parent: this.parent.id
|
|
37208
37209
|
};
|
|
37209
37210
|
}
|
|
@@ -44763,13 +44764,13 @@ class oT {
|
|
|
44763
44764
|
visit(e) {
|
|
44764
44765
|
const t = this.order;
|
|
44765
44766
|
for (const n of t)
|
|
44766
|
-
e(this.flatRecord[n]);
|
|
44767
|
+
e(this.flatRecord[n], this.flatRecord);
|
|
44767
44768
|
return this;
|
|
44768
44769
|
}
|
|
44769
44770
|
reverseVisit(e) {
|
|
44770
44771
|
const t = this.order.slice().reverse();
|
|
44771
44772
|
for (const n of t)
|
|
44772
|
-
e(this.flatRecord[n]);
|
|
44773
|
+
e(this.flatRecord[n], this.flatRecord);
|
|
44773
44774
|
return this;
|
|
44774
44775
|
}
|
|
44775
44776
|
async visitAsync(e) {
|
|
@@ -44781,7 +44782,7 @@ class oT {
|
|
|
44781
44782
|
n
|
|
44782
44783
|
);
|
|
44783
44784
|
Object.keys(s).length && await this.settlePromises(s, n);
|
|
44784
|
-
const o = e(this.flatRecord[a]);
|
|
44785
|
+
const o = e(this.flatRecord[a], this.flatRecord);
|
|
44785
44786
|
au(o) && (this.onGoingVisits[n][a] = o);
|
|
44786
44787
|
}
|
|
44787
44788
|
return await this.settlePromises(this.onGoingVisits[n], n), this.onGoingVisits[n] = {}, this;
|
|
@@ -44795,7 +44796,7 @@ class oT {
|
|
|
44795
44796
|
n
|
|
44796
44797
|
);
|
|
44797
44798
|
Object.keys(s).length && await this.settlePromises(s, n);
|
|
44798
|
-
const o = e(this.flatRecord[a]);
|
|
44799
|
+
const o = e(this.flatRecord[a], this.flatRecord);
|
|
44799
44800
|
au(o) && (this.onGoingVisits[n][a] = o);
|
|
44800
44801
|
}
|
|
44801
44802
|
return await this.settlePromises(this.onGoingVisits[n], n), this.onGoingVisits[n] = {}, this;
|
package/dist/index.umd.cjs
CHANGED
|
@@ -141,9 +141,9 @@ Input maps can only be added to variables which hold an entity with properties.`
|
|
|
141
141
|
The entity of the data-type has the following properties that can be reads as input maps, ids: '${q(v.properties.map(D=>D.id),"', '","' and '")}'`,issue:null})))}else if(Je.filter(h=>Fe.includes(h)).includes(o.type)){const f=rp(o),R=f.find(I=>I.id===n.declaration),v=`The parent entity has the following argument declarations that can be referenced by input-maps, ids: '${q(f.map(I=>I.id),"', '","' and '")}'`;R||a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.InputMap}' with id '${n.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The parent entity does not have an 'argument-declaration' with id '${n.declaration}'.
|
|
142
142
|
You can't add an input-map to an entity that doesn't have a matching 'argument-declaration'.
|
|
143
143
|
${v}`,issue:null}))}}return a.push(...s.errors,...je(n)),{errors:a,modifiedData:n}}validateGeneratedUpdate(e){const t=[];let n=JSON.parse(JSON.stringify(e));const a=Qa(n,this);return n=a.modifiedData,t.push(...a.errors),n.parent&&t.push(new g({id:`${this.id}--${T.InvalidParentUpdate}`,code:T.InvalidParentUpdate,severity:E.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
|
|
144
|
-
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`,issue:null})),{errors:t,modifiedData:n}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.readsValue){const a=S(this.initialData.readsValue),s=this.project.get(a);s&&(this.setValueWriter(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return qn.hydrateReadsValue(this),{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a,s;const e=[this],t=[],n=[];if(this.parent.addInput(this),e.push(this.parent),(a=this.readsValue)==null||a.addValueReader(this),this.readsValue&&e.push(this.readsValue),Fe.includes(this.parent.type)&&((s=this.parent.getDataType())!=null&&s.inferred)){const o=this.parent.type===i.VariableDeclaration?this.parent:this.parent.declaration;o.inferDataTypeAndSyncInstancesInputsAndOutputs(),e.push(o,...o.variableInstances)}return{updated:m(e),added:m(t),removed:m(n),self:this}}setParent(e){return this.parent=e,this}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}setDeclaration(e){return this.declaration=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.initialData.defaultValue&&(this.defaultValue=b(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),this.initialData.declaration&&(this.declaration=b(this.initialData.declaration,this.project)),qn.initReadsValue(this),this.afterAllChildrenInitialized(),this)}setValueWriter(e){return this.readsValue=e,this}removeValueWriter(){return this.readsValue=null,this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.index=e.index||(e.index!==0?this.index:0),this.name=e.name||this.name,this.description=e.description||this.description,this}async load(e=V){return await Ee.repository.load(this.id),this}async create(e=V){return await Ee.repository.create(this.toShallowJSON()),this}async update(e=V){return await Ee.repository.update(this.toShallowJSON()),this}async delete(e=V){return await Ee.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const n=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.defaultValue){const{affected:s,removed:o}=this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t});n.push(...s),a.push(...o)}return this.readsValue&&(n.push(this.readsValue),this.readsValue.removeValueReader(this)),this.defaultValue&&(n.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t})),e||(n.push(this.parent),this.parent.removeInput(this)),{affected:n,removed:a}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.defaultValue){const{affected:n}=this.defaultValue.restore({seenEntities:e});t.push(...n)}return this.readsValue&&(t.push(this.readsValue),this.readsValue.addValueReader(this)),this.defaultValue&&(t.push(this.defaultValue),this.defaultValue.restore({seenEntities:e})),t.push(this.parent),this.parent.addInput(this),{affected:t,self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.defaultValue?this.defaultValue.toFlat(e):[],...this.declaration?this.declaration.toFlat(e):[],...this.readsValue?this.readsValue.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.defaultValue?this.defaultValue.toFlatIds(e):[],...this.defaultValue?this.defaultValue.toFlatIds(e):[]])}toJSON(e=new Set){var t,n,a;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,declaration:((n=this.declaration)==null?void 0:n.toJSON(e))||null,readsValue:((a=this.readsValue)==null?void 0:a.toReference())||null,parent:this.parent.toReference()})}toJSONClone(e=L){var n,a,s,o,l,p,u,h,f,R,v;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((p=this.defaultValue)==null?void 0:p.toJSONClone({...e,newId:null}))||null,declaration:(u=this.declaration)!=null&&u.id&&this.project.getBuiltIn((h=this.declaration)==null?void 0:h.id)?(f=this.declaration)==null?void 0:f.toJSON(e.seenEntities):((R=this.declaration)==null?void 0:R.toJSONClone({...e,newId:null}))||null,readsValue:((v=this.readsValue)==null?void 0:v.toReference({seenEntityMaps:e.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n,a,s,o;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,defaultValue:((a=this.defaultValue)==null?void 0:a.toReference(e))||null,declaration:((s=this.declaration)==null?void 0:s.toReference(e))||null,readsValue:((o=this.readsValue)==null?void 0:o.toReference(e))||null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.defaultValue?this.defaultValue.toFlatJSON(e):[],...this.defaultValue?this.defaultValue.toFlatJSON(e):[]])}toGenerationTarget(){var e;return{id:this.id,name:this.name||void 0,description:this.description||void 0,type:this.type,declaration:((e=this.declaration)==null?void 0:e.id)||null,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(e):[],...this.defaultValue?this.defaultValue.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=W7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t;return[...this.errors,...((t=this.defaultValue)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return this.defaultValue||((e=this.declaration)==null?void 0:e.defaultValue)||null}setDefaultValue(e){return this.defaultValue=e,this}clone(e=null,t=null,n=!0){var f;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.InputMap,a);s.defaultValue=null;const l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(f=this.defaultValue)==null?void 0:f.clone(u,p+"--default-value-id",n);return u.defaultValue=h||null,u}getDataType(){var t;if(this.parent.type===i.Operation)return this.parent.declaration.inferInputMapDataType(this);if(Fe.includes(this.parent.type)){const n=Ur(this.parent),a=n.getDataType();(!a||a.inferred)&&n.inferDataTypeAndSyncInstancesInputsAndOutputs()}const e=(t=this.declaration)==null?void 0:t.getDataType();if(!e){const n=gn(this);if(n)return n}return e||null}};c(Ee,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(Ee,"MUTABLE_BASE_PROPERTIES",["name","description"]),c(Ee,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Ee,"BASE_PROPERTIES",[...Ee.MUTABLE_BASE_PROPERTIES,...Ee.INMUTABLE_BASE_PROPERTIES]),c(Ee,"MUTABLE_META_PROPERTIES",[...Ee.MUTABLE_BASE_PROPERTIES,"index"]),c(Ee,"INMUTABLE_META_PROPERTIES",[...Ee.INMUTABLE_BASE_PROPERTIES]),c(Ee,"META_PROPERTIES",[...Ee.MUTABLE_META_PROPERTIES,...Ee.INMUTABLE_META_PROPERTIES]),c(Ee,"MUTABLE_UPSTREAM_PROPERTIES",["readsValue"]),c(Ee,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(Ee,"UPSTREAM_PROPERTIES",[...Ee.MUTABLE_UPSTREAM_PROPERTIES,...Ee.INMUTABLE_UPSTREAM_PROPERTIES]),c(Ee,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),c(Ee,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Ee,"DOWNSTREAM_PROPERTIES",[...Ee.MUTABLE_DOWNSTREAM_PROPERTIES,...Ee.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Ee,"PROPERTIES",[...Ee.META_PROPERTIES,...Ee.UPSTREAM_PROPERTIES,...Ee.DOWNSTREAM_PROPERTIES]);let xn=Ee;class Y7 extends xn{constructor(t,n){super(t,n);c(this,"declaration",null);c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}class H7 extends xn{constructor(t,n){super(t,n);c(this,"name",null);c(this,"description",null);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}function z7(r){const e=S6(),t=r.toJSON();e.safeParse(t).success;const a=[];if(r.id==="exec-sequentially-return-map-id"){const s=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(s.error)}return Be(r.errors,a)}const Re=class Re{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"index");c(this,"type",i.OutputMap);c(this,"parentRelationType");c(this,"defaultValue",null);c(this,"declaration");c(this,"writesValues",[]);c(this,"dataType");c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.index=e.index,this.parentRelationType=e.parentRelationType}static fromGenerationTarget(e,t){const n=S(e.parent),a=t.get(n);let s;if(e.declaration){const p=S(e.declaration);s=t.get(p)}const o={id:e.id,version:1,type:i.OutputMap,index:(a.outputs||[]).length,defaultValue:null,declaration:s,writesValues:[],parent:a},l=b(o,t);return l.setParent(a),l.initChildren(),l}static validateGenerationTarget(e,t){var l;let n=JSON.parse(JSON.stringify(e));const a=[],s=tt(n,{parent:{list:!1,types:Je.filter(p=>p!==i.Condition)},declaration:{list:!1,types:[i.ReturnDeclaration,i.Property]}},t);n=s.modifiedData;const o=t.get(n.parent);if(o&&Je.filter(p=>p!==i.Condition).includes(o.type)){const p=o.outputs.find(u=>u.declaration.id===S(n.declaration));if(p)a.push(new g({id:`${n.id}--${T.OutputOverwrite}`,code:T.OutputOverwrite,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The parent already has an output-map with id '${p.id}' that points to the same base 'return-declaration'.
|
|
144
|
+
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`,issue:null})),{errors:t,modifiedData:n}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.readsValue){const a=S(this.initialData.readsValue),s=this.project.get(a);s&&(this.setValueWriter(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return qn.hydrateReadsValue(this),{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a,s;const e=[this],t=[],n=[];if(this.parent.addInput(this),e.push(this.parent),(a=this.readsValue)==null||a.addValueReader(this),this.readsValue&&e.push(this.readsValue),Fe.includes(this.parent.type)&&((s=this.parent.getDataType())!=null&&s.inferred)){const o=this.parent.type===i.VariableDeclaration?this.parent:this.parent.declaration;o.inferDataTypeAndSyncInstancesInputsAndOutputs(),e.push(o,...o.variableInstances)}return{updated:m(e),added:m(t),removed:m(n),self:this}}setParent(e){return this.parent=e,this}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}setDeclaration(e){return this.declaration=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.initialData.defaultValue&&(this.defaultValue=b(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),this.initialData.declaration&&(this.declaration=b(this.initialData.declaration,this.project)),qn.initReadsValue(this),this.afterAllChildrenInitialized(),this)}setValueWriter(e){return this.readsValue=e,this}removeValueWriter(){return this.readsValue=null,this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.index=e.index||(e.index!==0?this.index:0),this.name=e.name||this.name,this.description=e.description||this.description,this}async load(e=V){return await Ee.repository.load(this.id),this}async create(e=V){return await Ee.repository.create(this.toShallowJSON()),this}async update(e=V){return await Ee.repository.update(this.toShallowJSON()),this}async delete(e=V){return await Ee.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const n=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.defaultValue){const{affected:s,removed:o}=this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t});n.push(...s),a.push(...o)}return this.readsValue&&(n.push(this.readsValue),this.readsValue.removeValueReader(this)),this.defaultValue&&(n.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t})),e||(n.push(this.parent),this.parent.removeInput(this)),{affected:n,removed:a}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.defaultValue){const{affected:n}=this.defaultValue.restore({seenEntities:e});t.push(...n)}return this.readsValue&&(t.push(this.readsValue),this.readsValue.addValueReader(this)),this.defaultValue&&(t.push(this.defaultValue),this.defaultValue.restore({seenEntities:e})),t.push(this.parent),this.parent.addInput(this),{affected:t,self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.defaultValue?this.defaultValue.toFlat(e):[],...this.declaration?this.declaration.toFlat(e):[],...this.readsValue?this.readsValue.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.defaultValue?this.defaultValue.toFlatIds(e):[],...this.defaultValue?this.defaultValue.toFlatIds(e):[]])}toJSON(e=new Set){var t,n,a;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,declaration:((n=this.declaration)==null?void 0:n.toJSON(e))||null,readsValue:((a=this.readsValue)==null?void 0:a.toReference())||null,parent:this.parent.toReference()})}toJSONClone(e=L){var n,a,s,o,l,p,u,h,f,R,v;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((p=this.defaultValue)==null?void 0:p.toJSONClone({...e,newId:null}))||null,declaration:(u=this.declaration)!=null&&u.id&&this.project.getBuiltIn((h=this.declaration)==null?void 0:h.id)?(f=this.declaration)==null?void 0:f.toJSON(e.seenEntities):((R=this.declaration)==null?void 0:R.toJSONClone({...e,newId:null}))||null,readsValue:((v=this.readsValue)==null?void 0:v.toReference({seenEntityMaps:e.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n,a,s,o;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,defaultValue:((a=this.defaultValue)==null?void 0:a.toReference(e))||null,declaration:((s=this.declaration)==null?void 0:s.toReference(e))||null,readsValue:((o=this.readsValue)==null?void 0:o.toReference(e))||null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.defaultValue?this.defaultValue.toFlatJSON(e):[],...this.defaultValue?this.defaultValue.toFlatJSON(e):[]])}toGenerationTarget(){var e;return{id:this.id,name:this.name||void 0,description:this.description||void 0,type:this.type,declaration:((e=this.declaration)==null?void 0:e.id)||null,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(e):[],...this.defaultValue?this.defaultValue.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=W7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t;return[...this.errors,...((t=this.defaultValue)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return this.defaultValue||((e=this.declaration)==null?void 0:e.defaultValue)||null}setDefaultValue(e){return this.defaultValue=e,this}clone(e=null,t=null,n=!0){var f;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.InputMap,a);s.defaultValue=null;const l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(f=this.defaultValue)==null?void 0:f.clone(u,p+"--default-value-id",n);return u.defaultValue=h||null,u}getDataType(){var t;if(this.parent.type===i.Operation)return this.parent.declaration.inferInputMapDataType(this);if(Fe.includes(this.parent.type)){const n=Ur(this.parent),a=n.getDataType();(!a||a.inferred)&&n.inferDataTypeAndSyncInstancesInputsAndOutputs()}const e=(t=this.declaration)==null?void 0:t.getDataType();if(!e){const n=gn(this);if(n)return n}return e||null}};c(Ee,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(Ee,"MUTABLE_BASE_PROPERTIES",["name","description"]),c(Ee,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Ee,"BASE_PROPERTIES",[...Ee.MUTABLE_BASE_PROPERTIES,...Ee.INMUTABLE_BASE_PROPERTIES]),c(Ee,"MUTABLE_META_PROPERTIES",[...Ee.MUTABLE_BASE_PROPERTIES,"index"]),c(Ee,"INMUTABLE_META_PROPERTIES",[...Ee.INMUTABLE_BASE_PROPERTIES]),c(Ee,"META_PROPERTIES",[...Ee.MUTABLE_META_PROPERTIES,...Ee.INMUTABLE_META_PROPERTIES]),c(Ee,"MUTABLE_UPSTREAM_PROPERTIES",["readsValue"]),c(Ee,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(Ee,"UPSTREAM_PROPERTIES",[...Ee.MUTABLE_UPSTREAM_PROPERTIES,...Ee.INMUTABLE_UPSTREAM_PROPERTIES]),c(Ee,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),c(Ee,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Ee,"DOWNSTREAM_PROPERTIES",[...Ee.MUTABLE_DOWNSTREAM_PROPERTIES,...Ee.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Ee,"PROPERTIES",[...Ee.META_PROPERTIES,...Ee.UPSTREAM_PROPERTIES,...Ee.DOWNSTREAM_PROPERTIES]);let xn=Ee;class Y7 extends xn{constructor(t,n){super(t,n);c(this,"declaration",null);c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}class H7 extends xn{constructor(t,n){super(t,n);c(this,"name",null);c(this,"description",null);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}function z7(r){const e=S6(),t=r.toJSON();e.safeParse(t).success;const a=[];if(r.id==="exec-sequentially-return-map-id"){const s=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(s.error)}return Be(r.errors,a)}const Re=class Re{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"index");c(this,"type",i.OutputMap);c(this,"parentRelationType");c(this,"defaultValue",null);c(this,"declaration");c(this,"writesValues",[]);c(this,"dataType");c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.index=e.index,this.parentRelationType=e.parentRelationType}static fromGenerationTarget(e,t){const n=S(e.parent),a=t.get(n);let s;if(e.declaration){const p=S(e.declaration);s=t.get(p)}const o={id:e.id,version:1,type:i.OutputMap,index:(a.outputs||[]).length,defaultValue:null,declaration:s,writesValues:[],parent:a},l=b(o,t);return l.setParent(a),l.initChildren(),l}static validateGenerationTarget(e,t){var l;let n=JSON.parse(JSON.stringify(e));const a=[],s=tt(n,{parent:{list:!1,types:Je.filter(p=>p!==i.Condition)},declaration:{list:!1,types:[i.ReturnDeclaration,i.Property]}},t);n=s.modifiedData;const o=t.get(n.parent);if(o&&Je.filter(p=>p!==i.Condition).includes(o.type)){const p=o.outputs.find(u=>u.declaration.id===(n.declaration?S(n.declaration):null));if(p)a.push(new g({id:`${n.id}--${T.OutputOverwrite}`,code:T.OutputOverwrite,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The parent already has an output-map with id '${p.id}' that points to the same base 'return-declaration'.
|
|
145
145
|
Any value reads can be done with that output-map instead.
|
|
146
|
-
You can't edit output-map entities as they need to match their return declarations, so you can only choose to read their outputted value if you need it.`,issue:null}));else{const u=t.get(n.declaration);if(u&&Fe.includes(o.type)){const h=Ur(o),f=h.dataType,R=(l=h.dataType)==null?void 0:l.entity;f?R?R.type===i.ActionDescriptor?a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The data type of the 'variable-declaration' is a 'action-descriptor' entity.
|
|
146
|
+
You can't edit output-map entities as they need to match their return declarations, so you can only choose to read their outputted value if you need it.`,issue:null}));else{const u=n.declaration?t.get(n.declaration):null;if(u&&Fe.includes(o.type)){const h=Ur(o),f=h.dataType,R=(l=h.dataType)==null?void 0:l.entity;f?R?R.type===i.ActionDescriptor?a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The data type of the 'variable-declaration' is a 'action-descriptor' entity.
|
|
147
147
|
This means it can hold a function-call or operation as its value, to be executed programatically.
|
|
148
148
|
Output maps can only be added to variables which hold an entity with properties.`,issue:null})):(R.properties||[]).find(I=>I.id===u.id)||a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The 'declaration' with '${u.id}' of the 'output-map' does not exist in the entity of the 'data-type'.
|
|
149
149
|
The entity of the data-type has the following properties that can be reads as output maps, ids: '${q((R.properties||[]).map(I=>I.id),"', '","' and '")}'`,issue:null})):a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The data type of the 'variable-declaration' doesn't have an 'entity' set, so it cannot be determined if the output-map is reading a valid property of the data type entity.
|
|
@@ -151,7 +151,7 @@ ${ku}`,issue:null})):a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSign
|
|
|
151
151
|
${ku}`,issue:null}))}else if(u){const h=o.outputs.find(f=>f.declaration.id===n.declaration);h&&a.push(new g({id:`${n.id}--${T.OutputOverwrite}`,code:T.OutputOverwrite,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The parent already has an output-map with id '${h.id}' that points to the same declaration.
|
|
152
152
|
Any value reads can be done with that output-map instead.
|
|
153
153
|
You can't edit output-map entities as they need to match their return declarations, so you can only choose to read their outputted value if you need it.`,issue:null}))}}}return a.push(...s.errors,...je(n)),{errors:a,modifiedData:n}}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new g({id:`${this.id}--${T.InvalidParentUpdate}`,code:T.InvalidParentUpdate,severity:E.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
|
|
154
|
-
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`,issue:null})),{errors:t,modifiedData:e}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a;const e=[this],t=[],n=[];return this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=this):((a=this.declaration)==null?void 0:a.id)===_["value-descriptor"][os.ActionOngoingProcessOutputValue].id?this.parent.process=this:this.parent.addOutput(this),this.writesValues.forEach(s=>{s.setValueWriter(this),e.push(s)}),{updated:m(e),added:m(t),removed:m(n),self:this}}addValueReader(e){return this.writesValues.includes(e)?this:(this.writesValues.push(e),this)}removeValueReader(e){return this.writesValues=this.writesValues.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}setDeclaration(e){return this.declaration=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.initialData.defaultValue&&(this.defaultValue=b(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),is.initWritesValues(this,this.parent.parent),this.initialData.declaration&&(this.declaration=b(this.initialData.declaration,this.project)),this.afterAllChildrenInitialized(),this)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.index=e.index||(e.index!==0?this.index:0),this.parentRelationType=e.parentRelationType||this.parentRelationType,this}async load(e=V){return await Re.repository.load(this.id),this}async create(e=V){return await Re.repository.create(this.toShallowJSON()),this}async update(e=V){return await Re.repository.update(this.toShallowJSON()),this}async delete(e=V){return await Re.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const n=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.defaultValue){const{affected:s,removed:o}=this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t});n.push(...s),a.push(...o)}return this.writesValues.forEach(s=>{n.push(s),s.readsValue=null}),e||(n.push(this.parent),this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=null):this.parent.removeOutput(this)),{affected:n,removed:a}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.defaultValue){const{affected:n}=this.defaultValue.restore({seenEntities:e});t.push(...n)}return this.writesValues.forEach(n=>{t.push(n),n.setValueWriter(this)}),t.push(this.parent),this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=this):this.parent.addOutput(this),{affected:t,self:this}}toFlat(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this,...((n=this.defaultValue)==null?void 0:n.toFlat(e))||[],...this.writesValues.flatMap(a=>a.toFlat(e))])}toFlatIds(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.id,...((n=this.defaultValue)==null?void 0:n.toFlatIds(e))||[],...this.writesValues.flatMap(a=>a.toFlatIds(e))])}toJSON(e=new Set){var t,n;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,writesValues:this.writesValues.map(a=>a.toJSON(e)),declaration:((n=this.declaration)==null?void 0:n.toJSON(e))||null,parent:this.parent.toReference()})}toJSONClone(e=L){var n,a,s,o,l,p,u,h,f,R;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((p=this.defaultValue)==null?void 0:p.toJSONClone({...e,newId:null}))||null,writesValues:this.writesValues.map(v=>v.toJSONClone({...e,newId:null})),declaration:(u=this.declaration)!=null&&u.id&&this.project.getBuiltIn((h=this.declaration)==null?void 0:h.id)?(f=this.declaration)==null?void 0:f.toJSON(e.seenEntities):((R=this.declaration)==null?void 0:R.toJSONClone({...e,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n,a;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((a=this.defaultValue)==null?void 0:a.toReference(e))||null,declaration:this.declaration.toReference(e),writesValues:this.writesValues.map(s=>s.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((n=this.defaultValue)==null?void 0:n.toFlatJSON(e))||[],...this.writesValues.flatMap(a=>a.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,declaration:this.declaration.id,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((n=this.defaultValue)==null?void 0:n.toFlatGenerationTarget(e))||[],...this.writesValues.flatMap(a=>a.toFlatGenerationTarget(e))])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=z7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t;return[...this.errors,...((t=this.defaultValue)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return this.defaultValue||((e=this.declaration)==null?void 0:e.defaultValue)||null}setDefaultValue(e){return this.defaultValue=e,this}clone(e=null,t=null,n=!0){var R,v;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.OutputMap,a),l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(R=this.dataType)==null?void 0:R.clone(u,p+"--data-type-id",n);u.dataType=h||null;const f=(v=this.defaultValue)==null?void 0:v.clone(u,p+"-default-value-id",n);return u.defaultValue=f||null,u}getDataType(){var t;return this.parent.type===i.Operation?this.parent.declaration.inferOutputMapDataType(this):((t=this.declaration)==null?void 0:t.getDataType())||null}};c(Re,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(Re,"MUTABLE_BASE_PROPERTIES",[]),c(Re,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(Re,"BASE_PROPERTIES",[...Re.MUTABLE_BASE_PROPERTIES,...Re.INMUTABLE_BASE_PROPERTIES]),c(Re,"MUTABLE_META_PROPERTIES",[...Re.MUTABLE_BASE_PROPERTIES,"index"]),c(Re,"INMUTABLE_META_PROPERTIES",[...Re.INMUTABLE_BASE_PROPERTIES]),c(Re,"META_PROPERTIES",[...Re.MUTABLE_META_PROPERTIES,...Re.INMUTABLE_META_PROPERTIES]),c(Re,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(Re,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(Re,"UPSTREAM_PROPERTIES",[...Re.MUTABLE_UPSTREAM_PROPERTIES,...Re.INMUTABLE_UPSTREAM_PROPERTIES]),c(Re,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues"]),c(Re,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Re,"DOWNSTREAM_PROPERTIES",[...Re.MUTABLE_DOWNSTREAM_PROPERTIES,...Re.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Re,"PROPERTIES",[...Re.META_PROPERTIES,...Re.UPSTREAM_PROPERTIES,...Re.DOWNSTREAM_PROPERTIES]);let jn=Re;class Z7 extends jn{constructor(t,n){super(t,n);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}class K7 extends jn{constructor(t,n){super(t,n);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}function X7(r){var s;const e=s5(),t=r.toJSON();e.safeParse(t).success,(s=r.dataType)==null||s.validate();const a=[];if(r.id==="company-dto-func-declaration-argument-dcl-id"){const o=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}if(r.id==="manual-hello-world-loop-current-iteration-number-output-map-id"){const o=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}return Be(r.errors,a)}const ge=class ge{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"index");c(this,"required");c(this,"constant",!0);c(this,"type",i.ArgumentDeclaration);c(this,"defaultValue",null);c(this,"dataType",null);c(this,"writesValues",[]);c(this,"implements",null);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.index=e.index,this.name=e.name,this.description=e.description,this.required=e.required,this.constant=!0}static fromGenerationTarget(e,t){const n=S(e.parent),a=t.get(n),s={id:e.id,version:1,name:e.name,type:i.ArgumentDeclaration,index:a.inputs.length,defaultValue:null,description:e.description,required:e.required,constant:!0,implements:null,dataType:null,writesValues:[],parent:a},o=b(s,t);return o.setParent(a),o.initChildren(),o}static validateGenerationTarget(e,t){let n=JSON.parse(JSON.stringify(e));const a=[],s=tt(n,{parent:{list:!1,types:[i.FunctionDeclaration,i.Search,i.Condition]}},t);n=s.modifiedData;const o=Lu(n,t);if(n.parent){const l=t.get(S(n.parent));if(l&&We.includes(l.type)){const p=l.implements;if(p){const u=p.inputs.find(D=>D.name===n.name),h=p.inputs.filter(D=>!l.inputs.find($=>$.type===i.ArgumentDeclaration&&$.name===D.name)),f=l.inputs.filter(D=>D.type===i.ArgumentDeclaration),R=f.find(D=>D.name===n.name),v=f.length?`The parent entity already implements the following arguments: ${q(f.map(D=>`'${D.id}' (${D.name})`),", "," and ")}.`:"The parent entity does not yet have any implemented arguments.",I=h.length?`The parent entity is still missing the following arguments in the implementation: ${q(h.map(D=>`'${D.id}' (${D.name})`),", "," and ")}.`:"The parent entity has all the arguments it needs implemented.";u?R&&a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.ArgumentDeclaration}' with id '${n.id}' should not exist in a parent entity of type '${l.type}' with id '${l.id}' that implements a ${i.ActionDescriptor} with fixed arguments.
|
|
154
|
+
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`,issue:null})),{errors:t,modifiedData:e}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a;const e=[this],t=[],n=[];return this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=this):((a=this.declaration)==null?void 0:a.id)===_["value-descriptor"][os.ActionOngoingProcessOutputValue].id?this.parent.process=this:this.parent.addOutput(this),this.writesValues.forEach(s=>{s.setValueWriter(this),e.push(s)}),{updated:m(e),added:m(t),removed:m(n),self:this}}addValueReader(e){return this.writesValues.includes(e)?this:(this.writesValues.push(e),this)}removeValueReader(e){return this.writesValues=this.writesValues.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}setDeclaration(e){return this.declaration=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.initialData.defaultValue&&(this.defaultValue=b(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),is.initWritesValues(this,this.parent.parent),this.initialData.declaration&&(this.declaration=b(this.initialData.declaration,this.project)),this.afterAllChildrenInitialized(),this)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.index=e.index||(e.index!==0?this.index:0),this.parentRelationType=e.parentRelationType||this.parentRelationType,this}async load(e=V){return await Re.repository.load(this.id),this}async create(e=V){return await Re.repository.create(this.toShallowJSON()),this}async update(e=V){return await Re.repository.update(this.toShallowJSON()),this}async delete(e=V){return await Re.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const n=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.defaultValue){const{affected:s,removed:o}=this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t});n.push(...s),a.push(...o)}return this.writesValues.forEach(s=>{n.push(s),s.readsValue=null}),e||(n.push(this.parent),this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=null):this.parent.removeOutput(this)),{affected:n,removed:a}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.defaultValue){const{affected:n}=this.defaultValue.restore({seenEntities:e});t.push(...n)}return this.writesValues.forEach(n=>{t.push(n),n.setValueWriter(this)}),t.push(this.parent),this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=this):this.parent.addOutput(this),{affected:t,self:this}}toFlat(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this,...((n=this.defaultValue)==null?void 0:n.toFlat(e))||[],...this.writesValues.flatMap(a=>a.toFlat(e))])}toFlatIds(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.id,...((n=this.defaultValue)==null?void 0:n.toFlatIds(e))||[],...this.writesValues.flatMap(a=>a.toFlatIds(e))])}toJSON(e=new Set){var t,n;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,writesValues:this.writesValues.map(a=>a.toJSON(e)),declaration:((n=this.declaration)==null?void 0:n.toJSON(e))||null,parent:this.parent.toReference()})}toJSONClone(e=L){var n,a,s,o,l,p,u,h,f,R;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((p=this.defaultValue)==null?void 0:p.toJSONClone({...e,newId:null}))||null,writesValues:this.writesValues.map(v=>v.toJSONClone({...e,newId:null})),declaration:(u=this.declaration)!=null&&u.id&&this.project.getBuiltIn((h=this.declaration)==null?void 0:h.id)?(f=this.declaration)==null?void 0:f.toJSON(e.seenEntities):((R=this.declaration)==null?void 0:R.toJSONClone({...e,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n,a,s;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((a=this.defaultValue)==null?void 0:a.toReference(e))||null,declaration:(s=this.declaration)==null?void 0:s.toReference(e),writesValues:this.writesValues.map(o=>o.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((n=this.defaultValue)==null?void 0:n.toFlatJSON(e))||[],...this.writesValues.flatMap(a=>a.toFlatJSON(e))])}toGenerationTarget(){var e;return{id:this.id,type:this.type,declaration:((e=this.declaration)==null?void 0:e.id)||null,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((n=this.defaultValue)==null?void 0:n.toFlatGenerationTarget(e))||[],...this.writesValues.flatMap(a=>a.toFlatGenerationTarget(e))])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=z7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t;return[...this.errors,...((t=this.defaultValue)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return this.defaultValue||((e=this.declaration)==null?void 0:e.defaultValue)||null}setDefaultValue(e){return this.defaultValue=e,this}clone(e=null,t=null,n=!0){var R,v;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.OutputMap,a),l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(R=this.dataType)==null?void 0:R.clone(u,p+"--data-type-id",n);u.dataType=h||null;const f=(v=this.defaultValue)==null?void 0:v.clone(u,p+"-default-value-id",n);return u.defaultValue=f||null,u}getDataType(){var t;return this.parent.type===i.Operation?this.parent.declaration.inferOutputMapDataType(this):((t=this.declaration)==null?void 0:t.getDataType())||null}};c(Re,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(Re,"MUTABLE_BASE_PROPERTIES",[]),c(Re,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(Re,"BASE_PROPERTIES",[...Re.MUTABLE_BASE_PROPERTIES,...Re.INMUTABLE_BASE_PROPERTIES]),c(Re,"MUTABLE_META_PROPERTIES",[...Re.MUTABLE_BASE_PROPERTIES,"index"]),c(Re,"INMUTABLE_META_PROPERTIES",[...Re.INMUTABLE_BASE_PROPERTIES]),c(Re,"META_PROPERTIES",[...Re.MUTABLE_META_PROPERTIES,...Re.INMUTABLE_META_PROPERTIES]),c(Re,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(Re,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(Re,"UPSTREAM_PROPERTIES",[...Re.MUTABLE_UPSTREAM_PROPERTIES,...Re.INMUTABLE_UPSTREAM_PROPERTIES]),c(Re,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues"]),c(Re,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Re,"DOWNSTREAM_PROPERTIES",[...Re.MUTABLE_DOWNSTREAM_PROPERTIES,...Re.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Re,"PROPERTIES",[...Re.META_PROPERTIES,...Re.UPSTREAM_PROPERTIES,...Re.DOWNSTREAM_PROPERTIES]);let jn=Re;class Z7 extends jn{constructor(t,n){super(t,n);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}class K7 extends jn{constructor(t,n){super(t,n);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}function X7(r){var s;const e=s5(),t=r.toJSON();e.safeParse(t).success,(s=r.dataType)==null||s.validate();const a=[];if(r.id==="company-dto-func-declaration-argument-dcl-id"){const o=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}if(r.id==="manual-hello-world-loop-current-iteration-number-output-map-id"){const o=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}return Be(r.errors,a)}const ge=class ge{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"index");c(this,"required");c(this,"constant",!0);c(this,"type",i.ArgumentDeclaration);c(this,"defaultValue",null);c(this,"dataType",null);c(this,"writesValues",[]);c(this,"implements",null);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.index=e.index,this.name=e.name,this.description=e.description,this.required=e.required,this.constant=!0}static fromGenerationTarget(e,t){const n=S(e.parent),a=t.get(n),s={id:e.id,version:1,name:e.name,type:i.ArgumentDeclaration,index:a.inputs.length,defaultValue:null,description:e.description,required:e.required,constant:!0,implements:null,dataType:null,writesValues:[],parent:a},o=b(s,t);return o.setParent(a),o.initChildren(),o}static validateGenerationTarget(e,t){let n=JSON.parse(JSON.stringify(e));const a=[],s=tt(n,{parent:{list:!1,types:[i.FunctionDeclaration,i.Search,i.Condition]}},t);n=s.modifiedData;const o=Lu(n,t);if(n.parent){const l=t.get(S(n.parent));if(l&&We.includes(l.type)){const p=l.implements;if(p){const u=p.inputs.find(D=>D.name===n.name),h=p.inputs.filter(D=>!l.inputs.find($=>$.type===i.ArgumentDeclaration&&$.name===D.name)),f=l.inputs.filter(D=>D.type===i.ArgumentDeclaration),R=f.find(D=>D.name===n.name),v=f.length?`The parent entity already implements the following arguments: ${q(f.map(D=>`'${D.id}' (${D.name})`),", "," and ")}.`:"The parent entity does not yet have any implemented arguments.",I=h.length?`The parent entity is still missing the following arguments in the implementation: ${q(h.map(D=>`'${D.id}' (${D.name})`),", "," and ")}.`:"The parent entity has all the arguments it needs implemented.";u?R&&a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.ArgumentDeclaration}' with id '${n.id}' should not exist in a parent entity of type '${l.type}' with id '${l.id}' that implements a ${i.ActionDescriptor} with fixed arguments.
|
|
155
155
|
Adding a new argument would make the implementation invalid. An argument with the same name already exists in the parent entity.
|
|
156
156
|
${v}
|
|
157
157
|
${I}`,issue:null})):a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.ArgumentDeclaration}' with id '${n.id}' should not exist in a parent entity of type '${l.type}' with id '${l.id}' that implements a ${i.ActionDescriptor} with fixed arguments.
|
|
@@ -400,7 +400,7 @@ All global 'function-declaration' entity ids are:
|
|
|
400
400
|
The project currently has no global 'function-declaration' entities that can be called as 'function-call' entities.`;a.push(new g({id:`${n.id}--${T.InvalidReference}`,code:T.InvalidReference,severity:E.Error,message:`Entity of type "${i.FunctionCall}" with id "${n.id}", has an invalid reference at the 'declaration' property. The 'declaration' property must be a valid reference to an 'function-declaration' entity.
|
|
401
401
|
References can either be an ID string or an object with exacly four properties: 'id', 'entityId', 'entityType', 'type'.${l}`,issue:null}))}return{errors:a,modifiedData:n}}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new g({id:`${this.id}--${T.InvalidParentUpdate}`,code:T.InvalidParentUpdate,severity:E.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
|
|
402
402
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
403
|
-
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors:t,modifiedData:e}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return this.initialData.calledByEntry.forEach(a=>{const s=S(a),o=this.project.get(s);o&&(this.addEntryCaller(o),e.push(o))}),this.initialData.calledBySuccess.forEach(a=>{const s=S(a),o=this.project.get(s);o&&(this.addSuccessCaller(o),e.push(o))}),this.initialData.calledByError.forEach(a=>{const s=S(a),o=this.project.get(s);o&&(this.addErrorCaller(o),e.push(o))}),{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];this.initialized=!0;const{updated:a,added:s,removed:o}=this.syncMissingFixedInputs(),{updated:l,added:p,removed:u}=this.syncMissingFixedOutputs();return e.push(...a,...l),t.push(...s,...p),n.push(...o,...u),{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a;const e=[this],t=[],n=[];return this.parent===this.project&&this.project.addFunctionCall(this),(a=this.process)==null||a.writesValues.forEach(s=>{s.setValueWriter(this.process),e.push(s)}),this.successCalls.forEach(s=>{s.addSuccessCaller(this),e.push(s)}),this.errorCalls.forEach(s=>{s.addErrorCaller(this),e.push(s)}),this.calledBySuccess.forEach(s=>{s.addSuccessCall(this),e.push(s)}),this.calledByError.forEach(s=>{s.addErrorCall(this),e.push(s)}),this.calledByEntry.forEach(s=>{s.addCall(this),e.push(s)}),{updated:m(e),added:m(t),removed:m(n),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(e){const t=this.inputs.findIndex(n=>n.id===e.id);return t>-1&&this.inputs.splice(t,1),this}addInput(e){return this.inputs.includes(e)?this:(this.inputs.push(e),this)}addOutput(e){return this.outputs.includes(e)?this:(this.outputs.push(e),this)}removeOutput(e){const t=this.outputs.findIndex(n=>n.id===e.id);return t>-1&&this.outputs.splice(t,1),this}addValueReader(e){var t;return(t=this.process)==null||t.addValueReader(e),this}removeValueReader(e){var t;return(t=this.process)==null||t.removeValueReader(e),this}addSuccessCaller(e){return this.calledBySuccess.find(t=>t.id===e.id)||this.calledBySuccess.push(e),this}addErrorCaller(e){return this.calledByError.find(t=>t.id===e.id)||this.calledByError.push(e),this}addEntryCaller(e){return this.calledByEntry.find(t=>t.id===e.id)||this.calledByEntry.push(e),this}addErrorCall(e){return this.errorCalls.find(t=>t.id===e.id)||this.errorCalls.push(e),this}addSuccessCall(e){return this.successCalls.find(t=>t.id===e.id)||this.successCalls.push(e),this}removeCall(e){const t=this.successCalls.findIndex(a=>a.id===e.id);t>-1&&this.successCalls.splice(t,1);const n=this.errorCalls.findIndex(a=>a.id===e.id);return n>-1&&this.errorCalls.splice(n,1),this}removeCaller(e){return this.calledBySuccess=this.calledBySuccess.filter(t=>t.id!==e.id),this.calledByError=this.calledByError.filter(t=>t.id!==e.id),this.calledByEntry=this.calledByEntry.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}setDeclaration(e){return this.declaration=e,this}initChildren(){if(this.initialized)return this;if(this.initialized=!0,this.initialData.declaration.type===i.FunctionDeclaration){const e=b(this.initialData.declaration,this.project);this.declaration=e}else{const e=S(this.initialData.declaration),t=this.project.get(e);this.declaration=t}return this.successCalls=this.initialData.successCalls.map(e=>{const t=b(e,this.project);return t.addSuccessCaller(this),[i.BreakStatement,i.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==i.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.errorCalls=this.initialData.errorCalls.map(e=>{const t=b(e,this.project);return t.addErrorCaller(this),[i.BreakStatement,i.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==i.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.inputs=this.initialData.inputs.map(e=>{const t=b(e,this.project);return t.setParent(this),t.initChildren(),t}),this.initialData.process&&(this.process=b(this.initialData.process,this.project),this.process.setParent(this),this.process.initChildren()),this.initialData.error&&(this.error=b(this.initialData.error,this.project),this.error.setParent(this),this.error.initChildren()),this.afterAllChildrenInitialized(),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.x=e.x||this.x,this.y=e.y||this.y,this}async load(e=V){return await we.repository.load(this.id),this}async create(e=V){return await we.repository.create(this.toShallowJSON()),this}async update(e=V){return await we.repository.update(this.toShallowJSON()),this}async delete(e=V){return await we.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){var s;const n=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.process){const{affected:o,removed:l}=(s=this.process)==null?void 0:s.remove({ignoreUpstream:!0,seenEntities:t});n.push(...o),a.push(...l)}if(this.inputs.forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});n.push(...l),a.push(...p)}),this.outputs.forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});n.push(...l),a.push(...p)}),this.error){const{affected:o,removed:l}=this.error.remove({ignoreUpstream:!0,seenEntities:t});n.push(...o),a.push(...l)}return this.successCalls.forEach(o=>{n.push(o),o.removeCaller(this)}),this.errorCalls.forEach(o=>{n.push(o),o.removeCaller(this)}),e||this.calledBy.forEach(o=>{n.push(o),o.removeCall(this)}),{affected:m(n),removed:m(a)}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.process){const{affected:n}=this.process.restore({seenEntities:e});t.push(...n)}return this.inputs.forEach(n=>{const{affected:a}=n.restore({seenEntities:e});t.push(...a)}),this.outputs.forEach(n=>{const{affected:a}=n.restore({seenEntities:e});t.push(...a)}),this.successCalls.forEach(n=>{t.push(n),n.addSuccessCaller(this)}),this.errorCalls.forEach(n=>{t.push(n),n.addErrorCaller(this)}),this.calledBySuccess.forEach(n=>{t.push(n),n.addSuccessCall(this)}),this.calledByError.forEach(n=>{t.push(n),n.addErrorCall(this)}),this.calledByEntry.forEach(n=>{t.push(n),n.addCall(this)}),{affected:m(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.successCalls.flatMap(n=>n.toFlat(e)),...this.errorCalls.flatMap(n=>n.toFlat(e)),...this.inputs.flatMap(n=>n.toFlat(e)),...this.outputs.flatMap(n=>n.toFlat(e)),...this.process?this.process.toFlat(e):[],...this.error?this.error.toFlat(e):[],...this.calledBy.flatMap(n=>n.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.successCalls.flatMap(n=>n.toFlatIds(e)),...this.errorCalls.flatMap(n=>n.toFlatIds(e)),...this.inputs.flatMap(n=>n.toFlatIds(e)),...this.outputs.flatMap(n=>n.toFlatIds(e))])}toJSON(e=new Set){var t,n;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(a=>a.toJSON(e)),errorCalls:this.errorCalls.map(a=>a.toJSON(e)),calledBySuccess:this.calledBySuccess.map(a=>a.toReference()),calledByError:this.calledByError.map(a=>a.toReference()),calledByEntry:this.calledByEntry.map(a=>a.toReference()),process:(t=this.process)==null?void 0:t.toJSON(e),declaration:this.declaration.toJSON(e),inputs:this.inputs.map(a=>a.toJSON(e)),outputs:this.outputs.map(a=>a.toJSON(e)),parent:this.parent.toReference(),error:(n=this.error)==null?void 0:n.toJSON(e)})}toJSONClone(e=L){var n,a,s,o,l,p,u;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(h=>h.toJSONClone({...e,newId:null})),errorCalls:this.errorCalls.map(h=>h.toJSONClone({...e,newId:null})),calledBySuccess:this.calledBySuccess.map(h=>h.toReference({seenEntityMaps:e.seenEntityMaps})),calledByError:this.calledByError.map(h=>h.toReference({seenEntityMaps:e.seenEntityMaps})),calledByEntry:this.calledByEntry.map(h=>h.toReference({seenEntityMaps:e.seenEntityMaps})),process:(p=this.process)==null?void 0:p.toJSONClone({...e,newId:null}),declaration:this.declaration.toJSONClone({...e,newId:null}),inputs:this.inputs.map(h=>h.toJSONClone({...e,newId:null})),outputs:this.outputs.map(h=>h.toJSONClone({...e,newId:null})),error:(u=this.error)==null?void 0:u.toJSONClone({...e,newId:null}),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,x:this.x,y:this.y,process:this.process?this.process.toReference(e):null,inputs:this.inputs.map(a=>a.toReference(e)),outputs:this.outputs.map(a=>a.toReference(e)),declaration:this.declaration.toReference(e),successCalls:this.successCalls.map(a=>a.toReference(e)),errorCalls:this.errorCalls.map(a=>a.toReference(e)),calledBySuccess:this.calledBySuccess.map(a=>a.toReference(e)),calledByError:this.calledByError.map(a=>a.toReference(e)),calledByEntry:this.calledByEntry.map(a=>a.toReference(e)),error:this.error?this.error.toReference(e):null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.successCalls.flatMap(n=>n.toFlatJSON(e)),...this.errorCalls.flatMap(n=>n.toFlatJSON(e)),...this.inputs.flatMap(n=>n.toFlatJSON(e)),...this.outputs.flatMap(n=>n.toFlatJSON(e)),...this.process?this.process.toFlatJSON(e):[],...this.error?this.error.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===i.Project?void 0:this.parent.id;return{id:this.id,version:this.version,type:this.type,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),declaration:this.declaration.id,parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.successCalls.flatMap(n=>n.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(n=>n.toFlatGenerationTarget(e)),...this.inputs.flatMap(n=>n.toFlatGenerationTarget(e)),...this.outputs.flatMap(n=>n.toFlatGenerationTarget(e)),...this.process?this.process.toFlatGenerationTarget(e):[],...this.error?this.error.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(n=>n.clearErrors()),this.outputs.forEach(n=>n.clearErrors()),this.successCalls.forEach(n=>n.clearErrors()),this.errorCalls.forEach(n=>n.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=Eq(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors()),...this.outputs.flatMap(t=>t.getErrors()),...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(e=null,t=null,n=!0){var R,v;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.FunctionCall,a);s.inputs=[];const l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(R=this.inputs)==null?void 0:R.map((I,D)=>I.clone(u,p+"-input-map-"+D+"-id",n));u.inputs=h;const f=(v=this.outputs)==null?void 0:v.map((I,D)=>I.clone(u,p+"-output-map-"+D+"-id",n));return u.outputs=f,this.error&&(u.error=this.error.clone(u,p+"-error-map-id",n)),this.process&&(u.process=this.process.clone(u,p+"-process-id",n)),u}removeUnrecognizedInputs(){const e=[],t=[],n=[];return this.inputs.forEach(a=>{if(!this.declaration.inputs.find(o=>{var l;return o.id===((l=a.declaration)==null?void 0:l.id)})){const o=a.remove();n.push(...o.removed),e.push(...o.affected)}}),{updated:m(e),added:m(t),removed:m(n),self:this}}removeUnrecognizedOutputs(){const e=[],t=[],n=[];return this.outputs.forEach(a=>{if(!this.declaration.getUniqueReturnDeclarations().find(o=>{var l;return o.id===((l=a.declaration)==null?void 0:l.id)})){const o=a.remove();n.push(...o.removed),e.push(...o.affected)}}),{updated:m(e),added:m(t),removed:m(n),self:this}}syncMissingFixedInputs(){const e=[],t=[],n=[],a=this.declaration.inputs.filter(p=>!this.inputs.find(u=>u.declaration.id===p.id));this.inputs.sort((p,u)=>p.index-u.index),a.forEach(p=>{this.inputs.forEach(f=>{f.index>=p.index&&f.sync({index:f.index+1})});const u={id:M.UUID.uuid(),version:1,type:i.InputMap,declaration:p.toJSON(),readsValue:null,defaultValue:null,index:p.index,name:null,description:null,parent:this.toReference()},h=b(u,this.project);h.setParent(this),h.initChildren(),h.addSelfToProject(),t.push(h)}),this.inputs.sort((p,u)=>p.index-u.index);const{updated:s,added:o,removed:l}=this.removeUnrecognizedInputs();return e.push(...s),t.push(...o),n.push(...l),{updated:m(e),added:m(t),removed:m(n),self:this}}syncMissingFixedOutputs(){const e=[],t=[],n=[],a=[];this.outputs=this.initialData.outputs.map(u=>{const h=b(u,this.project);return a.push(h.index),h.setParent(this),h.initChildren(),h});const s=this.declaration.getUniqueReturnDeclarations().filter(u=>!this.outputs.find(h=>h.declaration.id===u.id));this.outputs.sort((u,h)=>u.index-h.index),s.forEach((u,h)=>{this.outputs.forEach(I=>{I.index>=u.index&&I.index++});const f=a.includes(u.index)?this.outputs.length-1+h:u.index,R={id:M.UUID.uuid(),version:1,type:i.OutputMap,declaration:u.toJSON(),defaultValue:null,writesValues:[],index:f,parent:this.toReference()},v=b(R,this.project);v.setParent(this),v.initChildren(),v.addSelfToProject()}),this.outputs.sort((u,h)=>u.index-h.index);const{updated:o,added:l,removed:p}=this.removeUnrecognizedOutputs();return e.push(...o),t.push(...l),n.push(...p),{updated:m(e),added:m(t),removed:m(n),self:this}}};c(we,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(we,"MUTABLE_BASE_PROPERTIES",[]),c(we,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(we,"BASE_PROPERTIES",[...we.MUTABLE_BASE_PROPERTIES,...we.INMUTABLE_BASE_PROPERTIES]),c(we,"MUTABLE_META_PROPERTIES",["x","y"]),c(we,"INMUTABLE_META_PROPERTIES",[...we.INMUTABLE_BASE_PROPERTIES]),c(we,"META_PROPERTIES",[...we.MUTABLE_META_PROPERTIES,...we.INMUTABLE_META_PROPERTIES]),c(we,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),c(we,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),c(we,"UPSTREAM_PROPERTIES",[...we.MUTABLE_UPSTREAM_PROPERTIES,...we.INMUTABLE_UPSTREAM_PROPERTIES]),c(we,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),c(we,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(we,"DOWNSTREAM_PROPERTIES",[...we.MUTABLE_DOWNSTREAM_PROPERTIES,...we.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(we,"PROPERTIES",[...we.META_PROPERTIES,...we.UPSTREAM_PROPERTIES,...we.DOWNSTREAM_PROPERTIES]);let Xr=we;function zu(r){return r&&typeof r.then=="function"}class Zu{constructor(e){c(this,"order",[]);c(this,"flatRecord",{});c(this,"onGoingVisits",{});this.flatten(e),this.orderEntities()}flatten(e){const t=new Set(np()),n=m(P(e,t,{ignoreBuiltInBaseEntities:!0})),a=new Set;for(const s of n)this.flatRecord[s.id]=s,a.add(s.id);this.order=Array.from(a)}moveEntityAfterDependencies(e){const t=cl(e,this.flatRecord);for(const n of t){const a=this.order.indexOf(n),s=this.order.indexOf(e.id);if(a>s)return this.order.splice(s,1),this.order.splice(a,0,e.id),!0}return!1}orderEntities(){let e=!1;for(let t=0;t<this.order.length;t++){const n=this.order[t],a=this.flatRecord[n];if(this.moveEntityAfterDependencies(a)){e=!0;break}}e&&this.orderEntities()}getUpstreamOngoingDependenciesVisits(e,t){const n=cl(this.flatRecord[e],this.flatRecord),a={};return Object.entries(this.onGoingVisits[t]||{}).forEach(([s,o])=>{Array.from(n).includes(s)&&(a[s]=o)}),a}getDownstreamOngoingDependenciesVisits(e,t){const n=Object.keys(this.onGoingVisits[t]||{}),a=new Set(n.flatMap(o=>Array.from(cl(this.flatRecord[o],this.flatRecord)))),s={};return Array.from(a).forEach(o=>{o===e&&(s[o]=this.onGoingVisits[t][o])}),s}async settlePromises(e,t){const n=Object.values(e);n.length&&await Promise.all(n),Object.keys(e).forEach(a=>{delete this.onGoingVisits[t][a]})}visit(e){const t=this.order;for(const n of t)e(this.flatRecord[n]);return this}reverseVisit(e){const t=this.order.slice().reverse();for(const n of t)e(this.flatRecord[n]);return this}async visitAsync(e){const t=this.order,n=Math.random().toString(36).substring(7);this.onGoingVisits[n]={};for(const a of t){const s=this.getUpstreamOngoingDependenciesVisits(a,n);Object.keys(s).length&&await this.settlePromises(s,n);const o=e(this.flatRecord[a]);zu(o)&&(this.onGoingVisits[n][a]=o)}return await this.settlePromises(this.onGoingVisits[n],n),this.onGoingVisits[n]={},this}async reverseVisitAsync(e){const t=this.order.slice().reverse(),n=Math.random().toString(36).substring(7);this.onGoingVisits[n]={};for(const a of t){const s=this.getDownstreamOngoingDependenciesVisits(a,n);Object.keys(s).length&&await this.settlePromises(s,n);const o=e(this.flatRecord[a]);zu(o)&&(this.onGoingVisits[n][a]=o)}return await this.settlePromises(this.onGoingVisits[n],n),this.onGoingVisits[n]={},this}}function PO(r){var e;switch(r.id){case _["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const t=r.project.entities.filter(p=>!!p.implements.find(u=>u.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));if(t.find(p=>!!p.properties.find(u=>{var h;return u.implements&&u.implements.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=u.getDefaultValue())==null?void 0:h.value)===!0}))){const u=t[0].properties.find(f=>f.implements&&f.implements.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),h=u==null?void 0:u.defaultValue;if(h)h.value=!0;else if(u!=null&&u.dataType){const f=(e=u==null?void 0:u.dataType)==null?void 0:e.id.split("-id")[0],R=b({id:f+"-default-value-id",version:1,type:i.LiteralValue,name:C.EntityTemplate,autogeneration:null,value:!0,valueAsType:null,parent:u==null?void 0:u.dataType.toReference()},r.project);return R.setParent(u==null?void 0:u.dataType),R.initChildren(),R.addSelfToProject(),{newEntities:[R]}}return{newEntities:[]}}const a=r.project.get(_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),s=al(a,"Main database");if(s.errors.length>0)return{newEntities:[]};const o=s.implemented.properties.find(p=>p.implements&&p.implements.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),l=o==null?void 0:o.defaultValue;if(l)l.value=!0;else if(o!=null&&o.dataType){const p=o==null?void 0:o.dataType.id.split("-id")[0],u=b({id:p+"-default-value-id",version:1,type:i.LiteralValue,name:C.EntityTemplate,autogeneration:null,value:!0,valueAsType:null,parent:o==null?void 0:o.dataType.toReference()},r.project);u.setParent(o==null?void 0:o.dataType),u.initChildren(),u.addSelfToProject()}return{newEntities:[s.implemented]}}}return{newEntities:[]}}function AO(r){return r.implements.filter(t=>t.type===i.BuiltInBaseEntity).map(t=>{switch(t.id){case _["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const a=r.project.entities.filter(l=>l.implements.find(p=>p.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)).find(l=>!!l.properties.find(p=>{var u;return p.implements&&p.implements.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((u=p.getDefaultValue())==null?void 0:u.value)===!0}));if(!a)return{newEntities:[]};const s=r.properties.find(l=>l.implements&&l.implements.id===_["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),o=s==null?void 0:s.defaultValue;if(s&&(s!=null&&s.dataType)&&!o){const l=s==null?void 0:s.dataType.id.split("-id")[0],p=b({id:l+"-default-value-id",version:1,type:i.LiteralValue,name:C.EntityTemplate,autogeneration:null,value:null,valueAsType:a,parent:s==null?void 0:s.dataType.toReference()},r.project);return p.setParent(s==null?void 0:s.dataType),p.initChildren(),p.addSelfToProject(),{newEntities:[p]}}return{newEntities:[]}}}}),{newEntities:[]}}function al(r,e,t){const n=t||de(e,i.DefinitionEntity,r.project),a=n.split("-id"),s=a[a.length-1||0]||n,o={id:n,version:1,name:e,type:i.DefinitionEntity,description:null,static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[r],x:0,y:0,parent:r.project},l=Zo(o,r.project);if(l.length>0)return{errors:l,implemented:null,entitiesChanges:{new:[],updated:[],deleted:[]}};const p=PO(r),u=b(o,r.project);u.setParent(r.project),u.initChildren();const h=r.properties.map(v=>{const I=s+"-"+de(w(v,r.project),i.Property,r.project),D=v.clone(u,I);return D.abstract=!1,D.implements=v,D.setParent(u),u.addProperty(D),D}),f=r.abstractMethods.map(v=>{const I=s+de(v.name,i.FunctionDeclaration,r.project),D=v.implementAsFunctionDeclaration(I),O={id:I+"-parent-ref-id",type:i.GenericReference,entityId:n,entityType:i.DefinitionEntity},$={...D,implements:v,parent:O},j=b($,r.project);return u.addMethod(j),j.setParent(u),j.initChildren(),j.implements=v,j});o.properties=h,o.methods=f;const R=AO(u);return{implemented:u,errors:[],entitiesChanges:{new:[u,...p.newEntities,...R.newEntities],updated:[u],deleted:[]}}}function Ku(r,e){return e.entities.find(a=>{const s=a.properties,o=s.map(f=>f.name),l=r.every(f=>o.includes(f)),p=o.filter(f=>!r.includes(f)),u=s.every(f=>!p.includes(f.name)||!f.required);return l&&u})||null}function CO(r,e,t=et.OrDataTypeGroup){const n=[],a=[],s=[],l={id:e.id+"--nested-data-type-id-"+r.id,version:1,type:i.DataType,entity:r.toJSON(),isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:t,parent:e.toReference()},p=b(l,r.project);return a.push(p),p.setParent(e),p.initChildren(),p.setEntity(r),p.addSelfToProject(),{updated:m(n),added:m(a),removed:m(s),self:p}}function Xu(r,e,t,n){const a=[],s=[],o=[];switch(typeof r){case"string":let l=!1;const p=new Date(r);if(p instanceof Date&&!isNaN(p.valueOf())&&(l=!0),l){const u=e.project.getBuiltIn(_[i.PrimitiveEntity][C.Date].id);e.setEntity(u);break}else{const u=e.project.getBuiltIn(_[i.PrimitiveEntity][C.String].id);e.setEntity(u);break}case"number":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Number].id));break;case"boolean":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Boolean].id));break;case"object":if(r===null){e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Null].id));break}else if(Array.isArray(r))if(e.sync({isList:!0}),r.length>0){const u=r.slice(0,5).filter(f=>f!==void 0);if(u.every(f=>typeof f==typeof u[0])&&(typeof u[0]!="object"||u[0]===null))switch(typeof u[0]){case"string":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.String].id));break;case"number":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Number].id));break;case"boolean":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Boolean].id));break;case"object":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Null].id));break}else{const f=[];let R=!1;u.forEach((I,D)=>{if(Array.isArray(I)&&(R=!0),typeof I=="object"&&!Array.isArray(I)&&I!==null){const O=sl(I,e.project,{...t,id:e.id+"--or-child-data-type-entity-id-"+D},n);O.hasCreated&&f.push(O.changeSet.self),a.push(...O.changeSet.updated),s.push(...O.changeSet.added),o.push(...O.changeSet.removed)}});const v=m(f);if(!v.length&&!R){u.forEach(I=>{const D={id:M.UUID.uuid(),version:1,type:i.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:et.OrDataTypeGroup,parent:e.toReference()},O=b(D,e.project);switch(O.setParent(e),O.initChildren(),O.addSelfToProject(),typeof I){case"string":O.setEntity(O.project.getBuiltIn(_[i.PrimitiveEntity][C.String].id));break;case"number":O.setEntity(O.project.getBuiltIn(_[i.PrimitiveEntity][C.Number].id));break;case"boolean":O.setEntity(O.project.getBuiltIn(_[i.PrimitiveEntity][C.Boolean].id));break;case"object":O.setEntity(O.project.getBuiltIn(_[i.PrimitiveEntity][C.Null].id));break}});break}else v.length===1&&!R?e.setEntity(v[0]):u.forEach((I,D)=>{if(typeof I=="object"&&!Array.isArray(I)&&I!==null){const O=Ku(Object.keys(I),e.project);if(O){const $=CO(O||v[0],e,et.OrDataTypeGroup);a.push(...$.updated),s.push(...$.added),o.push(...$.removed)}}else{const O={id:e.id+"--or-child-data-type-id--"+D,version:1,type:i.DataType,entity:null,isList:Array.isArray(I),asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:et.OrDataTypeGroup,parent:e.toReference()},$=b(O,e.project);$.setParent(e),$.initChildren(),$.addSelfToProject();const j=Xu(I,$,{...t,id:e.id+"--or-child-data-type-entity-id-"+D},n);a.push(...j.updated),s.push(...j.added),o.push(...j.removed)}})}}else{const u=sl(r[0],e.project,{...t},n);e.setEntity(u.changeSet.self),a.push(...u.changeSet.updated),s.push(...u.changeSet.added),o.push(...u.changeSet.removed);break}else{const u=sl(r,e.project,{...t},n);e.setEntity(u.changeSet.self),a.push(...u.changeSet.updated),s.push(...u.changeSet.added),o.push(...u.changeSet.removed);break}}return{updated:m(a),added:m(s),removed:m(o),self:e}}function sl(r,e,t,n){const a=[],s=[],o=[],l=Object.keys(r),p=Ku(l,e);if(p)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],self:p}};const u=n?t.name+" of "+n.name:t.name,f={id:t.id||de(u,i.DefinitionEntity,e),version:1,name:u,type:i.DefinitionEntity,description:t.description||null,static:t.static||!1,abstract:t.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:e.toReference()},R=b(f,e);return R.setParent(e),R.initChildren(),R.addSelfToProject(),s.push(R),l.forEach((v,I)=>{const D=de(u+" "+v,i.Property,e),O={id:D,version:1,name:v,type:i.Property,description:null,static:!1,abstract:!1,defaultValue:null,constant:!1,dataType:null,implements:null,index:I,hidden:!1,private:!1,required:!0,parent:R.toReference()},$=b(O,e);$.setParent(R),$.initChildren(),$.addSelfToProject(),s.push($);const j=r[v],oe={id:D+"--data-type-id",version:1,type:i.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parent:$.toReference()},ae=b(oe,e);ae.setParent($),ae.initChildren(),ae.addSelfToProject(),s.push(ae);const Xe=Xu(j,ae,{...t,name:v,id:D+"--data-type-entity-id"},n||R);a.push(...Xe.updated),s.push(...Xe.added),o.push(...Xe.removed)}),{hasCreated:!0,changeSet:{updated:m(a),added:m(s),removed:m(o),self:R}}}function ol(r,e){const t=Qr(r);if(t.length===0)return{list:[],last:null};let n=null;return{list:t.flatMap(s=>{if(s===e)return n=s,[s];const o=ol(s,e);return o.last&&(n=o.last),[s,...o.list]}),last:n}}function wO(r,e,t=new Set){const n=cr(r),a=cr(e),s=n.filter(p=>!a.includes(p)),o=n.filter(p=>a.includes(p)),l=s.reduce((p,u)=>t.has(u.id)?p:(t.add(u.id),m([...p,...wO(u,e,t)])),[]);return m([...o,...l])}function es(r,e){const t=ol(r,e);return t.last===e&&t.list.length>0&&t.list[0]!==e}function Rq(r,e){return!!ol(r,e).last}function gq(r){if(We.includes(r.type))return r;if([...Xt,i.VariableDeclaration].includes(r.type)){const e=r.parent;return We.includes(e.type)?e:null}return null}function Qu(r,e){if(!r||!e)throw new Error("Both entities must be defined to find a common ancestor");if(r===e)return r;const t=r.parent;if(t){if(t===e)return e;if(t.type===i.Project)return null}else return null;const n=e.parent;if(n){if(n===r)return r;if(n.type===i.Project)return null}else return null;return Qu(t,n)}function lt(r){if(ss.includes(r.type)){if(r.type===i.FunctionDeclaration){const e=r.parent;if(e.type===i.DefinitionEntity)return e;if(e.type===i.Loop)return e}return r}else{const e=r.parent;return e?lt(e):null}}function ll(r,e){const t=ts(r,e);if(!t)return null;if(ss.includes(t.type)){if(t.type===i.FunctionDeclaration){const n=ts(t.parent,e);if(n){if(n.type===i.DefinitionEntity)return n;if(n.type===i.Loop)return n}}return t}else{const n=t.parent?ts(t.parent,e):null;return n?ll(n,e):null}}function BO(r){if(!r)return null;if(Xt.includes(r.type))return r;const e=r.parent;return e?BO(e):null}function MO(r){if(!r)return null;if(Je.includes(r.type))return r;const e=r.parent;return e?MO(e):null}function _O(r){if(!r)return null;if(on.includes(r.type))return r;const e=r.parent;return e?_O(e):null}function bq(r){return r.type===i.VariableDeclaration?[r]:Je.includes(r.type)?[...r.inputs,...r.outputs||[]]:xe.includes(r.type)?r.outputs:ii.includes(r.type)||r.type===i.FunctionDeclaration?r.inputs:[]}function vq(r){const e=cr(r),t=[],n=[];Tp.includes(r.type)&&t.push(...ep(r));const a=e.filter(s=>{const o=t.includes(s);return o?!1:Xt.includes(s.type)&&!o?(n.push(s),!1):!0});return t.sort((s,o)=>es(o,s)?-1:0),n.sort((s,o)=>es(o,s)?-1:0),[...t,...n,...a]}function VO(r){return[...r].sort((e,t)=>es(t,e)?-1:0)}function Iq(r){const e=VO(r),t=[];return e.forEach(n=>{const a=t[t.length-1];if(a){const s=a[a.length-1];es(n,s)?t.push([n]):a.push(n)}else t.push([n])}),t}function Pt(r){const e=r.map(t=>lt(t));return m(e)}function ep(r){return Je.includes(r.type)?[...Pt(r.successCalls),...Pt(r.errorCalls)]:We.includes(r.type)?Pt(r.calls):[]}function Dq(r,e){return ep(r).includes(e)}function tp(r){return r.writesValues||[]}function Sq(r,e){return tp(r).includes(e)}function NO(r){var e;return Fe.includes((e=r==null?void 0:r.readsValue)==null?void 0:e.type)?r.readsValue:null}function Oq(r){return r.writesValues}function LO(r=[]){return r.map(NO).filter(e=>!!e)}function dl(r=[]){return r.map(e=>e.writesValues).flat().filter(e=>Fe.includes(e.type))}function GO(r=[]){return r.map(e=>e.readsValue).filter(e=>!!e&&Fe.includes(e.type))}function $O(r){return Fe.includes(r.type)?r:null}function FO(r){return r.writesValues.map($O).filter(e=>!!e)}function UO(r=[]){return r.reduce((e,t)=>t.type===i.OutputMap?[...e,...FO(t)]:e,[])}function Ue(r){return Je.includes(r.type)?[...vn(Pt(r.successCalls)),...vn(Pt(r.errorCalls))]:We.includes(r.type)?vn(Pt(r.calls)):[]}function Pq(r){return Je.includes(r.type)?[...vn(Pt(r.successCalls)),...vn(Pt(r.errorCalls))]:We.includes(r.type)?vn(Pt(r.calls)):[]}function xO(r,e=new Set){return r.writesValues.filter(n=>Fe.includes(n.type)&&!e.has(n.id)).reduce((n,a)=>e.has(a.id)?n:[...n,...Se(a,e)],[])}function jO(r,e=new Set){var n;return(((n=r.readsValue)==null?void 0:n.writesValues)||[]).filter(a=>Fe.includes(a.type)&&!e.has(a.id)).reduce((a,s)=>e.has(s.id)?a:[...a,...Se(s,e)],[])}function Se(r,e=new Set){if(e.has(r.id))return[];if(r.type===i.ReturnStatement)return GO(r.outputs).reduce((n,a)=>[...n,...Se(a,e)],[]);if(r.type===i.FunctionCall||r.type===i.Operation||r.type===i.Condition)return[...Ue(r).reduce((s,o)=>{const l=lt(o);return[...s,...Se(l||o,e)]},[]),...LO(r.inputs),...UO(r.outputs)].reduce((s,o)=>[...s,...Se(o,e)],[]);if(ii.includes(r.type)){const t=dl(r.inputs),a=Ue(r).reduce((s,o)=>{const l=lt(o);return[...s,...Se(l||o,e)]},[]);return t.push(...a),t.reduce((s,o)=>[...s,...Se(o,e)],[])}if(r.type===i.FunctionDeclaration){const t=[...dl(r.inputs)],a=Ue(r).reduce((s,o)=>{const l=lt(o);return[...s,...Se(l||o,e)]},[]);return t.push(...a),t.reduce((s,o)=>[...s,...Se(o)],[])}if(Fe.includes(r.type)){e.add(r.id);const n=Ue(r).reduce((a,s)=>{const o=lt(s);return[...a,...Se(o||s,e)]},[]);return[r,...n,...jO(r,e),...xO(r,e)]}return[]}function Nt(r,e=new Set){return e.has(r.id)?[]:(e.add(r.id),[...cr(r).reduce((a,s)=>[...a,s,...Nt(s,e)],[])])}function vn(r){return r.reduce((e,t)=>t.type===i.ReturnStatement||t.type===i.ContinueStatement||t.type===i.BreakStatement?[...e,t]:[...e,t,...Ue(t)],[])}function kO(r){const e=r.entities||[],t=[...e,...r.functions||[],...r.events||[],...r.projects||[]],n=e.reduce((p,u)=>[...p,...u.properties],[]),a=e.reduce((p,u)=>[...p,...u.methods],[]),s=a.reduce((p,u)=>[...p,...dl(u.inputs),...vn(Pt(u.calls)),...u.returnStatements],[]),o=r.functions.reduce((p,u)=>[...p,...vn(Pt(u.calls)),...u.returnStatements],[]),l=r.events.reduce((p,u)=>[...p,...vn(Pt(u.calls)),...u.returnStatements],[]);return[...t,...n,...a,...s,...o,...l]}function qO(r,e){return e.filter(n=>{if(!n)return!1;switch(n.type){case i.FunctionCall:return n.inputs.find(a=>a.id===r.id)!==void 0||n.outputs.find(a=>a.id===r.id)!==void 0;case i.Condition:return n.successCalls.find(a=>a.id===r.id)!==void 0||n.errorCalls.find(a=>a.id===r.id)!==void 0||n.inputs.find(a=>a.id===r.id)!==void 0;case i.Operation:return n.outputs.find(a=>a.id===r.id)!==void 0;case i.VariableDeclaration:return Je.includes(r.type)?RP(r).find(s=>{var o;return((o=s.readsValue)==null?void 0:o.id)===n.id})!==void 0:!1;case i.DefinitionEntity:return n.properties.find(a=>a.id===r.id)!==void 0||n.methods.find(a=>a.id===r.id)!==void 0;case i.FunctionDeclaration:return n.inputs.find(a=>a.id===r.id)!==void 0||(n.returnStatements.map(a=>a.outputs).flat()||[]).find(a=>a.id===r.id)!==void 0;default:return!1}})}function Aq(r){const e=kO(r.project);return qO(r,e)}function ts(r,e){return r?typeof r=="string"?e[r]:r.type===i.GenericReference?e[r.entityId]:e[r.id]?e[r.id]:null:null}function JO(r,e){const t=[];if(Xt.includes(r.type)){qt(r).forEach(s=>{const o=ll(s,e);o&&t.push(o)});const a=[...r.inputs||[],...r.outputs||[]].map(s=>{const o=ts(s,e);return o?bP(o,e):null}).filter(s=>s!==null);t.push(...m(a))}if(Fe.includes(r.type)){const n=ul(r);n&&t.push(n)}return m(t)}function Qr(r){const e=[];if(Xt.includes(r.type)){r.calledBy.forEach(a=>{const s=lt(a);s&&e.push(s)});const n=[...r.inputs||[],...r.outputs||[]].map(a=>ul(a)).filter(a=>a!==null);e.push(...m(n))}if(Fe.includes(r.type)){const t=ul(r);t&&e.push(t)}return m(e)}function qt(r){return[...r.calledByEntry||[],...r.calledByError||[],...r.calledBySuccess||[]]}function WO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ActionDescriptor)throw new Error("Entity must be an action descriptor to be flattened");return[r,...r.inputs.flatMap(n=>P(n,e,t)),...r.outputs.flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function YO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ArgumentDeclaration)throw new Error("Entity must be an argument declaration to be flattened");return[r,...r.defaultValue?P(r.defaultValue,e):[],...r.writesValues.flatMap(n=>P(n,e,t)),...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function HO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.BreakStatement)throw new Error("Entity must be a break statement to be flattened");return[r,...r.outputs.flatMap(n=>P(n,e,t)),...r.throws?P(r.throws,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function zO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.BuiltInBaseEntity)throw new Error("Entity must be a built-in base entity to be flattened");return[r,...(r.properties||[]).flatMap(n=>P(n,e,t)),...(r.methods||[]).flatMap(n=>P(n,e,t)),...(r.abstractMethods||[]).flatMap(n=>P(n,e,t)),...(r.extends||[]).flatMap(n=>P(n,e,t))]}function ZO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Condition)throw new Error("Entity must be a condition to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function KO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ContinueStatement)throw new Error("Entity must be a continue statement to be flattened");return[r,...r.outputs.flatMap(n=>P(n,e,t)),...r.throws?P(r.throws,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function XO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.DefinitionEntity)throw new Error("Entity must be a definition entity to be flattened");return[r,...(r.extends||[]).flatMap(n=>P(n,e,t)),...(r.implements||[]).flatMap(n=>P(n,e,t)),...(r.properties||[]).flatMap(n=>P(n,e,t)),...(r.methods||[]).flatMap(n=>P(n,e,t)),...(r.abstractMethods||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function QO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.DataType)throw new Error("Entity must be a data type to be flattened");return[r,...(r.andChildrenGroup||[]).flatMap(n=>P(n,e,t)),...(r.orChildrenGroup||[]).flatMap(n=>P(n,e,t)),...r.entity?P(r.entity,e,t):[],...r.parent?P(r.parent,e,t):[]]}function eP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.FunctionCall)throw new Error("Entity must be a function call to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...r.process?P(r.process,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function tP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.FunctionDeclaration)throw new Error("Entity must be a function declaration to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.returnStatements||[]).flatMap(n=>P(n,e,t)),...(r.calls||[]).flatMap(n=>P(n,e,t)),...r.implements?P(r.implements,e,t):[],...r.parent?P(r.parent,e,t):[]]}function nP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.GlobalEvent)throw new Error("Entity must be a global event to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.calls||[]).flatMap(n=>P(n,e,t)),...(r.returnStatements||[]).flatMap(n=>P(n,e,t)),...r.implements?P(r.implements,e,t):[],...r.parent?P(r.parent,e,t):[]]}function rP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.InputMap)throw new Error("Entity must be an input map to be flattened");return[r,...r.readsValue?P(r.readsValue,e,t):[],...r.declaration?P(r.declaration,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...r.parent?P(r.parent,e,t):[]]}function iP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.InstalledProject)throw new Error("Entity must be an installed project to be flattened");return[r,...(r.functions||[]).flatMap(n=>P(n,e,t)),...(r.events||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function aP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.InternalCall)throw new Error("Entity must be an internal call to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...r.process?P(r.process,e,t):[],...r.parent?P(r.parent,e,t):[]]}function sP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.LiteralValue)throw new Error("Entity must be a literal value to be flattened");return[r,...r.valueAsType?Array.isArray(r.valueAsType)?r.valueAsType.flatMap(n=>P(n,e,t)):P(r.valueAsType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function oP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Loop)throw new Error("Entity must be a loop to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...r.process?P(r.process,e,t):[],...r.body?P(r.body,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...(r.breakStatements||[]).flatMap(n=>P(n,e,t)),...(r.continueStatements||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function lP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Operation)throw new Error("Entity must be an operation to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...r.process?P(r.process,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function dP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.OutputMap)throw new Error("Entity must be an output map to be flattened");return[r,...(r.writesValues||[]).flatMap(n=>P(n,e,t)),...r.declaration?P(r.declaration,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...r.parent?P(r.parent,e,t):[]]}function cP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.PrimitiveEntity)throw new Error("Entity must be a primitive entity to be flattened");return[r,...(r.properties||[]).flatMap(n=>P(n,e,t)),...(r.methods||[]).flatMap(n=>P(n,e,t)),...(r.abstractMethods||[]).flatMap(n=>P(n,e,t))]}function uP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Project)throw new Error("Entity must be a project to be flattened");return[r,...(r.entities||[]).flatMap(n=>P(n,e,t)),...(r.functions||[]).flatMap(n=>P(n,e,t)),...(r.events||[]).flatMap(n=>P(n,e,t)),...(r.projects||[]).flatMap(n=>P(n,e,t)),...(r.variableDeclarations||[]).flatMap(n=>P(n,e,t)),...(r.variableInstances||[]).flatMap(n=>P(n,e,t)),...(r.operations||[]).flatMap(n=>P(n,e,t)),...(r.conditions||[]).flatMap(n=>P(n,e,t)),...(r.functionCalls||[]).flatMap(n=>P(n,e,t)),...(r.projects||[]).flatMap(n=>P(n,e,t)),...(r.loops||[]).flatMap(n=>P(n,e,t)),...(r.searches||[]).flatMap(n=>P(n,e,t))]}function pP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Property)throw new Error("Entity must be a property to be flattened");return[r,...r.defaultValue?P(r.defaultValue,e,t):[],...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function yP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ReturnDeclaration)throw new Error("Entity must be a return declaration to be flattened");return[r,...r.readsValue?P(r.readsValue,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function hP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ReturnStatement)throw new Error("Entity must be a return statement to be flattened");return[r,...(r.outputs||[]).flatMap(n=>P(n,e,t)),...r.throws?P(r.throws,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function fP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Search)throw new Error("Entity must be a search to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputsDeclarations||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputsDeclarations||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function mP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ValueDescriptor)throw new Error("Entity must be a value descriptor to be flattened");return[r,...r.defaultValue?P(r.defaultValue,e,t):[],...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function TP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.VariableDeclaration)throw new Error("Entity must be a variable declaration to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...(r.internalCalls||[]).flatMap(n=>P(n,e,t)),...(r.writesValues||[]).flatMap(n=>P(n,e,t)),...r.readsValue?P(r.readsValue,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function EP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.VariableInstance)throw new Error("Entity must be a variable instance to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...(r.internalCalls||[]).flatMap(n=>P(n,e,t)),...(r.writesValues||[]).flatMap(n=>P(n,e,t)),...r.readsValue?P(r.readsValue,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.declaration?P(r.declaration,e,t):[],...r.parent?P(r.parent,e,t):[]]}function np(){const r=new Set;return mg.flatMap(t=>P(t,r)).map(t=>t.id)}function P(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(!r)throw new Error("Entity must be defined to be flattened");if(r.type===i.GenericReference)return[];if(t.ignoreBuiltInBaseEntities&&(Jn.includes(r.type)||np().includes(r.id)))return[];if(e.has(r.id))return[];switch(r.type){case i.FunctionCall:return eP(r,e,t);case i.Operation:return lP(r,e,t);case i.Condition:return ZO(r,e,t);case i.Loop:return oP(r,e,t);case i.Search:return fP(r,e,t);case i.GlobalEvent:return nP(r,e,t);case i.ReturnStatement:return hP(r,e,t);case i.ContinueStatement:return KO(r,e,t);case i.BreakStatement:return HO(r,e,t);case i.VariableDeclaration:return TP(r,e,t);case i.DefinitionEntity:return XO(r,e,t);case i.FunctionDeclaration:return tP(r,e,t);case i.Project:return uP(r,e,t);case i.ActionDescriptor:return WO(r,e,t);case i.ArgumentDeclaration:return YO(r,e,t);case i.ReturnDeclaration:return yP(r,e,t);case i.ValueDescriptor:return mP(r,e,t);case i.InputMap:return rP(r,e,t);case i.OutputMap:return dP(r,e,t);case i.DataType:return QO(r,e,t);case i.InstalledProject:return iP(r,e,t);case i.InternalCall:return aP(r,e,t);case i.LiteralValue:return sP(r,e,t);case i.Property:return pP(r,e,t);case i.VariableInstance:return EP(r,e,t);case i.BuiltInBaseEntity:return t.ignoreBuiltInBaseEntities?[]:zO(r,e,t);case i.PrimitiveEntity:return t.ignoreBuiltInBaseEntities?[]:cP(r,e,t)}return[]}function cl(r,e){if(Jn.includes(r.type))return new Set;const t=JO(r,e),n=new Set(t.map(a=>a.id));if(r.type===i.LiteralValue&&r.valueAsType&&(Array.isArray(r.valueAsType)?r.valueAsType.forEach(a=>{n.add(a.id)}):n.add(r.valueAsType.id)),r.type===i.DataType&&r.entity&&(r.entity.type===i.DefinitionEntity?(r.entity.parent.entityId||r.entity.parent.id)!==r.id&&n.add(r.entity.id):n.add(r.entity.id)),fp.includes(r.type)){const a=r.parent;a&&(a.type===i.GenericReference?n.add(a.entityId):n.add(a.id))}if(mp.includes(r.type)){const a=r.implements;a&&(a.type===i.GenericReference?n.add(a.entityId):n.add(a.id))}if(gl.includes(r.type)){const a=r.declaration;a&&(a.type===i.GenericReference?n.add(a.entityId):n.add(a.id))}if(Sn.includes(r.type)){const a=r.readsValue;a&&(a.type===i.GenericReference?n.add(a.entityId):n.add(a.id))}if(Xt.includes(r.type)){const a=[...r.calledBySuccess||[],...r.calledByEntry||[],...r.calledByError||[]];a.length&&a.forEach(s=>{s.type===i.GenericReference?n.add(s.entityId):n.add(s.id)})}return n}function rp(r){return r.type===i.FunctionCall||r.type===i.InternalCall||[i.Operation,i.Condition,i.Loop].includes(r.type)?r.declaration.inputs:r.type===i.FunctionDeclaration||ii.includes(r.type)?r.inputs:r.type===i.Search?r.inputsDeclarations:[]}function Cq(r,e){return e.type===i.Condition?e.inputs.find(t=>t.declaration.id===r.id):e.type===i.FunctionCall||e.type===i.Operation?e.inputs.find(t=>t.declaration.id===r.id):null}function RP(r){return Je.includes(r.type)?r.inputs:[]}function gP(r){var e;return r.type===i.FunctionCall?((e=r.declaration.returnStatements[0])==null?void 0:e.outputs)||[]:[i.Operation,i.Condition,i.Loop].includes(r.type)?r.declaration.outputs:r.type===i.Search?r.outputsDeclarations:xe.includes(r.type)?r.outputs:[]}function wq(r,e){return e.type===i.Condition?null:e.type===i.FunctionCall||e.type===i.Operation?e.outputs.find(t=>t.declaration.id===r.id):null}function Bq(r){return r.type===i.Condition?[]:Je.includes(r.type)?r.outputs:[]}function ul(r){const e=r.readsValue;return e?lt(e):null}function bP(r,e){const t=r.readsValue;return t?ll(t,e):null}function vP(r){const e=r.internalCalls||[];return m(Pt(m(e.flatMap(t=>[...t.successCalls,...t.errorCalls]))))}function Hi(r){const e=tp(r),t=[];return e.forEach(n=>{if(Fe.includes(n.type))t.push(n);else if(Sn.includes(n.type)){const a=n.parent;t.push(a)}}),t}function m(r){const e=new Set;return r.filter(t=>!t||e.has(t.id)?!1:(e.add(t.id),!0))}function cr(r,e=!1){const t=[];if(r.type===i.Project&&t.push(...(r==null?void 0:r.entities)||[],...(r==null?void 0:r.functions)||[],...(r==null?void 0:r.variableDeclarations)||[],...(r==null?void 0:r.variableInstances)||[],...(r==null?void 0:r.searches)||[],...(r==null?void 0:r.loops)||[],...(r==null?void 0:r.operations)||[],...(r==null?void 0:r.conditions)||[],...(r==null?void 0:r.functionCalls)||[],...(r==null?void 0:r.events)||[],...(r==null?void 0:r.projects)||[]),pt.includes(r.type)&&t.push(...(r==null?void 0:r.detachedChildren)||[]),r.type===i.DefinitionEntity){const n=[...r.suggestedMethods,...r.methods].flatMap(a=>a.collapsed&&e?[]:cr(a));t.push(...n)}if(r.type===i.Condition){const n=r.successCalls.map(s=>lt(s)),a=r.errorCalls.map(s=>lt(s));t.push(...n,...a)}if(ii.includes(r.type)){if(r.collapsed&&e)return[];const n=r.inputs.map(s=>Hi(s)).flat(),a=r.calls.map(s=>lt(s));t.push(...m(n),...a)}if(Je.includes(r.type)&&r.type!==i.Condition&&r.type!==i.Loop){const n=r==null?void 0:r.outputs.map(o=>Hi(o)).flat(),a=r.successCalls.map(o=>lt(o)),s=r.errorCalls.map(o=>lt(o));t.push(...m(n),...a,...s)}if(Fe.includes(r.type)){const n=Hi(r),a=vP(r);t.push(...n,...a)}if(r.type===i.Loop){const n=r.outputs.map(o=>Hi(o)).flat();if(r.body){const o=cr(r.body,e);t.push(...o)}const a=r.errorCalls.map(o=>lt(o)),s=r.successCalls.map(o=>lt(o));t.push(...m(n),...s,...a)}if(r.type===i.FunctionDeclaration){if(r.collapsed&&e)return[];const n=r.inputs.map(s=>Hi(s)).flat(),a=r.calls.map(s=>lt(s));t.push(...m(n),...a)}return m(t)}function IP(r,e=!1){const t=cr(r,e),n=[...t,...t.reduce((a,s)=>[...a,...IP(s,e)],[])];return m(n)}function DP(r){const e=Qr(r),t=[...e,...e.reduce((n,a)=>[...n,...DP(a)],[])];return m(t)}function pl(r){return r.implements.reduce((e,t)=>t.type===i.DefinitionEntity?[...e,i.DefinitionEntity,...pl(t),...yl(t)]:[...e,t.name],[])}function yl(r){return r.extends.reduce((e,t)=>t.type===i.DefinitionEntity?[...e,i.DefinitionEntity,...yl(t),...pl(t)]:[...e,t.name],[])}function ip(r){return r.extends.reduce((e,t)=>t.type===i.DefinitionEntity?[...e,t,...ip(t),...ap(t)]:[...e,t],[])}function ap(r){return r.implements.reduce((e,t)=>t.type===i.DefinitionEntity?[...e,t,...ap(t),...ip(t)]:[...e,t],[])}function sp(r){return[...yl(r),...pl(r)].filter((t,n,a)=>a.indexOf(t)===n)}function SP(r){return r.implements.length===0&&r.extends.length===0?null:r.implements.find(n=>n.type===i.BuiltInBaseEntity&&n.name===U.PERSISTED_ENTITY)?r:[...r.implements,...r.extends].reduce((n,a)=>{if(a.type===i.DefinitionEntity){const s=SP(a);if(s)return s}return n},null)}function Mq(r){const e=r.extends.find(t=>t.type===i.BuiltInBaseEntity);return e&&e.type===i.BuiltInBaseEntity?e:null}function _q(r){const e=r.implements.find(t=>t.type===i.BuiltInBaseEntity);return e&&e.type===i.BuiltInBaseEntity?e:null}function op(r){const e=r.extends.find(t=>t.type===i.DefinitionEntity);return e&&e.type===i.DefinitionEntity?e:null}function ur(r){const e=[...r.implements,...r.extends].reduce((t,n)=>n.type===i.BuiltInBaseEntity?[...t,n]:n.type===i.DefinitionEntity?[...t,...ur(n)]:t,[]);return m(e)}function lp(r){return r.type===i.PrimitiveEntity?!0:r.type===i.BuiltInBaseEntity?r.interactive:!ur(r).find(n=>!n.interactive)}function Vq(r){return r.parent===r.project&&r.project.variableDeclarations.includes(r)}function dp(r){return r.parent!==r.project?!1:i.VariableDeclaration===r.type?r.project.variableDeclarations.includes(r):i.VariableInstance===r.type?r.project.variableInstances.includes(r):i.FunctionCall===r.type?r.project.functionCalls.includes(r):i.Condition===r.type?r.project.conditions.includes(r):i.Operation===r.type?r.project.operations.includes(r):i.Loop===r.type?r.project.loops.includes(r):i.Search===r.type?r.project.searches.includes(r):!1}function OP(r){if([...We,i.DefinitionEntity,i.InstalledProject,i.Project].includes(r.type)||dp(r))return!1;const e=Qr(r);return e.length===0?!0:e.some(t=>OP(t))}function cp(r){return[...We,i.DefinitionEntity,i.InstalledProject,i.Project].includes(r.type)||dp(r)?!1:Qr(r).length===0}function PP(r,e=0){if(cp(r)){const t=Qr(r);return t.length===0?r:t.map(a=>PP(a,e+1)).reduce((a,s)=>a?s&&s.x<a.x?s:a:s,null)}return null}function AP(r){const e=[];if(cp(r))e.push(r);else return[];return Qr(r).forEach(n=>{e.push(...AP(n))}),e}function CP(r){return r.type===i.FunctionDeclaration&&r.parent!==r.project&&!![i.DefinitionEntity,i.Loop,i.InstalledProject].includes(r.parent.type)}function Nq(r,e){const t=new Map;return r.forEach(n=>{t.set(n.id,n)}),e.forEach(n=>{t.set(n.id,n)}),Array.from(t.values())}function hl(r){switch(r){case i.DefinitionEntity:return ei;case i.FunctionDeclaration:return jr;case i.VariableDeclaration:return sn;case i.VariableInstance:return Wr;case i.FunctionCall:return Xr;case i.Operation:return kr;case i.Condition:return Jr;case i.ReturnStatement:return Zr;case i.Loop:return qr;case i.Search:return Yr;case i.InputMap:return xn;case i.OutputMap:return jn;case i.ArgumentDeclaration:return zr;case i.ReturnDeclaration:return kt;case i.Property:return xr;case i.InstalledProject:return Hr;case i.Project:return M;case i.BuiltInBaseEntity:return In;default:return null}}function At(r,e){if(pt.includes(r.type))return r;if(Jn.includes(r.type))return null;const t=r.parent;if(!t)return null;if(t.type===i.GenericReference){const n=S(t);if(!n)return null;const a=e.get(n);return a?At(a,e):null}else return t===e?e:At(t,e)}function up(r,e){if(Jn.includes(r.type)||e.getBuiltIn(r.id))return null;const t=Lt(r.parent,e);return t?t===e?pt.includes(r.type)?r:null:t.type===i.DefinitionEntity?r:up(t,e):null}function fl(r,e,t){if(r===e||e===t||r===t)return!1;const n=At(e.parent,t);return n===r?!0:fl(n,e,t)}var ml=(r=>(r.SameBothLocal="same-both-local",r.AInB="a-in-b",r.BInA="b-in-a",r.ParallelInCommonParent="parallel-in-common-parent",r.ParallelInProject="parallel-in-project",r.AIsGlobalBIsNot="a-is-global-b-is-not",r.BIsGlobalAIsNot="b-is-global-a-is-not",r.SameBothGlobal="same-both-global",r))(ml||{});function ns(r,e,t){const n=At(r,t),a=At(e,t);if(!n)throw new Error("Could not find scope owner for the entity: "+r.id);if(!a)throw new Error("Could not find scope owner for the entity: "+e.id);if(n===a&&n.type!==i.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:n};if(n===a&&n.type===i.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:n};if(n.type===i.Project&&a.type!==i.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:n};if(n.type!==i.Project&&a.type===i.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:a};if(fl(n,a,t))return{compatible:!0,type:"b-in-a",commonAncestorScope:n};if(fl(a,n,t))return{compatible:!0,type:"a-in-b",commonAncestorScope:a};const l=Qu(n,a);return l===t?{compatible:!1,type:"parallel-in-project",commonAncestorScope:l}:l?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:At(l,t)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:t}}function wP(r,e,t){const n=ns(r,e,t);if(!n.compatible||n.type!=="same-both-local")return null;if(r===e)return r;let a=At(r.parent,t);if(a){if(a===e)return e;if(a.type===i.Project)return r}else return r;for(;a;){if(a){if(a===e)return e;if(a.type===i.Project)return r}else return r;a=At(a.parent,t)}let s=At(e.parent,t);if(s){if(s===r)return r;if(s.type===i.Project)return e}else return e;for(;s;){if(s){if(s===r)return r;if(s.type===i.Project)return e}else return e;s=At(s.parent,t)}return null}function BP(r){return r.length===0?null:r.length===1?r[0]:r.reduce((t,n)=>{const a=wP(t,n,n.project);return!a||a===n?t:n},r[0])}function Lt(r,e){if(!r)return null;let t;return typeof r=="string"?t=r:r.type===i.GenericReference?t=S(r):t=r.id,t===e.id?e:e.get(t)}function pr(r){if(!r)return null;if(Jn.includes(r.type))return r;if(r.type===i.Project)return null;if(r.project.getBuiltIn(r.id))return r;const e=r.parent;return!e||e.type===i.Project?null:pr(e)}function Lq(r,e){var t;if(r.readsValue){const n=Lt(r.readsValue,e.project);e.setValueWriter(n),n.addValueReader(e)}else r.readsValue===null&&((t=e.readsValue)==null||t.removeValueReader(e),e.readsValue=null);return e}function rs(r){const e=[];function t(s,o){return e.some(l=>l.blockedByCaller===s&&l.blockedByCalling===o)}function n(s,o){t(s,o)||e.push({blockedByCaller:s,blockedByCalling:o})}const a=up(r,r.project);return r.calledBySuccess.forEach(s=>{[...s.successCalls||[]].forEach(p=>{xe.includes(p.type)&&p!==r&&(Ue(r).find(f=>f===p)||n(s,p))});let l;if(Je.includes(s.type)&&(l=s),l){const p=rs(l);p.reachable||Ue(r).find(f=>f===s)||p.blocks.forEach(f=>{n(s,f.blockedByCalling)})}}),r.calledByError.forEach(s=>{[...s.errorCalls||[]].forEach(p=>{xe.includes(p.type)&&p!==r&&(Ue(r).find(f=>f===p)||n(s,p))});let l;if(Je.includes(s.type)&&(l=s),l){const p=rs(l);p.reachable||Ue(r).find(f=>f===s)||p.blocks.forEach(f=>{n(s,f.blockedByCalling)})}}),r.calledByEntry.forEach(s=>{if([...s.calls||[]].forEach(p=>{xe.includes(p.type)&&p!==r&&(Ue(r).find(f=>f===p)||n(s,p))}),s===a)return;let l;if(s.type===i.FunctionDeclaration){const p=lt(s);if(p.type===i.DefinitionEntity)return;p.type===i.Loop&&(l=p)}if(l){const p=rs(l);p.reachable||p.blocks.forEach(u=>{n(s,u.blockedByCalling)})}}),{reachable:e.length===0,entryPoint:a,blocks:e}}function Gq(r){return ss.includes(r.type)?r.type===i.FunctionDeclaration?!CP(r):!0:!1}function $q(r){if(i.ActionDescriptor===r.type){if(r.project.operationDeclarations.find(s=>s.id===r.id))return i.Operation;if(r.project.globalEventActionDescriptors.find(s=>s.id===r.id))return i.GlobalEvent;if(r.project.loopDeclarations.find(s=>s.id===r.id))return i.Loop;if(r.project.conditionDeclarations.find(s=>s.id===r.id))return i.Condition}return r.type}function zi(r,e){if(r.type!==i.DefinitionEntity||r.abstract)return!1;const t=op(r)||r;return!!sp(t).includes(e)}function Fq(r){const e=[];return r.entities.forEach(t=>{if(zi(t,U.PERSISTED_ENTITY)){e.push(t);return}}),m(e)}function Uq(r){const e=[];return r.entities.forEach(t=>{if(zi(t,U.RELATIONAL_DATABASE)){e.push(t);return}}),m(e)}function xq(r){return r.type!==i.DefinitionEntity||r.abstract||!zi(r,U.PERSISTED_ENTITY)?null:(r==null?void 0:r.properties.find(t=>{var n;return((n=t.implements)==null?void 0:n.id)===_[i.BuiltInBaseEntity][U.PERSISTED_ENTITY].properties.primaryKey.id&&!t.abstract}))||null}function jq(r){if(r.type!==i.DefinitionEntity)return[];if(r.abstract)return[];if(!zi(r,U.PERSISTED_ENTITY))return[];const e=[],t=r.properties.filter(n=>{var a;return((a=n.implements)==null?void 0:a.id)!==_[i.BuiltInBaseEntity][U.PERSISTED_ENTITY].properties.database.id&&!n.abstract});return e.push(...t),e}function kq(r){var t;if(!r||r.type!==i.DefinitionEntity||!zi(r,U.PERSISTED_ENTITY))return null;const e=r.properties.find(n=>{var a;return((a=n.implements)==null?void 0:a.id)===_[i.BuiltInBaseEntity][U.PERSISTED_ENTITY].properties.database.id});return(t=e==null?void 0:e.getDefaultValue())==null?void 0:t.valueAsType}function He(r,e){var n;if(!Rp.includes(e.type)||!r)return e.project||null;let t=e.project;return r.type===i.Project?t=r:((n=e.project)==null?void 0:n.id)!==r.project.id&&(t=r.project),t}function qq(r,e){const t=[];if(r.parent)if(r.id===r.parent)t.push(new g({id:`${r.id}--${r.parent}--${T.SelfReference}`,code:T.SelfReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const n=e.get(r.parent);n?[i.Project,i.DataType].includes(n.type)||t.push(new g({id:`${r.id}--${r.parent}--${T.InvalidParentReference}`,code:T.InvalidParentReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):t.push(new g({id:`${r.id}--${r.parent}--${T.ReferencedEntityNotFound}`,code:T.ReferencedEntityNotFound,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return r.implements&&Array.isArray(r.implements)?r.implements.forEach(n=>{if(r.id===n){t.push(new g({id:`${r.id}--${n}--${T.SelfReference}`,code:T.SelfReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at one of the 'implements' references. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));return}const a=e.get(n);a?[i.DefinitionEntity,i.BuiltInBaseEntity].includes(a.type)?a.abstract||t.push(new g({id:`${r.id}--${n}--${T.InvalidImplementsReference}`,code:T.InvalidImplementsReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):t.push(new g({id:`${r.id}--${n}--${T.InvalidImplementsReference}`,code:T.InvalidImplementsReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):t.push(new g({id:`${r.id}--${n}--${T.ReferencedEntityNotFound}`,code:T.ReferencedEntityNotFound,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${n}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):t.push(new g({id:`${r.id}--${B.InvalidObjectStructure}`,code:B.InvalidObjectStructure,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' property that isn't an array.`,issue:null})),r.extends&&Array.isArray(r.extends)&&r.extends.forEach(n=>{const a=e.get(n);a?[i.DefinitionEntity,i.BuiltInBaseEntity].includes(a.type)?a.abstract&&t.push(new g({id:`${r.id}--${n}--${T.InvalidExtendsReference}`,code:T.InvalidExtendsReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to a non-abstract entity. Did you want to use the property 'implements', which holds a list of references to absract entities, instead?`,issue:null})):t.push(new g({id:`${r.id}--${n}--${T.InvalidExtendsReference}`,code:T.InvalidExtendsReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):t.push(new g({id:`${r.id}--${n}--${T.ReferencedEntityNotFound}`,code:T.ReferencedEntityNotFound,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${n}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),t}const De=class De{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"x");c(this,"y");c(this,"static");c(this,"abstract");c(this,"type",i.DefinitionEntity);c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"implements",[]);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"suggestedProperties",[]);c(this,"suggestedMethods",[]);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.name=e.name,this.description=e.description,this.x=e.x,this.y=e.y,this.static=e.static,this.abstract=e.abstract}static fromGenerationTarget(e,t){let n=t;if(e.parent){const p=S(e.parent);n=t.get(p)}const a=[];e.implements&&e.implements.forEach(p=>{a.push(t.get(p)||t.getBuiltIn(p))});const s=[];e.extends&&e.extends.forEach(p=>{s.push(t.get(p)||t.getBuiltIn(p))});const o={id:e.id,version:1,name:e.name,type:i.DefinitionEntity,description:e.description,static:e.static,abstract:e.abstract,properties:[],methods:[],abstractMethods:[],extends:s,implements:a,x:0,y:0,parent:n},l=b(o,t);return l.setParent(n),l.initChildren(),l}static validateGenerationTarget(e,t){let n=JSON.parse(JSON.stringify(e));const a=[],s=qq(n,t),o=Zo(n,t);a.push(...s,...o,...je(n));const l=n.parent?t.get(n.parent):null;if(l&&l.type===i.DataType){const p=l;p.entity&&a.push(new g({id:`${e.id}--${T.NewEntityWouldOverriteExisting}`,code:T.NewEntityWouldOverriteExisting,severity:E.Error,message:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${p.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
|
|
403
|
+
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors:t,modifiedData:e}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return this.initialData.calledByEntry.forEach(a=>{const s=S(a),o=this.project.get(s);o&&(this.addEntryCaller(o),e.push(o))}),this.initialData.calledBySuccess.forEach(a=>{const s=S(a),o=this.project.get(s);o&&(this.addSuccessCaller(o),e.push(o))}),this.initialData.calledByError.forEach(a=>{const s=S(a),o=this.project.get(s);o&&(this.addErrorCaller(o),e.push(o))}),{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];this.initialized=!0;const{updated:a,added:s,removed:o}=this.syncMissingFixedInputs(),{updated:l,added:p,removed:u}=this.syncMissingFixedOutputs();return e.push(...a,...l),t.push(...s,...p),n.push(...o,...u),{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a;const e=[this],t=[],n=[];return this.parent===this.project&&this.project.addFunctionCall(this),(a=this.process)==null||a.writesValues.forEach(s=>{s.setValueWriter(this.process),e.push(s)}),this.successCalls.forEach(s=>{s.addSuccessCaller(this),e.push(s)}),this.errorCalls.forEach(s=>{s.addErrorCaller(this),e.push(s)}),this.calledBySuccess.forEach(s=>{s.addSuccessCall(this),e.push(s)}),this.calledByError.forEach(s=>{s.addErrorCall(this),e.push(s)}),this.calledByEntry.forEach(s=>{s.addCall(this),e.push(s)}),{updated:m(e),added:m(t),removed:m(n),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(e){const t=this.inputs.findIndex(n=>n.id===e.id);return t>-1&&this.inputs.splice(t,1),this}addInput(e){return this.inputs.includes(e)?this:(this.inputs.push(e),this)}addOutput(e){return this.outputs.includes(e)?this:(this.outputs.push(e),this)}removeOutput(e){const t=this.outputs.findIndex(n=>n.id===e.id);return t>-1&&this.outputs.splice(t,1),this}addValueReader(e){var t;return(t=this.process)==null||t.addValueReader(e),this}removeValueReader(e){var t;return(t=this.process)==null||t.removeValueReader(e),this}addSuccessCaller(e){return this.calledBySuccess.find(t=>t.id===e.id)||this.calledBySuccess.push(e),this}addErrorCaller(e){return this.calledByError.find(t=>t.id===e.id)||this.calledByError.push(e),this}addEntryCaller(e){return this.calledByEntry.find(t=>t.id===e.id)||this.calledByEntry.push(e),this}addErrorCall(e){return this.errorCalls.find(t=>t.id===e.id)||this.errorCalls.push(e),this}addSuccessCall(e){return this.successCalls.find(t=>t.id===e.id)||this.successCalls.push(e),this}removeCall(e){const t=this.successCalls.findIndex(a=>a.id===e.id);t>-1&&this.successCalls.splice(t,1);const n=this.errorCalls.findIndex(a=>a.id===e.id);return n>-1&&this.errorCalls.splice(n,1),this}removeCaller(e){return this.calledBySuccess=this.calledBySuccess.filter(t=>t.id!==e.id),this.calledByError=this.calledByError.filter(t=>t.id!==e.id),this.calledByEntry=this.calledByEntry.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}setDeclaration(e){return this.declaration=e,this}initChildren(){if(this.initialized)return this;if(this.initialized=!0,this.initialData.declaration.type===i.FunctionDeclaration){const e=b(this.initialData.declaration,this.project);this.declaration=e}else{const e=S(this.initialData.declaration),t=this.project.get(e);this.declaration=t}return this.successCalls=this.initialData.successCalls.map(e=>{const t=b(e,this.project);return t.addSuccessCaller(this),[i.BreakStatement,i.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==i.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.errorCalls=this.initialData.errorCalls.map(e=>{const t=b(e,this.project);return t.addErrorCaller(this),[i.BreakStatement,i.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==i.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.inputs=this.initialData.inputs.map(e=>{const t=b(e,this.project);return t.setParent(this),t.initChildren(),t}),this.initialData.process&&(this.process=b(this.initialData.process,this.project),this.process.setParent(this),this.process.initChildren()),this.initialData.error&&(this.error=b(this.initialData.error,this.project),this.error.setParent(this),this.error.initChildren()),this.afterAllChildrenInitialized(),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.x=e.x||this.x,this.y=e.y||this.y,this}async load(e=V){return await we.repository.load(this.id),this}async create(e=V){return await we.repository.create(this.toShallowJSON()),this}async update(e=V){return await we.repository.update(this.toShallowJSON()),this}async delete(e=V){return await we.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){var s;const n=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.process){const{affected:o,removed:l}=(s=this.process)==null?void 0:s.remove({ignoreUpstream:!0,seenEntities:t});n.push(...o),a.push(...l)}if(this.inputs.forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});n.push(...l),a.push(...p)}),this.outputs.forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});n.push(...l),a.push(...p)}),this.error){const{affected:o,removed:l}=this.error.remove({ignoreUpstream:!0,seenEntities:t});n.push(...o),a.push(...l)}return this.successCalls.forEach(o=>{n.push(o),o.removeCaller(this)}),this.errorCalls.forEach(o=>{n.push(o),o.removeCaller(this)}),e||this.calledBy.forEach(o=>{n.push(o),o.removeCall(this)}),{affected:m(n),removed:m(a)}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.process){const{affected:n}=this.process.restore({seenEntities:e});t.push(...n)}return this.inputs.forEach(n=>{const{affected:a}=n.restore({seenEntities:e});t.push(...a)}),this.outputs.forEach(n=>{const{affected:a}=n.restore({seenEntities:e});t.push(...a)}),this.successCalls.forEach(n=>{t.push(n),n.addSuccessCaller(this)}),this.errorCalls.forEach(n=>{t.push(n),n.addErrorCaller(this)}),this.calledBySuccess.forEach(n=>{t.push(n),n.addSuccessCall(this)}),this.calledByError.forEach(n=>{t.push(n),n.addErrorCall(this)}),this.calledByEntry.forEach(n=>{t.push(n),n.addCall(this)}),{affected:m(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.successCalls.flatMap(n=>n.toFlat(e)),...this.errorCalls.flatMap(n=>n.toFlat(e)),...this.inputs.flatMap(n=>n.toFlat(e)),...this.outputs.flatMap(n=>n.toFlat(e)),...this.process?this.process.toFlat(e):[],...this.error?this.error.toFlat(e):[],...this.calledBy.flatMap(n=>n.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.successCalls.flatMap(n=>n.toFlatIds(e)),...this.errorCalls.flatMap(n=>n.toFlatIds(e)),...this.inputs.flatMap(n=>n.toFlatIds(e)),...this.outputs.flatMap(n=>n.toFlatIds(e))])}toJSON(e=new Set){var t,n;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(a=>a.toJSON(e)),errorCalls:this.errorCalls.map(a=>a.toJSON(e)),calledBySuccess:this.calledBySuccess.map(a=>a.toReference()),calledByError:this.calledByError.map(a=>a.toReference()),calledByEntry:this.calledByEntry.map(a=>a.toReference()),process:(t=this.process)==null?void 0:t.toJSON(e),declaration:this.declaration.toJSON(e),inputs:this.inputs.map(a=>a.toJSON(e)),outputs:this.outputs.map(a=>a.toJSON(e)),parent:this.parent.toReference(),error:(n=this.error)==null?void 0:n.toJSON(e)})}toJSONClone(e=L){var n,a,s,o,l,p,u;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(h=>h.toJSONClone({...e,newId:null})),errorCalls:this.errorCalls.map(h=>h.toJSONClone({...e,newId:null})),calledBySuccess:this.calledBySuccess.map(h=>h.toReference({seenEntityMaps:e.seenEntityMaps})),calledByError:this.calledByError.map(h=>h.toReference({seenEntityMaps:e.seenEntityMaps})),calledByEntry:this.calledByEntry.map(h=>h.toReference({seenEntityMaps:e.seenEntityMaps})),process:(p=this.process)==null?void 0:p.toJSONClone({...e,newId:null}),declaration:this.declaration.toJSONClone({...e,newId:null}),inputs:this.inputs.map(h=>h.toJSONClone({...e,newId:null})),outputs:this.outputs.map(h=>h.toJSONClone({...e,newId:null})),error:(u=this.error)==null?void 0:u.toJSONClone({...e,newId:null}),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,x:this.x,y:this.y,process:this.process?this.process.toReference(e):null,inputs:this.inputs.map(a=>a.toReference(e)),outputs:this.outputs.map(a=>a.toReference(e)),declaration:this.declaration.toReference(e),successCalls:this.successCalls.map(a=>a.toReference(e)),errorCalls:this.errorCalls.map(a=>a.toReference(e)),calledBySuccess:this.calledBySuccess.map(a=>a.toReference(e)),calledByError:this.calledByError.map(a=>a.toReference(e)),calledByEntry:this.calledByEntry.map(a=>a.toReference(e)),error:this.error?this.error.toReference(e):null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.successCalls.flatMap(n=>n.toFlatJSON(e)),...this.errorCalls.flatMap(n=>n.toFlatJSON(e)),...this.inputs.flatMap(n=>n.toFlatJSON(e)),...this.outputs.flatMap(n=>n.toFlatJSON(e)),...this.process?this.process.toFlatJSON(e):[],...this.error?this.error.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===i.Project?void 0:this.parent.id;return{id:this.id,version:this.version,type:this.type,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),declaration:this.declaration.id,parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.successCalls.flatMap(n=>n.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(n=>n.toFlatGenerationTarget(e)),...this.inputs.flatMap(n=>n.toFlatGenerationTarget(e)),...this.outputs.flatMap(n=>n.toFlatGenerationTarget(e)),...this.process?this.process.toFlatGenerationTarget(e):[],...this.error?this.error.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(n=>n.clearErrors()),this.outputs.forEach(n=>n.clearErrors()),this.successCalls.forEach(n=>n.clearErrors()),this.errorCalls.forEach(n=>n.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=Eq(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors()),...this.outputs.flatMap(t=>t.getErrors()),...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(e=null,t=null,n=!0){var R,v;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.FunctionCall,a);s.inputs=[];const l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(R=this.inputs)==null?void 0:R.map((I,D)=>I.clone(u,p+"-input-map-"+D+"-id",n));u.inputs=h;const f=(v=this.outputs)==null?void 0:v.map((I,D)=>I.clone(u,p+"-output-map-"+D+"-id",n));return u.outputs=f,this.error&&(u.error=this.error.clone(u,p+"-error-map-id",n)),this.process&&(u.process=this.process.clone(u,p+"-process-id",n)),u}removeUnrecognizedInputs(){const e=[],t=[],n=[];return this.inputs.forEach(a=>{if(!this.declaration.inputs.find(o=>{var l;return o.id===((l=a.declaration)==null?void 0:l.id)})){const o=a.remove();n.push(...o.removed),e.push(...o.affected)}}),{updated:m(e),added:m(t),removed:m(n),self:this}}removeUnrecognizedOutputs(){const e=[],t=[],n=[];return this.outputs.forEach(a=>{if(!this.declaration.getUniqueReturnDeclarations().find(o=>{var l;return o.id===((l=a.declaration)==null?void 0:l.id)})){const o=a.remove();n.push(...o.removed),e.push(...o.affected)}}),{updated:m(e),added:m(t),removed:m(n),self:this}}syncMissingFixedInputs(){const e=[],t=[],n=[],a=this.declaration.inputs.filter(p=>!this.inputs.find(u=>u.declaration.id===p.id));this.inputs.sort((p,u)=>p.index-u.index),a.forEach(p=>{this.inputs.forEach(f=>{f.index>=p.index&&f.sync({index:f.index+1})});const u={id:M.UUID.uuid(),version:1,type:i.InputMap,declaration:p.toJSON(),readsValue:null,defaultValue:null,index:p.index,name:null,description:null,parent:this.toReference()},h=b(u,this.project);h.setParent(this),h.initChildren(),h.addSelfToProject(),t.push(h)}),this.inputs.sort((p,u)=>p.index-u.index);const{updated:s,added:o,removed:l}=this.removeUnrecognizedInputs();return e.push(...s),t.push(...o),n.push(...l),{updated:m(e),added:m(t),removed:m(n),self:this}}syncMissingFixedOutputs(){const e=[],t=[],n=[],a=[];this.outputs=this.initialData.outputs.map(u=>{const h=b(u,this.project);return a.push(h.index),h.setParent(this),h.initChildren(),h});const s=this.declaration.getUniqueReturnDeclarations().filter(u=>!this.outputs.find(h=>h.declaration.id===u.id));this.outputs.sort((u,h)=>u.index-h.index),s.forEach((u,h)=>{this.outputs.forEach(I=>{I.index>=u.index&&I.index++});const f=a.includes(u.index)?this.outputs.length-1+h:u.index,R={id:M.UUID.uuid(),version:1,type:i.OutputMap,declaration:u.toJSON(),defaultValue:null,writesValues:[],index:f,parent:this.toReference()},v=b(R,this.project);v.setParent(this),v.initChildren(),v.addSelfToProject()}),this.outputs.sort((u,h)=>u.index-h.index);const{updated:o,added:l,removed:p}=this.removeUnrecognizedOutputs();return e.push(...o),t.push(...l),n.push(...p),{updated:m(e),added:m(t),removed:m(n),self:this}}};c(we,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(we,"MUTABLE_BASE_PROPERTIES",[]),c(we,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(we,"BASE_PROPERTIES",[...we.MUTABLE_BASE_PROPERTIES,...we.INMUTABLE_BASE_PROPERTIES]),c(we,"MUTABLE_META_PROPERTIES",["x","y"]),c(we,"INMUTABLE_META_PROPERTIES",[...we.INMUTABLE_BASE_PROPERTIES]),c(we,"META_PROPERTIES",[...we.MUTABLE_META_PROPERTIES,...we.INMUTABLE_META_PROPERTIES]),c(we,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),c(we,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),c(we,"UPSTREAM_PROPERTIES",[...we.MUTABLE_UPSTREAM_PROPERTIES,...we.INMUTABLE_UPSTREAM_PROPERTIES]),c(we,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),c(we,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(we,"DOWNSTREAM_PROPERTIES",[...we.MUTABLE_DOWNSTREAM_PROPERTIES,...we.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(we,"PROPERTIES",[...we.META_PROPERTIES,...we.UPSTREAM_PROPERTIES,...we.DOWNSTREAM_PROPERTIES]);let Xr=we;function zu(r){return r&&typeof r.then=="function"}class Zu{constructor(e){c(this,"order",[]);c(this,"flatRecord",{});c(this,"onGoingVisits",{});this.flatten(e),this.orderEntities()}flatten(e){const t=new Set(np()),n=m(P(e,t,{ignoreBuiltInBaseEntities:!0})),a=new Set;for(const s of n)this.flatRecord[s.id]=s,a.add(s.id);this.order=Array.from(a)}moveEntityAfterDependencies(e){const t=cl(e,this.flatRecord);for(const n of t){const a=this.order.indexOf(n),s=this.order.indexOf(e.id);if(a>s)return this.order.splice(s,1),this.order.splice(a,0,e.id),!0}return!1}orderEntities(){let e=!1;for(let t=0;t<this.order.length;t++){const n=this.order[t],a=this.flatRecord[n];if(this.moveEntityAfterDependencies(a)){e=!0;break}}e&&this.orderEntities()}getUpstreamOngoingDependenciesVisits(e,t){const n=cl(this.flatRecord[e],this.flatRecord),a={};return Object.entries(this.onGoingVisits[t]||{}).forEach(([s,o])=>{Array.from(n).includes(s)&&(a[s]=o)}),a}getDownstreamOngoingDependenciesVisits(e,t){const n=Object.keys(this.onGoingVisits[t]||{}),a=new Set(n.flatMap(o=>Array.from(cl(this.flatRecord[o],this.flatRecord)))),s={};return Array.from(a).forEach(o=>{o===e&&(s[o]=this.onGoingVisits[t][o])}),s}async settlePromises(e,t){const n=Object.values(e);n.length&&await Promise.all(n),Object.keys(e).forEach(a=>{delete this.onGoingVisits[t][a]})}visit(e){const t=this.order;for(const n of t)e(this.flatRecord[n],this.flatRecord);return this}reverseVisit(e){const t=this.order.slice().reverse();for(const n of t)e(this.flatRecord[n],this.flatRecord);return this}async visitAsync(e){const t=this.order,n=Math.random().toString(36).substring(7);this.onGoingVisits[n]={};for(const a of t){const s=this.getUpstreamOngoingDependenciesVisits(a,n);Object.keys(s).length&&await this.settlePromises(s,n);const o=e(this.flatRecord[a],this.flatRecord);zu(o)&&(this.onGoingVisits[n][a]=o)}return await this.settlePromises(this.onGoingVisits[n],n),this.onGoingVisits[n]={},this}async reverseVisitAsync(e){const t=this.order.slice().reverse(),n=Math.random().toString(36).substring(7);this.onGoingVisits[n]={};for(const a of t){const s=this.getDownstreamOngoingDependenciesVisits(a,n);Object.keys(s).length&&await this.settlePromises(s,n);const o=e(this.flatRecord[a],this.flatRecord);zu(o)&&(this.onGoingVisits[n][a]=o)}return await this.settlePromises(this.onGoingVisits[n],n),this.onGoingVisits[n]={},this}}function PO(r){var e;switch(r.id){case _["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const t=r.project.entities.filter(p=>!!p.implements.find(u=>u.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));if(t.find(p=>!!p.properties.find(u=>{var h;return u.implements&&u.implements.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=u.getDefaultValue())==null?void 0:h.value)===!0}))){const u=t[0].properties.find(f=>f.implements&&f.implements.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),h=u==null?void 0:u.defaultValue;if(h)h.value=!0;else if(u!=null&&u.dataType){const f=(e=u==null?void 0:u.dataType)==null?void 0:e.id.split("-id")[0],R=b({id:f+"-default-value-id",version:1,type:i.LiteralValue,name:C.EntityTemplate,autogeneration:null,value:!0,valueAsType:null,parent:u==null?void 0:u.dataType.toReference()},r.project);return R.setParent(u==null?void 0:u.dataType),R.initChildren(),R.addSelfToProject(),{newEntities:[R]}}return{newEntities:[]}}const a=r.project.get(_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),s=al(a,"Main database");if(s.errors.length>0)return{newEntities:[]};const o=s.implemented.properties.find(p=>p.implements&&p.implements.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),l=o==null?void 0:o.defaultValue;if(l)l.value=!0;else if(o!=null&&o.dataType){const p=o==null?void 0:o.dataType.id.split("-id")[0],u=b({id:p+"-default-value-id",version:1,type:i.LiteralValue,name:C.EntityTemplate,autogeneration:null,value:!0,valueAsType:null,parent:o==null?void 0:o.dataType.toReference()},r.project);u.setParent(o==null?void 0:o.dataType),u.initChildren(),u.addSelfToProject()}return{newEntities:[s.implemented]}}}return{newEntities:[]}}function AO(r){return r.implements.filter(t=>t.type===i.BuiltInBaseEntity).map(t=>{switch(t.id){case _["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const a=r.project.entities.filter(l=>l.implements.find(p=>p.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)).find(l=>!!l.properties.find(p=>{var u;return p.implements&&p.implements.id===_["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((u=p.getDefaultValue())==null?void 0:u.value)===!0}));if(!a)return{newEntities:[]};const s=r.properties.find(l=>l.implements&&l.implements.id===_["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),o=s==null?void 0:s.defaultValue;if(s&&(s!=null&&s.dataType)&&!o){const l=s==null?void 0:s.dataType.id.split("-id")[0],p=b({id:l+"-default-value-id",version:1,type:i.LiteralValue,name:C.EntityTemplate,autogeneration:null,value:null,valueAsType:a,parent:s==null?void 0:s.dataType.toReference()},r.project);return p.setParent(s==null?void 0:s.dataType),p.initChildren(),p.addSelfToProject(),{newEntities:[p]}}return{newEntities:[]}}}}),{newEntities:[]}}function al(r,e,t){const n=t||de(e,i.DefinitionEntity,r.project),a=n.split("-id"),s=a[a.length-1||0]||n,o={id:n,version:1,name:e,type:i.DefinitionEntity,description:null,static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[r],x:0,y:0,parent:r.project},l=Zo(o,r.project);if(l.length>0)return{errors:l,implemented:null,entitiesChanges:{new:[],updated:[],deleted:[]}};const p=PO(r),u=b(o,r.project);u.setParent(r.project),u.initChildren();const h=r.properties.map(v=>{const I=s+"-"+de(w(v,r.project),i.Property,r.project),D=v.clone(u,I);return D.abstract=!1,D.implements=v,D.setParent(u),u.addProperty(D),D}),f=r.abstractMethods.map(v=>{const I=s+de(v.name,i.FunctionDeclaration,r.project),D=v.implementAsFunctionDeclaration(I),O={id:I+"-parent-ref-id",type:i.GenericReference,entityId:n,entityType:i.DefinitionEntity},$={...D,implements:v,parent:O},j=b($,r.project);return u.addMethod(j),j.setParent(u),j.initChildren(),j.implements=v,j});o.properties=h,o.methods=f;const R=AO(u);return{implemented:u,errors:[],entitiesChanges:{new:[u,...p.newEntities,...R.newEntities],updated:[u],deleted:[]}}}function Ku(r,e){return e.entities.find(a=>{const s=a.properties,o=s.map(f=>f.name),l=r.every(f=>o.includes(f)),p=o.filter(f=>!r.includes(f)),u=s.every(f=>!p.includes(f.name)||!f.required);return l&&u})||null}function CO(r,e,t=et.OrDataTypeGroup){const n=[],a=[],s=[],l={id:e.id+"--nested-data-type-id-"+r.id,version:1,type:i.DataType,entity:r.toJSON(),isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:t,parent:e.toReference()},p=b(l,r.project);return a.push(p),p.setParent(e),p.initChildren(),p.setEntity(r),p.addSelfToProject(),{updated:m(n),added:m(a),removed:m(s),self:p}}function Xu(r,e,t,n){const a=[],s=[],o=[];switch(typeof r){case"string":let l=!1;const p=new Date(r);if(p instanceof Date&&!isNaN(p.valueOf())&&(l=!0),l){const u=e.project.getBuiltIn(_[i.PrimitiveEntity][C.Date].id);e.setEntity(u);break}else{const u=e.project.getBuiltIn(_[i.PrimitiveEntity][C.String].id);e.setEntity(u);break}case"number":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Number].id));break;case"boolean":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Boolean].id));break;case"object":if(r===null){e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Null].id));break}else if(Array.isArray(r))if(e.sync({isList:!0}),r.length>0){const u=r.slice(0,5).filter(f=>f!==void 0);if(u.every(f=>typeof f==typeof u[0])&&(typeof u[0]!="object"||u[0]===null))switch(typeof u[0]){case"string":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.String].id));break;case"number":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Number].id));break;case"boolean":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Boolean].id));break;case"object":e.setEntity(e.project.getBuiltIn(_[i.PrimitiveEntity][C.Null].id));break}else{const f=[];let R=!1;u.forEach((I,D)=>{if(Array.isArray(I)&&(R=!0),typeof I=="object"&&!Array.isArray(I)&&I!==null){const O=sl(I,e.project,{...t,id:e.id+"--or-child-data-type-entity-id-"+D},n);O.hasCreated&&f.push(O.changeSet.self),a.push(...O.changeSet.updated),s.push(...O.changeSet.added),o.push(...O.changeSet.removed)}});const v=m(f);if(!v.length&&!R){u.forEach(I=>{const D={id:M.UUID.uuid(),version:1,type:i.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:et.OrDataTypeGroup,parent:e.toReference()},O=b(D,e.project);switch(O.setParent(e),O.initChildren(),O.addSelfToProject(),typeof I){case"string":O.setEntity(O.project.getBuiltIn(_[i.PrimitiveEntity][C.String].id));break;case"number":O.setEntity(O.project.getBuiltIn(_[i.PrimitiveEntity][C.Number].id));break;case"boolean":O.setEntity(O.project.getBuiltIn(_[i.PrimitiveEntity][C.Boolean].id));break;case"object":O.setEntity(O.project.getBuiltIn(_[i.PrimitiveEntity][C.Null].id));break}});break}else v.length===1&&!R?e.setEntity(v[0]):u.forEach((I,D)=>{if(typeof I=="object"&&!Array.isArray(I)&&I!==null){const O=Ku(Object.keys(I),e.project);if(O){const $=CO(O||v[0],e,et.OrDataTypeGroup);a.push(...$.updated),s.push(...$.added),o.push(...$.removed)}}else{const O={id:e.id+"--or-child-data-type-id--"+D,version:1,type:i.DataType,entity:null,isList:Array.isArray(I),asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:et.OrDataTypeGroup,parent:e.toReference()},$=b(O,e.project);$.setParent(e),$.initChildren(),$.addSelfToProject();const j=Xu(I,$,{...t,id:e.id+"--or-child-data-type-entity-id-"+D},n);a.push(...j.updated),s.push(...j.added),o.push(...j.removed)}})}}else{const u=sl(r[0],e.project,{...t},n);e.setEntity(u.changeSet.self),a.push(...u.changeSet.updated),s.push(...u.changeSet.added),o.push(...u.changeSet.removed);break}else{const u=sl(r,e.project,{...t},n);e.setEntity(u.changeSet.self),a.push(...u.changeSet.updated),s.push(...u.changeSet.added),o.push(...u.changeSet.removed);break}}return{updated:m(a),added:m(s),removed:m(o),self:e}}function sl(r,e,t,n){const a=[],s=[],o=[],l=Object.keys(r),p=Ku(l,e);if(p)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],self:p}};const u=n?t.name+" of "+n.name:t.name,f={id:t.id||de(u,i.DefinitionEntity,e),version:1,name:u,type:i.DefinitionEntity,description:t.description||null,static:t.static||!1,abstract:t.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:e.toReference()},R=b(f,e);return R.setParent(e),R.initChildren(),R.addSelfToProject(),s.push(R),l.forEach((v,I)=>{const D=de(u+" "+v,i.Property,e),O={id:D,version:1,name:v,type:i.Property,description:null,static:!1,abstract:!1,defaultValue:null,constant:!1,dataType:null,implements:null,index:I,hidden:!1,private:!1,required:!0,parent:R.toReference()},$=b(O,e);$.setParent(R),$.initChildren(),$.addSelfToProject(),s.push($);const j=r[v],oe={id:D+"--data-type-id",version:1,type:i.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parent:$.toReference()},ae=b(oe,e);ae.setParent($),ae.initChildren(),ae.addSelfToProject(),s.push(ae);const Xe=Xu(j,ae,{...t,name:v,id:D+"--data-type-entity-id"},n||R);a.push(...Xe.updated),s.push(...Xe.added),o.push(...Xe.removed)}),{hasCreated:!0,changeSet:{updated:m(a),added:m(s),removed:m(o),self:R}}}function ol(r,e){const t=Qr(r);if(t.length===0)return{list:[],last:null};let n=null;return{list:t.flatMap(s=>{if(s===e)return n=s,[s];const o=ol(s,e);return o.last&&(n=o.last),[s,...o.list]}),last:n}}function wO(r,e,t=new Set){const n=cr(r),a=cr(e),s=n.filter(p=>!a.includes(p)),o=n.filter(p=>a.includes(p)),l=s.reduce((p,u)=>t.has(u.id)?p:(t.add(u.id),m([...p,...wO(u,e,t)])),[]);return m([...o,...l])}function es(r,e){const t=ol(r,e);return t.last===e&&t.list.length>0&&t.list[0]!==e}function Rq(r,e){return!!ol(r,e).last}function gq(r){if(We.includes(r.type))return r;if([...Xt,i.VariableDeclaration].includes(r.type)){const e=r.parent;return We.includes(e.type)?e:null}return null}function Qu(r,e){if(!r||!e)throw new Error("Both entities must be defined to find a common ancestor");if(r===e)return r;const t=r.parent;if(t){if(t===e)return e;if(t.type===i.Project)return null}else return null;const n=e.parent;if(n){if(n===r)return r;if(n.type===i.Project)return null}else return null;return Qu(t,n)}function lt(r){if(ss.includes(r.type)){if(r.type===i.FunctionDeclaration){const e=r.parent;if(e.type===i.DefinitionEntity)return e;if(e.type===i.Loop)return e}return r}else{const e=r.parent;return e?lt(e):null}}function ll(r,e){const t=ts(r,e);if(!t)return null;if(ss.includes(t.type)){if(t.type===i.FunctionDeclaration){const n=ts(t.parent,e);if(n){if(n.type===i.DefinitionEntity)return n;if(n.type===i.Loop)return n}}return t}else{const n=t.parent?ts(t.parent,e):null;return n?ll(n,e):null}}function BO(r){if(!r)return null;if(Xt.includes(r.type))return r;const e=r.parent;return e?BO(e):null}function MO(r){if(!r)return null;if(Je.includes(r.type))return r;const e=r.parent;return e?MO(e):null}function _O(r){if(!r)return null;if(on.includes(r.type))return r;const e=r.parent;return e?_O(e):null}function bq(r){return r.type===i.VariableDeclaration?[r]:Je.includes(r.type)?[...r.inputs,...r.outputs||[]]:xe.includes(r.type)?r.outputs:ii.includes(r.type)||r.type===i.FunctionDeclaration?r.inputs:[]}function vq(r){const e=cr(r),t=[],n=[];Tp.includes(r.type)&&t.push(...ep(r));const a=e.filter(s=>{const o=t.includes(s);return o?!1:Xt.includes(s.type)&&!o?(n.push(s),!1):!0});return t.sort((s,o)=>es(o,s)?-1:0),n.sort((s,o)=>es(o,s)?-1:0),[...t,...n,...a]}function VO(r){return[...r].sort((e,t)=>es(t,e)?-1:0)}function Iq(r){const e=VO(r),t=[];return e.forEach(n=>{const a=t[t.length-1];if(a){const s=a[a.length-1];es(n,s)?t.push([n]):a.push(n)}else t.push([n])}),t}function Pt(r){const e=r.map(t=>lt(t));return m(e)}function ep(r){return Je.includes(r.type)?[...Pt(r.successCalls),...Pt(r.errorCalls)]:We.includes(r.type)?Pt(r.calls):[]}function Dq(r,e){return ep(r).includes(e)}function tp(r){return r.writesValues||[]}function Sq(r,e){return tp(r).includes(e)}function NO(r){var e;return Fe.includes((e=r==null?void 0:r.readsValue)==null?void 0:e.type)?r.readsValue:null}function Oq(r){return r.writesValues}function LO(r=[]){return r.map(NO).filter(e=>!!e)}function dl(r=[]){return r.map(e=>e.writesValues).flat().filter(e=>Fe.includes(e.type))}function GO(r=[]){return r.map(e=>e.readsValue).filter(e=>!!e&&Fe.includes(e.type))}function $O(r){return Fe.includes(r.type)?r:null}function FO(r){return r.writesValues.map($O).filter(e=>!!e)}function UO(r=[]){return r.reduce((e,t)=>t.type===i.OutputMap?[...e,...FO(t)]:e,[])}function Ue(r){return Je.includes(r.type)?[...vn(Pt(r.successCalls)),...vn(Pt(r.errorCalls))]:We.includes(r.type)?vn(Pt(r.calls)):[]}function Pq(r){return Je.includes(r.type)?[...vn(Pt(r.successCalls)),...vn(Pt(r.errorCalls))]:We.includes(r.type)?vn(Pt(r.calls)):[]}function xO(r,e=new Set){return r.writesValues.filter(n=>Fe.includes(n.type)&&!e.has(n.id)).reduce((n,a)=>e.has(a.id)?n:[...n,...Se(a,e)],[])}function jO(r,e=new Set){var n;return(((n=r.readsValue)==null?void 0:n.writesValues)||[]).filter(a=>Fe.includes(a.type)&&!e.has(a.id)).reduce((a,s)=>e.has(s.id)?a:[...a,...Se(s,e)],[])}function Se(r,e=new Set){if(e.has(r.id))return[];if(r.type===i.ReturnStatement)return GO(r.outputs).reduce((n,a)=>[...n,...Se(a,e)],[]);if(r.type===i.FunctionCall||r.type===i.Operation||r.type===i.Condition)return[...Ue(r).reduce((s,o)=>{const l=lt(o);return[...s,...Se(l||o,e)]},[]),...LO(r.inputs),...UO(r.outputs)].reduce((s,o)=>[...s,...Se(o,e)],[]);if(ii.includes(r.type)){const t=dl(r.inputs),a=Ue(r).reduce((s,o)=>{const l=lt(o);return[...s,...Se(l||o,e)]},[]);return t.push(...a),t.reduce((s,o)=>[...s,...Se(o,e)],[])}if(r.type===i.FunctionDeclaration){const t=[...dl(r.inputs)],a=Ue(r).reduce((s,o)=>{const l=lt(o);return[...s,...Se(l||o,e)]},[]);return t.push(...a),t.reduce((s,o)=>[...s,...Se(o)],[])}if(Fe.includes(r.type)){e.add(r.id);const n=Ue(r).reduce((a,s)=>{const o=lt(s);return[...a,...Se(o||s,e)]},[]);return[r,...n,...jO(r,e),...xO(r,e)]}return[]}function Nt(r,e=new Set){return e.has(r.id)?[]:(e.add(r.id),[...cr(r).reduce((a,s)=>[...a,s,...Nt(s,e)],[])])}function vn(r){return r.reduce((e,t)=>t.type===i.ReturnStatement||t.type===i.ContinueStatement||t.type===i.BreakStatement?[...e,t]:[...e,t,...Ue(t)],[])}function kO(r){const e=r.entities||[],t=[...e,...r.functions||[],...r.events||[],...r.projects||[]],n=e.reduce((p,u)=>[...p,...u.properties],[]),a=e.reduce((p,u)=>[...p,...u.methods],[]),s=a.reduce((p,u)=>[...p,...dl(u.inputs),...vn(Pt(u.calls)),...u.returnStatements],[]),o=r.functions.reduce((p,u)=>[...p,...vn(Pt(u.calls)),...u.returnStatements],[]),l=r.events.reduce((p,u)=>[...p,...vn(Pt(u.calls)),...u.returnStatements],[]);return[...t,...n,...a,...s,...o,...l]}function qO(r,e){return e.filter(n=>{if(!n)return!1;switch(n.type){case i.FunctionCall:return n.inputs.find(a=>a.id===r.id)!==void 0||n.outputs.find(a=>a.id===r.id)!==void 0;case i.Condition:return n.successCalls.find(a=>a.id===r.id)!==void 0||n.errorCalls.find(a=>a.id===r.id)!==void 0||n.inputs.find(a=>a.id===r.id)!==void 0;case i.Operation:return n.outputs.find(a=>a.id===r.id)!==void 0;case i.VariableDeclaration:return Je.includes(r.type)?RP(r).find(s=>{var o;return((o=s.readsValue)==null?void 0:o.id)===n.id})!==void 0:!1;case i.DefinitionEntity:return n.properties.find(a=>a.id===r.id)!==void 0||n.methods.find(a=>a.id===r.id)!==void 0;case i.FunctionDeclaration:return n.inputs.find(a=>a.id===r.id)!==void 0||(n.returnStatements.map(a=>a.outputs).flat()||[]).find(a=>a.id===r.id)!==void 0;default:return!1}})}function Aq(r){const e=kO(r.project);return qO(r,e)}function ts(r,e){return r?typeof r=="string"?e[r]:r.type===i.GenericReference?e[r.entityId]:e[r.id]?e[r.id]:null:null}function JO(r,e){const t=[];if(Xt.includes(r.type)){qt(r).forEach(s=>{const o=ll(s,e);o&&t.push(o)});const a=[...r.inputs||[],...r.outputs||[]].map(s=>{const o=ts(s,e);return o?bP(o,e):null}).filter(s=>s!==null);t.push(...m(a))}if(Fe.includes(r.type)){const n=ul(r);n&&t.push(n)}return m(t)}function Qr(r){const e=[];if(Xt.includes(r.type)){r.calledBy.forEach(a=>{const s=lt(a);s&&e.push(s)});const n=[...r.inputs||[],...r.outputs||[]].map(a=>ul(a)).filter(a=>a!==null);e.push(...m(n))}if(Fe.includes(r.type)){const t=ul(r);t&&e.push(t)}return m(e)}function qt(r){return[...r.calledByEntry||[],...r.calledByError||[],...r.calledBySuccess||[]]}function WO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ActionDescriptor)throw new Error("Entity must be an action descriptor to be flattened");return[r,...r.inputs.flatMap(n=>P(n,e,t)),...r.outputs.flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function YO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ArgumentDeclaration)throw new Error("Entity must be an argument declaration to be flattened");return[r,...r.defaultValue?P(r.defaultValue,e):[],...r.writesValues.flatMap(n=>P(n,e,t)),...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function HO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.BreakStatement)throw new Error("Entity must be a break statement to be flattened");return[r,...r.outputs.flatMap(n=>P(n,e,t)),...r.throws?P(r.throws,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function zO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.BuiltInBaseEntity)throw new Error("Entity must be a built-in base entity to be flattened");return[r,...(r.properties||[]).flatMap(n=>P(n,e,t)),...(r.methods||[]).flatMap(n=>P(n,e,t)),...(r.abstractMethods||[]).flatMap(n=>P(n,e,t)),...(r.extends||[]).flatMap(n=>P(n,e,t))]}function ZO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Condition)throw new Error("Entity must be a condition to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function KO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ContinueStatement)throw new Error("Entity must be a continue statement to be flattened");return[r,...r.outputs.flatMap(n=>P(n,e,t)),...r.throws?P(r.throws,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function XO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.DefinitionEntity)throw new Error("Entity must be a definition entity to be flattened");return[r,...(r.extends||[]).flatMap(n=>P(n,e,t)),...(r.implements||[]).flatMap(n=>P(n,e,t)),...(r.properties||[]).flatMap(n=>P(n,e,t)),...(r.methods||[]).flatMap(n=>P(n,e,t)),...(r.abstractMethods||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function QO(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.DataType)throw new Error("Entity must be a data type to be flattened");return[r,...(r.andChildrenGroup||[]).flatMap(n=>P(n,e,t)),...(r.orChildrenGroup||[]).flatMap(n=>P(n,e,t)),...r.entity?P(r.entity,e,t):[],...r.parent?P(r.parent,e,t):[]]}function eP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.FunctionCall)throw new Error("Entity must be a function call to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...r.process?P(r.process,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function tP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.FunctionDeclaration)throw new Error("Entity must be a function declaration to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.returnStatements||[]).flatMap(n=>P(n,e,t)),...(r.calls||[]).flatMap(n=>P(n,e,t)),...r.implements?P(r.implements,e,t):[],...r.parent?P(r.parent,e,t):[]]}function nP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.GlobalEvent)throw new Error("Entity must be a global event to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.calls||[]).flatMap(n=>P(n,e,t)),...(r.returnStatements||[]).flatMap(n=>P(n,e,t)),...r.implements?P(r.implements,e,t):[],...r.parent?P(r.parent,e,t):[]]}function rP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.InputMap)throw new Error("Entity must be an input map to be flattened");return[r,...r.readsValue?P(r.readsValue,e,t):[],...r.declaration?P(r.declaration,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...r.parent?P(r.parent,e,t):[]]}function iP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.InstalledProject)throw new Error("Entity must be an installed project to be flattened");return[r,...(r.functions||[]).flatMap(n=>P(n,e,t)),...(r.events||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function aP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.InternalCall)throw new Error("Entity must be an internal call to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...r.process?P(r.process,e,t):[],...r.parent?P(r.parent,e,t):[]]}function sP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.LiteralValue)throw new Error("Entity must be a literal value to be flattened");return[r,...r.valueAsType?Array.isArray(r.valueAsType)?r.valueAsType.flatMap(n=>P(n,e,t)):P(r.valueAsType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function oP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Loop)throw new Error("Entity must be a loop to be flattened");return[r,...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...r.process?P(r.process,e,t):[],...r.body?P(r.body,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...(r.breakStatements||[]).flatMap(n=>P(n,e,t)),...(r.continueStatements||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function lP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Operation)throw new Error("Entity must be an operation to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...r.process?P(r.process,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function dP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.OutputMap)throw new Error("Entity must be an output map to be flattened");return[r,...(r.writesValues||[]).flatMap(n=>P(n,e,t)),...r.declaration?P(r.declaration,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...r.parent?P(r.parent,e,t):[]]}function cP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.PrimitiveEntity)throw new Error("Entity must be a primitive entity to be flattened");return[r,...(r.properties||[]).flatMap(n=>P(n,e,t)),...(r.methods||[]).flatMap(n=>P(n,e,t)),...(r.abstractMethods||[]).flatMap(n=>P(n,e,t))]}function uP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Project)throw new Error("Entity must be a project to be flattened");return[r,...(r.entities||[]).flatMap(n=>P(n,e,t)),...(r.functions||[]).flatMap(n=>P(n,e,t)),...(r.events||[]).flatMap(n=>P(n,e,t)),...(r.projects||[]).flatMap(n=>P(n,e,t)),...(r.variableDeclarations||[]).flatMap(n=>P(n,e,t)),...(r.variableInstances||[]).flatMap(n=>P(n,e,t)),...(r.operations||[]).flatMap(n=>P(n,e,t)),...(r.conditions||[]).flatMap(n=>P(n,e,t)),...(r.functionCalls||[]).flatMap(n=>P(n,e,t)),...(r.projects||[]).flatMap(n=>P(n,e,t)),...(r.loops||[]).flatMap(n=>P(n,e,t)),...(r.searches||[]).flatMap(n=>P(n,e,t))]}function pP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Property)throw new Error("Entity must be a property to be flattened");return[r,...r.defaultValue?P(r.defaultValue,e,t):[],...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function yP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ReturnDeclaration)throw new Error("Entity must be a return declaration to be flattened");return[r,...r.readsValue?P(r.readsValue,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function hP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ReturnStatement)throw new Error("Entity must be a return statement to be flattened");return[r,...(r.outputs||[]).flatMap(n=>P(n,e,t)),...r.throws?P(r.throws,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function fP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.Search)throw new Error("Entity must be a search to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputsDeclarations||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputsDeclarations||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...r.error?P(r.error,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.parent?P(r.parent,e,t):[]]}function mP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.ValueDescriptor)throw new Error("Entity must be a value descriptor to be flattened");return[r,...r.defaultValue?P(r.defaultValue,e,t):[],...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function TP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.VariableDeclaration)throw new Error("Entity must be a variable declaration to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...(r.internalCalls||[]).flatMap(n=>P(n,e,t)),...(r.writesValues||[]).flatMap(n=>P(n,e,t)),...r.readsValue?P(r.readsValue,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.dataType?P(r.dataType,e,t):[],...r.parent?P(r.parent,e,t):[]]}function EP(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(e.has(r.id))return[];if(e.add(r.id),r.type!==i.VariableInstance)throw new Error("Entity must be a variable instance to be flattened");return[r,...(r.successCalls||[]).flatMap(n=>P(n,e,t)),...(r.errorCalls||[]).flatMap(n=>P(n,e,t)),...(r.inputs||[]).flatMap(n=>P(n,e,t)),...(r.outputs||[]).flatMap(n=>P(n,e,t)),...(r.internalCalls||[]).flatMap(n=>P(n,e,t)),...(r.writesValues||[]).flatMap(n=>P(n,e,t)),...r.readsValue?P(r.readsValue,e,t):[],...r.defaultValue?P(r.defaultValue,e,t):[],...(qt(r)||[]).flatMap(n=>P(n,e,t)),...r.declaration?P(r.declaration,e,t):[],...r.parent?P(r.parent,e,t):[]]}function np(){const r=new Set;return mg.flatMap(t=>P(t,r)).map(t=>t.id)}function P(r,e=new Set,t={ignoreBuiltInBaseEntities:!1}){if(!r)throw new Error("Entity must be defined to be flattened");if(r.type===i.GenericReference)return[];if(t.ignoreBuiltInBaseEntities&&(Jn.includes(r.type)||np().includes(r.id)))return[];if(e.has(r.id))return[];switch(r.type){case i.FunctionCall:return eP(r,e,t);case i.Operation:return lP(r,e,t);case i.Condition:return ZO(r,e,t);case i.Loop:return oP(r,e,t);case i.Search:return fP(r,e,t);case i.GlobalEvent:return nP(r,e,t);case i.ReturnStatement:return hP(r,e,t);case i.ContinueStatement:return KO(r,e,t);case i.BreakStatement:return HO(r,e,t);case i.VariableDeclaration:return TP(r,e,t);case i.DefinitionEntity:return XO(r,e,t);case i.FunctionDeclaration:return tP(r,e,t);case i.Project:return uP(r,e,t);case i.ActionDescriptor:return WO(r,e,t);case i.ArgumentDeclaration:return YO(r,e,t);case i.ReturnDeclaration:return yP(r,e,t);case i.ValueDescriptor:return mP(r,e,t);case i.InputMap:return rP(r,e,t);case i.OutputMap:return dP(r,e,t);case i.DataType:return QO(r,e,t);case i.InstalledProject:return iP(r,e,t);case i.InternalCall:return aP(r,e,t);case i.LiteralValue:return sP(r,e,t);case i.Property:return pP(r,e,t);case i.VariableInstance:return EP(r,e,t);case i.BuiltInBaseEntity:return t.ignoreBuiltInBaseEntities?[]:zO(r,e,t);case i.PrimitiveEntity:return t.ignoreBuiltInBaseEntities?[]:cP(r,e,t)}return[]}function cl(r,e){if(Jn.includes(r.type))return new Set;const t=JO(r,e),n=new Set(t.map(a=>a.id));if(r.type===i.LiteralValue&&r.valueAsType&&(Array.isArray(r.valueAsType)?r.valueAsType.forEach(a=>{n.add(a.id)}):n.add(r.valueAsType.id)),r.type===i.DataType&&r.entity&&(r.entity.type===i.DefinitionEntity?(r.entity.parent.entityId||r.entity.parent.id)!==r.id&&n.add(r.entity.id):n.add(r.entity.id)),fp.includes(r.type)){const a=r.parent;a&&(a.type===i.GenericReference?n.add(a.entityId):n.add(a.id))}if(mp.includes(r.type)){const a=r.implements;a&&(a.type===i.GenericReference?n.add(a.entityId):n.add(a.id))}if(gl.includes(r.type)){const a=r.declaration;a&&(a.type===i.GenericReference?n.add(a.entityId):n.add(a.id))}if(Sn.includes(r.type)){const a=r.readsValue;a&&(a.type===i.GenericReference?n.add(a.entityId):n.add(a.id))}if(Xt.includes(r.type)){const a=[...r.calledBySuccess||[],...r.calledByEntry||[],...r.calledByError||[]];a.length&&a.forEach(s=>{s.type===i.GenericReference?n.add(s.entityId):n.add(s.id)})}return n}function rp(r){return r.type===i.FunctionCall||r.type===i.InternalCall||[i.Operation,i.Condition,i.Loop].includes(r.type)?r.declaration.inputs:r.type===i.FunctionDeclaration||ii.includes(r.type)?r.inputs:r.type===i.Search?r.inputsDeclarations:[]}function Cq(r,e){return e.type===i.Condition?e.inputs.find(t=>t.declaration.id===r.id):e.type===i.FunctionCall||e.type===i.Operation?e.inputs.find(t=>t.declaration.id===r.id):null}function RP(r){return Je.includes(r.type)?r.inputs:[]}function gP(r){var e;return r.type===i.FunctionCall?((e=r.declaration.returnStatements[0])==null?void 0:e.outputs)||[]:[i.Operation,i.Condition,i.Loop].includes(r.type)?r.declaration.outputs:r.type===i.Search?r.outputsDeclarations:xe.includes(r.type)?r.outputs:[]}function wq(r,e){return e.type===i.Condition?null:e.type===i.FunctionCall||e.type===i.Operation?e.outputs.find(t=>t.declaration.id===r.id):null}function Bq(r){return r.type===i.Condition?[]:Je.includes(r.type)?r.outputs:[]}function ul(r){const e=r.readsValue;return e?lt(e):null}function bP(r,e){const t=r.readsValue;return t?ll(t,e):null}function vP(r){const e=r.internalCalls||[];return m(Pt(m(e.flatMap(t=>[...t.successCalls,...t.errorCalls]))))}function Hi(r){const e=tp(r),t=[];return e.forEach(n=>{if(Fe.includes(n.type))t.push(n);else if(Sn.includes(n.type)){const a=n.parent;t.push(a)}}),t}function m(r){const e=new Set;return r.filter(t=>!t||e.has(t.id)?!1:(e.add(t.id),!0))}function cr(r,e=!1){const t=[];if(r.type===i.Project&&t.push(...(r==null?void 0:r.entities)||[],...(r==null?void 0:r.functions)||[],...(r==null?void 0:r.variableDeclarations)||[],...(r==null?void 0:r.variableInstances)||[],...(r==null?void 0:r.searches)||[],...(r==null?void 0:r.loops)||[],...(r==null?void 0:r.operations)||[],...(r==null?void 0:r.conditions)||[],...(r==null?void 0:r.functionCalls)||[],...(r==null?void 0:r.events)||[],...(r==null?void 0:r.projects)||[]),pt.includes(r.type)&&t.push(...(r==null?void 0:r.detachedChildren)||[]),r.type===i.DefinitionEntity){const n=[...r.suggestedMethods,...r.methods].flatMap(a=>a.collapsed&&e?[]:cr(a));t.push(...n)}if(r.type===i.Condition){const n=r.successCalls.map(s=>lt(s)),a=r.errorCalls.map(s=>lt(s));t.push(...n,...a)}if(ii.includes(r.type)){if(r.collapsed&&e)return[];const n=r.inputs.map(s=>Hi(s)).flat(),a=r.calls.map(s=>lt(s));t.push(...m(n),...a)}if(Je.includes(r.type)&&r.type!==i.Condition&&r.type!==i.Loop){const n=r==null?void 0:r.outputs.map(o=>Hi(o)).flat(),a=r.successCalls.map(o=>lt(o)),s=r.errorCalls.map(o=>lt(o));t.push(...m(n),...a,...s)}if(Fe.includes(r.type)){const n=Hi(r),a=vP(r);t.push(...n,...a)}if(r.type===i.Loop){const n=r.outputs.map(o=>Hi(o)).flat();if(r.body){const o=cr(r.body,e);t.push(...o)}const a=r.errorCalls.map(o=>lt(o)),s=r.successCalls.map(o=>lt(o));t.push(...m(n),...s,...a)}if(r.type===i.FunctionDeclaration){if(r.collapsed&&e)return[];const n=r.inputs.map(s=>Hi(s)).flat(),a=r.calls.map(s=>lt(s));t.push(...m(n),...a)}return m(t)}function IP(r,e=!1){const t=cr(r,e),n=[...t,...t.reduce((a,s)=>[...a,...IP(s,e)],[])];return m(n)}function DP(r){const e=Qr(r),t=[...e,...e.reduce((n,a)=>[...n,...DP(a)],[])];return m(t)}function pl(r){return r.implements.reduce((e,t)=>t.type===i.DefinitionEntity?[...e,i.DefinitionEntity,...pl(t),...yl(t)]:[...e,t.name],[])}function yl(r){return r.extends.reduce((e,t)=>t.type===i.DefinitionEntity?[...e,i.DefinitionEntity,...yl(t),...pl(t)]:[...e,t.name],[])}function ip(r){return r.extends.reduce((e,t)=>t.type===i.DefinitionEntity?[...e,t,...ip(t),...ap(t)]:[...e,t],[])}function ap(r){return r.implements.reduce((e,t)=>t.type===i.DefinitionEntity?[...e,t,...ap(t),...ip(t)]:[...e,t],[])}function sp(r){return[...yl(r),...pl(r)].filter((t,n,a)=>a.indexOf(t)===n)}function SP(r){return r.implements.length===0&&r.extends.length===0?null:r.implements.find(n=>n.type===i.BuiltInBaseEntity&&n.name===U.PERSISTED_ENTITY)?r:[...r.implements,...r.extends].reduce((n,a)=>{if(a.type===i.DefinitionEntity){const s=SP(a);if(s)return s}return n},null)}function Mq(r){const e=r.extends.find(t=>t.type===i.BuiltInBaseEntity);return e&&e.type===i.BuiltInBaseEntity?e:null}function _q(r){const e=r.implements.find(t=>t.type===i.BuiltInBaseEntity);return e&&e.type===i.BuiltInBaseEntity?e:null}function op(r){const e=r.extends.find(t=>t.type===i.DefinitionEntity);return e&&e.type===i.DefinitionEntity?e:null}function ur(r){const e=[...r.implements,...r.extends].reduce((t,n)=>n.type===i.BuiltInBaseEntity?[...t,n]:n.type===i.DefinitionEntity?[...t,...ur(n)]:t,[]);return m(e)}function lp(r){return r.type===i.PrimitiveEntity?!0:r.type===i.BuiltInBaseEntity?r.interactive:!ur(r).find(n=>!n.interactive)}function Vq(r){return r.parent===r.project&&r.project.variableDeclarations.includes(r)}function dp(r){return r.parent!==r.project?!1:i.VariableDeclaration===r.type?r.project.variableDeclarations.includes(r):i.VariableInstance===r.type?r.project.variableInstances.includes(r):i.FunctionCall===r.type?r.project.functionCalls.includes(r):i.Condition===r.type?r.project.conditions.includes(r):i.Operation===r.type?r.project.operations.includes(r):i.Loop===r.type?r.project.loops.includes(r):i.Search===r.type?r.project.searches.includes(r):!1}function OP(r){if([...We,i.DefinitionEntity,i.InstalledProject,i.Project].includes(r.type)||dp(r))return!1;const e=Qr(r);return e.length===0?!0:e.some(t=>OP(t))}function cp(r){return[...We,i.DefinitionEntity,i.InstalledProject,i.Project].includes(r.type)||dp(r)?!1:Qr(r).length===0}function PP(r,e=0){if(cp(r)){const t=Qr(r);return t.length===0?r:t.map(a=>PP(a,e+1)).reduce((a,s)=>a?s&&s.x<a.x?s:a:s,null)}return null}function AP(r){const e=[];if(cp(r))e.push(r);else return[];return Qr(r).forEach(n=>{e.push(...AP(n))}),e}function CP(r){return r.type===i.FunctionDeclaration&&r.parent!==r.project&&!![i.DefinitionEntity,i.Loop,i.InstalledProject].includes(r.parent.type)}function Nq(r,e){const t=new Map;return r.forEach(n=>{t.set(n.id,n)}),e.forEach(n=>{t.set(n.id,n)}),Array.from(t.values())}function hl(r){switch(r){case i.DefinitionEntity:return ei;case i.FunctionDeclaration:return jr;case i.VariableDeclaration:return sn;case i.VariableInstance:return Wr;case i.FunctionCall:return Xr;case i.Operation:return kr;case i.Condition:return Jr;case i.ReturnStatement:return Zr;case i.Loop:return qr;case i.Search:return Yr;case i.InputMap:return xn;case i.OutputMap:return jn;case i.ArgumentDeclaration:return zr;case i.ReturnDeclaration:return kt;case i.Property:return xr;case i.InstalledProject:return Hr;case i.Project:return M;case i.BuiltInBaseEntity:return In;default:return null}}function At(r,e){if(pt.includes(r.type))return r;if(Jn.includes(r.type))return null;const t=r.parent;if(!t)return null;if(t.type===i.GenericReference){const n=S(t);if(!n)return null;const a=e.get(n);return a?At(a,e):null}else return t===e?e:At(t,e)}function up(r,e){if(Jn.includes(r.type)||e.getBuiltIn(r.id))return null;const t=Lt(r.parent,e);return t?t===e?pt.includes(r.type)?r:null:t.type===i.DefinitionEntity?r:up(t,e):null}function fl(r,e,t){if(r===e||e===t||r===t)return!1;const n=At(e.parent,t);return n===r?!0:fl(n,e,t)}var ml=(r=>(r.SameBothLocal="same-both-local",r.AInB="a-in-b",r.BInA="b-in-a",r.ParallelInCommonParent="parallel-in-common-parent",r.ParallelInProject="parallel-in-project",r.AIsGlobalBIsNot="a-is-global-b-is-not",r.BIsGlobalAIsNot="b-is-global-a-is-not",r.SameBothGlobal="same-both-global",r))(ml||{});function ns(r,e,t){const n=At(r,t),a=At(e,t);if(!n)throw new Error("Could not find scope owner for the entity: "+r.id);if(!a)throw new Error("Could not find scope owner for the entity: "+e.id);if(n===a&&n.type!==i.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:n};if(n===a&&n.type===i.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:n};if(n.type===i.Project&&a.type!==i.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:n};if(n.type!==i.Project&&a.type===i.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:a};if(fl(n,a,t))return{compatible:!0,type:"b-in-a",commonAncestorScope:n};if(fl(a,n,t))return{compatible:!0,type:"a-in-b",commonAncestorScope:a};const l=Qu(n,a);return l===t?{compatible:!1,type:"parallel-in-project",commonAncestorScope:l}:l?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:At(l,t)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:t}}function wP(r,e,t){const n=ns(r,e,t);if(!n.compatible||n.type!=="same-both-local")return null;if(r===e)return r;let a=At(r.parent,t);if(a){if(a===e)return e;if(a.type===i.Project)return r}else return r;for(;a;){if(a){if(a===e)return e;if(a.type===i.Project)return r}else return r;a=At(a.parent,t)}let s=At(e.parent,t);if(s){if(s===r)return r;if(s.type===i.Project)return e}else return e;for(;s;){if(s){if(s===r)return r;if(s.type===i.Project)return e}else return e;s=At(s.parent,t)}return null}function BP(r){return r.length===0?null:r.length===1?r[0]:r.reduce((t,n)=>{const a=wP(t,n,n.project);return!a||a===n?t:n},r[0])}function Lt(r,e){if(!r)return null;let t;return typeof r=="string"?t=r:r.type===i.GenericReference?t=S(r):t=r.id,t===e.id?e:e.get(t)}function pr(r){if(!r)return null;if(Jn.includes(r.type))return r;if(r.type===i.Project)return null;if(r.project.getBuiltIn(r.id))return r;const e=r.parent;return!e||e.type===i.Project?null:pr(e)}function Lq(r,e){var t;if(r.readsValue){const n=Lt(r.readsValue,e.project);e.setValueWriter(n),n.addValueReader(e)}else r.readsValue===null&&((t=e.readsValue)==null||t.removeValueReader(e),e.readsValue=null);return e}function rs(r){const e=[];function t(s,o){return e.some(l=>l.blockedByCaller===s&&l.blockedByCalling===o)}function n(s,o){t(s,o)||e.push({blockedByCaller:s,blockedByCalling:o})}const a=up(r,r.project);return r.calledBySuccess.forEach(s=>{[...s.successCalls||[]].forEach(p=>{xe.includes(p.type)&&p!==r&&(Ue(r).find(f=>f===p)||n(s,p))});let l;if(Je.includes(s.type)&&(l=s),l){const p=rs(l);p.reachable||Ue(r).find(f=>f===s)||p.blocks.forEach(f=>{n(s,f.blockedByCalling)})}}),r.calledByError.forEach(s=>{[...s.errorCalls||[]].forEach(p=>{xe.includes(p.type)&&p!==r&&(Ue(r).find(f=>f===p)||n(s,p))});let l;if(Je.includes(s.type)&&(l=s),l){const p=rs(l);p.reachable||Ue(r).find(f=>f===s)||p.blocks.forEach(f=>{n(s,f.blockedByCalling)})}}),r.calledByEntry.forEach(s=>{if([...s.calls||[]].forEach(p=>{xe.includes(p.type)&&p!==r&&(Ue(r).find(f=>f===p)||n(s,p))}),s===a)return;let l;if(s.type===i.FunctionDeclaration){const p=lt(s);if(p.type===i.DefinitionEntity)return;p.type===i.Loop&&(l=p)}if(l){const p=rs(l);p.reachable||p.blocks.forEach(u=>{n(s,u.blockedByCalling)})}}),{reachable:e.length===0,entryPoint:a,blocks:e}}function Gq(r){return ss.includes(r.type)?r.type===i.FunctionDeclaration?!CP(r):!0:!1}function $q(r){if(i.ActionDescriptor===r.type){if(r.project.operationDeclarations.find(s=>s.id===r.id))return i.Operation;if(r.project.globalEventActionDescriptors.find(s=>s.id===r.id))return i.GlobalEvent;if(r.project.loopDeclarations.find(s=>s.id===r.id))return i.Loop;if(r.project.conditionDeclarations.find(s=>s.id===r.id))return i.Condition}return r.type}function zi(r,e){if(r.type!==i.DefinitionEntity||r.abstract)return!1;const t=op(r)||r;return!!sp(t).includes(e)}function Fq(r){const e=[];return r.entities.forEach(t=>{if(zi(t,U.PERSISTED_ENTITY)){e.push(t);return}}),m(e)}function Uq(r){const e=[];return r.entities.forEach(t=>{if(zi(t,U.RELATIONAL_DATABASE)){e.push(t);return}}),m(e)}function xq(r){return r.type!==i.DefinitionEntity||r.abstract||!zi(r,U.PERSISTED_ENTITY)?null:(r==null?void 0:r.properties.find(t=>{var n;return((n=t.implements)==null?void 0:n.id)===_[i.BuiltInBaseEntity][U.PERSISTED_ENTITY].properties.primaryKey.id&&!t.abstract}))||null}function jq(r){if(r.type!==i.DefinitionEntity)return[];if(r.abstract)return[];if(!zi(r,U.PERSISTED_ENTITY))return[];const e=[],t=r.properties.filter(n=>{var a;return((a=n.implements)==null?void 0:a.id)!==_[i.BuiltInBaseEntity][U.PERSISTED_ENTITY].properties.database.id&&!n.abstract});return e.push(...t),e}function kq(r){var t;if(!r||r.type!==i.DefinitionEntity||!zi(r,U.PERSISTED_ENTITY))return null;const e=r.properties.find(n=>{var a;return((a=n.implements)==null?void 0:a.id)===_[i.BuiltInBaseEntity][U.PERSISTED_ENTITY].properties.database.id});return(t=e==null?void 0:e.getDefaultValue())==null?void 0:t.valueAsType}function He(r,e){var n;if(!Rp.includes(e.type)||!r)return e.project||null;let t=e.project;return r.type===i.Project?t=r:((n=e.project)==null?void 0:n.id)!==r.project.id&&(t=r.project),t}function qq(r,e){const t=[];if(r.parent)if(r.id===r.parent)t.push(new g({id:`${r.id}--${r.parent}--${T.SelfReference}`,code:T.SelfReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const n=e.get(r.parent);n?[i.Project,i.DataType].includes(n.type)||t.push(new g({id:`${r.id}--${r.parent}--${T.InvalidParentReference}`,code:T.InvalidParentReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):t.push(new g({id:`${r.id}--${r.parent}--${T.ReferencedEntityNotFound}`,code:T.ReferencedEntityNotFound,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return r.implements&&Array.isArray(r.implements)?r.implements.forEach(n=>{if(r.id===n){t.push(new g({id:`${r.id}--${n}--${T.SelfReference}`,code:T.SelfReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at one of the 'implements' references. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));return}const a=e.get(n);a?[i.DefinitionEntity,i.BuiltInBaseEntity].includes(a.type)?a.abstract||t.push(new g({id:`${r.id}--${n}--${T.InvalidImplementsReference}`,code:T.InvalidImplementsReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):t.push(new g({id:`${r.id}--${n}--${T.InvalidImplementsReference}`,code:T.InvalidImplementsReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):t.push(new g({id:`${r.id}--${n}--${T.ReferencedEntityNotFound}`,code:T.ReferencedEntityNotFound,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${n}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):t.push(new g({id:`${r.id}--${B.InvalidObjectStructure}`,code:B.InvalidObjectStructure,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' property that isn't an array.`,issue:null})),r.extends&&Array.isArray(r.extends)&&r.extends.forEach(n=>{const a=e.get(n);a?[i.DefinitionEntity,i.BuiltInBaseEntity].includes(a.type)?a.abstract&&t.push(new g({id:`${r.id}--${n}--${T.InvalidExtendsReference}`,code:T.InvalidExtendsReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to a non-abstract entity. Did you want to use the property 'implements', which holds a list of references to absract entities, instead?`,issue:null})):t.push(new g({id:`${r.id}--${n}--${T.InvalidExtendsReference}`,code:T.InvalidExtendsReference,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):t.push(new g({id:`${r.id}--${n}--${T.ReferencedEntityNotFound}`,code:T.ReferencedEntityNotFound,severity:E.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${n}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),t}const De=class De{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"x");c(this,"y");c(this,"static");c(this,"abstract");c(this,"type",i.DefinitionEntity);c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"implements",[]);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"suggestedProperties",[]);c(this,"suggestedMethods",[]);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.name=e.name,this.description=e.description,this.x=e.x,this.y=e.y,this.static=e.static,this.abstract=e.abstract}static fromGenerationTarget(e,t){let n=t;if(e.parent){const p=S(e.parent);n=t.get(p)}const a=[];e.implements&&e.implements.forEach(p=>{a.push(t.get(p)||t.getBuiltIn(p))});const s=[];e.extends&&e.extends.forEach(p=>{s.push(t.get(p)||t.getBuiltIn(p))});const o={id:e.id,version:1,name:e.name,type:i.DefinitionEntity,description:e.description,static:e.static,abstract:e.abstract,properties:[],methods:[],abstractMethods:[],extends:s,implements:a,x:0,y:0,parent:n},l=b(o,t);return l.setParent(n),l.initChildren(),l}static validateGenerationTarget(e,t){let n=JSON.parse(JSON.stringify(e));const a=[],s=qq(n,t),o=Zo(n,t);a.push(...s,...o,...je(n));const l=n.parent?t.get(n.parent):null;if(l&&l.type===i.DataType){const p=l;p.entity&&a.push(new g({id:`${e.id}--${T.NewEntityWouldOverriteExisting}`,code:T.NewEntityWouldOverriteExisting,severity:E.Error,message:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${p.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
|
|
404
404
|
You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
|
|
405
405
|
${bn({describe_entity:p.entity.id})}
|
|
406
406
|
Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:a,modifiedData:n}}get allBasePropertiesFromExtendedAndImplementedEntities(){return m([...this.extends.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract),...e],[])])}get extendedPropertiesFromOriginalParents(){return m(this.extends.reduce((e,t)=>{const n=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...n]},[]))}get implementedPropertiesFromOriginalParents(){return m([...this.extends.reduce((e,t)=>{const n=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(s=>!!s.abstract&&!n.find(o=>o.name===s.name));return[...n,...a,...e]},[]),...this.implements.reduce((e,t)=>{const n=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(s=>!!s.abstract&&!n.find(o=>o.name===s.name));return[...n,...a,...e]},[])].filter(e=>!!e.abstract))}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new g({id:`${this.id}--${T.InvalidParentUpdate}`,code:T.InvalidParentUpdate,severity:E.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors:t,modifiedData:e}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}return this.initialData.extends.forEach(a=>{const s=S(a),o=this.project.get(s);o&&(this.addExtension(o),e.push(o))}),this.initialData.implements.forEach(a=>{const s=S(a),o=this.project.get(s);o&&(this.addImplementation(o),e.push(o))}),{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,this.syncImplementationProperties(),this.addExtendedProperties(),this.addSuggestions(),{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){const e=[this],t=[],n=[];if(this.parent.type===i.DataType){const a=this.parent;a.entity=this,e.push(a)}else this.project.addDefinitionEntity(this);return{updated:m(e),added:m(t),removed:m(n),self:this}}setParent(e){return this.parent=e,this}addExtension(e){return this.extends.includes(e)||this.extends.push(e),this}removeExtension(e){return this.extends=this.extends.filter(t=>t.id!==e.id),this}addImplementation(e){return this.implements.includes(e)||this.implements.push(e),this}removeImplementation(e){return this.implements=this.implements.filter(t=>t.id!==e.id),this}removeProperty(e){return this.properties=this.properties.filter(t=>t.id!==e.id),this}addMethod(e){return this.methods.includes(e)||(this.methods.push(e),this.suggestedMethods=this.suggestedMethods.filter(t=>t.name!==e.name)),this}removeMethod(e){return this.methods=this.methods.filter(t=>t.id!==e.id),this}addProperty(e){return this.properties.includes(e)||(this.properties.push(e),this.suggestedProperties=this.suggestedProperties.filter(t=>t.name!==e.name)),this}addSuggestedProperty(e){return this.suggestedProperties.includes(e)||this.suggestedProperties.push(e),this}addSuggestedMethod(e){return this.suggestedMethods.includes(e)||this.suggestedMethods.push(e),this}removeSuggestedProperty(e){return this.suggestedProperties=this.suggestedProperties.filter(t=>t.id!==e.id),this}removeSuggestedMethod(e){return this.suggestedMethods=this.suggestedMethods.filter(t=>t.id!==e.id),this}addAbstractMethod(e){return this.abstractMethods.includes(e)||this.abstractMethods.push(e),this}removeAbstractMethod(e){return this.abstractMethods=this.abstractMethods.filter(t=>t.id!==e.id),this}initChildren(){return this.initialized?this:(this.initialized=!0,this.properties=this.initialData.properties.map(e=>{const t=b(e,this.project);return t.setParent(this),t.initChildren(),t}),this.methods=this.initialData.methods.map(e=>{const t=b(e,this.project);return t.setParent(this),t.initChildren(),t}),this.abstractMethods=this.initialData.abstractMethods.map(e=>{const t=b(e,this.project);return t.setParent(this),t.initChildren(),t}),this.extends=this.initialData.extends.map(e=>b(e,this.project)),this.implements=this.initialData.implements.map(e=>b(e,this.project)),this.afterAllChildrenInitialized(),this)}syncImplementationProperties(){const e=this.properties,t=this.implementedPropertiesFromOriginalParents,n=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...e];return t.filter(s=>!n.find(l=>{var p;return((p=l.implements)==null?void 0:p.id)===s.id})).forEach(s=>{if(this.properties.find(u=>{var h;return((h=u.implements)==null?void 0:h.id)===s.id}))return;const l=this.properties.find(u=>u.name===s.name&&!!u.abstract&&!u.implements);if(l){l.implements=s,l.abstract=!1;return}const p=s.clone(this,M.UUID.uuid());p.initChildren(),p.implements=s,p.abstract=!1,this.addProperty(p)}),this}addExtendedProperties(){const e=this.properties,t=this.extendedPropertiesFromOriginalParents,n=t.filter(s=>t.find(l=>{var p;return((p=l.implements)==null?void 0:p.id)===s.id})?!1:!s.abstract),a=new Set(e.map(s=>s.name));return n.forEach(s=>{if(a.has(s.name))return;a.add(s.name);const o=s.clone(this,M.UUID.uuid());o.initChildren(),this.addProperty(o)}),this}addSuggestions(){return this.implements.forEach(e=>{v5(this,e).forEach(a=>{const s=a.toJSON();s.id=`_suggestion--parent--${this.id}--${a.id}`;const o=b(s,this.project);o.suggestion=!0,o.setParent(this),o.initChildren(),this.addSuggestedProperty(o)}),I5(this,e).forEach(a=>{const s=`_suggestion--parent--${this.id}--${a.id}`,o=a.implementAsFunctionDeclaration(s),l=b(o,this.project);if(l.suggestion=!0,l.setParent(this),l.initChildren(),l.inputs.forEach(p=>{p.suggestion=!0}),l.returnStatements.length){const p=l.returnStatements[0];p.suggestion=!0,p.outputs.forEach(u=>{u.suggestion=!0})}this.addSuggestedMethod(l)})}),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.name=e.name||this.name,this.x=e.x||this.x,this.y=e.y||this.y,this.static=e.static||this.static,this.abstract=e.abstract||this.abstract,this}async load(e=V){return await De.repository.load(this.id),this}async create(e=V){return await De.repository.create(this.toShallowJSON()),this}async update(e=V){return await De.repository.update(this.toShallowJSON()),this}async delete(e=V){return await De.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const n=[],a=[];return t.has(this.id)?{affected:[],removed:[]}:(t.add(this.id),a.push(this),this.unsubscribe(),this.properties.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});n.push(...o),a.push(...l)}),this.methods.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});n.push(...o),a.push(...l)}),this.abstractMethods.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});n.push(...o),a.push(...l)}),this.suggestedProperties.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});n.push(...o),a.push(...l)}),this.suggestedMethods.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});n.push(...o),a.push(...l)}),{affected:m(n),removed:m(a)})}restore({seenEntities:e}={seenEntities:new Set}){const t=[];return e.has(this.id)?{affected:[],self:this}:(e.add(this.id),this.subscribe(),this.properties.forEach(n=>{const{affected:a}=n.restore({seenEntities:e});t.push(...a)}),this.methods.forEach(n=>{const{affected:a}=n.restore({seenEntities:e});t.push(...a)}),this.abstractMethods.forEach(n=>{const{affected:a}=n.restore({seenEntities:e});t.push(...a)}),this.suggestedProperties.forEach(n=>{const{affected:a}=n.restore({seenEntities:e});t.push(...a)}),this.suggestedMethods.forEach(n=>{const{affected:a}=n.restore({seenEntities:e});t.push(...a)}),{affected:m(t),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(n=>n.toFlat(e)),...this.implements.flatMap(n=>n.toFlat(e)),...this.properties.flatMap(n=>n.toFlat(e)),...this.methods.flatMap(n=>n.toFlat(e)),...this.abstractMethods.flatMap(n=>n.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(n=>n.toFlatIds(e)),...this.implements.flatMap(n=>n.toFlatIds(e)),...this.properties.flatMap(n=>n.toFlatIds(e)),...this.methods.flatMap(n=>n.toFlatIds(e)),...this.abstractMethods.flatMap(n=>n.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),implements:this.implements.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e)),parent:this.parent.toReference()})}toJSONClone(e=L){var n,a,s,o,l;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:1,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(p=>p.toJSONClone({...e,newId:null})),methods:this.methods.map(p=>p.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(p=>p.toJSONClone({...e,newId:null})),implements:this.implements.map(p=>p.type===i.BuiltInBaseEntity?p.toJSON():p.toJSONClone({...e,newId:null})),extends:this.extends.map(p=>p.type===i.BuiltInBaseEntity?p.toJSON():p.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,name:this.name,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(a=>a.toReference(e)),methods:this.methods.map(a=>a.toReference(e)),abstractMethods:this.abstractMethods.map(a=>a.toReference(e)),implements:this.implements.map(a=>a.toReference(e)),extends:this.extends.map(a=>a.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(n=>n.toFlatJSON(e)),...this.methods.flatMap(n=>n.toFlatJSON(e)),...this.abstractMethods.flatMap(n=>n.toFlatJSON(e)),...this.implements.flatMap(n=>n.toFlatJSON(e)),...this.extends.flatMap(n=>n.toFlatJSON(e))])}toGenerationTarget(){const e=this.parent.type===i.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,static:this.static,abstract:this.abstract,extends:this.extends.map(t=>t.id),implements:this.implements.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(n=>n.toFlatGenerationTarget(e)),...this.methods.flatMap(n=>n.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(n=>n.toFlatGenerationTarget(e)),...this.implements.filter(n=>n.type===i.DefinitionEntity).flatMap(n=>n.toFlatGenerationTarget(e)),...this.implements.filter(n=>n.type===i.DefinitionEntity).flatMap(n=>n.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){return this.errors=b5(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e=null,t=null,n=!0){var v,I,D;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.DefinitionEntity,a);s.properties=[],s.methods=[],s.abstractMethods=[];const l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e&&u.setParent(e),n&&u.subscribe(),u.initChildren();const h=(v=this.properties)==null?void 0:v.map((O,$)=>O.clone(u,p+"-property-"+$+"-id",n));u.properties=h;const f=(I=this.methods)==null?void 0:I.map((O,$)=>O.clone(u,p+"-method-"+$+"-id",n));u.methods=f;const R=(D=this.abstractMethods)==null?void 0:D.map((O,$)=>O.clone(u,p+"-abstract-method-"+$+"-id",n));return u.abstractMethods=R,u}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t){return al(this,e,t)}getAllInteractiveMethods(){const e=this.implements.filter(n=>n.type===i.DefinitionEntity||n.type===i.BuiltInBaseEntity&&n.interactive);return m([...this.methods,...this.extends.flatMap(n=>n.getAllInteractiveMethods()),...e.flatMap(n=>n.getAllInteractiveMethods())])}inferFromInputs(e){if(this.parent.type!==i.DataType||!this.parent.inferred)return this;const t=[];e.forEach(s=>{t.find(l=>w(l,this.project)===w(s,this.project))||t.push(s)});const n=this.properties.filter(s=>!s.getDataType());t.forEach(s=>{const o=n.find(f=>w(f,this.project)===w(s,this.project));if(!o)return;const p=Ur(s.parent).getMasterInputWithValueWritterFromAllInstances(s),u=gn(p),h=u==null?void 0:u.clone(o,o.id+"--"+M.UUID.uuid()+"--data-type",!0);h&&o.setDataType(h),s.setDeclaration(o)});const a=[];return t.forEach(s=>{if(!s.declaration){a.push(s);return}}),a.length===0?this:(a.forEach(s=>{const o=this.properties.find(v=>w(v,this.project)===w(s,this.project));if(o){if(s.setDeclaration(o),!o.getDataType()){const I=Ur(s.parent).getMasterInputWithValueWritterFromAllInstances(s),D=gn(I),O=D==null?void 0:D.clone(o,o.id+"--"+M.UUID.uuid()+"--data-type",!0);O&&o.setDataType(O)}return}const l={id:s.id+"--"+M.UUID.uuid()+"--inferred-property",type:i.Property,version:1,name:w(s,this.project),description:s.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:s.index,implements:null,dataType:null,parent:this.toReference()},p=b(l,this.project);p.setParent(this),p.initChildren();const h=Ur(s.parent).getMasterInputWithValueWritterFromAllInstances(s),f=gn(h),R=f==null?void 0:f.clone(p,l.id+"--"+M.UUID.uuid()+"--data-type",!0);return R&&p.setDataType(R),this.addProperty(p),s.setDeclaration(p),p}),this)}};c(De,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(De,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),c(De,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(De,"BASE_PROPERTIES",[...De.MUTABLE_BASE_PROPERTIES,...De.INMUTABLE_BASE_PROPERTIES]),c(De,"MUTABLE_META_PROPERTIES",[...De.MUTABLE_BASE_PROPERTIES,"x","y"]),c(De,"INMUTABLE_META_PROPERTIES",[...De.INMUTABLE_BASE_PROPERTIES]),c(De,"META_PROPERTIES",[...De.MUTABLE_META_PROPERTIES,...De.INMUTABLE_META_PROPERTIES]),c(De,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),c(De,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),c(De,"UPSTREAM_PROPERTIES",[...De.MUTABLE_UPSTREAM_PROPERTIES,...De.INMUTABLE_UPSTREAM_PROPERTIES]),c(De,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),c(De,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(De,"DOWNSTREAM_PROPERTIES",[...De.MUTABLE_DOWNSTREAM_PROPERTIES,...De.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(De,"PROPERTIES",[...De.META_PROPERTIES,...De.UPSTREAM_PROPERTIES,...De.DOWNSTREAM_PROPERTIES]);let ei=De;function Jq(r){const e=X9(),t=r.toJSON();e.safeParse(t).success;const a=[];return Be(r.errors,a)}const as=class as{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"type",i.BuiltInBaseEntity);c(this,"abstract",!1);c(this,"static");c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"interactive",!1);c(this,"errors",[]);c(this,"project");this.initialData=this.initialData||e,this.project=this.project||t,this.id=this.id||e.id,this.version=this.version||e.version,this.name=this.name||e.name,this.static=this.static||e.static,this.interactive=this.interactive||e.interactive,this.abstract=e.abstract,this.properties=this.initialData.properties.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.methods=this.initialData.methods.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.abstractMethods=this.initialData.abstractMethods.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.extends=this.initialData.extends.map(n=>b(n,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return m(this.extends.reduce((e,t)=>{const n=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...n]},[]))}get extendedPropertiesFromOriginalParents(){return m(this.extends.reduce((e,t)=>{const n=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...n]},[]))}get implementedPropertiesFromOriginalParents(){return m([...this.extends.reduce((e,t)=>{const n=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(s=>!!s.abstract&&!n.find(o=>o.name===s.name));return[...n,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async load(e=V){return await as.repository.load(this.id),this}remove(e={ignoreUpstream:!1,seenEntities:new Set}){return{affected:[],removed:[]}}restore({seenEntities:e}={seenEntities:new Set}){return{affected:[],self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(n=>n.toFlat(e)),...this.methods.flatMap(n=>n.toFlat(e)),...this.abstractMethods.flatMap(n=>n.toFlat(e)),...this.extends.flatMap(n=>n.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(n=>n.toFlatIds(e)),...this.methods.flatMap(n=>n.toFlatIds(e)),...this.abstractMethods.flatMap(n=>n.toFlatIds(e)),...this.extends.flatMap(n=>n.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=L){return{id:this.id+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(e=L){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(n=>n.toFlatJSON(e)),...this.methods.flatMap(n=>n.toFlatJSON(e)),...this.abstractMethods.flatMap(n=>n.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(n=>n.toFlatGenerationTarget(e)),...this.methods.flatMap(n=>n.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(n=>n.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=Jq(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}implement(e,t){return al(this,e,t)}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(n=>n.type===i.BuiltInBaseEntity&&n.interactive||n.type===i.PrimitiveEntity).forEach(n=>{n instanceof as&&e.push(...n.getAllInteractiveMethods())})),m(e)}};c(as,"repository",{load:async e=>null});let In=as;function Wq(r){const e=k9(),t=r.toJSON();e.safeParse(t).success;const a=[];return Be(r.errors,a)}const El=class El{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"type",i.PrimitiveEntity);c(this,"static");c(this,"abstract");c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"errors",[]);c(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.methods=this.initialData.methods.map(n=>{const a=b(n,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(n=>{const a=b(n,this.project);return a.parent=this,a})}get allBasePropertiesFromExtendedAndImplementedEntities(){return m(this.extends.reduce((e,t)=>{const n=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...n]},[]))}get extendedPropertiesFromOriginalParents(){return m(this.extends.reduce((e,t)=>{const n=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...n]},[]))}get implementedPropertiesFromOriginalParents(){return m([...this.extends.reduce((e,t)=>{const n=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(s=>!!s.abstract&&!n.find(o=>o.name===s.name));return[...n,...a,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async load(e=V){return await El.repository.load(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){return{affected:[],removed:[]}}restore({seenEntities:e}={seenEntities:new Set}){return{affected:[],self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(n=>n.toFlat(e)),...this.methods.flatMap(n=>n.toFlat(e)),...this.abstractMethods.flatMap(n=>n.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(n=>n.toFlatIds(e)),...this.methods.flatMap(n=>n.toFlatIds(e)),...this.abstractMethods.flatMap(n=>n.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=L){return{id:this.id+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(e=L){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(n=>n.toFlatJSON(e)),...this.methods.flatMap(n=>n.toFlatJSON(e)),...this.abstractMethods.flatMap(n=>n.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(n=>n.toFlatGenerationTarget(e)),...this.methods.flatMap(n=>n.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(n=>n.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=Wq(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const e=[];return e.push(...this.methods),this.extends.filter(n=>n.type===i.BuiltInBaseEntity&&n.interactive||n.type===i.PrimitiveEntity).forEach(n=>{n instanceof In&&e.push(...n.getAllInteractiveMethods())}),m(e)}};c(El,"repository",{load:async e=>null});let Kt=El;function ke(r,e){if(!r)throw new Error("Entity is null");const t=e.get(r.id);switch(r.type){case i.LiteralValue:return t||new Wi(r,e);case i.DefinitionEntity:return t||new ei(r,e);case i.PrimitiveEntity:return t||new Kt(r,e);case i.FunctionDeclaration:return t||new jr(r,e);case i.GlobalEvent:return t||new qi(r,e);case i.DataType:return t||new ki(r,e);case i.Property:return t||new xr(r,e);case i.FunctionCall:return t||new Xr(r,e);case i.Condition:return t||new Jr(r,e);case i.Operation:return t||new kr(r,e);case i.VariableDeclaration:return t||new sn(r,e);case i.VariableInstance:return t||new Wr(r,e);case i.OutputMap:return t||new jn(r,e);case i.ReturnDeclaration:return t||new kt(r,e);case i.ArgumentDeclaration:return t||new zr(r,e);case i.InputMap:return t||new xn(r,e);case i.Project:return t||new M(r);case i.InstalledProject:return t||new Hr(r,e);case i.ActionDescriptor:return t||new se(r,e);case i.ReturnStatement:return t||new Zr(r,e);case i.Loop:return t||new qr(r,e);case i.Search:return t||new Yr(r,e);case i.ValueDescriptor:return t||new Kr(r,e);case i.BuiltInBaseEntity:return t||new In(r,e);case i.InternalCall:return t||new Ji(r,e);case i.ContinueStatement:return t||new Ot(r,e);case i.BreakStatement:return t||new Yi(r,e);case i.GenericReference:return e.get(r.entityId);default:throw new Error("Invalid entity type: "+r.type)}}function b(r,e){if(!r)throw new Error("Entity is null");const t=ke(r,e);return t.subscribe(),t}function Yq(r,e){if(!r)throw new Error("Entity is null");switch(r.type){case i.LiteralValue:return Wi.fromGenerationTarget(r,e);case i.DefinitionEntity:return ei.fromGenerationTarget(r,e);case i.FunctionDeclaration:return jr.fromGenerationTarget(r,e);case i.GlobalEvent:return qi.fromGenerationTarget(r,e);case i.DataType:return ki.fromGenerationTarget(r,e);case i.Property:return xr.fromGenerationTarget(r,e);case i.FunctionCall:return Xr.fromGenerationTarget(r,e);case i.Condition:return Jr.fromGenerationTarget(r,e);case i.Operation:return kr.fromGenerationTarget(r,e);case i.VariableDeclaration:return sn.fromGenerationTarget(r,e);case i.VariableInstance:return Wr.fromGenerationTarget(r,e);case i.OutputMap:return jn.fromGenerationTarget(r,e);case i.ReturnDeclaration:return kt.fromGenerationTarget(r,e);case i.ArgumentDeclaration:return zr.fromGenerationTarget(r,e);case i.InputMap:return xn.fromGenerationTarget(r,e);case i.InstalledProject:return Hr.fromGenerationTarget(r,e);case i.ReturnStatement:return Zr.fromGenerationTarget(r,e);case i.Loop:return qr.fromGenerationTarget(r,e);case i.Search:return Yr.fromGenerationTarget(r,e);case i.ActionDescriptor:return se.fromGenerationTarget(r,e);case i.ValueDescriptor:return Kr.fromGenerationTarget(r,e);case i.InternalCall:return Ji.fromGenerationTarget(r,e);case i.ContinueStatement:return Ot.fromGenerationTarget(r,e);case i.BreakStatement:return Yi.fromGenerationTarget(r,e);default:throw new Error("Invalid entity type: "+r.type)}}const L={seenEntityMaps:new Map,seenEntities:new Set};class MP{constructor(){c(this,"initialData")}}const V={cascade:!1},_P={load:async r=>null},Hq={create:async r=>r,update:async r=>r,delete:async r=>{},..._P};class zq{}class Zq extends MP{}class Kq{}class Xq{}class Qq{}class pp{}class eJ extends pp{}class tJ extends pp{}class nJ{}class qn{static initReadsValue(e){if(e.initialData.readsValue&&e.initialData.readsValue.type!==i.GenericReference)e.readsValue=b(e.initialData.readsValue,e.project);else if(e.initialData.readsValue&&e.initialData.readsValue.type===i.GenericReference){const t=Lt(e.initialData.readsValue,e.project);t&&(e.readsValue=t)}if(e.readsValue){if(Fe.includes(e.readsValue.type)){let t=e.parent;pt.includes(t.type)||(t=t.parent);const n=e.type===i.InputMap&&e.parent.type===i.Loop;n&&(t=e.parent.parent),e.readsValue.setParent(t),e.readsValue.initChildren(),!n&&t.detachedChildren.includes(e)?t.replaceDetachedChild(e,e.readsValue):n||t.subscribeDetachedChild(e.readsValue)}e.readsValue.addValueReader(e)}return e.readsValue}static hydrateReadsValue(e){if(e.initialData.readsValue&&e.initialData.readsValue.type!==i.GenericReference)e.readsValue=b(e.initialData.readsValue,e.project);else if(e.initialData.readsValue&&e.initialData.readsValue.type===i.GenericReference){const t=Lt(e.initialData.readsValue,e.project);t&&(e.readsValue=t)}if(e.readsValue){if(Fe.includes(e.readsValue.type)){let t=e.parent;pt.includes(t.type)||(t=t.parent);const n=e.type===i.InputMap&&e.parent.type===i.Loop;n&&(t=e.parent.parent),e.readsValue.setParent(t),!n&&t.detachedChildren.includes(e)?t.replaceDetachedChild(e,e.readsValue):n||t.subscribeDetachedChild(e.readsValue)}e.readsValue.addValueReader(e)}return e.readsValue}}class is{static initWritesValues(e,t){const n=e.initialData.writesValues.reduce((s,o)=>{if(o.type===i.GenericReference||e.writesValues.some(p=>p.id===o.id))return s;const l=b(o,e.project);return l.setValueWriter(e),Fe.includes(l.type)&&(l.setParent(t),l.initChildren()),[...s,l]},[]),a=[...e.writesValues];return e.writesValues=m([...a,...n]),e.writesValues}}class rJ{}const te=class te{constructor(e){c(this,"initialData");c(this,"id");c(this,"version");c(this,"type",i.Project);c(this,"name",null);c(this,"description",null);c(this,"x");c(this,"y");c(this,"entities",[]);c(this,"projects",[]);c(this,"functions",[]);c(this,"events",[]);c(this,"variableDeclarations",[]);c(this,"variableInstances",[]);c(this,"conditions",[]);c(this,"operations",[]);c(this,"functionCalls",[]);c(this,"loops",[]);c(this,"searches",[]);c(this,"primitives",[]);c(this,"builtInBaseEntities",[]);c(this,"operationDeclarations",[]);c(this,"globalEventActionDescriptors",[]);c(this,"loopDeclarations",[]);c(this,"loopDeclarationsBodies",[]);c(this,"conditionDeclarations",[]);c(this,"valueDescriptors",[]);c(this,"dataTypes",[]);c(this,"project");c(this,"instances",{});c(this,"builtInInstances",{});c(this,"errors",[]);c(this,"references",[]);c(this,"initialized",!1);this.initialData=e,this.id=e.id,this.version=e.version,this.name=e.name,this.description=e.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!te.UUID||te.UUID.isBackup)&&(te.UUID=eo==null?void 0:eo()),te.UUID||(te.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:t=>t})}catch(t){console.error("Error initializing UUID module",t),te.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:n=>n}}}static injectUUIDModule(e){te.UUID=e}static validateGenerationTarget(e,t){let n=JSON.parse(JSON.stringify(e));const a=[];return a.push(...je(n)),{errors:a,modifiedData:n}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async n=>{await t.init(this),n(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}hydrateAncestors(){const e=[],t=[],n=[];return{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,this.validate(),{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){const e=[],t=[],n=[];return{updated:m(e),added:m(t),removed:m(n),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(e){return this.operationDeclarations.includes(e)}isGlobalEventActionDescriptor(e){return this.globalEventActionDescriptors.includes(e)}isLoopDeclaration(e){return this.loopDeclarations.includes(e)}isConditionDeclaration(e){return this.conditionDeclarations.includes(e)}initChildren(){return this.initialized?this:(this.initialized=!0,this.entities=this.initialData.entities.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.projects=this.initialData.projects.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.variableDeclarations=this.initialData.variableDeclarations.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.variableInstances=this.initialData.variableInstances.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.conditions=this.initialData.conditions.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.operations=this.initialData.operations.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.functions=this.initialData.functions.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.events=this.initialData.events.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.functionCalls=this.initialData.functionCalls.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.loops=this.initialData.loops.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.searches=this.initialData.searches.map(e=>{const t=b(e,this);return t.setParent(this),t.initChildren(),t}),this.attachOrphanReferences(),this.afterAllChildrenInitialized(),this)}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeBuiltInInstance(e){return(!this.builtInInstances[e.id]||this.builtInInstances[e.id]!==e)&&(this.builtInInstances[e.id]=e),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(e){return delete this.instances[e.id],this}findSubscribedInstance(e){return this.instances[e.id]||null}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getManaged(e){return this.instances[e]||null}getBuiltIn(e){return this.builtInInstances[e]||null}findSubscribedInstanceFromReference(e){return this.instances[e.entityId]||null}findSubscribedBuiltInInstanceFromReference(e){return this.builtInInstances[e.entityId]||null}sync(e){return this.version=e.version||this.version,this.name=e.name||this.name,this.description=e.description||this.description,this.x=e.x||this.x,this.y=e.y||this.y,this}async load(e=V){return await te.repository.load(this.id),this}async create(e=V){return await te.repository.create(this.toShallowJSON()),this}async update(e=V){return await te.repository.update(this.toShallowJSON()),this}async delete(e=V){return await te.repository.delete(this.id),this}remove({ignoreUpstream:e}={ignoreUpstream:!1}){return{affected:[],removed:[]}}restore({seenEntities:e}={seenEntities:new Set}){return{affected:[],self:this}}getAllBuiltInIds(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlatIds(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlatIds(e)),...this.operationDeclarations.flatMap(t=>t.toFlatIds(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlatIds(e)),...this.loopDeclarations.flatMap(t=>t.toFlatIds(e)),...this.conditionDeclarations.flatMap(t=>t.toFlatIds(e)),...this.valueDescriptors.flatMap(t=>t.toFlatIds(e)),...this.dataTypes.flatMap(t=>t.toFlatIds(e))]}getAllBuiltIn(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlat(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlat(e)),...this.operationDeclarations.flatMap(t=>t.toFlat(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlat(e)),...this.loopDeclarations.flatMap(t=>t.toFlat(e)),...this.conditionDeclarations.flatMap(t=>t.toFlat(e)),...this.valueDescriptors.flatMap(t=>t.toFlat(e)),...this.dataTypes.flatMap(t=>t.toFlat(e))]}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(n=>n.toFlat(e)),...this.functions.flatMap(n=>n.toFlat(e)),...this.events.flatMap(n=>n.toFlat(e)),...this.projects.flatMap(n=>n.toFlat(e)),...this.variableDeclarations.flatMap(n=>n.toFlat(e)),...this.variableInstances.flatMap(n=>n.toFlat(e)),...this.conditions.flatMap(n=>n.toFlat(e)),...this.operations.flatMap(n=>n.toFlat(e)),...this.functionCalls.flatMap(n=>n.toFlat(e)),...this.loops.flatMap(n=>n.toFlat(e)),...this.searches.flatMap(n=>n.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),Array.from(e))}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,entities:this.entities.map(t=>t.toJSON(e)),variableDeclarations:this.variableDeclarations.map(t=>t.toJSON(e)),variableInstances:this.variableInstances.map(t=>t.toJSON(e)),conditions:this.conditions.map(t=>t.toJSON(e)),operations:this.operations.map(t=>t.toJSON(e)),loops:this.loops.map(t=>t.toJSON(e)),searches:this.searches.map(t=>t.toJSON(e)),functions:this.functions.map(t=>t.toJSON(e)),events:this.events.map(t=>t.toJSON(e)),projects:this.projects.map(t=>t.toJSON(e)),functionCalls:this.functionCalls.map(t=>t.toJSON(e))})}toJSONClone(e={uuidStrategy:"uuid"}){const t=new Map,n=new Set,a=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(s=>{if(a.includes(s)){t.set(s,s);return}t.set(s,te.UUID.uuid())}),n.add(this.id),{id:t.get(this.id),version:this.version,type:this.type,name:this.name,description:this.description,entities:this.entities.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),projects:this.projects.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),variableDeclarations:this.variableDeclarations.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),variableInstances:this.variableInstances.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),conditions:this.conditions.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),operations:this.operations.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),functions:this.functions.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),events:this.events.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),functionCalls:this.functionCalls.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),loops:this.loops.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null})),searches:this.searches.map(s=>s.toJSONClone({...e,seenEntityMaps:t,seenEntities:n,newId:null}))}}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+te.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,name:this.name,description:this.description,entities:this.entities.map(a=>a.toReference(e)),functions:this.functions.map(a=>a.toReference(e)),events:this.events.map(a=>a.toReference(e)),projects:this.projects.map(a=>a.toReference(e)),variableDeclarations:this.variableDeclarations.map(a=>a.toReference(e)),variableInstances:this.variableInstances.map(a=>a.toReference(e)),conditions:this.conditions.map(a=>a.toReference(e)),operations:this.operations.map(a=>a.toReference(e)),functionCalls:this.functionCalls.map(a=>a.toReference(e)),loops:this.loops.map(a=>a.toReference(e)),searches:this.searches.map(a=>a.toReference(e))}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(n=>n.toFlatJSON(e)),...this.functions.flatMap(n=>n.toFlatJSON(e)),...this.events.flatMap(n=>n.toFlatJSON(e)),...this.projects.flatMap(n=>n.toFlatJSON(e)),...this.variableDeclarations.flatMap(n=>n.toFlatJSON(e)),...this.variableInstances.flatMap(n=>n.toFlatJSON(e)),...this.conditions.flatMap(n=>n.toFlatJSON(e)),...this.operations.flatMap(n=>n.toFlatJSON(e)),...this.functionCalls.flatMap(n=>n.toFlatJSON(e)),...this.loops.flatMap(n=>n.toFlatJSON(e)),...this.searches.flatMap(n=>n.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(n=>n.toFlatGenerationTarget(e)),...this.functions.flatMap(n=>n.toFlatGenerationTarget(e)),...this.events.flatMap(n=>n.toFlatGenerationTarget(e)),...this.projects.flatMap(n=>n.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(n=>n.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(n=>n.toFlatGenerationTarget(e)),...this.conditions.flatMap(n=>n.toFlatGenerationTarget(e)),...this.operations.flatMap(n=>n.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(n=>n.toFlatGenerationTarget(e)),...this.loops.flatMap(n=>n.toFlatGenerationTarget(e)),...this.searches.flatMap(n=>n.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.entities.forEach(e=>e.clearErrors()),this.projects.forEach(e=>e.clearErrors()),this.functions.forEach(e=>e.clearErrors()),this.events.forEach(e=>e.clearErrors()),this.variableDeclarations.forEach(e=>e.clearErrors()),this.variableInstances.forEach(e=>e.clearErrors()),this.conditions.forEach(e=>e.clearErrors()),this.operations.forEach(e=>e.clearErrors()),this.functionCalls.forEach(e=>e.clearErrors()),this.loops.forEach(e=>e.clearErrors()),this.searches.forEach(e=>e.clearErrors()),this}validate(){const e=f5(),t=this.toJSON();return e.safeParse(t),this.validateChildren(),{success:!0,error:null,data:t}}validateChildren(){this.entities.forEach(e=>e.validate()),this.projects.forEach(e=>e.validate()),this.functions.forEach(e=>e.validate()),this.events.forEach(e=>e.validate()),this.variableDeclarations.forEach(e=>e.validate()),this.variableInstances.forEach(e=>e.validate()),this.conditions.forEach(e=>e.validate()),this.operations.forEach(e=>e.validate()),this.functionCalls.forEach(e=>e.validate()),this.loops.forEach(e=>e.validate()),this.searches.forEach(e=>e.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(t=>t.getErrors()),...this.projects.flatMap(t=>t.getErrors()),...this.functions.flatMap(t=>t.getErrors()),...this.events.flatMap(t=>t.getErrors()),...this.variableDeclarations.flatMap(t=>t.getErrors()),...this.variableInstances.flatMap(t=>t.getErrors()),...this.conditions.flatMap(t=>t.getErrors()),...this.operations.flatMap(t=>t.getErrors()),...this.functionCalls.flatMap(t=>t.getErrors()),...this.loops.flatMap(t=>t.getErrors()),...this.searches.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(e){return this.entities.find(t=>t.id===e)||null}addDefinitionEntityFromTransfer(e){const t=b(e,this);return this.addDefinitionEntity(t),t}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=b(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=b(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=b(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=b(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=b(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=b(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=b(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=b(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=b(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=b(e,this);return this.addSearch(t),this}addSearch(e){return this.searches.includes(e)||this.searches.push(e),this}removeDefinitionEntity(e){const t=this.entities.findIndex(n=>n.id===e.id);if(t>-1){const n=this.entities[t];return this.entities.splice(t,1),n}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(n=>n.id===e.id);if(t>-1){const n=this.functions[t];return this.functions.splice(t,1),n}return null}removeExternalProject(e){const t=this.projects.findIndex(n=>n.id===e.id);if(t>-1){const n=this.projects[t];return this.projects.splice(t,1),n}return null}removeGlobalEvent(e){const t=this.events.findIndex(n=>n.id===e.id);if(t>-1){const n=this.events[t];return this.events.splice(t,1),n}return null}removeTopLevelVariableDeclaration(e){if(e.type!==i.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(n=>n.id===e.id);if(t>-1){const n=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),n}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(t=>t.methods)]}getFunctionDeclaration(e){return this.functions.find(t=>t.id===e)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Condition)]},[]),...this.functionCalls.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Condition)]},[]),...this.operations.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Condition)]},[]),...this.loops.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Condition)]},[]),...this.searches.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Operation)]},[]),...this.functionCalls.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Operation)]},[]),...this.conditions.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Operation)]},[]),...this.loops.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Operation)]},[]),...this.searches.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.FunctionCall)]},[]),...this.conditions.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.FunctionCall)]},[]),...this.operations.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.FunctionCall)]},[]),...this.loops.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.FunctionCall)]},[]),...this.searches.reduce((t,n)=>{const a=Ue(n);return[...t,...a.filter(s=>s.type===i.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,n)=>{const a=Se(n);return[...t,...a]},[]),...this.functionCalls.reduce((t,n)=>{const a=Se(n);return[...t,...a]},[]),...this.conditions.reduce((t,n)=>{const a=Se(n);return[...t,...a]},[]),...this.operations.reduce((t,n)=>{const a=Se(n);return[...t,...a]},[]),...this.loops.reduce((t,n)=>{const a=Se(n);return[...t,...a]},[]),...this.searches.reduce((t,n)=>{const a=Se(n);return[...t,...a]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableInstance);return[...t,...s]},[]),...this.functionCalls.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableInstance);return[...t,...s]},[]),...this.conditions.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableInstance);return[...t,...s]},[]),...this.operations.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableInstance);return[...t,...s]},[]),...this.loops.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableInstance);return[...t,...s]},[]),...this.searches.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableInstance);return[...t,...s]},[])]}getVariableDeclarations(){return m([...this.variableDeclarations,...this.getEntryPoints().reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableDeclaration);return[...t,...s]},[]),...this.functionCalls.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableDeclaration);return[...t,...s]},[]),...this.conditions.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableDeclaration);return[...t,...s]},[]),...this.operations.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableDeclaration);return[...t,...s]},[]),...this.loops.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableDeclaration);return[...t,...s]},[]),...this.searches.reduce((t,n)=>{const s=Se(n).filter(o=>o.type===i.VariableDeclaration);return[...t,...s]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(n=>{if(!n.declaration){const a=n.initialData,s=a.declaration.entityId||a.declaration.id,o=t.find(l=>l.id===s);o&&n.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===U.PERSISTED_ENTITY)||null}};c(te,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),c(te,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(te,"MUTABLE_BASE_PROPERTIES",["name","description"]),c(te,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(te,"BASE_PROPERTIES",[...te.MUTABLE_BASE_PROPERTIES,...te.INMUTABLE_BASE_PROPERTIES]),c(te,"MUTABLE_META_PROPERTIES",[...te.MUTABLE_BASE_PROPERTIES,"x","y"]),c(te,"INMUTABLE_META_PROPERTIES",[...te.INMUTABLE_BASE_PROPERTIES]),c(te,"META_PROPERTIES",[...te.MUTABLE_META_PROPERTIES,...te.INMUTABLE_META_PROPERTIES]),c(te,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(te,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),c(te,"UPSTREAM_PROPERTIES",[...te.MUTABLE_UPSTREAM_PROPERTIES,...te.INMUTABLE_UPSTREAM_PROPERTIES]),c(te,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),c(te,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(te,"DOWNSTREAM_PROPERTIES",[...te.MUTABLE_DOWNSTREAM_PROPERTIES,...te.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(te,"PROPERTIES",[...te.META_PROPERTIES,...te.UPSTREAM_PROPERTIES,...te.DOWNSTREAM_PROPERTIES]);let M=te;class VP extends se{constructor(t){super(Qt,t);c(this,"id",Ve.Parallel);c(this,"name",Ve.Parallel);c(this,"description","Execute a list of actions one after the other");c(this,"version",1);c(this,"autoexecutable",!0);c(this,"initialData",Qt);c(this,"type",i.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"project");this.project=t,this.inputs=Qt.inputs.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.outputs=Qt.outputs.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.error=Qt.error?b(Qt.error,this.project):null}}class NP extends se{constructor(t){super(Rt,t);c(this,"id",Rt.id);c(this,"name",Rt.name);c(this,"description",Rt.description);c(this,"version",Rt.version);c(this,"autoexecutable",!1);c(this,"initialData",Rt);c(this,"type",i.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"project");this.project=t,this.inputs=Rt.inputs.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.outputs=Rt.outputs.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.error=Rt.error?b(Rt.error,this.project):null}}class LP extends se{constructor(t){super(wn,t);c(this,"id",Ve.Sequential);c(this,"name",Ve.Sequential);c(this,"description","Execute a list of actions one after the other");c(this,"version",1);c(this,"autoexecutable",!0);c(this,"initialData",wn);c(this,"type",i.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"project");this.project=t,this.inputs=wn.inputs.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.outputs=wn.outputs.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.error=wn.error?b(wn.error,this.project):null}}class iJ extends se{constructor(e){super(Xi,e)}}class aJ extends se{constructor(e){super(hr,e)}}class sJ extends se{constructor(t){super(fr,t);c(this,"autoexecutable",!0)}getEntityToMatchInputMap(t){return t.inputs.find(n=>{var a;return((a=n.declaration)==null?void 0:a.id)===_.operation[Ne.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(t){return t.inputs.find(n=>{var a;return((a=n.declaration)==null?void 0:a.id)===_.operation[Ne.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(t){return t.outputs.find(n=>{var a;return((a=n.declaration)==null?void 0:a.id)===_.operation[Ne.Validate].outputs.outputEntity.id})||null}getEntityToMatch(t){let n=null;if(t.readsValue){const s=t.readsValue.getDataType();s&&s.entity&&s.entity.type===i.DefinitionEntity&&(n=s.entity)}const a=t.getDefaultValue();return!n&&a&&a.valueAsType&&!Array.isArray(a.valueAsType)&&a.valueAsType.type===i.DefinitionEntity&&(n=a.valueAsType),n}syncOperationInstance(t){const n=this.getEntityToMatchInputMap(t);n&&this.syncEntityToMatchInputMapDataType(n);const a=this.getDataToValidateInputMap(t);a&&this.syncDataToValidateInputMapDataType(a);const s=this.getOutputDataOutputMap(t);return s&&this.syncOutputDataOutputMapDataType(s),t}syncEntityToMatchInputMapDataType(t){var a,s,o;if(((a=t.declaration)==null?void 0:a.id)!==_.operation[Ne.Validate].inputs.entityToMatch.id)return null;if(!t.dataType){const l={id:t.id+"--"+M.UUID.uuid()+"--infered-data-type",version:1,type:i.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,like:!0,inferred:!0,parent:t.toReference()},p=b(l,t.project);p.setParent(t),p.initChildren(),t.setDataType(p)}(s=t.dataType)==null||s.sync({inferred:!0,like:!1,asType:!0});const n=this.getEntityToMatch(t);return(o=t.dataType)==null||o.setEntity(n),t.dataType}syncDataToValidateInputMapDataType(t){var o,l,p;if(((o=t.declaration)==null?void 0:o.id)!==_.operation[Ne.Validate].inputs.dataToValidate.id)return null;const n=this.getEntityToMatchInputMap(t.parent);if(!n||!this.getEntityToMatch(n))return null;if(!t.dataType){const u={id:t.id+"--"+M.UUID.uuid()+"--infered-data-type",version:1,type:i.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:t.toReference()},h=b(u,t.project);h.setParent(t),h.initChildren(),t.setDataType(h)}(l=t.dataType)==null||l.sync({inferred:!0,like:!0,asType:!1});const s=this.getEntityToMatch(n);return(p=t.dataType)==null||p.setEntity(s),t.dataType}syncOutputDataOutputMapDataType(t){var o,l,p;if(((o=t.declaration)==null?void 0:o.id)!==_.operation[Ne.Validate].outputs.outputEntity.id)return null;const n=this.getEntityToMatchInputMap(t.parent);if(!n||!this.getEntityToMatch(n))return null;if(!t.dataType){const u={id:t.id+"--"+M.UUID.uuid()+"--infered-data-type",version:1,type:i.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:t.toReference()},h=b(u,t.project);h.setParent(t),h.initChildren(),t.setDataType(h)}(l=t.dataType)==null||l.sync({inferred:!0,like:!0,asType:!1});const s=this.getEntityToMatch(n);return(p=t.dataType)==null||p.setEntity(s),t.dataType}inferInputMapDataType(t){var n,a;return((n=t.declaration)==null?void 0:n.id)===_.operation[Ne.Validate].inputs.entityToMatch.id?this.syncEntityToMatchInputMapDataType(t):((a=t.declaration)==null?void 0:a.id)===_.operation[Ne.Validate].inputs.dataToValidate.id?this.syncDataToValidateInputMapDataType(t):null}inferOutputMapDataType(t){var n;return((n=t.declaration)==null?void 0:n.id)===_.operation[Ne.Validate].outputs.outputEntity.id?this.syncOutputDataOutputMapDataType(t):null}}class oJ extends se{constructor(e){super(wl,e)}}class lJ extends se{constructor(e){super(Ml,e)}}class dJ extends se{constructor(e){super(_l,e)}}class cJ extends se{constructor(e){super(us,e)}}class uJ extends se{constructor(e){super(ls,e)}}class pJ extends se{constructor(e){super(Ki,e)}}function yJ(r){const e=[new LP(r),new VP(r),new NP(r),new iJ(r),new aJ(r),new sJ(r),new cJ(r),new oJ(r),new dJ(r),new lJ(r),new uJ(r),new pJ(r),new se(Cl,r),new se(Al,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.operationDeclarations=e,e}class GP extends In{constructor(t){super(st,t);c(this,"initialData");c(this,"id",U.PERSISTED_ENTITY);c(this,"version",1);c(this,"name",U.PERSISTED_ENTITY);c(this,"description",st.description);c(this,"type",i.BuiltInBaseEntity);c(this,"abstract",st.abstract);c(this,"static",st.static);c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"errors",[]);c(this,"project");this.initialData=st,this.project=t,this.id=st.id,this.version=st.version,this.name=st.name,this.static=st.static,this.abstract=st.abstract,this.properties=this.initialData.properties.map(n=>{const a=b(n,this.project);return a.setParent(this),a.initChildren(),a}),this.methods=this.initialData.methods.map(n=>{const a=b(n,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(n=>{const a=b(n,this.project);return a.parent=this,a}),this.extends=this.initialData.extends.map(n=>b(n,this.project))}}function hJ(r){const e=[new GP(r),new In(ra,r),new In(un,r),new In(Os,r)];return e.forEach(t=>{r.subscribeBuiltInInstance(t)}),r.builtInBaseEntities=e,e}function fJ(r){const e=[new Kt(J,r),new Kt(On,r),new Kt(ee,r),new Kt(it,r),new Kt(Pn,r),new Kt(ln,r),new Kt(An,r),new Kt(ai,r)];return e.forEach(t=>{r.subscribeBuiltInInstance(t)}),r.primitives=e,e}function mJ(r){const e=[new se(As,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.globalEventActionDescriptors=e,e}function TJ(r){const e=[new se(ta,r),new se(Wn,r),new se(ea,r),new se(li,r),new se(di,r),new se(Rs,r)];e.forEach(n=>{n.initChildren(),r.subscribeBuiltInInstance(n)}),r.loopDeclarations=e;const t=[new se(Kl,r),new se(bs,r),new se(Wl,r),new se(JT,r),new se(cE,r),new se(kl,r)];return t.forEach(n=>{n.initChildren(),r.subscribeBuiltInInstance(n)}),r.loopDeclarationsBodies=t,e}function EJ(r){const e=[new Kr(Cs,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.valueDescriptors=e,e}function RJ(r){const e=[new se(gr,r),new se(hi,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.operationDeclarations=e,e}const ti={},Tl={};async function gJ(r,e={}){const t={...RD};return t.id=r.id,e.empty?{data:{id:r.id,type:i.Project,version:1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]}}:{data:t}}function yp(r){const e=new M(r);return fJ(e),hJ(e),yJ(e),mJ(e),TJ(e),EJ(e),RJ(e),e.getAllBuiltIn().forEach(n=>{e.builtInInstances[n.id]||(e.builtInInstances[n.id]=n,delete e.instances[n.id])}),e}function bJ(r){const e=new Map,t=r.getAllBuiltInIds();Object.keys(r.instances).forEach(a=>{if(t.includes(a)){e.set(a,a);return}e.set(a,M.UUID.uuid())});const n=yp(r.toShallowJSON({seenEntityMaps:e}));return new Zu(r).visit(a=>{const s=b(a.toShallowJSON({seenEntityMaps:e}),n);s.hydrateAncestors(),s.addSelfToProject()}).visit(a=>{const s=n.get(e.get(a.id));s&&s.afterAllChildrenInitialized()}),n.afterAllChildrenInitialized(),n}function $P(r){const e=yp(r);return new Zu(r).visit(t=>{const n=b(t,e);n.hydrateAncestors(),n.addSelfToProject()}).visit(t=>{const n=e.get(t.id);n&&n.afterAllChildrenInitialized()}),e.afterAllChildrenInitialized(),e}async function vJ(r,e={}){if(r.id&&ti[r.id])return ti[r.id];if(r.id&&Tl[r.id])return await Tl[r.id],ti[r.id];const t=gJ(r,e);r.id&&(Tl[r.id]=t);const n=await t;if(n.data){const a=$P(n.data);return ti[r.id]=a,r.id&&delete Tl[r.id],a}return null}function IJ(r){return ti[r.id]&&delete ti[r.id],null}const DJ="test_primitive_entities_export";d.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Wu,d.ALL_BUILT_IN_BASE_ENTITIES=ZR,d.ALL_BUILT_IN_CONDITION_ENTITIES=cg,d.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=pg,d.ALL_BUILT_IN_LOOP_ENTITIES=OE,d.ALL_BUILT_IN_OPERATION_ENTITIES=Lm,d.ALL_BUILT_IN_PRIMITIVE_ENTITIES=Op,d.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=mg,d.ALL_BUILT_IN_VALUE_DESCRIPTORS=fg,d.ActionDescriptorState=se,d.ActionInputMapState=H7,d.ActionOutputMapState=K7,d.AppendToListOperationInputIds=Vh,d.AppendToListOperationOutputIds=Nh,d.ArgumentDeclarationState=zr,d.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=ju,d.BUILT_IN_BASE_ENTITY_IDS=_,d.BUILT_IN_ENTITY_TYPES=Jn,d.BaseCanvasDraggableState=Kq,d.BaseEntityNames=U,d.BaseState=Zq,d.BaseValueDescriptorIds=os,d.BreakStatementState=Yi,d.BuiltInBaseEntityState=In,d.CACHED_PROJECTS_BY_ID=ti,d.CALLABLE_ENTITIES_EXPLANATION=dq,d.CALLABLE_TYPES=Xt,d.CALLER_ENTITIES_EXPLANATION=TO,d.CALLER_TYPES=on,d.CALLS_UPDATE_EXPLANATION=lr,d.COMPARISON_CONDITIONS=lg,d.CONDITIONS=dg,d.CUSTOM_ENTITY_OPERATIONS=em,d.CallableEntityClass=Qq,d.CallerEntityClass=pp,d.ChildEntityState=Xq,d.ComparisonOperatorTypes=qe,d.ConditionState=Jr,d.ContinueStatementState=Ot,d.CreateNewInputIds=Af,d.CreateNewOutputIds=Cf,d.DRAGGABLE_CALLABLE_TYPES=vl,d.DRAGGABLE_CALLER_TYPES=Tp,d.DRAGGABLE_ELEMENT_TYPES=ss,d.DRAGGABLE_EXECUTABLE_TYPES=xP,d.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=bl,d.DataTypeCompatibilityTypes=zt,d.DataTypeParentChildRelation=et,d.DataTypeState=ki,d.DefinitionEntityState=ei,d.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=Hq,d.ENTITIES_WITH_VALLUES_EXPLANATION=el,d.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=V,d.ENTITY_RECUSION_OPTIONS_DEFAULTS=L,d.ENTITY_TYPES=jP,d.ENTITY_WITH_DECLARATION_TYPES=FP,d.ENTITY_WITH_LOGIC_SCOPE_TYPES=pt,d.ENTITY_WITH_NAMES_TYPES=Ep,d.ENTITY_WITH_PARENT_TYPES=fp,d.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=gl,d.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=mp,d.ENTITY_WITH_VALUE_TYPES=hp,d.ENTRY_POINT_ENTITIES_EXPLANATION=Xa,d.ENTRY_POINT_TYPES=We,d.EVENT_TYPES=ii,d.EXECUTABLE_TYPES=UP,d.EXECUTION_OPERATIONS=Pf,d.EntityError=Cr,d.EntityErrorSeverity=E,d.EntityGenerationError=g,d.EntityGenerationErrorCode=T,d.EntityInstanceErrorCode=G,d.EntityOperations=Ne,d.EntityType=i,d.EntityWithLogicScopeClass=rJ,d.EntityWithValueClass=nJ,d.EntryPointEntityClass=eJ,d.ExecutionOperations=Ve,d.ExecutionTerminationType=hO,d.FunctionCallState=Xr,d.FunctionDeclarationState=jr,d.GLOBAL_EVENT_DECLARATIONS=ug,d.GetLastInListOperationInputIds=vh,d.GetLastInListOperationOutputIds=Ih,d.GlobalEventNames=Dn,d.GlobalEventState=qi,d.HTTPOperations=dt,d.HTTP_OPERATIONS=Vm,d.InputMapState=xn,d.InstalledProjectState=Hr,d.InternalCallState=Ji,d.JoinListOperationInputIds=jy,d.JoinListOperationOutputIds=ky,d.LIST_OPERATIONS=Hh,d.ListOperations=X,d.LiteralValueState=Wi,d.LoopState=qr,d.LoopTypes=k,d.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=dr,d.NUMBER_OPERATIONS=ny,d.NumberOperations=Ge,d.OPERATION_DECLARATIONS=Nm,d.OperationState=kr,d.OutputMapParentChildRelation=ri,d.OutputMapState=jn,d.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=tl,d.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=or,d.PASS_THROUGH_CALLABLE_TYPES=Je,d.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=Ju,d.ParallelExecutionOperation=VP,d.PassThroughCallableEntityClass=tJ,d.PersistedEntity=GP,d.PersistedEntityMethods=Gt,d.PrimitiveEntityState=Kt,d.PrimitiveTypes=C,d.ProjectState=M,d.PropertyState=xr,d.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=_P,d.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=cq,d.ReturnDeclarationState=kt,d.ReturnStatementState=Zr,d.STANDALONE_CONDITIONS=QR,d.STRING_OPERATIONS=xy,d.ScopeCompatibilityType=ml,d.SearchState=Yr,d.SequentialExecutionOperation=LP,d.SequentialExecutionOperationInputIds=hf,d.SequentialExecutionOperationOutputIds=ff,d.SharedEntityErrorCode=B,d.SharedStateFunctionality=MP,d.SplitListOperationInputIds=ih,d.SplitListOperationOutputIds=ah,d.StandaloneOperatorTypes=Jt,d.StringOperations=re,d.TERMINATION_TYPES=xe,d.Traverser=Zu,d.USER_MANAGED_ENTITY_TYPES=Rp,d.UserManagedEntityStateFunctionality=zq,d.VALUE_READING_ENTITIES_EXPLANATION=qu,d.VALUE_READING_TYPES=Sn,d.VALUE_WRITING_ENTITIES_EXPLANATION=EO,d.VALUE_WRITING_TYPES=Ze,d.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=ku,d.VARIABLE_TYPES=Fe,d.ValueAutogenerationType=ze,d.ValueDescriptorParentChildRelation=A,d.ValueDescriptorState=Kr,d.ValueReadingEntityClass=qn,d.ValueWritingEntityClass=is,d.VariableDeclarationState=sn,d.VariableInputMapState=Y7,d.VariableInstanceState=Wr,d.VariableOutputMapState=Z7,d.WaitOperation=NP,d.WaitOperationInputIds=of,d.WaitOperationOutputIds=lf,d.appendToListOperation=us,d.appendToListOperationElementToAppendArgument=Nl,d.appendToListOperationElementToAppendArgumentParentRef=kh,d.appendToListOperationElementToAppendArgumentRef=$h,d.appendToListOperationError=Yh,d.appendToListOperationErrorParentRef=Wh,d.appendToListOperationListArgument=Vl,d.appendToListOperationListArgumentParentRef=jh,d.appendToListOperationListArgumentRef=Lh,d.appendToListOperationListDataType=Gh,d.appendToListOperationResultListDataType=xh,d.appendToListOperationResultListReturn=Jh,d.appendToListOperationResultListReturnParentRef=qh,d.appendToListOperationResultListReturnRef=Uh,d.appendToListOperationSecondListDataType=Fh,d.asGenerationActionExample=bn,d.booleanPrototype=On,d.capitalizeFirstLetter=Jo,d.checkAreDataTypesCompatible=Zt,d.checkAreDefinitionEntitiesCompatibleAsDataType=nO,d.checkArePropertiesCompatibleAsDataType=tO,d.checkIsBranchDependentButNotDirectlyOnBranch=es,d.checkIsBranchDependentOnBranch=Rq,d.checkIsCallableEntityReachable=rs,d.checkIsCanvasEntity=Gq,d.checkIsDetachedBranch=OP,d.checkIsDetachedBranchShallow=cp,d.checkIsGlobalVariable=Vq,d.checkIsGloballyDeclared=dp,d.checkIsMethod=CP,d.checkIsNestedScope=fl,d.checkScopeCompatibility=ns,d.cloneProject=bJ,d.countedLoopActionDescriptor=ta,d.countedLoopActionDescriptorDynamicReturnDeclaration=EE,d.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=TE,d.countedLoopActionDescriptorStringArgumentDeclaration=mE,d.countedLoopActionDescriptorStringArgumentDeclarationDataType=hE,d.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=pE,d.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=uE,d.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=yE,d.countedLoopActionDescriptorStringArgumentDeclarationParentRef=fE,d.countedLoopBodyActionDescriptor=Kl,d.countedLoopBodyActionDescriptorAnyDynamicArgument=IE,d.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=vE,d.countedLoopBodyActionDescriptorAnyDynamicReturn=SE,d.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=DE,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Zl,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=gE,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=RE,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=bE,d.createDefinitionEntityFromJSONObject=sl,d.createEntityError=Q,d.createNestedDataTypeForEntity=CO,d.createNewInstanceOperation=hr,d.createNewInstanceOperationEntityToInstanciateArgument=Gf,d.createNewInstanceOperationEntityToInstanciateArgumentRef=Vf,d.createNewInstanceOperationEntityToInstanciateDataType=Nf,d.createNewInstanceOperationError=xf,d.createNewInstanceOperationErrorParentRef=Uf,d.createNewInstanceOperationNewEntityDataArgument=_f,d.createNewInstanceOperationNewEntityDataArgumentDataType=Mf,d.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=Bf,d.createNewInstanceOperationNewEntityDataArgumentParentRef=wf,d.createNewInstanceOperationOutputEntityDeclaration=Ff,d.createNewInstanceOperationOutputEntityDeclarationParentRef=$f,d.createNewInstanceOperationRef=Lf,d.createSemanticId=de,d.createStateFromGenerationTargetType=Yq,d.createStateFromType=ke,d.createStateFromTypeAndSubscribe=b,d.cronJobBuiltInBaseEntity=Os,d.cronJobBuiltInBaseEntityExpressionProperty=HR,d.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=zP,d.cronJobBuiltInBaseEntityExpressionPropertyRef=WR,d.cronJobBuiltInBaseEntityRef=YR,d.cronJobTriggeredFunctionDeclarationBlueprint=ud,d.cronJobTriggeredFunctionDeclarationBlueprintParentRef=qR,d.dataTypeCompatibilityToErrorExplanation=OO,d.datePrototype=ln,d.dateValueAutogenerationSchema=Pc,d.definitionEntityToZodSchema=Mg,d.deletePersistedEntityMethod=cd,d.deletePersistedEntityMethodParentRef=CR,d.deleteRootProject=IJ,d.endpointBuiltInBaseEntity=ra,d.endpointBuiltInBaseEntityRef=wE,d.endpointBuiltInBaseEntityRefFour=uR,d.endpointBuiltInBaseEntityRefThree=FE,d.endpointBuiltInBaseEntityRefTwo=NE,d.endpointBuiltInCorsProperty=BE,d.endpointBuiltInCorsPropertyDataType=CE,d.endpointBuiltInCorsPropertyDataTypeRef=PE,d.endpointBuiltInCorsPropertyRef=AE,d.endpointBuiltInMethodProperty=Ql,d.endpointBuiltInMethodPropertyDataType=$E,d.endpointBuiltInMethodPropertyDataTypeRef=LE,d.endpointBuiltInMethodPropertyRef=GE,d.endpointBuiltInPathProperty=Xl,d.endpointBuiltInPathPropertyDataType=VE,d.endpointBuiltInPathPropertyDataTypeRef=ME,d.endpointBuiltInPathPropertyRef=_E,d.endpointPathParamsArgumentDeclaration=td,d.endpointPathParamsArgumentDeclarationRef=zE,d.endpointPathParamsVariableDataType=ZE,d.endpointPathParamsVariableDataTypeRef=HE,d.endpointReachedTriggerActionDescriptor=od,d.endpointReachedTriggerActionDescriptorRef=KE,d.endpointReachedTriggerActionDescriptorRefFour=eR,d.endpointReachedTriggerActionDescriptorRefThree=QE,d.endpointReachedTriggerActionDescriptorRefTwo=XE,d.endpointRequestBodyArgumentDeclaration=rd,d.endpointRequestBodyArgumentDeclarationRef=kE,d.endpointRequestBodyVariableDataType=qE,d.endpointRequestHeadersArgumentDeclaration=ed,d.endpointRequestHeadersArgumentDeclarationRef=xE,d.endpointRequestHeadersVariableDataType=jE,d.endpointRequestHeadersVariableDataTypeRef=UE,d.endpointRequestQueryParamsArgumentDeclaration=nd,d.endpointRequestQueryParamsArgumentDeclarationRef=WE,d.endpointRequestQueryParamsVariableDataType=YE,d.endpointRequestQueryParamsVariableDataTypeRef=JE,d.endpointResponseBodyDataType=dR,d.endpointResponseBodyReturnDeclaration=sd,d.endpointResponseBodyReturnDeclarationRef=lR,d.endpointResponseCodeDataType=nR,d.endpointResponseCodeReturnDeclaration=id,d.endpointResponseCodeReturnDeclarationRef=tR,d.endpointResponseHeadersDataType=sR,d.endpointResponseHeadersDataTypeRef=iR,d.endpointResponseHeadersReturnDeclaration=ad,d.endpointResponseHeadersReturnDeclarationRef=aR,d.endpointReturnStatementRef=rR,d.endpointReturnStatementRefThree=cR,d.endpointReturnStatementRefTwo=oR,d.enrichFromKnownEntities=ts,d.enumOptionsProperty=Sp,d.enumOptionsPropertyDataType=Ip,d.enumOptionsPropertyDataTypeRef=bp,d.enumOptionsPropertyRef=vp,d.enumPrototype=Pn,d.enumPrototypeRef=Dp,d.executionBuiltInBaseEntity=Ps,d.executionBuiltInEntityAbortMethod=pd,d.executionBuiltInEntityAbortMethodParentRef=zR,d.filterOutDuplicateEntities=m,d.filterOutDuplicateErrors=V9,d.findEntityFromKeys=Ku,d.findReferenceToSelfInList=qO,d.findReferencesToSelfInProject=Aq,d.flattenActionDescriptor=WO,d.flattenArgumentDeclaration=YO,d.flattenBreakStatement=HO,d.flattenBuiltInBaseEntity=zO,d.flattenCalls=vn,d.flattenCanvasAncestorsUntil=ol,d.flattenCondition=ZO,d.flattenContinueStatement=KO,d.flattenDataType=QO,d.flattenDefinitionEntity=XO,d.flattenDefinitionEntityExtensionAndImplementationTypes=sp,d.flattenDefinitionEntityExtensionTypes=yl,d.flattenDefinitionEntityExtensions=ip,d.flattenDefinitionEntityImplementations=ap,d.flattenDefinitionEntityImplementionTypes=pl,d.flattenDerivedCanvasEntities=Nt,d.flattenDetachedBranch=AP,d.flattenElementCalls=Ue,d.flattenElementCallsOnTheSameScope=Pq,d.flattenEntity=P,d.flattenFunctionCall=eP,d.flattenFunctionDeclaration=tP,d.flattenGlobalEvent=nP,d.flattenInputMap=rP,d.flattenInstalledProject=iP,d.flattenInternalCall=aP,d.flattenLiteralValue=sP,d.flattenLoop=oP,d.flattenOperation=lP,d.flattenOutputMap=dP,d.flattenPrimitiveEntity=cP,d.flattenProject=uP,d.flattenProjectElements=kO,d.flattenProperty=pP,d.flattenRelatedCanvasElementsOnTheLeft=DP,d.flattenRelatedCanvasElementsOnTheRight=IP,d.flattenReturnDeclaration=yP,d.flattenReturnStatement=hP,d.flattenSearch=fP,d.flattenValueDescriptor=mP,d.flattenVariableDeclaration=TP,d.flattenVariableInstance=EP,d.flattenVariableReads=jO,d.flattenVariableWrites=xO,d.flattenVariables=Se,d.fromZodParseToEntityGenerationErrors=Fu,d.generate=YC,d.generateActionExample=uq,d.generateExecutionDataType=R7,d.generateIdFromStrategy=Ye,d.generateMutablePropertiesExplanation=Ko,d.generateRandomBoolean=ib,d.generateRandomDate=Lg,d.generateRandomDateAfter=_g,d.generateRandomDateBefore=Vg,d.generateRandomDateBetweenRange=Ng,d.generateRandomNumber=Qg,d.generateRandomNumberAfter=Zg,d.generateRandomNumberBefore=Kg,d.generateRandomNumberBetweenRange=Xg,d.generateRandomText=rb,d.generateRandomTextAfter=eb,d.generateRandomTextBefore=tb,d.generateRandomTextBetweenRange=nb,d.generateUniqueUUID=zg,d.getAllActionDescriptorsForConditions=il,d.getAllActionDescriptorsForGlobalEvents=nl,d.getAllActionDescriptorsForLoops=rl,d.getAllActionDescriptorsForOperations=fq,d.getAllBuiltInEntityIds=np,d.getAllGloballyDeclaredFunctionDeclarationsExplanation=IO,d.getBaseBuiltInEntities=ur,d.getBaseSchemaBasedOnType=fO,d.getBuiltInEntityOwner=pr,d.getCallableEntityReferenceSchema=at,d.getCallableEntityTypeSchema=kD,d.getCalledBy=qt,d.getCallerEntityReferenceSchema=F3,d.getCallerEntityTypeSchema=$3,d.getCalls=ep,d.getCanvasEntitiesDerivedFromInternalCalls=vP,d.getCanvasEntitiesDerivedFromWrites=Hi,d.getCanvasEntityDerivedFromValueReadingEntity=ul,d.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=bP,d.getCanvasEntityReferenceSchema=n5,d.getCanvasEntityTypeSchema=t5,d.getChildrenEntityWithValues=bq,d.getColumnProperties=jq,d.getCommonAncestor=Qu,d.getCommonChildren=wO,d.getDatabaseEntities=Uq,d.getDatabaseEntity=kq,d.getDeclaration=Ur,d.getDeepestScope=BP,d.getDefinitionEntityExtends=zi,d.getDraggableCallableEntityReferenceSchema=JD,d.getDraggableCallableEntityTypeSchema=qD,d.getDraggableCallerEntityReferenceSchema=x3,d.getDraggableCallerEntityTypeSchema=U3,d.getDraggableExecutableEntityReferenceSchema=J3,d.getDraggableExecutableEntityTypeSchema=q3,d.getDraggablePassThroughCallableEntityReferenceSchema=Go,d.getDraggablePassThroughCallableEntityTypeSchema=Lo,d.getDraggablePlayableEntityReferenceSchema=Z3,d.getDraggablePlayableEntityTypeSchema=z3,d.getEntityArgumentDeclarations=rp,d.getEntityInputMaps=RP,d.getEntityOutputMaps=Bq,d.getEntityReferenceSchema=e5,d.getEntityReturnDeclarations=gP,d.getEntityTypeSchema=Q3,d.getEntityWithLogicScopeReferenceSchema=$n,d.getEntityWithLogicScopeTypeSchema=W3,d.getEntityWithValueReferenceSchema=jD,d.getEntityWithValueTypeSchema=G3,d.getEntryPointEntityReferenceSchema=nt,d.getEntryPointEntityTypeSchema=ir,d.getEventEntityReferenceSchema=Vo,d.getEventEntityTypeSchema=_o,d.getExecutableEntityReferenceSchema=k3,d.getExecutableEntityTypeSchema=j3,d.getExtendedBuiltInEntity=Mq,d.getExtendedDefinitionEntity=op,d.getGenerationTargetSchemaBasedOnType=mO,d.getHeadIfPartOfDetachedBranch=PP,d.getHighestScope=wP,d.getImplementedBuiltInEntity=_q,d.getIsInteractive=lp,d.getLastInListOperation=_l,d.getLastInListOperationError=_h,d.getLastInListOperationErrorParentRef=Mh,d.getLastInListOperationInputListArgument=Ch,d.getLastInListOperationInputListArgumentParentRef=Ah,d.getLastInListOperationInputListArgumentRef=Dh,d.getLastInListOperationInputListDataType=Sh,d.getLastInListOperationOutputElementDataType=Ph,d.getLastInListOperationOutputElementReturn=Bh,d.getLastInListOperationOutputElementReturnParentRef=wh,d.getLastInListOperationOutputElementReturnRef=Oh,d.getLinkedEntitiesFromArgumentDeclaration=Oq,d.getLowestPersistedEntityImplementation=SP,d.getParentCallableEntity=BO,d.getParentCallerEntity=_O,d.getParentCanvasEntities=Pt,d.getParentCanvasEntity=lt,d.getParentCanvasEntityFromTransfer=ll,d.getParentEntryPoint=gq,d.getParentPassthroughCallableEntity=MO,d.getPassThroughCallableEntityReferenceSchema=$e,d.getPassThroughCallableEntityTypeSchema=No,d.getPeristedEntities=Fq,d.getPlayableEntityReferenceSchema=H3,d.getPlayableEntityTypeSchema=Y3,d.getProject=vJ,d.getPrototypeByType=hl,d.getReferenceEntityId=S,d.getReferencedEntitiesStateOrErrors=Qo,d.getReferencedEntityStateOrErrors=Uu,d.getRelatedCanvasElementsOnTheLeft=Qr,d.getRelatedCanvasElementsOnTheLeftFromTransfer=JO,d.getRelatedCanvasElementsOnTheRight=cr,d.getRootEntryPointScopeOwner=up,d.getScopeOwner=At,d.getTerminationReferenceSchema=X3,d.getTerminationTypeSchema=K3,d.getUpstreamDependencyIds=cl,d.getUsedArgFromDeclaration=Cq,d.getUsedReturnFromDeclaration=wq,d.getValueReadingEntityReferenceSchema=xD,d.getValueReadingEntityTypeSchema=Gn,d.getValueWritingEntityReferenceSchema=L3,d.getValueWritingEntityTypeSchema=xa,d.getVariableFromInputMapping=NO,d.getVariableFromReturnVariablePointer=$O,d.getVariableReferenceSchema=rr,d.getVariableTypeSchema=Vr,d.getVariablesFromArgumentDeclarations=dl,d.getVariablesFromInputMaps=LO,d.getVariablesFromOutputMapping=FO,d.getVariablesFromOutputMaps=UO,d.getVariablesFromReturnDeclarations=GO,d.getVariablesInSameOrHigherScope=Mu,d.getWrites=tp,d.groupCallsBasedOnParallelizableExecution=Iq,d.handleAfterEntityImplementationSideEffects=AO,d.handleBeforeEntityImplementationSideEffects=PO,d.httpRequestBodyArgument=fs,d.httpRequestBodyArgumentRef=ym,d.httpRequestBodyDataType=hm,d.httpRequestHeadersArgument=hs,d.httpRequestHeadersArgumentRef=um,d.httpRequestHeadersDataType=pm,d.httpRequestMethodArgument=ps,d.httpRequestMethodArgumentRef=dm,d.httpRequestMethodDataType=cm,d.httpRequestMethodDataTypeRef=om,d.httpRequestOperation=Xi,d.httpRequestOperationErrorValueDescriptor=xl,d.httpRequestOperationErrorValueDescriptorDatatype=_m,d.httpRequestOperationErrorValueDescriptorRef=Mm,d.httpRequestOperationRef=Am,d.httpRequestOperationRefEight=wm,d.httpRequestOperationRefFive=Om,d.httpRequestOperationRefFour=Sm,d.httpRequestOperationRefNine=Bm,d.httpRequestOperationRefSeven=Cm,d.httpRequestOperationRefSix=Pm,d.httpRequestOperationRefThree=Dm,d.httpRequestOperationRefTwo=Im,d.httpRequestQueryParamsArgument=Ul,d.httpRequestQueryParamsArgumentRef=am,d.httpRequestQueryParamsDataType=sm,d.httpRequestVariableURLArgument=ys,d.httpRequestVariableURLArgumentRef=rm,d.httpRequestVariableURLDataType=im,d.httpRequestVariableURLDataTypeRef=tm,d.httpResponseBodyReturnDataType=vm,d.httpResponseBodyReturnDataTypeRef=gm,d.httpResponseBodyReturnReturn=Es,d.httpResponseBodyReturnReturnRef=bm,d.httpResponseCodeDataType=mm,d.httpResponseCodeReturn=ms,d.httpResponseCodeReturnRef=fm,d.httpResponseHeadersDataType=Rm,d.httpResponseHeadersDataTypeRef=Tm,d.httpResponseHeadersReturn=Ts,d.httpResponseHeadersReturnRef=Em,d.implement=al,d.inferArgumentDeclarationDataType=rO,d.inferDataType=gn,d.inferInputMapDataType=Cu,d.inferOutputMapDataType=Bu,d.inferPropertyDataType=sO,d.inferReturnDeclarationDataType=wu,d.inferValueDescriptorDataType=oO,d.inferVariableDeclarationDataType=aO,d.inferVariableInstanceDataType=iO,d.initBaseProjectEntity=yp,d.initProject=$P,d.isPromise=zu,d.iterateOverListActionDescriptorListArgumentDeclaration=yT,d.iterateOverListActionDescriptorListArgumentDeclarationDataType=uT,d.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=cT,d.iterateOverListActionDescriptorListArgumentDeclarationParentRef=pT,d.iterateOverListLoopActionDescriptor=Wn,d.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=fT,d.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=hT,d.iterateOverListLoopBodyActionDescriptor=bs,d.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=DT,d.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=IT,d.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=OT,d.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=ST,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=gs,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=TT,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=mT,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=ET,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=vT,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=gT,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=RT,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=bT,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=BT,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=CT,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=AT,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=wT,d.iterateOverObjectKeysLoopActionDescriptor=li,d.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=_T,d.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=MT,d.iterateOverObjectKeysLoopBodyActionDescriptor=JT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=jT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=xT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=qT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=kT,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Yl,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=NT,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=VT,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=LT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=UT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=$T,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=GT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=FT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=ZT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=HT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=YT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=zT,d.iterateOverObjectValuesLoopActionDescriptor=di,d.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=XT,d.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=KT,d.iterateOverObjectValuesLoopBodyActionDescriptor=cE,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=oE,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=sE,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=dE,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=lE,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Hl,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=eE,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=QT,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=tE,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=aE,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=rE,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=nE,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=iE,d.iterateOverStringActionDescriptorDynamicReturnDeclaration=Xm,d.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=Km,d.iterateOverStringActionDescriptorStringArgumentDeclaration=Zm,d.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=Hm,d.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=Ym,d.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=zm,d.iterateOverStringLoopActionDescriptor=ea,d.iterateOverStringLoopBodyActionDescriptor=Wl,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=sT,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=aT,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=lT,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=oT,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=ql,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=eT,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Qm,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=tT,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Jl,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=rT,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=nT,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=iT,d.joinListOperation=wl,d.joinListOperationError=rh,d.joinListOperationErrorParentRef=nh,d.joinListOperationFirstListArgument=Ky,d.joinListOperationFirstListArgumentParentRef=Zy,d.joinListOperationFirstListArgumentRef=qy,d.joinListOperationFirstListDataType=Jy,d.joinListOperationResultListDataType=zy,d.joinListOperationResultListReturn=th,d.joinListOperationResultListReturnParentRef=eh,d.joinListOperationResultListReturnRef=Hy,d.joinListOperationSecondListArgument=Qy,d.joinListOperationSecondListArgumentParentRef=Xy,d.joinListOperationSecondListArgumentRef=Wy,d.joinListOperationSecondListDataType=Yy,d.joinListWithLastSeparator=q,d.joinStringsOperation=Ki,d.joinStringsOperationDynamicStringArgument=Iy,d.joinStringsOperationDynamicStringArgumentParentRef=vy,d.joinStringsOperationDynamicStringArgumentRef=gy,d.joinStringsOperationDynamicStringDataType=by,d.joinStringsOperationError=Ry,d.joinStringsOperationErrorParentRef=Ey,d.joinStringsOperationFirstStringArgument=ds,d.joinStringsOperationFirstStringArgumentParentRef=dy,d.joinStringsOperationFirstStringArgumentRef=ry,d.joinStringsOperationFirstStringDataType=iy,d.joinStringsOperationResultStringDataType=ly,d.joinStringsOperationResultStringReturn=Zi,d.joinStringsOperationResultStringReturnParentRef=Ty,d.joinStringsOperationResultStringReturnRef=oy,d.joinStringsOperationSecondStringArgument=cs,d.joinStringsOperationSecondStringArgumentParentRef=my,d.joinStringsOperationSecondStringArgumentRef=ay,d.joinStringsOperationSecondStringDataType=sy,d.joinStringsOperationSeparatorStringArgument=fy,d.joinStringsOperationSeparatorStringArgumentParentRef=hy,d.joinStringsOperationSeparatorStringArgumentRef=cy,d.joinStringsOperationSeparatorStringDataType=yy,d.joinStringsOperationSeparatorStringDataTypeDefaultValue=py,d.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=uy,d.keyValuePrototype=ai,d.lowercaseFirstLetter=Wo,d.manualFlowActionDescriptorDeclarationArgumentDeclaration=jl,d.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=Um,d.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=Fm,d.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=xm,d.manualFlowLoopActionDescriptor=Rs,d.manualFlowLoopActionDescriptorDynamicReturnDeclaration=$m,d.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=Gm,d.manualFlowLoopBodyActionDescriptor=kl,d.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=km,d.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=jm,d.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=Jm,d.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=qm,d.mapActionDescriptorToTypeItRepresents=$q,d.mergeEntityErrorsList=N9,d.mergeListOfEntities=Nq,d.methodDefaultValue=lm,d.mockClientProject=RD,d.moreThanOrEqualCondition=hi,d.moreThanOrEqualConditionLeftHandArgument=rg,d.moreThanOrEqualConditionLeftHandArgumentDataType=tg,d.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=eg,d.moreThanOrEqualConditionLeftHandArgumentParentRef=ng,d.moreThanOrEqualConditionRightHandArgument=og,d.moreThanOrEqualConditionRightHandArgumentDataType=ag,d.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=ig,d.moreThanOrEqualConditionRightHandArgumentParentRef=sg,d.notEmptyCondition=gr,d.notEmptyConditionArgument=XR,d.notEmptyConditionRef=KR,d.nullPrototype=gp,d.numberAdditionOperation=ls,d.numberAdditionOperationDynamicSummandArgument=Fp,d.numberAdditionOperationDynamicSummandArgumentType=$p,d.numberAdditionOperationDynamicSummandArgumentTypeParentRef=Gp,d.numberAdditionOperationError=Lp,d.numberAdditionOperationErrorParentRef=Np,d.numberAdditionOperationFirstNumberArgument=Il,d.numberAdditionOperationFirstNumberArgumentRef=Pp,d.numberAdditionOperationFirstNumberDataType=Ap,d.numberAdditionOperationRef=_p,d.numberAdditionOperationRefThree=Sl,d.numberAdditionOperationRefTwo=Vp,d.numberAdditionOperationResultNumberDataType=Mp,d.numberAdditionOperationResultNumberReturn=Ol,d.numberAdditionOperationResultNumberReturnRef=Bp,d.numberAdditionOperationSecondNumberArgument=Dl,d.numberAdditionOperationSecondNumberArgumentRef=Cp,d.numberAdditionOperationSecondNumberDataType=wp,d.numberPrototype=ee,d.numberSubtractionOperation=Al,d.numberSubtractionOperationDynamicSubtrahendArgument=ty,d.numberSubtractionOperationDynamicSubtrahendArgumentType=ey,d.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Qp,d.numberSubtractionOperationError=Xp,d.numberSubtractionOperationErrorParentRef=Kp,d.numberSubtractionOperationFirstNumberArgument=Wp,d.numberSubtractionOperationFirstNumberArgumentRef=Up,d.numberSubtractionOperationFirstNumberDataType=xp,d.numberSubtractionOperationRef=Pl,d.numberSubtractionOperationRefThree=zp,d.numberSubtractionOperationRefTwo=Yp,d.numberSubtractionOperationResultNumberDataType=Jp,d.numberSubtractionOperationResultNumberReturn=Zp,d.numberSubtractionOperationResultNumberReturnRef=qp,d.numberSubtractionOperationSecondNumberArgument=Hp,d.numberSubtractionOperationSecondNumberArgumentRef=jp,d.numberSubtractionOperationSecondNumberDataType=kp,d.numberValueAutogenerationSchema=Oc,d.parallelExecutionOperation=Qt,d.parallelExecutionOperationError=sf,d.parallelExecutionOperationErrorParentRef=af,d.parallelExecutionOperationListOfExecutionResultsDataType=tf,d.parallelExecutionOperationListOfExecutionResultsReturn=Gl,d.parallelExecutionOperationListOfExecutionResultsReturnRef=ef,d.parallelExecutionOperationListOfFunctionsArgument=Ll,d.parallelExecutionOperationListOfFunctionsArgumentDatatype=Qh,d.parallelExecutionOperationListOfFunctionsArgumentRef=Xh,d.parallelExecutionOperationListOfFunctionsBlueprint=Kh,d.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=Zh,d.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=zh,d.parallelExecutionOperationRef=nf,d.parallelExecutionOperationRefThree=rf,d.persistedBuiltInBaseEntity=st,d.persistedBuiltInBaseEntityDatabaseProperty=ui,d.persistedBuiltInBaseEntityDatabasePropertyDataType=MR,d.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=YP,d.persistedBuiltInBaseEntityDatabasePropertyParentRef=_R,d.persistedBuiltInBaseEntityDatabasePropertyRef=BR,d.persistedBuiltInBaseEntityPrimaryKeyProperty=pi,d.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=xR,d.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=NR,d.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=VR,d.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=jR,d.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=UR,d.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=GR,d.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=LR,d.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=FR,d.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=$R,d.processOutputGlobalValueDescriptorDataType=hg,d.processOutputGlobalValueDescriptorReturn=Cs,d.processOutputGlobalValueDescriptorReturnRef=yg,d.projectPublicationCompletedGlobalEvent=As,d.propertyToZodSchema=Bg,d.relationalDatabaseBuiltInBaseEntity=un,d.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=dd,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=PR,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=OR,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=AR,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=SR,d.relationalDatabaseBuiltInBaseEntityDefaultProperty=ld,d.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=DR,d.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=vR,d.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=IR,d.relationalDatabaseBuiltInBaseEntityIdentifierProperty=vs,d.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=hR,d.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=pR,d.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=yR,d.relationalDatabaseBuiltInBaseEntityMinSizeProperty=Ss,d.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=bR,d.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=RR,d.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=gR,d.relationalDatabaseBuiltInBaseEntityPasswordProperty=Ds,d.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=ER,d.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=WP,d.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=TR,d.relationalDatabaseBuiltInBaseEntityRef=ci,d.relationalDatabaseBuiltInBaseEntityUsernameProperty=Is,d.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=mR,d.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=JP,d.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=fR,d.resolveActionDescriptorName=yO,d.resolveBaseEntityName=dO,d.resolveBuiltInBaseEntityDataTypeLabel=cO,d.resolveClonedEntityProject=He,d.resolveConditionOperatorLabel=zo,d.resolveDataType=Yo,d.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Xu,d.resolveDataTypeLabel=Ka,d.resolveDefinitionEntityDataTypeLabel=D7,d.resolveEntityDataTypeLabel=I7,d.resolveEntityName=w,d.resolveFirstCallsSecond=Dq,d.resolveFirstWritesSecond=Sq,d.resolvePrimaryKeyProperty=xq,d.resolvePrimitiveEntityName=pO,d.resolveSearchName=uO,d.resolveVariableScope=g7,d.sequentialExecutionOperation=wn,d.sequentialExecutionOperationError=Of,d.sequentialExecutionOperationErrorParentRef=Sf,d.sequentialExecutionOperationListOfExecutionResultsDataType=vf,d.sequentialExecutionOperationListOfExecutionResultsReturn=Fl,d.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=Df,d.sequentialExecutionOperationListOfExecutionResultsReturnRef=bf,d.sequentialExecutionOperationListOfFunctionsArgument=$l,d.sequentialExecutionOperationListOfFunctionsArgumentDatatype=gf,d.sequentialExecutionOperationListOfFunctionsArgumentParentRef=If,d.sequentialExecutionOperationListOfFunctionsArgumentRef=Rf,d.sequentialExecutionOperationListOfFunctionsBlueprint=Ef,d.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=Tf,d.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=mf,d.softDeletePersistedEntityMethod=HP,d.softDeletePersistedEntityMethodParentRef=kR,d.sortCallsBasedOnExecutionDependencies=VO,d.sortChildrenEntitiesBasedOnExecutionDependencies=vq,d.splitListOperation=Ml,d.splitListOperationError=bh,d.splitListOperationErrorParentRef=gh,d.splitListOperationFirstOutputListDataType=ch,d.splitListOperationFirstOutputListReturn=mh,d.splitListOperationFirstOutputListReturnParentRef=fh,d.splitListOperationFirstOutputListReturnRef=Bl,d.splitListOperationInputListArgument=ph,d.splitListOperationInputListArgumentParentRef=uh,d.splitListOperationInputListArgumentRef=sh,d.splitListOperationInputListDataType=oh,d.splitListOperationSecondOutputListDataType=Th,d.splitListOperationSecondOutputListReturn=Rh,d.splitListOperationSecondOutputListReturnParentRef=Eh,d.splitListOperationSplitIndexArgument=hh,d.splitListOperationSplitIndexArgumentParentRef=yh,d.splitListOperationSplitIndexArgumentRef=lh,d.splitListOperationSplitIndexDataType=dh,d.splitStringOperation=Cl,d.splitStringOperationError=Uy,d.splitStringOperationErrorParentRef=Fy,d.splitStringOperationFirstPartResultStringDataType=Cy,d.splitStringOperationFirstPartResultStringReturn=$y,d.splitStringOperationFirstPartResultStringReturnParentRef=Gy,d.splitStringOperationFirstPartResultStringReturnRef=Ay,d.splitStringOperationIndexArgument=Ny,d.splitStringOperationIndexArgumentParentRef=Vy,d.splitStringOperationIndexArgumentRef=Oy,d.splitStringOperationIndexDataType=Py,d.splitStringOperationSecondPartResultStringDataType=By,d.splitStringOperationSecondPartResultStringReturn=kP,d.splitStringOperationSecondPartResultStringReturnParentRef=Ly,d.splitStringOperationSecondPartResultStringReturnRef=wy,d.splitStringOperationStringArgument=_y,d.splitStringOperationStringArgumentParentRef=My,d.splitStringOperationStringArgumentRef=Dy,d.splitStringOperationStringDataType=Sy,d.stringPrototype=J,d.stringValueAutogenerationSchema=Sc,d.suggestNewIdForEntity=$u,d.test_primitive_entities_export=DJ,d.toCamelCase=b7,d.toEntityState=Lt,d.toKebabCase=lO,d.toLowerCaseKebabCase=Ho,d.toPascalCase=v7,d.untypedDataPrototype=it,d.updateErrorsList=Be,d.updateValueReader=Lq,d.urlDefaultValue=nm,d.uuidPrototype=An,d.validateArgumentDeclarationName=Lu,d.validateCalledByErrorIdInAction=yq,d.validateCalledByIdInAction=pq,d.validateCallers=vO,d.validateConditionEntityDeclaration=mq,d.validateDataOperation=fr,d.validateDataOperationDataToValidateArgument=Jf,d.validateDataOperationDataToValidateArgumentParentRef=qf,d.validateDataOperationDataToValidateArgumentRef=jf,d.validateDataOperationDataToValidateDataType=kf,d.validateDataOperationEntityToMatchTypeArgument=zf,d.validateDataOperationEntityToMatchTypeArgumentParentRef=Hf,d.validateDataOperationEntityToMatchTypeArgumentRef=Wf,d.validateDataOperationEntityToMatchTypeDataType=Yf,d.validateDataOperationError=Qf,d.validateDataOperationErrorParentRef=Xf,d.validateDataOperationOutputEntityDeclaration=Kf,d.validateDataOperationOutputEntityDeclarationParentRef=Zf,d.validateDefinitionEntityName=Zo,d.validateEntryCaller=bO,d.validateErrorCaller=gO,d.validateFunctionCallDeclaration=DO,d.validateFunctionDeclarationName=_u,d.validateGeneratedEntityParentIsNotBuiltInEntity=lq,d.validateGeneration=sq,d.validateGenerationTarget=je,d.validateGenerationUpdate=oq,d.validateLoopEntityDeclaration=Tq,d.validateName=S7,d.validateOperationEntityDeclaration=SO,d.validatePropertyName=Nu,d.validateReachability=kn,d.validateReadsValueInActionPayload=hq,d.validateReferenceObject=Xo,d.validateReferenceToOne=xu,d.validateReferences=tt,d.validateReturnDeclarationName=Gu,d.validateSuccessCaller=RO,d.validateValueReaderGenerationUpdate=Qa,d.validateValueWritter=Yu,d.validateVariableDeclarationName=Vu,d.validateVariableInternalCallUse=Hu,d.valueAutogenerationCurrentDateAndTimeSchema=bD,d.valueAutogenerationGenericSchema=Eo,d.valueAutogenerationOptions=Ac,d.valueAutogenerationOptionsSchema=gD,d.valueAutogenerationRandomBooleanSchema=Dc,d.valueAutogenerationRandomDateBetweenSchema=wD,d.valueAutogenerationRandomDateFromSchema=AD,d.valueAutogenerationRandomDateSchema=bo,d.valueAutogenerationRandomDateUntilSchema=CD,d.valueAutogenerationRandomNumberBetweenSchema=DD,d.valueAutogenerationRandomNumberFromSchema=vD,d.valueAutogenerationRandomNumberSchema=Ro,d.valueAutogenerationRandomNumberUntilSchema=ID,d.valueAutogenerationRandomSchema=Va,d.valueAutogenerationRandomTextBetweenSchema=PD,d.valueAutogenerationRandomTextFromSchema=SD,d.valueAutogenerationRandomTextSchema=go,d.valueAutogenerationRandomTextUntilSchema=OD,d.valueAutogenerationRangeValueTypesSchema=_a,d.valueAutogenerationUniqueSchema=Ic,d.waitOperation=Rt,d.waitOperationMillisecondsNumberArgument=yr,d.waitOperationMillisecondsNumberArgumentRef=df,d.waitOperationMillisecondsNumberDataType=cf,d.waitOperationOperationError=yf,d.waitOperationOperationErrorParentRef=pf,d.waitOperationRef=uf,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ElementTransfer, Element, EntityId } from '../../definitions';
|
|
2
|
+
import { EntityState } from '../state';
|
|
2
3
|
|
|
3
4
|
export declare function isPromise(obj: any): obj is Promise<any>;
|
|
4
5
|
export declare class Traverser {
|
|
5
6
|
order: EntityId[];
|
|
6
|
-
flatRecord: Record<EntityId, Element | ElementTransfer>;
|
|
7
|
+
flatRecord: Record<EntityId, Element | ElementTransfer | EntityState>;
|
|
7
8
|
private onGoingVisits;
|
|
8
|
-
constructor(root: Element | ElementTransfer);
|
|
9
|
+
constructor(root: Element | ElementTransfer | EntityState);
|
|
9
10
|
private flatten;
|
|
10
11
|
private moveEntityAfterDependencies;
|
|
11
12
|
private orderEntities;
|
|
12
13
|
getUpstreamOngoingDependenciesVisits(entityId: EntityId, taskId: string): Record<EntityId, Promise<any>>;
|
|
13
14
|
getDownstreamOngoingDependenciesVisits(entityId: EntityId, taskId: string): Record<EntityId, Promise<any>>;
|
|
14
15
|
settlePromises(promises: Record<EntityId, Promise<any>>, taskId: string): Promise<void>;
|
|
15
|
-
visit(callback: (entity: Element | ElementTransfer) => any): Traverser;
|
|
16
|
-
reverseVisit(callback: (entity: Element | ElementTransfer) => any): Traverser;
|
|
17
|
-
visitAsync(callback: (entity: Element | ElementTransfer) => Promise<any>): Promise<Traverser>;
|
|
18
|
-
reverseVisitAsync(callback: (entity: Element | ElementTransfer) => Promise<any>): Promise<Traverser>;
|
|
16
|
+
visit(callback: (entity: Element | ElementTransfer, knownEntitiesRecord: Record<EntityId, Element | ElementTransfer | EntityState>) => any): Traverser;
|
|
17
|
+
reverseVisit(callback: (entity: Element | ElementTransfer, knownEntitiesRecord: Record<EntityId, Element | ElementTransfer | EntityState>) => any): Traverser;
|
|
18
|
+
visitAsync(callback: (entity: Element | ElementTransfer, knownEntitiesRecord: Record<EntityId, Element | ElementTransfer | EntityState>) => Promise<any>): Promise<Traverser>;
|
|
19
|
+
reverseVisitAsync(callback: (entity: Element | ElementTransfer, knownEntitiesRecord: Record<EntityId, Element | ElementTransfer | EntityState>) => Promise<any>): Promise<Traverser>;
|
|
19
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyx-code/project-logic-tree",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6126",
|
|
4
4
|
"author": "Sergio Herrero",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",
|