@elyx-code/project-logic-tree 0.0.6172 → 0.0.6174

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.
@@ -405,4 +405,4 @@ If an entity is called by another, they must be in the same scope, which means t
405
405
  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}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:c,added:h,removed:p}=this.remove({ignoreUpstream:!1},r);a.push(...c),d.push(...h),o.push(...p)}if(t==="parent"){const{updated:c,added:h,removed:p}=this.remove({ignoreUpstream:!1},r);a.push(...c),d.push(...h),o.push(...p)}return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:c,added:h,removed:p}=this.restore({},r);a.push(...c),d.push(...h),o.push(...p)}if(t==="parent"){const{updated:c,added:h,removed:p}=this.restore({},r);a.push(...c),d.push(...h),o.push(...p)}return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){var e;return(e=this.parent)==null||e.subscribeDependents([{entity:this,field:"parent"}]),this.declaration.subscribeDependents([{entity:this,field:"declaration"}]),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=R.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new ke(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.inputs=this.inputs,e.outputs=this.outputs,e.error=this.error,e.successCalls=this.successCalls,e.errorCalls=this.errorCalls,e.process=this.process,e.declaration=this.declaration,e.calledBySuccess=this.calledBySuccess,e.calledByError=this.calledByError,e.calledByEntry=this.calledByEntry,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const c=new Map;for(const[h,p]of this.knownVersions||new Map){if(c.set(h,p),p.activeVersion=!1,p.knownVersions)for(const[v,E]of p.knownVersions)c.set(v,E);p.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const c=await this.APILoadVersion({},e);if(!c)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new ke(c,this.project)}return this.metaSync(o.toShallowJSON(),null),this.inputs=o.inputs,this.outputs=o.outputs,this.error=o.error,this.successCalls=o.successCalls,this.errorCalls=o.errorCalls,this.process=o.process,this.declaration=o.declaration,this.calledBySuccess=o.calledBySuccess,this.calledByError=o.calledByError,this.calledByEntry=o.calledByEntry,this.parent=o.parent,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=g(this.initialData.parent),o=this.project.get(d);o&&(this.setParent(o,null),e.push(o))}if(this.initialData.declaration){const d=g(this.initialData.declaration),o=this.project.get(d);o&&(this.setDeclaration(o),e.push(o))}return this.initialData.calledByEntry.forEach(d=>{const o=g(d),l=this.project.get(o);l&&(this.addEntryCaller(l,null),e.push(l))}),this.initialData.calledBySuccess.forEach(d=>{const o=g(d),l=this.project.get(o);l&&(this.addSuccessCaller(l,null),e.push(l))}),this.initialData.calledByError.forEach(d=>{const o=g(d),l=this.project.get(o);l&&(this.addErrorCaller(l,null),e.push(l))}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];this.initialized=!0,this.captureVersion();const{updated:o,added:l,removed:c}=this.syncMissingFixedInputs(e),{updated:h,added:p,removed:v}=this.syncMissingFixedOutputs(e);return t.push(...o,...h),r.push(...l,...p),a.push(...c,...v),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){var o;const t=[this],r=[],a=[],d=[];return this.parent===this.project&&this.project.addFunctionCall(this),(o=this.process)==null||o.writesValues.forEach(l=>{l.setValueWriter(this.process),t.push(l)}),this.successCalls.forEach(l=>{l.addSuccessCaller(this,e),t.push(l)}),this.errorCalls.forEach(l=>{l.addErrorCaller(this,e),t.push(l)}),this.calledBySuccess.forEach(l=>{l.addSuccessCall(this),t.push(l)}),this.calledByError.forEach(l=>{l.addErrorCall(this),t.push(l)}),this.calledByEntry.forEach(l=>{l.addCall(this),t.push(l)}),this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(e){const t=this.inputs.findIndex(r=>r.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(r=>r.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,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-success-caller"))){return this.calledBySuccess.find(r=>r.id===e.id)||(this.calledBySuccess.push(e),t&&(t==null||t.add(this,b.Updated),t==null||t.add(e,b.Affected)),t==null||t.attemptAutoclose("add-success-caller",this.id)),this}addErrorCaller(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-error-caller"))){return this.calledByError.find(r=>r.id===e.id)||(this.calledByError.push(e),t&&(t==null||t.add(this,b.Updated),t==null||t.add(e,b.Affected)),t==null||t.attemptAutoclose("add-error-caller",this.id)),this}addEntryCaller(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-entry-caller"))){return this.calledByEntry.find(r=>r.id===e.id)||(this.calledByEntry.push(e),t&&(t==null||t.add(this,b.Updated),t==null||t.add(e,b.Affected)),t==null||t.attemptAutoclose("add-entry-caller",this.id)),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 r=this.errorCalls.findIndex(a=>a.id===e.id);return r>-1&&this.errorCalls.splice(r,1),this}removeCaller(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-caller"))){return this.calledBySuccess=this.calledBySuccess.filter(r=>r.id!==e.id?(t&&(t==null||t.add(this,b.Updated),t==null||t.add(r,b.Affected)),!0):!1),this.calledByError=this.calledByError.filter(r=>r.id!==e.id?(t&&(t==null||t.add(this,b.Updated),t==null||t.add(r,b.Affected)),!0):!1),this.calledByEntry=this.calledByEntry.filter(r=>r.id!==e.id?(t&&(t==null||t.add(this,b.Updated),t==null||t.add(r,b.Affected)),!0):!1),t==null||t.attemptAutoclose("remove-caller",this.id),this}setParent(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}setDeclaration(e){return this.declaration=e,this}initChildren(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.declaration.type===n.FunctionDeclaration){const t=V(this.initialData.declaration,this.project);this.declaration=t}else{const t=g(this.initialData.declaration),r=this.project.get(t);this.declaration=r}return this.successCalls=this.initialData.successCalls.map(t=>{const r=V(t,this.project);return r.addSuccessCaller(this),[n.BreakStatement,n.ContinueStatement].includes(r.type)?(r.setParent(this.parent.parent,null),r.initChildren(e)):r.type!==n.InternalCall&&(r.setParent(this.parent,null),r.initChildren(e)),r}),this.errorCalls=this.initialData.errorCalls.map(t=>{const r=V(t,this.project);return r.addErrorCaller(this),[n.BreakStatement,n.ContinueStatement].includes(r.type)?(r.setParent(this.parent.parent,null),r.initChildren(e)):r.type!==n.InternalCall&&(r.setParent(this.parent,null),r.initChildren(e)),r}),this.inputs=this.initialData.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.initialData.process&&(this.process=V(this.initialData.process,this.project),this.process.setParent(this,null),this.process.initChildren(e)),this.initialData.error&&(this.error=V(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(e)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.x=e.x||this.x,this.y=e.y||this.y,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await ke.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await ke.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await ke.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await ke.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await ke.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await ke.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){var l;const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(c=>{const{updated:h,removed:p,added:v}=c.entity.onDetachedDependencyRemoved(this,c.field,t);r.push(...h),a.push(...p),d.push(...v)}),this.process){const{updated:c,removed:h}=(l=this.process)==null?void 0:l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}if(this.inputs.forEach(c=>{const{updated:h,removed:p}=c.remove({ignoreUpstream:!0},t);r.push(...h),a.push(...p)}),this.outputs.forEach(c=>{const{updated:h,removed:p}=c.remove({ignoreUpstream:!0},t);r.push(...h),a.push(...p)}),this.error){const{updated:c,removed:h}=this.error.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}return this.successCalls.forEach(c=>{r.push(c),c.removeCaller(this)}),this.errorCalls.forEach(c=>{r.push(c),c.removeCaller(this)}),e||this.calledBy.forEach(c=>{r.push(c),c.removeCall(this)}),t==null||t.attemptAutoclose("remove-entity",this.id),{added:u(d),updated:u(r),removed:u(a),affected:u(o),self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];if(e!=null&&e.hasAdded(this.id))return e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.process){const{updated:o}=this.process.restore({},e);r.push(...o)}return this.inputs.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.outputs.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.successCalls.forEach(o=>{r.push(o),o.addSuccessCaller(this)}),this.errorCalls.forEach(o=>{r.push(o),o.addErrorCaller(this)}),this.calledBySuccess.forEach(o=>{r.push(o),o.addSuccessCall(this)}),this.calledByError.forEach(o=>{r.push(o),o.addErrorCall(this)}),this.calledByEntry.forEach(o=>{r.push(o),o.addCall(this)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:u(t),updated:u(r),removed:u(a),affected:u(d),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.successCalls.flatMap(r=>r.toFlat(e)),...this.errorCalls.flatMap(r=>r.toFlat(e)),...this.inputs.flatMap(r=>r.toFlat(e)),...this.outputs.flatMap(r=>r.toFlat(e)),...this.process?this.process.toFlat(e):[],...this.error?this.error.toFlat(e):[],...this.calledBy.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.successCalls.flatMap(r=>r.toFlatIds(e)),...this.errorCalls.flatMap(r=>r.toFlatIds(e)),...this.inputs.flatMap(r=>r.toFlatIds(e)),...this.outputs.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){var t,r;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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:(r=this.error)==null?void 0:r.toJSON(e)})}toJSONClone(e=Z){var r,a,d,o,l,c,h;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||pt(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.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,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(p=>p.toJSONClone({...e,newId:null})),errorCalls:this.errorCalls.map(p=>p.toJSONClone({...e,newId:null})),calledBySuccess:this.calledBySuccess.map(p=>p.toReference({seenEntityMaps:e.seenEntityMaps})),calledByError:this.calledByError.map(p=>p.toReference({seenEntityMaps:e.seenEntityMaps})),calledByEntry:this.calledByEntry.map(p=>p.toReference({seenEntityMaps:e.seenEntityMaps})),process:(c=this.process)==null?void 0:c.toJSONClone({...e,newId:null}),declaration:this.declaration.toJSONClone({...e,newId:null}),inputs:this.inputs.map(p=>p.toJSONClone({...e,newId:null})),outputs:this.outputs.map(p=>p.toJSONClone({...e,newId:null})),error:(h=this.error)==null?void 0:h.toJSONClone({...e,newId:null}),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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(r=>r.toFlatJSON(e)),...this.errorCalls.flatMap(r=>r.toFlatJSON(e)),...this.inputs.flatMap(r=>r.toFlatJSON(e)),...this.outputs.flatMap(r=>r.toFlatJSON(e)),...this.process?this.process.toFlatJSON(e):[],...this.error?this.error.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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(r=>r.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.inputs.flatMap(r=>r.toFlatGenerationTarget(e)),...this.outputs.flatMap(r=>r.toFlatGenerationTarget(e)),...this.process?this.process.toFlatGenerationTarget(e):[],...this.error?this.error.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(r=>r.clearErrors()),this.outputs.forEach(r=>r.clearErrors()),this.successCalls.forEach(r=>r.clearErrors()),this.errorCalls.forEach(r=>r.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=Vq(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=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var P,w;let d=ft(t,this);const o=this.toJSON(),l=r||R.UUID.uuid();o.inputs=[];const c=l.split("-id"),h=c[c.length-1||0]||l;o.id=l,o.version=R.UUID.uuid();const p=lt(o,d);t?p.setParent(t,null):p.setParent(this.parent,null),a&&p.subscribe(),p.initChildren(e),e==null||e.add(p,b.Added);const v=(P=this.inputs)==null?void 0:P.map((C,U)=>C.clone(e,p,h+"-input-map-"+U+"-id",a));p.inputs=v;const E=(w=this.outputs)==null?void 0:w.map((C,U)=>C.clone(e,p,h+"-output-map-"+U+"-id",a));return p.outputs=E,this.error&&(p.error=this.error.clone(e,p,h+"-error-map-id",a)),this.process&&(p.process=this.process.clone(e,p,h+"-process-id",a)),e==null||e.attemptAutoclose("clone-entity",this.id),p}removeUnrecognizedInputs(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-unrecognized-inputs"))){const t=[],r=[],a=[],d=[];return this.inputs.forEach(o=>{if(!this.declaration.inputs.find(c=>{var h;return c.id===((h=o.declaration)==null?void 0:h.id)})){const c=o.remove({ignoreUpstream:!1},e);a.push(...c.removed),t.push(...c.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}removeUnrecognizedOutputs(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-unrecognized-outputs"))){const t=[],r=[],a=[],d=[];return this.outputs.forEach(o=>{if(!this.declaration.getUniqueReturnDeclarations().find(c=>{var h;return c.id===((h=o.declaration)==null?void 0:h.id)})){const c=o.remove({ignoreUpstream:!1},e);a.push(...c.removed),t.push(...c.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-outputs",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}syncMissingFixedInputs(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-missing-fixed-inputs"))){const t=[],r=[],a=[],d=[],o=this.declaration.inputs.filter(p=>!this.inputs.find(v=>v.declaration.id===p.id));this.inputs.sort((p,v)=>p.index-v.index),o.forEach(p=>{this.inputs.forEach(P=>{P.index>=p.index&&P.metaSync({index:P.index+1},e)});const v={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.InputMap,declaration:p.toJSON(),readsValue:null,defaultValue:null,index:p.index,name:null,description:null,parent:this.toReference()},E=V(v,this.project);E.setParent(this,e),E.initChildren(e),e==null||e.add(E,b.Added),E.addSelfToProject(e),r.push(E)}),this.inputs.sort((p,v)=>p.index-v.index);const{updated:l,added:c,removed:h}=this.removeUnrecognizedInputs(e);return t.push(...l),r.push(...c),a.push(...h),e==null||e.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}syncMissingFixedOutputs(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-missing-fixed-outputs"))){const t=[],r=[],a=[],d=[],o=[];this.outputs=this.initialData.outputs.map(v=>{const E=V(v,this.project);return o.push(E.index),E.setParent(this,null),E.initChildren(e),E});const l=this.declaration.getUniqueReturnDeclarations().filter(v=>!this.outputs.find(E=>E.declaration.id===v.id));this.outputs.sort((v,E)=>v.index-E.index),l.forEach((v,E)=>{this.outputs.forEach(U=>{U.index>=v.index&&U.index++});const P=o.includes(v.index)?this.outputs.length-1+E:v.index,w={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.OutputMap,declaration:v.toJSON(),defaultValue:null,writesValues:[],index:P,parent:this.toReference()},C=V(w,this.project);C.setParent(this,e),C.initChildren(e),e==null||e.add(C,b.Added),C.addSelfToProject(e)}),this.outputs.sort((v,E)=>v.index-E.index);const{updated:c,added:h,removed:p}=this.removeUnrecognizedOutputs(e);return t.push(...c),r.push(...h),a.push(...p),e==null||e.attemptAutoclose("sync-missing-fixed-outputs",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}};f(ke,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(ke,"type",n.FunctionCall),f(ke,"USER_MANAGED_PARENT_TYPES",[...mt,n.Project]),f(ke,"PARENT_TYPES",[...ke.USER_MANAGED_PARENT_TYPES]),f(ke,"MUTABLE_BASE_PROPERTIES",[]),f(ke,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(ke,"BASE_PROPERTIES",[...ke.MUTABLE_BASE_PROPERTIES,...ke.INMUTABLE_BASE_PROPERTIES]),f(ke,"MUTABLE_META_PROPERTIES",["x","y"]),f(ke,"INMUTABLE_META_PROPERTIES",[...ke.INMUTABLE_BASE_PROPERTIES]),f(ke,"META_PROPERTIES",[...ke.MUTABLE_META_PROPERTIES,...ke.INMUTABLE_META_PROPERTIES]),f(ke,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),f(ke,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),f(ke,"UPSTREAM_PROPERTIES",[...ke.MUTABLE_UPSTREAM_PROPERTIES,...ke.INMUTABLE_UPSTREAM_PROPERTIES]),f(ke,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),f(ke,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(ke,"DOWNSTREAM_PROPERTIES",[...ke.MUTABLE_DOWNSTREAM_PROPERTIES,...ke.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(ke,"PROPERTIES",[...ke.META_PROPERTIES,...ke.UPSTREAM_PROPERTIES,...ke.DOWNSTREAM_PROPERTIES]);let qi=ke;function Cp(i){return i&&typeof i.then=="function"}class gp{constructor(s){f(this,"order",[]);f(this,"flatRecord",{});f(this,"allBuiltInEntityIds",Wr());f(this,"onGoingVisits",{});this.flatten(s),this.orderEntities()}flatten(s){const e=new Set(Wr()),t=u(N(s,e,{ignoreBuiltInBaseEntities:!0})),r=new Set;for(const a of t)this.flatRecord[a.id]=a,r.add(a.id);this.order=Array.from(r)}moveEntityAfterDependencies(s){const{upstream:e}=qd(s,this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds});for(const t of Object.keys(e)){const r=this.order.indexOf(t),a=this.order.indexOf(s.id);if(r>a)return this.order.splice(a,1),this.order.splice(r,0,s.id),!0}return!1}orderEntities(){let s=!1;for(let e=0;e<this.order.length;e++){const t=this.order[e],r=this.flatRecord[t];if(this.moveEntityAfterDependencies(r)){s=!0;break}}s&&this.orderEntities()}getUpstreamOngoingDependenciesVisits(s,e){const{upstream:t}=qd(this.flatRecord[s],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}),r={};return Object.entries(this.onGoingVisits[e]||{}).forEach(([a,d])=>{Object.keys(t).includes(a)&&(r[a]=d)}),r}getDownstreamOngoingDependenciesVisits(s,e){const t=Object.keys(this.onGoingVisits[e]||{}),r=new Set(t.flatMap(d=>Object.keys(qd(this.flatRecord[d],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}).downstream))),a={};return Array.from(r).forEach(d=>{d===s&&(a[d]=this.onGoingVisits[e][d])}),a}async settlePromises(s,e){const t=Object.values(s);t.length&&await Promise.all(t),Object.keys(s).forEach(r=>{delete this.onGoingVisits[e][r]})}visit(s){const e=this.order;for(const t of e)s(this.flatRecord[t],this.flatRecord);return this}reverseVisit(s){const e=this.order.slice().reverse();for(const t of e)s(this.flatRecord[t],this.flatRecord);return this}async visitAsync(s){const e=this.order,t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const r of e){const a=this.getUpstreamOngoingDependenciesVisits(r,t);Object.keys(a).length&&await this.settlePromises(a,t);const d=s(this.flatRecord[r],this.flatRecord);Cp(d)&&(this.onGoingVisits[t][r]=d)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}async reverseVisitAsync(s){const e=this.order.slice().reverse(),t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const r of e){const a=this.getDownstreamOngoingDependenciesVisits(r,t);Object.keys(a).length&&await this.settlePromises(a,t);const d=s(this.flatRecord[r],this.flatRecord);Cp(d)&&(this.onGoingVisits[t][r]=d)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}}function mO(i,s){switch(i.id){case F["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const e=i.project.entities.filter(l=>!!l.implements.find(c=>c.id===F["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));if(e.find(l=>!!l.properties.find(c=>{var h;return c.implements&&c.implements.id===F["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=c.getDefaultValue())==null?void 0:h.value)===!0}))){const c=e[0].properties.find(p=>p.implements&&p.implements.id===F["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),h=c==null?void 0:c.defaultValue;if(h)h.value=!0;else if(c!=null&&c.dataType){const p=V({id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.LiteralValue,name:M.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:c==null?void 0:c.dataType.toReference()},i.project);return p.setParent(c==null?void 0:c.dataType,s),p.initChildren(s),p.addSelfToProject(s),{newEntities:[p]}}return{newEntities:[]}}const r=i.project.get(F["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),a=Sd(r,"Main database",s);if(a.errors.length>0)return{newEntities:[]};const d=a.implemented.properties.find(l=>l.implements&&l.implements.id===F["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),o=d==null?void 0:d.defaultValue;if(o)o.value=!0;else if(d!=null&&d.dataType){const l=V({id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.LiteralValue,name:M.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:d==null?void 0:d.dataType.toReference()},i.project);l.setParent(d==null?void 0:d.dataType,s),l.initChildren(s),l.addSelfToProject(s)}return{newEntities:[a.implemented]}}}return{newEntities:[]}}function vO(i,s){return i.implements.filter(t=>t.type===n.BuiltInBaseEntity).map(t=>{switch(t.id){case F["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const a=i.project.entities.filter(l=>l.implements.find(c=>c.id===F["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)).find(l=>!!l.properties.find(c=>{var h;return c.implements&&c.implements.id===F["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=c.getDefaultValue())==null?void 0:h.value)===!0}));if(!a)return{newEntities:[]};const d=i.properties.find(l=>l.implements&&l.implements.id===F["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),o=d==null?void 0:d.defaultValue;if(d&&(d!=null&&d.dataType)&&!o){const l=V({id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.LiteralValue,name:M.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:a,valueAsTypeList:null,parent:d==null?void 0:d.dataType.toReference()},i.project);return l.setParent(d==null?void 0:d.dataType,s),l.initChildren(s),l.addSelfToProject(s),{newEntities:[l]}}return{newEntities:[]}}}}),{newEntities:[]}}function Sd(i,s,e,t){const r=t||R.UUID.uuid(),a={id:r,version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,name:s,type:n.DefinitionEntity,description:null,static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[i],x:0,y:0,parent:i.project},d=gd(a,i.project);if(d.length>0)return{errors:d,implemented:null,entitiesChanges:{new:[],updated:[],deleted:[]}};const o=mO(i,e),l=V(a,i.project);l.setParent(i.project,e),l.initChildren(e);const c=i.properties.map(v=>{const E=R.UUID.uuid(),P=v.clone(e,l,E);return P.abstract=!1,P.implements=v,P.setParent(l,e),l.addProperty(P),P}),h=i.abstractMethods.map(v=>{const E=R.UUID.uuid(),P=v.implementAsFunctionDeclaration(E),w={id:E+"-parent-ref-id",type:n.GenericReference,entityId:r,version:R.UUID.uuid(),entityType:n.DefinitionEntity},C={...P,implements:v,parent:w},U=V(C,i.project);return l.addMethod(U),U.setParent(l,e),U.initChildren(e),U.implements=v,U});a.properties=c,a.methods=h;const p=vO(l,e);return{implemented:l,errors:[],entitiesChanges:{new:[l,...o.newEntities,...p.newEntities],updated:[l],deleted:[]}}}function Bp(i,s){return s.entities.find(r=>{const a=r.properties,d=a.map(p=>p.name),o=i.every(p=>d.includes(p)),l=d.filter(p=>!i.includes(p)),c=a.every(p=>!l.includes(p.name)||!p.required);return o&&c})||null}function TO(i,s,e,t=Rt.OrDataTypeGroup){const r=[],a=[],d=[],o=[],c={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,entity:i.toJSON(),isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:t,parent:s.toReference()},h=V(c,i.project);return a.push(h),h.setParent(s,e),h.initChildren(e),h.setEntity(i),h.addSelfToProject(e),{updated:u(r),added:u(a),removed:u(d),affected:u(o),self:h}}function _p(i,s,e,t,r){var c,h,p,v,E,P,w,C;const a=[],d=[],o=[],l=[];switch(typeof i){case"string":let U=!1;const S=new Date(i);if(S instanceof Date&&!isNaN(S.valueOf())&&(U=!0),U){const B=s.project.getBuiltIn(F[n.PrimitiveEntity][M.Date].id);s.setEntity(B);break}else{const B=s.project.getBuiltIn(F[n.PrimitiveEntity][M.String].id);s.setEntity(B);break}case"number":s.setEntity(s.project.getBuiltIn(F[n.PrimitiveEntity][M.Number].id));break;case"boolean":s.setEntity(s.project.getBuiltIn(F[n.PrimitiveEntity][M.Boolean].id));break;case"object":if(i===null){s.setEntity(s.project.getBuiltIn(F[n.PrimitiveEntity][M.Null].id));break}else if(Array.isArray(i))if(s.metaSync({isList:!0},t),i.length>0){const B=i.slice(0,5).filter(k=>k!==void 0);if(B.every(k=>typeof k==typeof B[0])&&(typeof B[0]!="object"||B[0]===null))switch(typeof B[0]){case"string":s.setEntity(s.project.getBuiltIn(F[n.PrimitiveEntity][M.String].id));break;case"number":s.setEntity(s.project.getBuiltIn(F[n.PrimitiveEntity][M.Number].id));break;case"boolean":s.setEntity(s.project.getBuiltIn(F[n.PrimitiveEntity][M.Boolean].id));break;case"object":s.setEntity(s.project.getBuiltIn(F[n.PrimitiveEntity][M.Null].id));break}else{const k=[];let W=!1;B.forEach(ce=>{var Te,Q,se,Ht;if(Array.isArray(ce)&&(W=!0),typeof ce=="object"&&!Array.isArray(ce)&&ce!==null){const zr=Fd(ce,s.project,{...e,id:R.UUID.uuid()},t,r);zr.hasCreated&&k.push((Te=zr.changeSet)==null?void 0:Te.self),a.push(...(Q=zr.changeSet)==null?void 0:Q.updated),d.push(...(se=zr.changeSet)==null?void 0:se.added),o.push(...(Ht=zr.changeSet)==null?void 0:Ht.removed)}});const ee=u(k);if(!ee.length&&!W){B.forEach(ce=>{const Te={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:Rt.OrDataTypeGroup,parent:s.toReference()},Q=V(Te,s.project);switch(Q.setParent(s,t),Q.initChildren(t),Q.addSelfToProject(t),typeof ce){case"string":Q.setEntity(Q.project.getBuiltIn(F[n.PrimitiveEntity][M.String].id));break;case"number":Q.setEntity(Q.project.getBuiltIn(F[n.PrimitiveEntity][M.Number].id));break;case"boolean":Q.setEntity(Q.project.getBuiltIn(F[n.PrimitiveEntity][M.Boolean].id));break;case"object":Q.setEntity(Q.project.getBuiltIn(F[n.PrimitiveEntity][M.Null].id));break}});break}else ee.length===1&&!W?s.setEntity(ee[0]):B.forEach(ce=>{if(typeof ce=="object"&&!Array.isArray(ce)&&ce!==null){const Te=Bp(Object.keys(ce),s.project);if(Te){const Q=TO(Te||ee[0],s,t,Rt.OrDataTypeGroup);a.push(...Q.updated),d.push(...Q.added),o.push(...Q.removed)}}else{const Te={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,entity:null,isList:Array.isArray(ce),asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:Rt.OrDataTypeGroup,parent:s.toReference()},Q=V(Te,s.project);Q.setParent(s,t),Q.initChildren(t),Q.addSelfToProject(t);const se=_p(ce,Q,{...e,id:R.UUID.uuid()},t,r);a.push(...se.updated),d.push(...se.added),o.push(...se.removed)}})}}else{const B=Fd(i[0],s.project,{...e},t,r);s.setEntity((c=B.changeSet)==null?void 0:c.self),a.push(...(h=B.changeSet)==null?void 0:h.updated),d.push(...(p=B.changeSet)==null?void 0:p.added),o.push(...(v=B.changeSet)==null?void 0:v.removed);break}else{const B=Fd(i,s.project,{...e},t,r);s.setEntity((E=B.changeSet)==null?void 0:E.self),a.push(...(P=B.changeSet)==null?void 0:P.updated),d.push(...(w=B.changeSet)==null?void 0:w.added),o.push(...(C=B.changeSet)==null?void 0:C.removed);break}}return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:s}}function Fd(i,s,e,t,r){const a=[],d=[],o=[],l=[],c=Object.keys(i),h=Bp(c,s);if(h)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:h}};const p=r?e.name+" of "+r.name:e.name,E={id:e.id||R.UUID.uuid(),version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,name:p,type:n.DefinitionEntity,description:e.description||null,static:e.static||!1,abstract:e.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:s.toReference()},P=V(E,s);return P.setParent(s,t),P.initChildren(t),P.addSelfToProject(t),d.push(P),c.forEach((w,C)=>{const S={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,name:w,type:n.Property,description:null,static:!1,abstract:!1,defaultValue:null,constant:!1,dataType:null,implements:null,index:C,hidden:!1,private:!1,required:!0,parent:P.toReference()},B=V(S,s);B.setParent(P,t),B.initChildren(t),B.addSelfToProject(t),d.push(B);const $=i[w],W={id:R.UUID.uuid(),version:R.UUID.uuid(),createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parent:B.toReference()},ee=V(W,s);ee.setParent(B,t),ee.initChildren(t),ee.addSelfToProject(t),d.push(ee);const ce=_p($,ee,{...e,name:w,id:R.UUID.uuid()},t,r||P);a.push(...ce.updated),d.push(...ce.added),o.push(...ce.removed)}),{hasCreated:!0,changeSet:{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:P}}}function xd(i,s){const e=_n(i);if(e.length===0)return{list:[],last:null};let t=null;return{list:e.flatMap(a=>{if(a===s)return t=a,[a];const d=xd(a,s);return d.last&&(t=d.last),[a,...d.list]}),last:t}}function EO(i,s,e=new Set){const t=Ji(i),r=Ji(s),a=t.filter(l=>!r.includes(l)),d=t.filter(l=>r.includes(l)),o=a.reduce((l,c)=>e.has(c.id)?l:(e.add(c.id),u([...l,...EO(c,s,e)])),[]);return u([...d,...o])}function Vs(i,s){const e=xd(i,s);return e.last===s&&e.list.length>0&&e.list[0]!==s}function Cq(i,s){return!!xd(i,s).last}function gq(i){if(at.includes(i.type))return i;if([...Vr,n.VariableDeclaration].includes(i.type)){const s=i.parent;return at.includes(s.type)?s:null}return null}function Mp(i,s){if(!i||!s)throw new Error("Both entities must be defined to find a common ancestor");if(i===s)return i;const e=i.parent;if(e){if(e===s)return s;if(e.type===n.Project)return null}else return null;const t=s.parent;if(t){if(t===i)return i;if(t.type===n.Project)return null}else return null;return Mp(e,t)}function wt(i){if($s.includes(i.type)){if(i.type===n.FunctionDeclaration){const s=i.parent;if(s.type===n.DefinitionEntity)return s;if(s.type===n.Loop)return s}return i}else{const s=i.parent;return s?wt(s):null}}function kd(i,s){const e=Cs(i,s);if(!e)return null;if($s.includes(e.type)){if(e.type===n.FunctionDeclaration){const t=Cs(e.parent,s);if(t){if(t.type===n.DefinitionEntity)return t;if(t.type===n.Loop)return t}}return e}else{const t=e.parent?Cs(e.parent,s):null;return t?kd(t,s):null}}function IO(i){if(!i)return null;if(Vr.includes(i.type))return i;const s=i.parent;return s?IO(s):null}function bO(i){if(!i)return null;if(nt.includes(i.type))return i;const s=i.parent;return s?bO(s):null}function RO(i){if(!i)return null;if(Cr.includes(i.type))return i;const s=i.parent;return s?RO(s):null}function Bq(i){return i.type===n.VariableDeclaration?[i]:nt.includes(i.type)?[...i.inputs,...i.outputs||[]]:st.includes(i.type)?i.outputs:jn.includes(i.type)||i.type===n.FunctionDeclaration?i.inputs:[]}function _q(i){const s=Ji(i),e=[],t=[];Hp.includes(i.type)&&e.push(...Np(i));const r=s.filter(a=>{const d=e.includes(a);return d?!1:Vr.includes(a.type)&&!d?(t.push(a),!1):!0});return e.sort((a,d)=>Vs(d,a)?-1:0),t.sort((a,d)=>Vs(d,a)?-1:0),[...e,...t,...r]}function AO(i){return[...i].sort((s,e)=>Vs(e,s)?-1:0)}function Mq(i){const s=AO(i),e=[];return s.forEach(t=>{const r=e[e.length-1];if(r){const a=r[r.length-1];Vs(t,a)?e.push([t]):r.push(t)}else e.push([t])}),e}function Yt(i){const s=i.map(e=>wt(e));return u(s)}function Np(i){return nt.includes(i.type)?[...Yt(i.successCalls),...Yt(i.errorCalls)]:at.includes(i.type)?Yt(i.calls):[]}function Nq(i,s){return Np(i).includes(s)}function Lp(i){return i.writesValues||[]}function Lq(i,s){return Lp(i).includes(s)}function DO(i){var s;return Qe.includes((s=i==null?void 0:i.readsValue)==null?void 0:s.type)?i.readsValue:null}function Uq(i){return i.writesValues}function OO(i=[]){return i.map(DO).filter(s=>!!s)}function Zd(i=[]){return i.map(s=>s.writesValues).flat().filter(s=>Qe.includes(s.type))}function PO(i=[]){return i.map(s=>s.readsValue).filter(s=>!!s&&Qe.includes(s.type))}function wO(i){return Qe.includes(i.type)?i:null}function VO(i){return i.writesValues.map(wO).filter(s=>!!s)}function CO(i=[]){return i.reduce((s,e)=>e.type===n.OutputMap?[...s,...VO(e)]:s,[])}function it(i){return nt.includes(i.type)?[...Jr(Yt(i.successCalls)),...Jr(Yt(i.errorCalls))]:at.includes(i.type)?Jr(Yt(i.calls)):[]}function jq(i){return nt.includes(i.type)?[...Jr(Yt(i.successCalls)),...Jr(Yt(i.errorCalls))]:at.includes(i.type)?Jr(Yt(i.calls)):[]}function gO(i,s=new Set){return i.writesValues.filter(t=>Qe.includes(t.type)&&!s.has(t.id)).reduce((t,r)=>s.has(r.id)?t:[...t,...We(r,s)],[])}function BO(i,s=new Set){var t;return(((t=i.readsValue)==null?void 0:t.writesValues)||[]).filter(r=>Qe.includes(r.type)&&!s.has(r.id)).reduce((r,a)=>s.has(a.id)?r:[...r,...We(a,s)],[])}function We(i,s=new Set){if(s.has(i.id))return[];if(i.type===n.ReturnStatement)return PO(i.outputs).reduce((t,r)=>[...t,...We(r,s)],[]);if(i.type===n.FunctionCall||i.type===n.Operation||i.type===n.Condition)return[...it(i).reduce((a,d)=>{const o=wt(d);return[...a,...We(o||d,s)]},[]),...OO(i.inputs),...CO(i.outputs)].reduce((a,d)=>[...a,...We(d,s)],[]);if(jn.includes(i.type)){const e=Zd(i.inputs),r=it(i).reduce((a,d)=>{const o=wt(d);return[...a,...We(o||d,s)]},[]);return e.push(...r),e.reduce((a,d)=>[...a,...We(d,s)],[])}if(i.type===n.FunctionDeclaration){const e=[...Zd(i.inputs)],r=it(i).reduce((a,d)=>{const o=wt(d);return[...a,...We(o||d,s)]},[]);return e.push(...r),e.reduce((a,d)=>[...a,...We(d)],[])}if(Qe.includes(i.type)){s.add(i.id);const t=it(i).reduce((r,a)=>{const d=wt(a);return[...r,...We(d||a,s)]},[]);return[i,...t,...BO(i,s),...gO(i,s)]}return[]}function ir(i,s=new Set){return s.has(i.id)?[]:(s.add(i.id),[...Ji(i).reduce((r,a)=>[...r,a,...ir(a,s)],[])])}function Jr(i){return i.reduce((s,e)=>e.type===n.ReturnStatement||e.type===n.ContinueStatement||e.type===n.BreakStatement?[...s,e]:[...s,e,...it(e)],[])}function _O(i){const s=i.entities||[],e=[...s,...i.functions||[],...i.events||[],...i.projects||[]],t=s.reduce((l,c)=>[...l,...c.properties],[]),r=s.reduce((l,c)=>[...l,...c.methods],[]),a=r.reduce((l,c)=>[...l,...Zd(c.inputs),...Jr(Yt(c.calls)),...c.returnStatements],[]),d=i.functions.reduce((l,c)=>[...l,...Jr(Yt(c.calls)),...c.returnStatements],[]),o=i.events.reduce((l,c)=>[...l,...Jr(Yt(c.calls)),...c.returnStatements],[]);return[...e,...t,...r,...a,...d,...o]}function MO(i,s){return s.filter(t=>{if(!t)return!1;switch(t.type){case n.FunctionCall:return t.inputs.find(r=>r.id===i.id)!==void 0||t.outputs.find(r=>r.id===i.id)!==void 0;case n.Condition:return t.successCalls.find(r=>r.id===i.id)!==void 0||t.errorCalls.find(r=>r.id===i.id)!==void 0||t.inputs.find(r=>r.id===i.id)!==void 0;case n.Operation:return t.outputs.find(r=>r.id===i.id)!==void 0;case n.VariableDeclaration:return nt.includes(i.type)?oP(i).find(a=>{var d;return((d=a.readsValue)==null?void 0:d.id)===t.id})!==void 0:!1;case n.DefinitionEntity:return t.properties.find(r=>r.id===i.id)!==void 0||t.methods.find(r=>r.id===i.id)!==void 0;case n.FunctionDeclaration:return t.inputs.find(r=>r.id===i.id)!==void 0||(t.returnStatements.map(r=>r.outputs).flat()||[]).find(r=>r.id===i.id)!==void 0;default:return!1}})}function $q(i){const s=_O(i.project);return MO(i,s)}function Cs(i,s){return i?typeof i=="string"?s[i]:i.type===n.GenericReference?s[i.entityId]:s[i.id]?s[i.id]:null:null}function qd(i,s={},e={ignoreBuiltInBaseEntities:!1,allBuiltInEntityIds:[]}){if(e.ignoreBuiltInBaseEntities&&(hr.includes(i.type)||(e.allBuiltInEntityIds||[]).includes(i.id)))return{upstream:{},downstream:{}};const t=i,r=i,a=i,d=i,o=i,l=i,c=i,h=i,p=i,v=i,E=i,P=i,w=i,C=[...w.readsValue?[w.readsValue]:[],...w.declaration?[w.declaration]:[],...(P.calledByEntry||[]).flatMap($=>$),...(P.calledBySuccess||[]).flatMap($=>$),...(P.calledByError||[]).flatMap($=>$),...(a.extends||[]).flatMap($=>$),...v.parent?[v.parent]:[]];Array.isArray(a.implements)?C.push(...a.implements.flatMap($=>$)):p.implements&&C.push(p.implements),o.valueAsTypeList&&Array.isArray(o.valueAsTypeList)&&C.push(...o.valueAsTypeList.flatMap($=>$)),o.valueAsTypeSingle&&C.push(o.valueAsTypeSingle);const U=[...(t.inputs||[]).flatMap($=>$),...(E.inputsDeclarations||[]).flatMap($=>$),...(t.outputs||[]).flatMap($=>$),...(E.outputsDeclarations||[]).flatMap($=>$),...(w.internalCalls||[]).flatMap($=>$),...w.writesValues||[],...P.dataType?[P.dataType]:[],...l.body?[l.body]:[],...P.defaultValue?[P.defaultValue]:[],...(P.successCalls||[]).flatMap($=>$),...(P.errorCalls||[]).flatMap($=>$),...(a.properties||[]).flatMap($=>$),...(a.methods||[]).flatMap($=>$),...(a.abstractMethods||[]).flatMap($=>$),...c.error?[c.error]:[],...c.process?[c.process]:[],...v.throws?[v.throws]:[],...(r.andChildrenGroup||[]).flatMap($=>$),...(r.orChildrenGroup||[]).flatMap($=>$),...(h.entities||[]).flatMap($=>$),...(h.functions||[]).flatMap($=>$),...(h.functionCalls||[]).flatMap($=>$),...(h.events||[]).flatMap($=>$),...(h.conditions||[]).flatMap($=>$),...(h.operations||[]).flatMap($=>$),...(h.loops||[]).flatMap($=>$),...(h.variableDeclarations||[]).flatMap($=>$),...(h.variableInstances||[]).flatMap($=>$),...(h.searches||[]).flatMap($=>$),...(h.projects||[]).flatMap($=>$),...(d.calls||[]).flatMap($=>$)];i.type===n.DataType&&(r.entity&&s[g(r.entity)]&&s[g(r.entity)].parent&&g(s[g(r.entity)].parent)===i.id?U.push(r.entity):r.entity&&C.push(r.entity));const S={},B={};return C.forEach($=>{const k=g($);if(k&&e.ignoreBuiltInBaseEntities&&(hr.includes($.type)||(e.allBuiltInEntityIds||[]).includes(k)))return;const W=$.version;k&&(S[k]=W)}),U.forEach($=>{const k=g($);if(k&&e.ignoreBuiltInBaseEntities&&(hr.includes($.type)||(e.allBuiltInEntityIds||[]).includes(k)))return;const W=$.version;k&&(B[k]=W)}),{upstream:S,downstream:B}}function Gq(i,s){const e=[];if(Vr.includes(i.type)){pr(i).forEach(a=>{const d=kd(a,s);d&&e.push(d)});const r=[...i.inputs||[],...i.outputs||[]].map(a=>{const d=Cs(a,s);return d?lP(d,s):null}).filter(a=>a!==null);e.push(...u(r))}if(Qe.includes(i.type)){const t=Jd(i);t&&e.push(t)}return u(e)}function _n(i){const s=[];if(Vr.includes(i.type)){i.calledBy.forEach(r=>{const a=wt(r);a&&s.push(a)});const t=[...i.inputs||[],...i.outputs||[]].map(r=>Jd(r)).filter(r=>r!==null);s.push(...u(t))}if(Qe.includes(i.type)){const e=Jd(i);e&&s.push(e)}return u(s)}function pr(i){return[...i.calledByEntry||[],...i.calledByError||[],...i.calledBySuccess||[]].filter(s=>s.type!==n.GenericReference)}function NO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ActionDescriptor)throw new Error("Entity must be an action descriptor to be flattened");return[i,...i.inputs.flatMap(t=>N(t,s,e)),...i.outputs.flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.parent?N(i.parent,s,e):[]]}function LO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ArgumentDeclaration)throw new Error("Entity must be an argument declaration to be flattened");return[i,...i.defaultValue?N(i.defaultValue,s):[],...i.writesValues.flatMap(t=>N(t,s,e)),...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function UO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.BreakStatement)throw new Error("Entity must be a break statement to be flattened");return[i,...i.outputs.flatMap(t=>N(t,s,e)),...i.throws?N(i.throws,s,e):[],...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function jO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.BuiltInBaseEntity)throw new Error("Entity must be a built-in base entity to be flattened");return[i,...(i.properties||[]).flatMap(t=>N(t,s,e)),...(i.methods||[]).flatMap(t=>N(t,s,e)),...(i.abstractMethods||[]).flatMap(t=>N(t,s,e)),...(i.extends||[]).flatMap(t=>N(t,s,e))]}function $O(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Condition)throw new Error("Entity must be a condition to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function GO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ContinueStatement)throw new Error("Entity must be a continue statement to be flattened");return[i,...i.outputs.flatMap(t=>N(t,s,e)),...i.throws?N(i.throws,s,e):[],...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function SO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.DefinitionEntity)throw new Error("Entity must be a definition entity to be flattened");return[i,...(i.extends||[]).flatMap(t=>N(t,s,e)),...(i.implements||[]).flatMap(t=>N(t,s,e)),...(i.properties||[]).flatMap(t=>N(t,s,e)),...(i.methods||[]).flatMap(t=>N(t,s,e)),...(i.abstractMethods||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function FO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.DataType)throw new Error("Entity must be a data type to be flattened");return[i,...(i.andChildrenGroup||[]).flatMap(t=>N(t,s,e)),...(i.orChildrenGroup||[]).flatMap(t=>N(t,s,e)),...i.entity?N(i.entity,s,e):[],...i.parent?N(i.parent,s,e):[]]}function xO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.FunctionCall)throw new Error("Entity must be a function call to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...(pr(i)||[]).flatMap(t=>N(t,s,e)),...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function kO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.FunctionDeclaration)throw new Error("Entity must be a function declaration to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.calls||[]).flatMap(t=>N(t,s,e)),...i.implements?N(i.implements,s,e):[],...i.parent?N(i.parent,s,e):[]]}function ZO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.GlobalEvent)throw new Error("Entity must be a global event to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.calls||[]).flatMap(t=>N(t,s,e)),...i.implements?N(i.implements,s,e):[],...i.parent?N(i.parent,s,e):[]]}function qO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.InputMap)throw new Error("Entity must be an input map to be flattened");return[i,...i.readsValue?N(i.readsValue,s,e):[],...i.declaration?N(i.declaration,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...i.parent?N(i.parent,s,e):[]]}function JO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.InstalledProject)throw new Error("Entity must be an installed project to be flattened");return[i,...(i.functions||[]).flatMap(t=>N(t,s,e)),...(i.events||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function WO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.InternalCall)throw new Error("Entity must be an internal call to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...i.parent?N(i.parent,s,e):[]]}function YO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.LiteralValue)throw new Error("Entity must be a literal value to be flattened");return[i,...i.valueAsTypeSingle?N(i.valueAsTypeSingle,s,e):[],...i.valueAsTypeList&&Array.isArray(i.valueAsTypeList)?i.valueAsTypeList.flatMap(t=>N(t,s,e)):[],...i.parent?N(i.parent,s,e):[]]}function zO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Loop)throw new Error("Entity must be a loop to be flattened");return[i,...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...i.body?N(i.body,s,e):[],...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function HO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Operation)throw new Error("Entity must be an operation to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...i.process?N(i.process,s,e):[],...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function KO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.OutputMap)throw new Error("Entity must be an output map to be flattened");return[i,...(i.writesValues||[]).flatMap(t=>N(t,s,e)),...i.declaration?N(i.declaration,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...i.parent?N(i.parent,s,e):[]]}function XO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.PrimitiveEntity)throw new Error("Entity must be a primitive entity to be flattened");return[i,...(i.properties||[]).flatMap(t=>N(t,s,e)),...(i.methods||[]).flatMap(t=>N(t,s,e)),...(i.abstractMethods||[]).flatMap(t=>N(t,s,e))]}function QO(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Project)throw new Error("Entity must be a project to be flattened");return[i,...(i.entities||[]).flatMap(t=>N(t,s,e)),...(i.functions||[]).flatMap(t=>N(t,s,e)),...(i.events||[]).flatMap(t=>N(t,s,e)),...(i.projects||[]).flatMap(t=>N(t,s,e)),...(i.variableDeclarations||[]).flatMap(t=>N(t,s,e)),...(i.variableInstances||[]).flatMap(t=>N(t,s,e)),...(i.operations||[]).flatMap(t=>N(t,s,e)),...(i.conditions||[]).flatMap(t=>N(t,s,e)),...(i.functionCalls||[]).flatMap(t=>N(t,s,e)),...(i.projects||[]).flatMap(t=>N(t,s,e)),...(i.loops||[]).flatMap(t=>N(t,s,e)),...(i.searches||[]).flatMap(t=>N(t,s,e))]}function eP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Property)throw new Error("Entity must be a property to be flattened");return[i,...i.defaultValue?N(i.defaultValue,s,e):[],...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function tP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ReturnDeclaration)throw new Error("Entity must be a return declaration to be flattened");return[i,...i.readsValue?N(i.readsValue,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function rP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ReturnStatement)throw new Error("Entity must be a return statement to be flattened");return[i,...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.throws?N(i.throws,s,e):[],...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function iP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.Search)throw new Error("Entity must be a search to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputsDeclarations||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputsDeclarations||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...i.error?N(i.error,s,e):[],...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.parent?N(i.parent,s,e):[]]}function nP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.ValueDescriptor)throw new Error("Entity must be a value descriptor to be flattened");return[i,...i.defaultValue?N(i.defaultValue,s,e):[],...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function aP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.VariableDeclaration)throw new Error("Entity must be a variable declaration to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(i.internalCalls||[]).flatMap(t=>N(t,s,e)),...(i.writesValues||[]).flatMap(t=>N(t,s,e)),...i.readsValue?N(i.readsValue,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.dataType?N(i.dataType,s,e):[],...i.parent?N(i.parent,s,e):[]]}function sP(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(s.has(i.id))return[];if(s.add(i.id),i.type!==n.VariableInstance)throw new Error("Entity must be a variable instance to be flattened");return[i,...(i.successCalls||[]).flatMap(t=>N(t,s,e)),...(i.errorCalls||[]).flatMap(t=>N(t,s,e)),...(i.inputs||[]).flatMap(t=>N(t,s,e)),...(i.outputs||[]).flatMap(t=>N(t,s,e)),...(i.internalCalls||[]).flatMap(t=>N(t,s,e)),...(i.writesValues||[]).flatMap(t=>N(t,s,e)),...i.readsValue?N(i.readsValue,s,e):[],...i.defaultValue?N(i.defaultValue,s,e):[],...(pr(i)||[]).flatMap(t=>N(t,s,e)),...i.declaration?N(i.declaration,s,e):[],...i.parent?N(i.parent,s,e):[]]}function Wr(){const i=new Set;return YE.flatMap(e=>N(e,i)).map(e=>e.id)}function N(i,s=new Set,e={ignoreBuiltInBaseEntities:!1}){if(!i)throw new Error("Entity must be defined to be flattened");if(i.type===n.GenericReference)return[];if(e.ignoreBuiltInBaseEntities&&(hr.includes(i.type)||Wr().includes(i.id)))return[];if(s.has(i.id))return[];switch(i.type){case n.FunctionCall:return xO(i,s,e);case n.Operation:return HO(i,s,e);case n.Condition:return $O(i,s,e);case n.Loop:return zO(i,s,e);case n.Search:return iP(i,s,e);case n.GlobalEvent:return ZO(i,s,e);case n.ReturnStatement:return rP(i,s,e);case n.ContinueStatement:return GO(i,s,e);case n.BreakStatement:return UO(i,s,e);case n.VariableDeclaration:return aP(i,s,e);case n.DefinitionEntity:return SO(i,s,e);case n.FunctionDeclaration:return kO(i,s,e);case n.Project:return QO(i,s,e);case n.ActionDescriptor:return NO(i,s,e);case n.ArgumentDeclaration:return LO(i,s,e);case n.ReturnDeclaration:return tP(i,s,e);case n.ValueDescriptor:return nP(i,s,e);case n.InputMap:return qO(i,s,e);case n.OutputMap:return KO(i,s,e);case n.DataType:return FO(i,s,e);case n.InstalledProject:return JO(i,s,e);case n.InternalCall:return WO(i,s,e);case n.LiteralValue:return YO(i,s,e);case n.Property:return eP(i,s,e);case n.VariableInstance:return sP(i,s,e);case n.BuiltInBaseEntity:return e.ignoreBuiltInBaseEntities?[]:jO(i,s,e);case n.PrimitiveEntity:return e.ignoreBuiltInBaseEntities?[]:XO(i,s,e)}return[]}function Up(i){return i.type===n.FunctionCall||i.type===n.InternalCall||[n.Operation,n.Condition,n.Loop].includes(i.type)?i.declaration.inputs:i.type===n.FunctionDeclaration||jn.includes(i.type)?i.inputs:i.type===n.Search?i.inputsDeclarations:[]}function Sq(i,s){return s.type===n.Condition?s.inputs.find(e=>e.declaration.id===i.id):s.type===n.FunctionCall||s.type===n.Operation?s.inputs.find(e=>e.declaration.id===i.id):null}function oP(i){return nt.includes(i.type)?i.inputs:[]}function dP(i){var s;return i.type===n.FunctionCall?((s=i.declaration.returnStatements[0])==null?void 0:s.outputs)||[]:[n.Operation,n.Condition,n.Loop].includes(i.type)?i.declaration.outputs:i.type===n.Search?i.outputsDeclarations:st.includes(i.type)?i.outputs:[]}function Fq(i,s){return s.type===n.Condition?null:s.type===n.FunctionCall||s.type===n.Operation?s.outputs.find(e=>e.declaration.id===i.id):null}function xq(i){return i.type===n.Condition?[]:nt.includes(i.type)?i.outputs:[]}function Jd(i){const s=i.readsValue;return s?wt(s):null}function lP(i,s){const e=i.readsValue;return e?kd(e,s):null}function uP(i){const s=i.internalCalls||[];return u(Yt(u(s.flatMap(e=>[...e.successCalls,...e.errorCalls]))))}function Ra(i){const s=Lp(i),e=[];return s.forEach(t=>{if(Qe.includes(t.type))e.push(t);else if(hi.includes(t.type)){const r=t.parent;e.push(r)}}),e}function u(i){const s=new Set;return i.filter(e=>!e||s.has(e.id)?!1:(s.add(e.id),!0))}function Ji(i,s=!1){const e=[];if(i.type===n.Project&&e.push(...(i==null?void 0:i.entities)||[],...(i==null?void 0:i.functions)||[],...(i==null?void 0:i.variableDeclarations)||[],...(i==null?void 0:i.variableInstances)||[],...(i==null?void 0:i.searches)||[],...(i==null?void 0:i.loops)||[],...(i==null?void 0:i.operations)||[],...(i==null?void 0:i.conditions)||[],...(i==null?void 0:i.functionCalls)||[],...(i==null?void 0:i.events)||[],...(i==null?void 0:i.projects)||[]),mt.includes(i.type)&&e.push(...(i==null?void 0:i.detachedChildren)||[]),i.type===n.DefinitionEntity){const t=[...i.suggestedMethods,...i.methods].flatMap(r=>r.collapsed&&s?[]:Ji(r));e.push(...t)}if(i.type===n.Condition){const t=i.successCalls.map(a=>wt(a)),r=i.errorCalls.map(a=>wt(a));e.push(...t,...r)}if(jn.includes(i.type)){if(i.collapsed&&s)return[];const t=i.inputs.map(a=>Ra(a)).flat(),r=i.calls.map(a=>wt(a));e.push(...u(t),...r)}if(nt.includes(i.type)&&i.type!==n.Condition&&i.type!==n.Loop){const t=i==null?void 0:i.outputs.map(d=>Ra(d)).flat(),r=i.successCalls.map(d=>wt(d)),a=i.errorCalls.map(d=>wt(d));e.push(...u(t),...r,...a)}if(Qe.includes(i.type)){const t=Ra(i),r=uP(i);e.push(...t,...r)}if(i.type===n.Loop){const t=i.outputs.map(d=>Ra(d)).flat();if(i.body){const d=Ji(i.body,s);e.push(...d)}const r=i.errorCalls.map(d=>wt(d)),a=i.successCalls.map(d=>wt(d));e.push(...u(t),...a,...r)}if(i.type===n.FunctionDeclaration){if(i.collapsed&&s)return[];const t=i.inputs.map(a=>Ra(a)).flat(),r=i.calls.map(a=>wt(a));e.push(...u(t),...r)}return u(e)}function cP(i,s=!1){const e=Ji(i,s),t=[...e,...e.reduce((r,a)=>[...r,...cP(a,s)],[])];return u(t)}function pP(i){const s=_n(i),e=[...s,...s.reduce((t,r)=>[...t,...pP(r)],[])];return u(e)}function Wd(i){return i.implements.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,n.DefinitionEntity,...Wd(e),...Yd(e)]:[...s,e.name],[])}function Yd(i){return i.extends.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,n.DefinitionEntity,...Yd(e),...Wd(e)]:[...s,e.name],[])}function jp(i){return i.extends.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,e,...jp(e),...$p(e)]:[...s,e],[])}function $p(i){return i.implements.reduce((s,e)=>e.type===n.DefinitionEntity?[...s,e,...$p(e),...jp(e)]:[...s,e],[])}function Gp(i){return[...Yd(i),...Wd(i)].filter((e,t,r)=>r.indexOf(e)===t)}function fP(i){return i.implements.length===0&&i.extends.length===0?null:i.implements.find(t=>t.type===n.BuiltInBaseEntity&&t.name===z.PERSISTED_ENTITY)?i:[...i.implements,...i.extends].reduce((t,r)=>{if(r.type===n.DefinitionEntity){const a=fP(r);if(a)return a}return t},null)}function kq(i){const s=i.extends.find(e=>e.type===n.BuiltInBaseEntity);return s&&s.type===n.BuiltInBaseEntity?s:null}function Zq(i){const s=i.implements.find(e=>e.type===n.BuiltInBaseEntity);return s&&s.type===n.BuiltInBaseEntity?s:null}function Sp(i){const s=i.extends.find(e=>e.type===n.DefinitionEntity);return s&&s.type===n.DefinitionEntity?s:null}function Wi(i){const s=[...i.implements,...i.extends].reduce((e,t)=>t.type===n.BuiltInBaseEntity?[...e,t]:t.type===n.DefinitionEntity?[...e,...Wi(t)]:e,[]);return u(s)}function Fp(i){return i.type===n.PrimitiveEntity?!0:i.type===n.BuiltInBaseEntity?i.interactive:!Wi(i).find(t=>!t.interactive)}function qq(i){return i.parent===i.project&&i.project.variableDeclarations.includes(i)}function xp(i){return i.parent!==i.project?!1:n.VariableDeclaration===i.type?i.project.variableDeclarations.includes(i):n.VariableInstance===i.type?i.project.variableInstances.includes(i):n.FunctionCall===i.type?i.project.functionCalls.includes(i):n.Condition===i.type?i.project.conditions.includes(i):n.Operation===i.type?i.project.operations.includes(i):n.Loop===i.type?i.project.loops.includes(i):n.Search===i.type?i.project.searches.includes(i):!1}function yP(i){if([...at,n.DefinitionEntity,n.InstalledProject,n.Project].includes(i.type)||xp(i))return!1;const s=_n(i);return s.length===0?!0:s.some(e=>yP(e))}function kp(i){return[...at,n.DefinitionEntity,n.InstalledProject,n.Project].includes(i.type)||xp(i)?!1:_n(i).length===0}function hP(i,s=0){if(kp(i)){const e=_n(i);return e.length===0?i:e.map(r=>hP(r,s+1)).reduce((r,a)=>r?a&&a.x<r.x?a:r:a,null)}return null}function mP(i){const s=[];if(kp(i))s.push(i);else return[];return _n(i).forEach(t=>{s.push(...mP(t))}),s}function vP(i){return i.type===n.FunctionDeclaration&&i.parent!==i.project&&!![n.DefinitionEntity,n.Loop,n.InstalledProject].includes(i.parent.type)}function Jq(i,s){const e=new Map;return i.forEach(t=>{e.set(t.id,t)}),s.forEach(t=>{e.set(t.id,t)}),Array.from(e.values())}function gs(i){switch(i){case n.DefinitionEntity:return zi;case n.FunctionDeclaration:return _i;case n.VariableDeclaration:return ji;case n.VariableInstance:return Ui;case n.FunctionCall:return qi;case n.Operation:return Mi;case n.Condition:return Li;case n.ReturnStatement:return Bi;case n.Loop:return Ni;case n.Search:return $i;case n.InputMap:return kr;case n.OutputMap:return Zr;case n.ArgumentDeclaration:return Si;case n.ReturnDeclaration:return rr;case n.Property:return gi;case n.InstalledProject:return Gi;case n.Project:return R;case n.BuiltInBaseEntity:return Yr;default:return null}}function zt(i,s){if(mt.includes(i.type))return i;if(hr.includes(i.type))return null;const e=i.parent;if(!e)return null;if(e.type===n.GenericReference){const t=g(e);if(!t)return null;const r=s.get(t);return r?zt(r,s):null}else return e===s?s:zt(e,s)}function Zp(i,s){if(hr.includes(i.type)||s.getBuiltIn(i.id))return null;const e=nr(i.parent,s);return e?e===s?mt.includes(i.type)?i:null:e.type===n.DefinitionEntity?i:Zp(e,s):null}function zd(i,s,e){if(i===s||s===e||i===e)return!1;const t=zt(s.parent,e);return t===i?!0:zd(t,s,e)}var Hd=(i=>(i.SameBothLocal="same-both-local",i.AInB="a-in-b",i.BInA="b-in-a",i.ParallelInCommonParent="parallel-in-common-parent",i.ParallelInProject="parallel-in-project",i.AIsGlobalBIsNot="a-is-global-b-is-not",i.BIsGlobalAIsNot="b-is-global-a-is-not",i.SameBothGlobal="same-both-global",i))(Hd||{});function Bs(i,s,e){const t=zt(i,e),r=zt(s,e);if(!t)throw new Error("Could not find scope owner for the entity: "+i.id);if(!r)throw new Error("Could not find scope owner for the entity: "+s.id);if(t===r&&t.type!==n.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:t};if(t===r&&t.type===n.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:t};if(t.type===n.Project&&r.type!==n.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:t};if(t.type!==n.Project&&r.type===n.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:r};if(zd(t,r,e))return{compatible:!0,type:"b-in-a",commonAncestorScope:t};if(zd(r,t,e))return{compatible:!0,type:"a-in-b",commonAncestorScope:r};const o=Mp(t,r);return o===e?{compatible:!1,type:"parallel-in-project",commonAncestorScope:o}:o?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:zt(o,e)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:e}}function TP(i,s,e){const t=Bs(i,s,e);if(!t.compatible||t.type!=="same-both-local")return null;if(i===s)return i;let r=zt(i.parent,e);if(r){if(r===s)return s;if(r.type===n.Project)return i}else return i;for(;r;){if(r){if(r===s)return s;if(r.type===n.Project)return i}else return i;r=zt(r.parent,e)}let a=zt(s.parent,e);if(a){if(a===i)return i;if(a.type===n.Project)return s}else return s;for(;a;){if(a){if(a===i)return i;if(a.type===n.Project)return s}else return s;a=zt(a.parent,e)}return null}function EP(i){return i.length===0?null:i.length===1?i[0]:i.reduce((e,t)=>{const r=TP(e,t,t.project);return!r||r===t?e:t},i[0])}function nr(i,s){if(!i)return null;let e;return typeof i=="string"?e=i:i.type===n.GenericReference?e=g(i):e=i.id,e===s.id?s:s.get(e)}function Yi(i){if(!i)return null;if(hr.includes(i.type))return i;if(i.type===n.Project)return null;if(i.project.getBuiltIn(i.id))return i;const s=i.parent;return!s||s.type===n.Project?null:Yi(s)}function Wq(i,s){var e;if(i.readsValue){const t=nr(i.readsValue,s.project);s.setValueWriter(t),t.addValueReader(s)}else i.readsValue===null&&((e=s.readsValue)==null||e.removeValueReader(s),s.readsValue=null);return s}function _s(i){const s=[];function e(a,d){return s.some(o=>o.blockedByCaller===a&&o.blockedByCalling===d)}function t(a,d){e(a,d)||s.push({blockedByCaller:a,blockedByCalling:d})}const r=Zp(i,i.project);return i.calledBySuccess.forEach(a=>{[...a.successCalls||[]].forEach(l=>{st.includes(l.type)&&l!==i&&(it(i).find(p=>p===l)||t(a,l))});let o;if(nt.includes(a.type)&&(o=a),o){const l=_s(o);l.reachable||it(i).find(p=>p===a)||l.blocks.forEach(p=>{t(a,p.blockedByCalling)})}}),i.calledByError.forEach(a=>{[...a.errorCalls||[]].forEach(l=>{st.includes(l.type)&&l!==i&&(it(i).find(p=>p===l)||t(a,l))});let o;if(nt.includes(a.type)&&(o=a),o){const l=_s(o);l.reachable||it(i).find(p=>p===a)||l.blocks.forEach(p=>{t(a,p.blockedByCalling)})}}),i.calledByEntry.forEach(a=>{if([...a.calls||[]].forEach(l=>{st.includes(l.type)&&l!==i&&(it(i).find(p=>p===l)||t(a,l))}),a===r)return;let o;if(a.type===n.FunctionDeclaration){const l=wt(a);if(l.type===n.DefinitionEntity)return;l.type===n.Loop&&(o=l)}if(o){const l=_s(o);l.reachable||l.blocks.forEach(c=>{t(a,c.blockedByCalling)})}}),{reachable:s.length===0,entryPoint:r,blocks:s}}function Yq(i){return $s.includes(i.type)?i.type===n.FunctionDeclaration?!vP(i):!0:!1}function zq(i){if(n.ActionDescriptor===i.type){if(i.project.operationDeclarations.find(a=>a.id===i.id))return n.Operation;if(i.project.globalEventActionDescriptors.find(a=>a.id===i.id))return n.GlobalEvent;if(i.project.loopDeclarations.find(a=>a.id===i.id))return n.Loop;if(i.project.conditionDeclarations.find(a=>a.id===i.id))return n.Condition}return i.type}function Aa(i,s){if(i.type!==n.DefinitionEntity||i.abstract)return!1;const e=Sp(i)||i;return!!Gp(e).includes(s)}function Hq(i){const s=[];return i.entities.forEach(e=>{if(Aa(e,z.PERSISTED_ENTITY)){s.push(e);return}}),u(s)}function Kq(i){const s=[];return i.entities.forEach(e=>{if(Aa(e,z.RELATIONAL_DATABASE)){s.push(e);return}}),u(s)}function Xq(i){return i.type!==n.DefinitionEntity||i.abstract||!Aa(i,z.PERSISTED_ENTITY)?null:(i==null?void 0:i.properties.find(e=>{var t;return((t=e.implements)==null?void 0:t.id)===F[n.BuiltInBaseEntity][z.PERSISTED_ENTITY].properties.primaryKey.id&&!e.abstract}))||null}function Qq(i){if(i.type!==n.DefinitionEntity)return[];if(i.abstract)return[];if(!Aa(i,z.PERSISTED_ENTITY))return[];const s=[],e=i.properties.filter(t=>{var r;return((r=t.implements)==null?void 0:r.id)!==F[n.BuiltInBaseEntity][z.PERSISTED_ENTITY].properties.database.id&&!t.abstract});return s.push(...e),s}function eJ(i){var e;if(!i||i.type!==n.DefinitionEntity||!Aa(i,z.PERSISTED_ENTITY))return null;const s=i.properties.find(t=>{var r;return((r=t.implements)==null?void 0:r.id)===F[n.BuiltInBaseEntity][z.PERSISTED_ENTITY].properties.database.id});return(e=s==null?void 0:s.getDefaultValue())==null?void 0:e.valueAsTypeSingle}function ft(i,s){var t;if(!Xp.includes(s.type)||!i)return s.project||null;let e=s.project;return i.type===n.Project?e=i:((t=s.project)==null?void 0:t.id)!==i.project.id&&(e=i.project),e}function tJ(i){switch(i){case n.Project:return R;case n.InstalledProject:return Gi;case n.DefinitionEntity:return zi;case n.FunctionDeclaration:return _i;case n.GlobalEvent:return Vn;case n.VariableInstance:return Ui;case n.VariableDeclaration:return ji;case n.InputMap:return kr;case n.OutputMap:return Zr;case n.Condition:return Li;case n.Operation:return Mi;case n.FunctionCall:return qi;case n.ReturnDeclaration:return rr;case n.ArgumentDeclaration:return Si;case n.PrimitiveEntity:return fr;case n.DataType:return wn;case n.Property:return gi;case n.ActionDescriptor:return qe;case n.ReturnStatement:return Bi;case n.ContinueStatement:return $t;case n.BreakStatement:return Cn;case n.Loop:return Ni;case n.Search:return $i;case n.ValueDescriptor:return Fi;case n.InternalCall:return gn;case n.LiteralValue:return Bn}return null}function rJ(i){const s={added:{},updated:{},removed:{},affected:[],seenEntities:[],self:i==null?void 0:i.self};return i==null||i.added.forEach(e=>{s.added[e.id]=e}),i==null||i.updated.forEach(e=>{s.updated[e.id]=e}),i==null||i.removed.forEach(e=>{s.removed[e.id]=e}),s.affected=Array.from(new Set(i==null?void 0:i.affected.map(e=>e.id))),s}function dt(i,s){const e=gs(i.type);return e?!e.MUTABLE_META_PROPERTIES.every(r=>{const a=i[r],d=s[r];return d===void 0||a===d?!0:Array.isArray(a)&&Array.isArray(d)?a.length!==d.length?!1:a.every((o,l)=>o===d[l]):!1}):!1}function Kd(i,s={}){if(i.type===n.Project)return[];if(!i.parent)return[];const e=g(i.parent);if(!e)return[];const t=s[e];return t?[t.id,...Kd(t,s)]:[]}function iJ(i,s){const e=[];if(i.parent)if(i.id===i.parent)e.push(new O({id:`${i.id}--${i.parent}--${I.SelfReference}`,code:I.SelfReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.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 t=s.get(i.parent);t?[n.Project,n.DataType].includes(t.type)||e.push(new O({id:`${i.id}--${i.parent}--${I.InvalidParentReference}`,code:I.InvalidParentReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):e.push(new O({id:`${i.id}--${i.parent}--${I.ReferencedEntityNotFound}`,code:I.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${i.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return i.implements&&Array.isArray(i.implements)?i.implements.forEach(t=>{if(i.id===t){e.push(new O({id:`${i.id}--${t}--${I.SelfReference}`,code:I.SelfReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.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 r=s.get(t);r?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(r.type)?r.abstract||e.push(new O({id:`${i.id}--${t}--${I.InvalidImplementsReference}`,code:I.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):e.push(new O({id:`${i.id}--${t}--${I.InvalidImplementsReference}`,code:I.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new O({id:`${i.id}--${t}--${I.ReferencedEntityNotFound}`,code:I.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${t}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):e.push(new O({id:`${i.id}--${j.InvalidObjectStructure}`,code:j.InvalidObjectStructure,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'implements' property that isn't an array.`,issue:null})),i.extends&&Array.isArray(i.extends)&&i.extends.forEach(t=>{const r=s.get(t);r?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(r.type)?r.abstract&&e.push(new O({id:`${i.id}--${t}--${I.InvalidExtendsReference}`,code:I.InvalidExtendsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.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})):e.push(new O({id:`${i.id}--${t}--${I.InvalidExtendsReference}`,code:I.InvalidExtendsReference,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", has an 'extends' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new O({id:`${i.id}--${t}--${I.ReferencedEntityNotFound}`,code:I.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${i.type}" with id "${i.id}", is referencing an entity with id "${t}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),e}var IP=(i=>(i.Extends="extends",i.Implements="implements",i))(IP||{});const Le=class Le extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"x");f(this,"y");f(this,"static");f(this,"abstract");f(this,"type",n.DefinitionEntity);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"implements",[]);f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"suggestedProperties",[]);f(this,"suggestedMethods",[]);this.initialData=e,this.project=t,this.id=e.id,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 r=t;if(e.parent){const c=g(e.parent);r=t.get(c)}const a=[];e.implements&&e.implements.forEach(c=>{a.push(t.get(c)||t.getBuiltIn(c))});const d=[];e.extends&&e.extends.forEach(c=>{d.push(t.get(c)||t.getBuiltIn(c))});const o={id:e.id,version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:e.name,type:n.DefinitionEntity,description:e.description,static:e.static,abstract:e.abstract,properties:[],methods:[],abstractMethods:[],extends:d,implements:a,x:0,y:0,parent:r},l=V(o,t);return l.setParent(r,null),l.initChildren(null),l}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[],d=iJ(r,t),o=gd(r,t);a.push(...d,...o,...ot(r));const l=r.parent?t.get(r.parent):null;if(l&&l.type===n.DataType){const c=l;c.entity&&a.push(new O({id:`${e.id}--${I.NewEntityWouldOverriteExisting}`,code:I.NewEntityWouldOverriteExisting,severity:D.Error,message:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${c.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
406
406
  You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
407
407
  ${qr({describe_entity:c.entity.id})}
408
- 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:r}}get allBasePropertiesFromExtendedAndImplementedEntities(){return u([...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 u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[]),...this.implements.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...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 O({id:`${this.id}--${I.InvalidParentUpdate}`,code:I.InvalidParentUpdate,severity:D.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}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){return this.implements.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=R.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Le(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.properties=this.properties,e.methods=this.methods,e.abstractMethods=this.abstractMethods,e.extends=this.extends,e.implements=this.implements,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const c=new Map;for(const[h,p]of this.knownVersions||new Map){if(c.set(h,p),p.activeVersion=!1,p.knownVersions)for(const[v,E]of p.knownVersions)c.set(v,E);p.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const c=await this.APILoadVersion({},e);if(!c)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Le(c,this.project)}return this.metaSync(o.toShallowJSON(),null),this.properties=o.properties,this.methods=o.methods,this.abstractMethods=o.abstractMethods,this.extends=o.extends,this.implements=o.implements,this.parent=o.parent,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=g(this.initialData.parent),o=this.project.get(d);o&&(this.setParent(o,null),e.push(o))}return this.initialData.extends.forEach(d=>{const o=g(d),l=this.project.get(o);l&&(this.addExtension(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),this.initialData.implements.forEach(d=>{const o=g(d),l=this.project.get(o);l&&(this.addImplementation(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];this.initialized=!0,this.captureVersion();const{updated:o,added:l,removed:c,affected:h}=this.syncImplementationProperties(e);t.push(...o),r.push(...l),a.push(...c),d.push(...h);const{updated:p,added:v,removed:E,affected:P}=this.addExtendedProperties(e);return t.push(...p),r.push(...v),a.push(...E),d.push(...P),this.addSuggestions(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){const t=[this],r=[],a=[],d=[];if(this.parent.type===n.DataType){const o=this.parent;o.entity=this,t.push(o)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}setParent(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),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(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.methods=this.initialData.methods.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.extends=this.initialData.extends.map(t=>V(t,this.project)),this.implements=this.initialData.implements.map(t=>V(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}syncImplementationProperties(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.implementedPropertiesFromOriginalParents,c=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return l.filter(p=>!c.find(E=>{var P;return((P=E.implements)==null?void 0:P.id)===p.id})).forEach(p=>{if(this.properties.find(w=>{var C;return((C=w.implements)==null?void 0:C.id)===p.id}))return;const E=this.properties.find(w=>w.name===p.name&&!!w.abstract&&!w.implements);if(E){E.implements=p,E.abstract=!1;return}const P=p.clone(e,this,R.UUID.uuid());P.initChildren(e),r.push(P),e==null||e.add(P,b.Added),P.setImplements(p,e),P.metaSync({abstract:!1},e),this.addProperty(P)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addExtendedProperties(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-extended-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.extendedPropertiesFromOriginalParents,c=l.filter(p=>l.find(E=>{var P;return((P=E.implements)==null?void 0:P.id)===p.id})?!1:!p.abstract),h=new Set(o.map(p=>p.name));return c.forEach(p=>{if(h.has(p.name))return;h.add(p.name);const v=p.clone(e,this,R.UUID.uuid());v.initChildren(e),r.push(v),e==null||e.add(v,b.Added),this.addProperty(v)}),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSuggestions(){return this.implements.forEach(e=>{B5(this,e).forEach(a=>{const d=a.toJSON();d.id=`_suggestion--parent--${this.id}--${a.id}`;const o=V(d,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),_5(this,e).forEach(a=>{const d=`_suggestion--parent--${this.id}--${a.id}`,o=a.implementAsFunctionDeclaration(d),l=V(o,this.project);if(l.suggestion=!0,l.setParent(this,null),l.initChildren(null),l.inputs.forEach(c=>{c.suggestion=!0}),l.returnStatements.length){const c=l.returnStatements[0];c.suggestion=!0,c.outputs.forEach(h=>{h.suggestion=!0})}this.addSuggestedMethod(l)})}),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),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,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await Le.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await Le.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await Le.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await Le.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await Le.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await Le.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:c,removed:h,added:p}=l.entity.onDetachedDependencyRemoved(this,l.field,t);r.push(...c),a.push(...h),d.push(...p)}),this.properties.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),this.methods.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),this.abstractMethods.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),this.suggestedProperties.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),this.suggestedMethods.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const l=this.parent.setEntity(null);r.push(l)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:u(d),updated:u(r),removed:u(a),affected:u(o),self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.properties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.methods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.abstractMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedProperties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:u(t),updated:u(r),removed:u(a),affected:u(d),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(r=>r.toFlat(e)),...this.implements.flatMap(r=>r.toFlat(e)),...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(r=>r.toFlatIds(e)),...this.implements.flatMap(r=>r.toFlatIds(e)),...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.parent.toFlatIds(e)])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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=Z){var r,a,d,o,l;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||pt(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.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:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!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(c=>c.toJSONClone({...e,newId:null})),methods:this.methods.map(c=>c.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(c=>c.toJSONClone({...e,newId:null})),implements:this.implements.map(c=>c.type===n.BuiltInBaseEntity?c.toJSON():c.toJSONClone({...e,newId:null})),extends:this.extends.map(c=>c.type===n.BuiltInBaseEntity?c.toJSON():c.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e)),...this.implements.flatMap(r=>r.toFlatJSON(e)),...this.extends.flatMap(r=>r.toFlatJSON(e)),...this.parent.toFlatJSON(e)])}toGenerationTarget(){const e=this.parent.type===n.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(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.parent.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=g5(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=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var w,C,U;let d=ft(t,this);const o=this.toJSON(),l=r||R.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const c=l.split("-id"),h=c[c.length-1||0]||l;o.id=l,o.version=R.UUID.uuid();const p=lt(o,d);t&&p.setParent(t,null),a&&p.subscribe(),p.initChildren(e),e==null||e.add(p,b.Added);const v=(w=this.properties)==null?void 0:w.map(S=>S.clone(e,p,R.UUID.uuid(),a));p.properties=v;const E=(C=this.methods)==null?void 0:C.map((S,B)=>S.clone(e,p,h+"-method-"+B+"-id",a));p.methods=E;const P=(U=this.abstractMethods)==null?void 0:U.map((S,B)=>S.clone(e,p,h+"-abstract-method-"+B+"-id",a));return p.abstractMethods=P,e==null||e.attemptAutoclose("clone-entity",this.id),p}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"implement-definition-entity")),r){const a=Sd(this,e,t,r);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),a}getAllInteractiveMethods(){const e=this.implements.filter(r=>r.type===n.DefinitionEntity||r.type===n.BuiltInBaseEntity&&r.interactive);return u([...this.methods,...this.extends.flatMap(r=>r.getAllInteractiveMethods()),...e.flatMap(r=>r.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const r=[],a=[],d=[],o=[];if(this.parent.type!==n.DataType||!this.parent.inferred)return t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[];e.forEach(p=>{l.find(E=>G(E,this.project)===G(p,this.project))||l.push(p)});const c=this.properties.filter(p=>!p.dataType);l.forEach(p=>{var U,S;const v=c.find(B=>G(B,this.project)===G(p,this.project));if(!v)return;const P=Pn(p.parent).getMasterInputWithValueWritterFromAllInstances(p),w=xr(P,t),C=w==null?void 0:w.clone(t,v,R.UUID.uuid(),!0);if(C){const B=(U=v.dataType)==null?void 0:U.merge(C,t);v.dataType&&(B==null?void 0:B.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),C.id!==((S=B==null?void 0:B.self)==null?void 0:S.id)&&C.remove({ignoreUpstream:!1},t),B!=null&&B.self&&(B.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(B.self,b.Added),v.setDataType(B.self),t==null||t.add(v,b.Updated))}p.setDeclaration(v),t==null||t.add(p,b.Updated)});const h=[];return l.forEach(p=>{if(!p.declaration){h.push(p);return}}),h.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(h.forEach(p=>{var B,$,k,W;const v=this.properties.find(ee=>G(ee,this.project)===G(p,this.project));if(v){if(p.setDeclaration(v),!v.getDataType(t)){const ce=Pn(p.parent).getMasterInputWithValueWritterFromAllInstances(p),Te=xr(ce),Q=Te==null?void 0:Te.clone(t,v,R.UUID.uuid(),!0);if(Q){const se=(B=v.dataType)==null?void 0:B.merge(Q,t);v.dataType&&(se==null?void 0:se.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),Q.id!==(($=se==null?void 0:se.self)==null?void 0:$.id)&&Q.remove({ignoreUpstream:!1},t),se!=null&&se.self&&(se.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(se.self,b.Added),v.setDataType(se.self),t==null||t.add(v,b.Updated))}}return}const E={id:R.UUID.uuid(),type:n.Property,version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:G(p,this.project),description:p.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:p.index,implements:null,dataType:null,parent:this.toReference()},P=V(E,this.project);P.setParent(this,t),P.initChildren(t),t==null||t.add(P,b.Added);const C=Pn(p.parent).getMasterInputWithValueWritterFromAllInstances(p),U=xr(C),S=U==null?void 0:U.clone(t,P,R.UUID.uuid(),!0);if(S){const ee=(k=P.dataType)==null?void 0:k.merge(S,t);P.dataType&&(ee==null?void 0:ee.self.id)!==P.dataType.id&&P.dataType.remove({ignoreUpstream:!1},t),S.id!==((W=ee==null?void 0:ee.self)==null?void 0:W.id)&&S.remove({ignoreUpstream:!1},t),ee!=null&&ee.self&&(ee.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(ee.self,b.Added),P.setDataType(ee.self),t==null||t.add(P,b.Updated))}return this.addProperty(P),p.setDeclaration(P),t==null||t.add(p,b.Updated),P}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:u(r),updated:u(a),removed:u(d),affected:u(o),self:this})}};f(Le,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(Le,"type",n.DefinitionEntity),f(Le,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),f(Le,"PARENT_TYPES",[...Le.USER_MANAGED_PARENT_TYPES]),f(Le,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),f(Le,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(Le,"BASE_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"MUTABLE_META_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,"x","y"]),f(Le,"INMUTABLE_META_PROPERTIES",[...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"META_PROPERTIES",[...Le.MUTABLE_META_PROPERTIES,...Le.INMUTABLE_META_PROPERTIES]),f(Le,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),f(Le,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(Le,"UPSTREAM_PROPERTIES",[...Le.MUTABLE_UPSTREAM_PROPERTIES,...Le.INMUTABLE_UPSTREAM_PROPERTIES]),f(Le,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),f(Le,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(Le,"DOWNSTREAM_PROPERTIES",[...Le.MUTABLE_DOWNSTREAM_PROPERTIES,...Le.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(Le,"PROPERTIES",[...Le.META_PROPERTIES,...Le.UPSTREAM_PROPERTIES,...Le.DOWNSTREAM_PROPERTIES]);let zi=Le;function nJ(i){const s=d6(),e=i.toJSON();s.safeParse(e).success;const r=[];return Ye(i.errors,r)}const Ns=class Ns extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"version");f(this,"name");f(this,"description",null);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",!1);f(this,"static");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"interactive",!1);f(this,"errors",[]);f(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(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.extends=this.initialData.extends.map(r=>V(r,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...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 APILoad(e=L,...t){return await Ns.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.extends.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.extends.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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=Z){return{id:this.id+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.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(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.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=nJ(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=this.project.addChangeSet(new A(this.project,"",T().toISOString(),null,!0,"implement-built-in-base-entity")),r){const a=Sd(this,e,t,r);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),a}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Ns&&e.push(...r.getAllInteractiveMethods())})),u(e)}};f(Ns,"repository",{APILoad:async(e,...t)=>null});let Yr=Ns;function aJ(i){const s=Q9(),e=i.toJSON();s.safeParse(e).success;const r=[];return Ye(i.errors,r)}const Qd=class Qd extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"type",n.PrimitiveEntity);f(this,"static");f(this,"abstract");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=V(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=V(r,this.project);return a.parent=this,a})}get allBasePropertiesFromExtendedAndImplementedEntities(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...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 APILoad(e=L,...t){return await Qd.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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=Z){return{id:this.id+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.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(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.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=aJ(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(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Yr&&e.push(...r.getAllInteractiveMethods())}),u(e)}};f(Qd,"repository",{APILoad:async(e,...t)=>null});let fr=Qd;function lt(i,s){if(!i)throw new Error("Entity is null");const e=s.get(i.id);switch(i.type){case n.LiteralValue:return e||new Bn(i,s);case n.DefinitionEntity:return e||new zi(i,s);case n.PrimitiveEntity:return e||new fr(i,s);case n.FunctionDeclaration:return e||new _i(i,s);case n.GlobalEvent:return e||new Vn(i,s);case n.DataType:return e||new wn(i,s);case n.Property:return e||new gi(i,s);case n.FunctionCall:return e||new qi(i,s);case n.Condition:return e||new Li(i,s);case n.Operation:return e||new Mi(i,s);case n.VariableDeclaration:return e||new ji(i,s);case n.VariableInstance:return e||new Ui(i,s);case n.OutputMap:return e||new Zr(i,s);case n.ReturnDeclaration:return e||new rr(i,s);case n.ArgumentDeclaration:return e||new Si(i,s);case n.InputMap:return e||new kr(i,s);case n.Project:return e||new R(i);case n.InstalledProject:return e||new Gi(i,s);case n.ActionDescriptor:return e||new qe(i,s);case n.ReturnStatement:return e||new Bi(i,s);case n.Loop:return e||new Ni(i,s);case n.Search:return e||new $i(i,s);case n.ValueDescriptor:return e||new Fi(i,s);case n.BuiltInBaseEntity:return e||new Yr(i,s);case n.InternalCall:return e||new gn(i,s);case n.ContinueStatement:return e||new $t(i,s);case n.BreakStatement:return e||new Cn(i,s);case n.GenericReference:return s.get(i.entityId);default:throw new Error("Invalid entity type: "+i.type)}}function V(i,s){if(!i)throw new Error("Entity is null");const e=lt(i,s);return e.subscribe(),e}function sJ(i,s){if(!i)throw new Error("Entity is null");switch(i.type){case n.LiteralValue:return Bn.fromGenerationTarget(i,s);case n.DefinitionEntity:return zi.fromGenerationTarget(i,s);case n.FunctionDeclaration:return _i.fromGenerationTarget(i,s);case n.GlobalEvent:return Vn.fromGenerationTarget(i,s);case n.DataType:return wn.fromGenerationTarget(i,s);case n.Property:return gi.fromGenerationTarget(i,s);case n.FunctionCall:return qi.fromGenerationTarget(i,s);case n.Condition:return Li.fromGenerationTarget(i,s);case n.Operation:return Mi.fromGenerationTarget(i,s);case n.VariableDeclaration:return ji.fromGenerationTarget(i,s);case n.VariableInstance:return Ui.fromGenerationTarget(i,s);case n.OutputMap:return Zr.fromGenerationTarget(i,s);case n.ReturnDeclaration:return rr.fromGenerationTarget(i,s);case n.ArgumentDeclaration:return Si.fromGenerationTarget(i,s);case n.InputMap:return kr.fromGenerationTarget(i,s);case n.InstalledProject:return Gi.fromGenerationTarget(i,s);case n.ReturnStatement:return Bi.fromGenerationTarget(i,s);case n.Loop:return Ni.fromGenerationTarget(i,s);case n.Search:return $i.fromGenerationTarget(i,s);case n.ActionDescriptor:return qe.fromGenerationTarget(i,s);case n.ValueDescriptor:return Fi.fromGenerationTarget(i,s);case n.InternalCall:return gn.fromGenerationTarget(i,s);case n.ContinueStatement:return $t.fromGenerationTarget(i,s);case n.BreakStatement:return Cn.fromGenerationTarget(i,s);default:throw new Error("Invalid entity type: "+i.type)}}const Z={seenEntityMaps:new Map,seenEntities:new Set};class bP{constructor(){f(this,"initialData")}}const L={cascade:!1},RP={APILoad:async(i,...s)=>null},oJ={APICreate:async(i,...s)=>i,APIUpdate:async(i,...s)=>i,APIDelete:async(i,...s)=>i,APIClone:async(i,...s)=>{},APILoadVersion:async(i,s,...e)=>null,...RP};class dJ{}class lJ extends bP{}class uJ{}class cJ{}class pJ{}class qp{}class fJ extends qp{}class yJ extends qp{}class hJ{}class yi{static initReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=V(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),s.readsValue.initChildren(null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}static hydrateReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=V(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}}class Ms{static initWritesValues(s,e){const t=s.initialData.writesValues.reduce((a,d)=>{if(d.type===n.GenericReference||s.writesValues.some(l=>l.id===d.id))return a;const o=V(d,s.project);return o.setValueWriter(s),Qe.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...a,o]},[]),r=[...s.writesValues];return s.writesValues=u([...r,...t]),s.writesValues}}class mJ{}const de=class de extends rt{constructor(e){super(e);f(this,"initialData");f(this,"id");f(this,"type",n.Project);f(this,"name",null);f(this,"description",null);f(this,"x");f(this,"y");f(this,"entities",[]);f(this,"projects",[]);f(this,"functions",[]);f(this,"events",[]);f(this,"variableDeclarations",[]);f(this,"variableInstances",[]);f(this,"conditions",[]);f(this,"operations",[]);f(this,"functionCalls",[]);f(this,"loops",[]);f(this,"searches",[]);f(this,"primitives",[]);f(this,"builtInBaseEntities",[]);f(this,"operationDeclarations",[]);f(this,"globalEventActionDescriptors",[]);f(this,"loopDeclarations",[]);f(this,"loopDeclarationsBodies",[]);f(this,"conditionDeclarations",[]);f(this,"valueDescriptors",[]);f(this,"dataTypes",[]);f(this,"project");f(this,"instances",{});f(this,"builtInInstances",{});f(this,"deletedInstances",{});f(this,"errors",[]);f(this,"references",[]);f(this,"history",[]);f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"onCloseChangeSetCallback",null);this.initialData=e,this.id=e.id,this.name=e.name,this.description=e.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!de.UUID||de.UUID.isBackup)&&(de.UUID=Lo==null?void 0:Lo()),de.UUID||(de.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),de.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:r=>r}}}static injectUUIDModule(e){de.UUID=e}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[];return a.push(...ot(r)),{errors:a,modifiedData:r}}onCloseChangeSet(e){this.onCloseChangeSetCallback=e}closeChangeSet(e){this.onCloseChangeSetCallback&&this.onCloseChangeSetCallback(e)}addChangeSet(e){if(!this.history.length)return this.history.push(e),e;const t=this.history.find(a=>a.id===(e==null?void 0:e.id));if(t)return t;const r=this.history.findIndex(a=>T(a.timestamp).isBefore(T(e==null?void 0:e.timestamp)));return r===-1?this.history.push(e):this.history.splice(r,0,e),e}discardChangeSet(e){const t=this.history.findIndex(r=>r.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}undo(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}redo(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async r=>{await t.init(this),r(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){return this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=de.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new de(this);return(r=this.knownVersions)==null||r.set(this.version,e),e.entities=this.entities,e.projects=this.projects,e.functions=this.functions,e.events=this.events,e.variableDeclarations=this.variableDeclarations,e.variableInstances=this.variableInstances,e.conditions=this.conditions,e.operations=this.operations,e.functionCalls=this.functionCalls,e.loops=this.loops,e.searches=this.searches,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const c=new Map;for(const[h,p]of this.knownVersions||new Map){if(c.set(h,p),p.activeVersion=!1,p.knownVersions)for(const[v,E]of p.knownVersions)c.set(v,E);p.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const c=await this.APILoadVersion({},e);if(!c)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new de(c)}return this.metaSync(o.toShallowJSON(),null),this.entities=o.entities,this.projects=o.projects,this.functions=o.functions,this.events=o.events,this.variableDeclarations=o.variableDeclarations,this.variableInstances=o.variableInstances,this.conditions=o.conditions,this.operations=o.operations,this.functionCalls=o.functionCalls,this.loops=o.loops,this.searches=o.searches,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=null){const t=[],r=[],a=[],d=[];return this.initialized=!0,this.captureVersion(),this.validate(),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e){const t=[],r=[],a=[],d=[];return this.subscribe(),this.subscribeToDependencies(),{updated:u(t),added:u(r),removed:u(a),affected:u(d),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(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.projects=this.initialData.projects.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableInstances=this.initialData.variableInstances.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.conditions=this.initialData.conditions.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.operations=this.initialData.operations.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functions=this.initialData.functions.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.events=this.initialData.events.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functionCalls=this.initialData.functionCalls.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.loops=this.initialData.loops.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.searches=this.initialData.searches.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeDeletedInstance(e){return(!this.deletedInstances[e.id]||this.deletedInstances[e.id]!==e)&&(this.deletedInstances[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}unsubscribeDeletedInstance(e){return delete this.deletedInstances[e.id],this}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getDeleted(e){return this.deletedInstances[e]||null}getManaged(e){return this.getBuiltIn(e)?null: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}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.description=e.description||this.description,this.x=e.x||this.x,this.y=e.y||this.y,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await de.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await de.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await de.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await de.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await de.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await de.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],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,...this.entities.flatMap(r=>r.toFlat(e)),...this.functions.flatMap(r=>r.toFlat(e)),...this.events.flatMap(r=>r.toFlat(e)),...this.projects.flatMap(r=>r.toFlat(e)),...this.variableDeclarations.flatMap(r=>r.toFlat(e)),...this.variableInstances.flatMap(r=>r.toFlat(e)),...this.conditions.flatMap(r=>r.toFlat(e)),...this.operations.flatMap(r=>r.toFlat(e)),...this.functionCalls.flatMap(r=>r.toFlat(e)),...this.loops.flatMap(r=>r.toFlat(e)),...this.searches.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(r=>r.toFlatIds(e)),...this.functions.flatMap(r=>r.toFlatIds(e)),...this.events.flatMap(r=>r.toFlatIds(e)),...this.projects.flatMap(r=>r.toFlatIds(e)),...this.variableDeclarations.flatMap(r=>r.toFlatIds(e)),...this.variableInstances.flatMap(r=>r.toFlatIds(e)),...this.conditions.flatMap(r=>r.toFlatIds(e)),...this.operations.flatMap(r=>r.toFlatIds(e)),...this.functionCalls.flatMap(r=>r.toFlatIds(e)),...this.loops.flatMap(r=>r.toFlatIds(e)),...this.searches.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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,r=new Set,a=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(d=>{if(a.includes(d)){t.set(d,d);return}t.set(d,de.UUID.uuid())}),r.add(this.id),{id:t.get(this.id),version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),projects:this.projects.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableDeclarations:this.variableDeclarations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableInstances:this.variableInstances.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),conditions:this.conditions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),operations:this.operations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functions:this.functions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),events:this.events.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functionCalls:this.functionCalls.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),loops:this.loops.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),searches:this.searches.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null}))}}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+de.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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.toShallowJSON(),...this.entities.flatMap(r=>r.toFlatJSON(e)),...this.functions.flatMap(r=>r.toFlatJSON(e)),...this.events.flatMap(r=>r.toFlatJSON(e)),...this.projects.flatMap(r=>r.toFlatJSON(e)),...this.variableDeclarations.flatMap(r=>r.toFlatJSON(e)),...this.variableInstances.flatMap(r=>r.toFlatJSON(e)),...this.conditions.flatMap(r=>r.toFlatJSON(e)),...this.operations.flatMap(r=>r.toFlatJSON(e)),...this.functionCalls.flatMap(r=>r.toFlatJSON(e)),...this.loops.flatMap(r=>r.toFlatJSON(e)),...this.searches.flatMap(r=>r.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(r=>r.toFlatGenerationTarget(e)),...this.functions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.events.flatMap(r=>r.toFlatGenerationTarget(e)),...this.projects.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(r=>r.toFlatGenerationTarget(e)),...this.conditions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.operations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.loops.flatMap(r=>r.toFlatGenerationTarget(e)),...this.searches.flatMap(r=>r.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=D5(),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=V(e,this);return this.addDefinitionEntity(t),t}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=V(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=V(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=V(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=V(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=V(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=V(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=V(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=V(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=V(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=V(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(r=>r.id===e.id);if(t>-1){const r=this.entities[t];return this.entities.splice(t,1),r}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(r=>r.id===e.id);if(t>-1){const r=this.functions[t];return this.functions.splice(t,1),r}return null}removeExternalProject(e){const t=this.projects.findIndex(r=>r.id===e.id);if(t>-1){const r=this.projects[t];return this.projects.splice(t,1),r}return null}removeGlobalEvent(e){const t=this.events.findIndex(r=>r.id===e.id);if(t>-1){const r=this.events[t];return this.events.splice(t,1),r}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(r=>r.id===e.id);if(t>-1){const r=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),r}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,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.functionCalls.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.conditions.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.operations.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.loops.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.searches.reduce((t,r)=>{const a=We(r);return[...t,...a]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[])]}getVariableDeclarations(){return u([...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(r=>{if(!r.declaration){const a=r.initialData,d=a.declaration.entityId||a.declaration.id,o=t.find(l=>l.id===d);o&&r.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===z.PERSISTED_ENTITY)||null}};f(de,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),f(de,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(de,"type",n.Project),f(de,"USER_MANAGED_PARENT_TYPES",[]),f(de,"PARENT_TYPES",[...de.USER_MANAGED_PARENT_TYPES]),f(de,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(de,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(de,"BASE_PROPERTIES",[...de.MUTABLE_BASE_PROPERTIES,...de.INMUTABLE_BASE_PROPERTIES]),f(de,"MUTABLE_META_PROPERTIES",[...de.MUTABLE_BASE_PROPERTIES,"x","y"]),f(de,"INMUTABLE_META_PROPERTIES",[...de.INMUTABLE_BASE_PROPERTIES]),f(de,"META_PROPERTIES",[...de.MUTABLE_META_PROPERTIES,...de.INMUTABLE_META_PROPERTIES]),f(de,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(de,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),f(de,"UPSTREAM_PROPERTIES",[...de.MUTABLE_UPSTREAM_PROPERTIES,...de.INMUTABLE_UPSTREAM_PROPERTIES]),f(de,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),f(de,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(de,"DOWNSTREAM_PROPERTIES",[...de.MUTABLE_DOWNSTREAM_PROPERTIES,...de.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(de,"PROPERTIES",[...de.META_PROPERTIES,...de.UPSTREAM_PROPERTIES,...de.DOWNSTREAM_PROPERTIES]);let R=de;var AP=(i=>(i.PersistChangeSet="persist-change-set",i.CreateSingle="create-single",i.CreateBulk="create-bulk",i.CreateSingleNested="create-single-nested",i.CreateBulkNested="create-bulk-nested",i.Update="update",i.Clone="clone",i.Delete="delete",i.Load="load",i.LoadNested="load-nested",i.LoadVersion="load-version",i))(AP||{});class DP extends qe{constructor(e){super(Rr,e);f(this,"id",He.Parallel);f(this,"name",He.Parallel);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",Rr);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=Rr.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=Rr.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=Rr.error?V(Rr.error,this.project):null}}class OP extends qe{constructor(e){super(St,e);f(this,"id",St.id);f(this,"name",St.name);f(this,"description",St.description);f(this,"version",St.version);f(this,"autoexecutable",!1);f(this,"initialData",St);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=St.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=St.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=St.error?V(St.error,this.project):null}}class PP extends qe{constructor(e){super(ti,e);f(this,"id",He.Sequential);f(this,"name",He.Sequential);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",ti);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=ti.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=ti.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=ti.error?V(ti.error,this.project):null}}class vJ extends qe{constructor(s){super(wa,s)}}class TJ extends qe{constructor(s){super(Xi,s)}}class EJ extends qe{constructor(e){super(Qi,e);f(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"get-entity-to-match-validate-data"))){let r=null;if(e.readsValue){const d=e.readsValue.getDataType(t);d&&d.entity&&d.entity.type===n.DefinitionEntity&&(r=d.entity)}const a=e.getDefaultValue();return!r&&a&&a.valueAsTypeSingle&&!Array.isArray(a.valueAsTypeSingle)&&a.valueAsTypeSingle.type===n.DefinitionEntity&&(r=a.valueAsTypeSingle),r}syncOperationInstance(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const r=[],a=[],d=[],o=[],l=this.getEntityToMatchInputMap(e);if(l){const{added:p,updated:v,removed:E,affected:P}=this.syncEntityToMatchInputMapDataType(l,t);r.push(...v),a.push(...p),d.push(...E),o.push(...P)}const c=this.getDataToValidateInputMap(e);if(c){const{added:p,updated:v,removed:E,affected:P}=this.syncDataToValidateInputMapDataType(c,t);r.push(...v),a.push(...p),d.push(...E),o.push(...P)}const h=this.getOutputDataOutputMap(e);if(h){const{added:p,updated:v,removed:E,affected:P}=this.syncOutputDataOutputMapDataType(h,t);r.push(...v),a.push(...p),d.push(...E),o.push(...P)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:u(r),added:u(a),removed:u(d),affected:u(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var c,h,p;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==F.operation[Ke.Validate].inputs.entityToMatch.id)return t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const v={id:R.UUID.uuid(),version:"1",createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,like:!0,inferred:!0,parent:e.toReference()},E=V(v,e.project);E.setParent(e,t),E.initChildren(t),t==null||t.add(E,b.Added),r.push(E),e.setDataType(E)}(h=e.dataType)==null||h.metaSync({inferred:!0,like:!1,asType:!0},t);const l=this.getEntityToMatch(e,t);return(p=e.dataType)==null||p.setEntity(l),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var p,v,E;const r=[],a=[],d=[],o=[];if(((p=e.declaration)==null?void 0:p.id)!==F.operation[Ke.Validate].inputs.dataToValidate.id)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const P={id:R.UUID.uuid(),version:"1",createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=V(P,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,b.Added),r.push(w),e.setDataType(w)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var p,v,E;const r=[],a=[],d=[],o=[];if(((p=e.declaration)==null?void 0:p.id)!==F.operation[Ke.Validate].outputs.outputEntity.id)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const P={id:R.UUID.uuid(),version:"1",createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=V(P,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,b.Added),r.push(w),e.setDataType(w)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var r,a;if(((r=e.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].inputs.entityToMatch.id){const{added:d,updated:o,removed:l,affected:c}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:u(o),added:u(d),removed:u(l),affected:u(c),self:e.dataType}}else if(((a=e.declaration)==null?void 0:a.id)===F.operation[Ke.Validate].inputs.dataToValidate.id){const{added:d,updated:o,removed:l,affected:c}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:u(o),added:u(d),removed:u(l),affected:u(c),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var r;if(((r=e.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].outputs.outputEntity.id){const{added:a,updated:d,removed:o,affected:l}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:u(d),added:u(a),removed:u(o),affected:u(l),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class IJ extends qe{constructor(s){super(ul,s)}}class bJ extends qe{constructor(s){super(pl,s)}}class RJ extends qe{constructor(s){super(fl,s)}}class AJ extends qe{constructor(s){super(ks,s)}}class DJ extends qe{constructor(s){super(Ss,s)}}class OJ extends qe{constructor(s){super(Pa,s)}}function PJ(i){const s=[new PP(i),new DP(i),new OP(i),new vJ(i),new TJ(i),new EJ(i),new AJ(i),new IJ(i),new RJ(i),new bJ(i),new DJ(i),new OJ(i),new qe(ll,i),new qe(dl,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}class wP extends Yr{constructor(e){super(Ot,e);f(this,"initialData");f(this,"id",z.PERSISTED_ENTITY);f(this,"version","1");f(this,"name",z.PERSISTED_ENTITY);f(this,"description",Ot.description);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",Ot.abstract);f(this,"static",Ot.static);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=Ot,this.project=e,this.id=Ot.id,this.version=Ot.version,this.name=Ot.name,this.static=Ot.static,this.abstract=Ot.abstract,this.properties=this.initialData.properties.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.methods=this.initialData.methods.map(t=>{const r=V(t,this.project);return r.parent=this,r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=V(t,this.project);return r.parent=this,r}),this.extends=this.initialData.extends.map(t=>V(t,this.project))}}function wJ(i){const s=[new wP(i),new Yr(Ma,i),new Yr(Mr,i),new Yr(so,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.builtInBaseEntities=s,s}function VJ(i){const s=[new fr(ne,i),new fr(Kr,i),new fr(me,i),new fr(At,i),new fr(Xr,i),new fr(gr,i),new fr(Qr,i),new fr($n,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.primitives=s,s}function CJ(i){const s=[new qe(lo,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.globalEventActionDescriptors=s,s}function gJ(i){const s=[new qe(Ba,i),new qe(mi,i),new qe(Ca,i),new qe(Fn,i),new qe(xn,i),new qe(Ks,i)];s.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarations=s;const e=[new qe(to,i),new qe(ga,i),new qe(Qs,i),new qe(Pl,i),new qe(Vl,i),new qe(Xs,i)];return e.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarationsBodies=e,s}function BJ(i){const s=[new Fi(uo,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.valueDescriptors=s,s}function _J(i){const s=[new qe(an,i),new qe(Wn,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}const Mn={},Xd={};async function MJ(i,s={}){const e={...kA};return e.id=i.id,s.empty?{data:{id:i.id,type:n.Project,version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]}}:{data:e}}function Jp(i){const s=new R(i);return VJ(s),wJ(s),PJ(s),CJ(s),gJ(s),BJ(s),_J(s),Array.from(new Set([...s.getAllBuiltInIds(),...Wr()])).forEach(t=>{!s.builtInInstances[t]&&s.instances[t]&&(s.builtInInstances[t]=s.instances[t],delete s.instances[t])}),s}function NJ(i,{enrich:s}={enrich:!0}){const e=new Map,t=Array.from(new Set([...i.getAllBuiltInIds(),...Wr()]));Object.keys(i.instances).forEach(l=>{if(t.includes(l)){e.set(l,l);return}const c=i.get(l);if(!Kd(c,{...i.instances,...i.builtInInstances}).every(v=>!t.includes(v))){e.set(l,l);return}e.set(l,R.UUID.uuid())});const r=i.toShallowJSON({seenEntityMaps:e});r.previousVersion=null;const a=Jp(r),d=s?a.addChangeSet(new A(a,"",T().toISOString(),a)):null,o=new gp(i);return o.visit(l=>{const c=l.toShallowJSON({seenEntityMaps:e});c.previousVersion=null;const h=V(c,a);h.hydrateAncestors(),h.addSelfToProject(d),d==null||d.add(h,b.Added)}),s&&(o.visit(l=>{const c=a.get(e.get(l.id));c&&c.afterAllChildrenInitialized(d)}),a.afterAllChildrenInitialized(d)),d==null||d.close(),a}function VP(i,{enrich:s}={enrich:!0}){const e=Jp(i),t=s?e.addChangeSet(new A(e,"",T().toISOString(),e)):null;t&&(t.type=hp.Automatic);const r=new gp(i);return r.visit(a=>{const d=V(a,e);d.hydrateAncestors(),d.addSelfToProject(t)}),s&&(r.visit(a=>{const d=e.get(a.id);d&&d.afterAllChildrenInitialized(t)}),e.afterAllChildrenInitialized(t)),t==null||t.close(),e}async function LJ(i,s={}){if(i.id&&Mn[i.id])return Mn[i.id];if(i.id&&Xd[i.id])return await Xd[i.id],Mn[i.id];const e=MJ(i,s);i.id&&(Xd[i.id]=e);const t=await e;if(t.data){const r=VP(t.data);return Mn[i.id]=r,i.id&&delete Xd[i.id],r}return null}function UJ(i){return Mn[i.id]&&delete Mn[i.id],null}const jJ="test_primitive_entities_export";y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Pp,y.ALL_BUILT_IN_BASE_ENTITIES=VE,y.ALL_BUILT_IN_CONDITION_ENTITIES=xE,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=ZE,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=nT,y.ALL_BUILT_IN_LOOP_ENTITIES=iT,y.ALL_BUILT_IN_OPERATION_ENTITIES=h0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=sf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=YE,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=WE,y.ActionDescriptorState=qe,y.ActionInputMapState=dq,y.ActionOutputMapState=cq,y.AppendToListOperationInputIds=yh,y.AppendToListOperationOutputIds=hh,y.ArgumentDeclarationDependencyField=eO,y.ArgumentDeclarationState=Si,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Rp,y.BUILT_IN_BASE_ENTITY_IDS=F,y.BUILT_IN_ENTITY_TYPES=hr,y.BaseCanvasDraggableState=uJ,y.BaseEntityNames=z,y.BaseState=lJ,y.BaseValueDescriptorIds=Gs,y.BreakStatementDependencyField=vp,y.BreakStatementState=Cn,y.BuiltInBaseEntityState=Yr,y.CACHED_PROJECTS_BY_ID=Mn,y.CALLABLE_ENTITIES_EXPLANATION=Eq,y.CALLABLE_TYPES=Vr,y.CALLER_ENTITIES_EXPLANATION=aO,y.CALLER_TYPES=Cr,y.CALLS_UPDATE_EXPLANATION=ki,y.COMPARISON_CONDITIONS=SE,y.CONDITIONS=FE,y.CUSTOM_ENTITY_OPERATIONS=Mm,y.CallableEntityClass=pJ,y.CallerEntityClass=qp,y.ChangeSet=A,y.ChangeSetChangeCaptureType=hp,y.ChangeSetEntityChangeType=b,y.ChildEntityState=cJ,y.ComparisonOperatorTypes=ct,y.ConditionDependencyField=Y1,y.ConditionState=Li,y.ContinueStatementDependencyField=mp,y.ContinueStatementState=$t,y.CreateNewInputIds=om,y.CreateNewOutputIds=dm,y.DRAGGABLE_CALLABLE_TYPES=rl,y.DRAGGABLE_CALLER_TYPES=Hp,y.DRAGGABLE_ELEMENT_TYPES=$s,y.DRAGGABLE_EXECUTABLE_TYPES=MP,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=js,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=tl,y.DataTypeCompatibilityTypes=Er,y.DataTypeDependencyField=Z1,y.DataTypeParentChildRelation=Rt,y.DataTypeState=wn,y.DefinitionEntityDependencyField=IP,y.DefinitionEntityState=zi,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=oJ,y.ENTITIES_WITH_VALLUES_EXPLANATION=Ld,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=L,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=Z,y.ENTITY_TYPES=NP,y.ENTITY_WITH_DECLARATION_TYPES=BP,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=mt,y.ENTITY_WITH_NAMES_TYPES=Kp,y.ENTITY_WITH_PARENT_TYPES=CP,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Yp,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=gP,y.ENTITY_WITH_VALUE_TYPES=Wp,y.ENTRY_POINT_ENTITIES_EXPLANATION=Ps,y.ENTRY_POINT_TYPES=at,y.EVENT_TYPES=jn,y.EXECUTABLE_TYPES=_P,y.EXECUTION_OPERATIONS=sm,y.EntityAction=AP,y.EntityError=hn,y.EntityErrorSeverity=D,y.EntityGenerationError=O,y.EntityGenerationErrorCode=I,y.EntityInstanceErrorCode=q,y.EntityOperations=Ke,y.EntityType=n,y.EntityWithLogicScopeClass=mJ,y.EntityWithValueClass=hJ,y.EntryPointEntityClass=fJ,y.ExecutionOperations=He,y.ExecutionTerminationType=J1,y.FunctionCallDependencyField=hO,y.FunctionCallState=qi,y.FunctionDeclarationDependencyField=k1,y.FunctionDeclarationState=_i,y.GLOBAL_EVENT_DECLARATIONS=kE,y.GetLastInListOperationInputIds=rh,y.GetLastInListOperationOutputIds=ih,y.GlobalEventNames=Hr,y.GlobalEventState=Vn,y.HTTPOperations=Ct,y.HTTP_OPERATIONS=f0,y.InputMapDependencyField=X1,y.InputMapState=kr,y.InstalledProjectState=Gi,y.InternalCallDependencyField=K1,y.InternalCallState=gn,y.JoinListOperationInputIds=Ry,y.JoinListOperationOutputIds=Ay,y.LIST_OPERATIONS=Vh,y.ListOperations=fe,y.LiteralValueDependencyField=tO,y.LiteralValueState=Bn,y.LoopDependencyField=W1,y.LoopState=Ni,y.LoopTypes=K,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Zi,y.NUMBER_OPERATIONS=Uf,y.NumberOperations=Xe,y.OPERATION_DECLARATIONS=y0,y.OperationDependencyField=q1,y.OperationState=Mi,y.OutputMapDependencyField=Q1,y.OutputMapParentChildRelation=Un,y.OutputMapState=Zr,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Ud,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=xi,y.PASS_THROUGH_CALLABLE_TYPES=nt,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=zp,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=Op,y.ParallelExecutionOperation=DP,y.PassThroughCallableEntityClass=yJ,y.PersistedEntity=wP,y.PersistedEntityMethods=sr,y.PrimitiveEntityState=fr,y.PrimitiveTypes=M,y.ProjectState=R,y.PropertyDependencyField=F1,y.PropertyState=gi,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=RP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Iq,y.ReturnDeclarationDependencyField=x1,y.ReturnDeclarationState=rr,y.ReturnStatementDependencyField=Bd,y.ReturnStatementState=Bi,y.STANDALONE_CONDITIONS=BE,y.STRING_OPERATIONS=by,y.ScopeCompatibilityType=Hd,y.SearchDependencyField=H1,y.SearchState=$i,y.SequentialExecutionOperation=PP,y.SequentialExecutionOperationInputIds=Wh,y.SequentialExecutionOperationOutputIds=Yh,y.SharedEntityErrorCode=j,y.SharedStateFunctionality=bP,y.SplitListOperationInputIds=$y,y.SplitListOperationOutputIds=Gy,y.StandaloneOperatorTypes=yr,y.StringOperations=Ee,y.TERMINATION_TYPES=st,y.Traverser=gp,y.USER_MANAGED_ENTITY_TYPES=Xp,y.UserManagedEntityStateTemplate=dJ,y.VALUE_READING_ENTITIES_EXPLANATION=Dp,y.VALUE_READING_TYPES=hi,y.VALUE_WRITING_ENTITIES_EXPLANATION=sO,y.VALUE_WRITING_TYPES=ht,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Ap,y.VARIABLE_TYPES=Qe,y.ValueAutogenerationType=yt,y.ValueDescriptorDependencyField=rO,y.ValueDescriptorParentChildRelation=_,y.ValueDescriptorState=Fi,y.ValueReadingEntityClass=yi,y.ValueWritingEntityClass=Ms,y.VariableDeclarationDependencyField=z1,y.VariableDeclarationState=ji,y.VariableInputMapState=oq,y.VariableInstanceDependencyField=Tp,y.VariableInstanceState=Ui,y.VariableOutputMapState=uq,y.WaitOperation=OP,y.WaitOperationInputIds=Sh,y.WaitOperationOutputIds=Fh,y.appendToListOperation=ks,y.appendToListOperationElementToAppendArgument=hl,y.appendToListOperationElementToAppendArgumentParentRef=Ah,y.appendToListOperationElementToAppendArgumentRef=Th,y.appendToListOperationError=wh,y.appendToListOperationErrorParentRef=Ph,y.appendToListOperationListArgument=yl,y.appendToListOperationListArgumentParentRef=Rh,y.appendToListOperationListArgumentRef=mh,y.appendToListOperationListDataType=vh,y.appendToListOperationResultListDataType=bh,y.appendToListOperationResultListReturn=Oh,y.appendToListOperationResultListReturnParentRef=Dh,y.appendToListOperationResultListReturnRef=Ih,y.appendToListOperationSecondListDataType=Eh,y.asGenerationActionExample=qr,y.booleanPrototype=Kr,y.capitalizeFirstLetter=Wt,y.changeSetJSONRecordToUniqueIds=$7,y.checkAreDataTypesCompatible=Ir,y.checkAreDefinitionEntitiesCompatibleAsDataType=V1,y.checkArePropertiesCompatibleAsDataType=w1,y.checkHasMetadataChanged=dt,y.checkIsBranchDependentButNotDirectlyOnBranch=Vs,y.checkIsBranchDependentOnBranch=Cq,y.checkIsCallableEntityReachable=_s,y.checkIsCanvasEntity=Yq,y.checkIsDetachedBranch=yP,y.checkIsDetachedBranchShallow=kp,y.checkIsGlobalVariable=qq,y.checkIsGloballyDeclared=xp,y.checkIsMethod=vP,y.checkIsNestedScope=zd,y.checkScopeCompatibility=Bs,y.cloneProject=NJ,y.countedLoopActionDescriptor=Ba,y.countedLoopActionDescriptorDynamicReturnDeclaration=zv,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=Yv,y.countedLoopActionDescriptorStringArgumentDeclaration=Wv,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=qv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=kv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=xv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=Zv,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=Jv,y.countedLoopBodyActionDescriptor=to,y.countedLoopBodyActionDescriptorAnyDynamicArgument=eT,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Qv,y.countedLoopBodyActionDescriptorAnyDynamicReturn=rT,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=tT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=gl,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Kv,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Hv,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Xv,y.createDefinitionEntityFromJSONObject=Fd,y.createEntityError=ye,y.createNestedDataTypeForEntity=TO,y.createNewInstanceOperation=Xi,y.createNewInstanceOperationEntityToInstanciateArgument=mm,y.createNewInstanceOperationEntityToInstanciateArgumentRef=fm,y.createNewInstanceOperationEntityToInstanciateDataType=ym,y.createNewInstanceOperationError=Im,y.createNewInstanceOperationErrorParentRef=Em,y.createNewInstanceOperationNewEntityDataArgument=pm,y.createNewInstanceOperationNewEntityDataArgumentDataType=cm,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=um,y.createNewInstanceOperationNewEntityDataArgumentParentRef=lm,y.createNewInstanceOperationOutputEntityDeclaration=Tm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=vm,y.createNewInstanceOperationRef=hm,y.createSemanticId=S1,y.createStateFromGenerationTargetType=sJ,y.createStateFromType=lt,y.createStateFromTypeAndSubscribe=V,y.cronJobBuiltInBaseEntity=so,y.cronJobBuiltInBaseEntityExpressionProperty=PE,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=FP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=DE,y.cronJobBuiltInBaseEntityRef=OE,y.cronJobTriggeredFunctionDeclarationBlueprint=Zl,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=RE,y.dataTypeCompatibilityToErrorExplanation=yO,y.datePrototype=gr,y.dateValueAutogenerationSchema=ic,y.definitionEntityToZodSchema=uI,y.deletePersistedEntityMethod=kl,y.deletePersistedEntityMethodParentRef=oE,y.deleteRootProject=UJ,y.endpointBuiltInBaseEntity=Ma,y.endpointBuiltInBaseEntityRef=dT,y.endpointBuiltInBaseEntityRefFour=kT,y.endpointBuiltInBaseEntityRefThree=vT,y.endpointBuiltInBaseEntityRefTwo=fT,y.endpointBuiltInCorsProperty=lT,y.endpointBuiltInCorsPropertyDataType=oT,y.endpointBuiltInCorsPropertyDataTypeRef=aT,y.endpointBuiltInCorsPropertyRef=sT,y.endpointBuiltInMethodProperty=_l,y.endpointBuiltInMethodPropertyDataType=mT,y.endpointBuiltInMethodPropertyDataTypeRef=yT,y.endpointBuiltInMethodPropertyRef=hT,y.endpointBuiltInPathProperty=Bl,y.endpointBuiltInPathPropertyDataType=pT,y.endpointBuiltInPathPropertyDataTypeRef=uT,y.endpointBuiltInPathPropertyRef=cT,y.endpointPathParamsArgumentDeclaration=Nl,y.endpointPathParamsArgumentDeclarationRef=wT,y.endpointPathParamsVariableDataType=VT,y.endpointPathParamsVariableDataTypeRef=PT,y.endpointReachedTriggerActionDescriptor=Sl,y.endpointReachedTriggerActionDescriptorRef=CT,y.endpointReachedTriggerActionDescriptorRefFour=_T,y.endpointReachedTriggerActionDescriptorRefThree=BT,y.endpointReachedTriggerActionDescriptorRefTwo=gT,y.endpointRequestBodyArgumentDeclaration=Ul,y.endpointRequestBodyArgumentDeclarationRef=bT,y.endpointRequestBodyVariableDataType=RT,y.endpointRequestHeadersArgumentDeclaration=Ml,y.endpointRequestHeadersArgumentDeclarationRef=ET,y.endpointRequestHeadersVariableDataType=IT,y.endpointRequestHeadersVariableDataTypeRef=TT,y.endpointRequestQueryParamsArgumentDeclaration=Ll,y.endpointRequestQueryParamsArgumentDeclarationRef=DT,y.endpointRequestQueryParamsVariableDataType=OT,y.endpointRequestQueryParamsVariableDataTypeRef=AT,y.endpointResponseBodyDataType=FT,y.endpointResponseBodyReturnDeclaration=Gl,y.endpointResponseBodyReturnDeclarationRef=ST,y.endpointResponseCodeDataType=NT,y.endpointResponseCodeReturnDeclaration=jl,y.endpointResponseCodeReturnDeclarationRef=MT,y.endpointResponseHeadersDataType=$T,y.endpointResponseHeadersDataTypeRef=UT,y.endpointResponseHeadersReturnDeclaration=$l,y.endpointResponseHeadersReturnDeclarationRef=jT,y.endpointReturnStatementRef=LT,y.endpointReturnStatementRefThree=xT,y.endpointReturnStatementRefTwo=GT,y.enrichFromKnownEntities=Cs,y.enumOptionsProperty=af,y.enumOptionsPropertyDataType=rf,y.enumOptionsPropertyDataTypeRef=ef,y.enumOptionsPropertyRef=tf,y.enumPrototype=Xr,y.enumPrototypeRef=nf,y.executionBuiltInBaseEntity=oo,y.executionBuiltInEntityAbortMethod=ql,y.executionBuiltInEntityAbortMethodParentRef=wE,y.filterOutDuplicateEntities=u,y.filterOutDuplicateErrors=Z9,y.findEntityFromKeys=Bp,y.findReferenceToSelfInList=MO,y.findReferencesToSelfInProject=$q,y.flattenActionDescriptor=NO,y.flattenArgumentDeclaration=LO,y.flattenBreakStatement=UO,y.flattenBuiltInBaseEntity=jO,y.flattenCalls=Jr,y.flattenCanvasAncestorsUntil=xd,y.flattenCondition=$O,y.flattenContinueStatement=GO,y.flattenDataType=FO,y.flattenDefinitionEntity=SO,y.flattenDefinitionEntityExtensionAndImplementationTypes=Gp,y.flattenDefinitionEntityExtensionTypes=Yd,y.flattenDefinitionEntityExtensions=jp,y.flattenDefinitionEntityImplementations=$p,y.flattenDefinitionEntityImplementionTypes=Wd,y.flattenDerivedCanvasEntities=ir,y.flattenDetachedBranch=mP,y.flattenElementCalls=it,y.flattenElementCallsOnTheSameScope=jq,y.flattenEntity=N,y.flattenFunctionCall=xO,y.flattenFunctionDeclaration=kO,y.flattenGlobalEvent=ZO,y.flattenInputMap=qO,y.flattenInstalledProject=JO,y.flattenInternalCall=WO,y.flattenLiteralValue=YO,y.flattenLoop=zO,y.flattenOperation=HO,y.flattenOutputMap=KO,y.flattenPrimitiveEntity=XO,y.flattenProject=QO,y.flattenProjectElements=_O,y.flattenProperty=eP,y.flattenRelatedCanvasElementsOnTheLeft=pP,y.flattenRelatedCanvasElementsOnTheRight=cP,y.flattenReturnDeclaration=tP,y.flattenReturnStatement=rP,y.flattenSearch=iP,y.flattenValueDescriptor=nP,y.flattenVariableDeclaration=aP,y.flattenVariableInstance=sP,y.flattenVariableReads=BO,y.flattenVariableWrites=gO,y.flattenVariables=We,y.fromChangeSetToRecordChangeSet=rJ,y.fromZodParseToEntityGenerationErrors=Ep,y.generate=qV,y.generateActionExample=bq,y.generateExecutionDataType=V7,y.generateIdFromStrategy=pt,y.generateMutablePropertiesExplanation=_d,y.generateRandomBoolean=jI,y.generateRandomDate=yI,y.generateRandomDateAfter=cI,y.generateRandomDateBefore=pI,y.generateRandomDateBetweenRange=fI,y.generateRandomNumber=_I,y.generateRandomNumberAfter=CI,y.generateRandomNumberBefore=gI,y.generateRandomNumberBetweenRange=BI,y.generateRandomText=UI,y.generateRandomTextAfter=MI,y.generateRandomTextBefore=NI,y.generateRandomTextBetweenRange=LI,y.generateUniqueUUID=VI,y.getAllActionDescriptorsForConditions=Gd,y.getAllActionDescriptorsForGlobalEvents=jd,y.getAllActionDescriptorsForLoops=$d,y.getAllActionDescriptorsForOperations=Oq,y.getAllBuiltInEntityIds=Wr,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=cO,y.getBaseBuiltInEntities=Wi,y.getBaseSchemaBasedOnType=iO,y.getBuiltInEntityOwner=Yi,y.getCallableEntityReferenceSchema=Dt,y.getCallableEntityTypeSchema=hD,y.getCalledBy=pr,y.getCallerEntityReferenceSchema=Y3,y.getCallerEntityTypeSchema=W3,y.getCalls=Np,y.getCanvasEntitiesDerivedFromInternalCalls=uP,y.getCanvasEntitiesDerivedFromWrites=Ra,y.getCanvasEntityDerivedFromValueReadingEntity=Jd,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=lP,y.getCanvasEntityReferenceSchema=c5,y.getCanvasEntityTypeSchema=u5,y.getChildrenEntityWithValues=Bq,y.getColumnProperties=Qq,y.getCommonAncestor=Mp,y.getCommonChildren=EO,y.getDatabaseEntities=Kq,y.getDatabaseEntity=eJ,y.getDeclaration=Pn,y.getDeepestScope=EP,y.getDefinitionEntityExtends=Aa,y.getDraggableCallableEntityReferenceSchema=vD,y.getDraggableCallableEntityTypeSchema=mD,y.getDraggableCallerEntityReferenceSchema=H3,y.getDraggableCallerEntityTypeSchema=z3,y.getDraggableExecutableEntityReferenceSchema=e5,y.getDraggableExecutableEntityTypeSchema=Q3,y.getDraggablePassThroughCallableEntityReferenceSchema=vd,y.getDraggablePassThroughCallableEntityTypeSchema=md,y.getDraggablePlayableEntityReferenceSchema=a5,y.getDraggablePlayableEntityTypeSchema=n5,y.getEntityArgumentDeclarations=Up,y.getEntityInputMaps=oP,y.getEntityOutputMaps=xq,y.getEntityReferenceSchema=l5,y.getEntityReturnDeclarations=dP,y.getEntityTypeSchema=d5,y.getEntityWithLogicScopeReferenceSchema=ui,y.getEntityWithLogicScopeTypeSchema=t5,y.getEntityWithValueReferenceSchema=yD,y.getEntityWithValueTypeSchema=J3,y.getEntryPointEntityReferenceSchema=bt,y.getEntryPointEntityTypeSchema=wi,y.getEventEntityReferenceSchema=yd,y.getEventEntityTypeSchema=fd,y.getExecutableEntityReferenceSchema=X3,y.getExecutableEntityTypeSchema=K3,y.getExtendedBuiltInEntity=kq,y.getExtendedDefinitionEntity=Sp,y.getGenerationTargetSchemaBasedOnType=nO,y.getHeadIfPartOfDetachedBranch=hP,y.getHighestScope=TP,y.getImplementedBuiltInEntity=Zq,y.getIsInteractive=Fp,y.getLastInListOperation=fl,y.getLastInListOperationError=fh,y.getLastInListOperationErrorParentRef=ph,y.getLastInListOperationInputListArgument=lh,y.getLastInListOperationInputListArgumentParentRef=dh,y.getLastInListOperationInputListArgumentRef=nh,y.getLastInListOperationInputListDataType=ah,y.getLastInListOperationOutputElementDataType=oh,y.getLastInListOperationOutputElementReturn=ch,y.getLastInListOperationOutputElementReturnParentRef=uh,y.getLastInListOperationOutputElementReturnRef=sh,y.getLinkedEntitiesFromArgumentDeclaration=Uq,y.getLowestPersistedEntityImplementation=fP,y.getParentCallableEntity=IO,y.getParentCallerEntity=RO,y.getParentCanvasEntities=Yt,y.getParentCanvasEntity=wt,y.getParentCanvasEntityFromTransfer=kd,y.getParentEntryPoint=gq,y.getParentPassthroughCallableEntity=bO,y.getPassThroughCallableEntityReferenceSchema=et,y.getPassThroughCallableEntityTypeSchema=hd,y.getPeristedEntities=Hq,y.getPlayableEntityReferenceSchema=i5,y.getPlayableEntityTypeSchema=r5,y.getProject=LJ,y.getPrototypeByType=gs,y.getRecusriveParentsIds=Kd,y.getReferenceEntityId=g,y.getReferencedEntitiesStateOrErrors=Nd,y.getReferencedEntityStateOrErrors=Ip,y.getReferencedIds=qd,y.getRelatedCanvasElementsOnTheLeft=_n,y.getRelatedCanvasElementsOnTheLeftFromTransfer=Gq,y.getRelatedCanvasElementsOnTheRight=Ji,y.getRootEntryPointScopeOwner=Zp,y.getScopeOwner=zt,y.getStateClassFromType=tJ,y.getTerminationReferenceSchema=o5,y.getTerminationTypeSchema=s5,y.getUsedArgFromDeclaration=Sq,y.getUsedReturnFromDeclaration=Fq,y.getValueReadingEntityReferenceSchema=fD,y.getValueReadingEntityTypeSchema=li,y.getValueWritingEntityReferenceSchema=q3,y.getValueWritingEntityTypeSchema=ms,y.getVariableFromInputMapping=DO,y.getVariableFromReturnVariablePointer=wO,y.getVariableReferenceSchema=Pi,y.getVariableTypeSchema=In,y.getVariablesFromArgumentDeclarations=Zd,y.getVariablesFromInputMaps=OO,y.getVariablesFromOutputMapping=VO,y.getVariablesFromOutputMaps=CO,y.getVariablesFromReturnDeclarations=PO,y.getVariablesInSameOrHigherScope=dp,y.getWrites=Lp,y.groupCallsBasedOnParallelizableExecution=Mq,y.handleAfterEntityImplementationSideEffects=vO,y.handleBeforeEntityImplementationSideEffects=mO,y.httpRequestBodyArgument=Ws,y.httpRequestBodyArgumentRef=Jm,y.httpRequestBodyDataType=Wm,y.httpRequestHeadersArgument=Js,y.httpRequestHeadersArgumentRef=Zm,y.httpRequestHeadersDataType=qm,y.httpRequestMethodArgument=Zs,y.httpRequestMethodArgumentRef=xm,y.httpRequestMethodDataType=km,y.httpRequestMethodDataTypeRef=Sm,y.httpRequestOperation=wa,y.httpRequestOperationErrorValueDescriptor=bl,y.httpRequestOperationErrorValueDescriptorDatatype=p0,y.httpRequestOperationErrorValueDescriptorRef=c0,y.httpRequestOperationRef=o0,y.httpRequestOperationRefEight=l0,y.httpRequestOperationRefFive=a0,y.httpRequestOperationRefFour=n0,y.httpRequestOperationRefNine=u0,y.httpRequestOperationRefSeven=d0,y.httpRequestOperationRefSix=s0,y.httpRequestOperationRefThree=i0,y.httpRequestOperationRefTwo=r0,y.httpRequestQueryParamsArgument=Il,y.httpRequestQueryParamsArgumentRef=$m,y.httpRequestQueryParamsDataType=Gm,y.httpRequestVariableURLArgument=qs,y.httpRequestVariableURLArgumentRef=Um,y.httpRequestVariableURLDataType=jm,y.httpRequestVariableURLDataTypeRef=Nm,y.httpResponseBodyReturnDataType=t0,y.httpResponseBodyReturnDataTypeRef=Qm,y.httpResponseBodyReturnReturn=Hs,y.httpResponseBodyReturnReturnRef=e0,y.httpResponseCodeDataType=zm,y.httpResponseCodeReturn=Ys,y.httpResponseCodeReturnRef=Ym,y.httpResponseHeadersDataType=Xm,y.httpResponseHeadersDataTypeRef=Hm,y.httpResponseHeadersReturn=zs,y.httpResponseHeadersReturnRef=Km,y.implement=Sd,y.inferArgumentDeclarationDataType=C1,y.inferDataType=xr,y.inferInputMapDataType=ap,y.inferOutputMapDataType=op,y.inferPropertyDataType=_1,y.inferReturnDeclarationDataType=sp,y.inferValueDescriptorDataType=M1,y.inferVariableDeclarationDataType=B1,y.inferVariableInstanceDataType=g1,y.initBaseProjectEntity=Jp,y.initProject=VP,y.isPromise=Cp,y.iterateOverListActionDescriptorListArgumentDeclaration=J0,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=Z0,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=k0,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=q0,y.iterateOverListLoopActionDescriptor=mi,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=Y0,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=W0,y.iterateOverListLoopBodyActionDescriptor=ga,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=iv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=rv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=av,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=nv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=eo,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=H0,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=z0,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=K0,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=tv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Q0,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=X0,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=ev,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=uv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=dv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=ov,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=lv,y.iterateOverObjectKeysLoopActionDescriptor=Fn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=pv,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=cv,y.iterateOverObjectKeysLoopBodyActionDescriptor=Pl,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=bv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Iv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=Av,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=Rv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Ol,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=yv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=fv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=hv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Ev,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=vv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=mv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Tv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=Vv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=Pv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=Ov,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=wv,y.iterateOverObjectValuesLoopActionDescriptor=xn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=gv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=Cv,y.iterateOverObjectValuesLoopBodyActionDescriptor=Vl,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=Gv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=$v,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=Fv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Sv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=wl,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=_v,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Bv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Mv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=jv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Lv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Nv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Uv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=B0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=g0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=C0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=w0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=P0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=V0,y.iterateOverStringLoopActionDescriptor=Ca,y.iterateOverStringLoopBodyActionDescriptor=Qs,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=G0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=$0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=F0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=S0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Al,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=M0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=_0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=N0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Dl,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=U0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=L0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=j0,y.joinListOperation=ul,y.joinListOperationError=jy,y.joinListOperationErrorParentRef=Uy,y.joinListOperationFirstListArgument=By,y.joinListOperationFirstListArgumentParentRef=gy,y.joinListOperationFirstListArgumentRef=Dy,y.joinListOperationFirstListDataType=Oy,y.joinListOperationResultListDataType=Cy,y.joinListOperationResultListReturn=Ly,y.joinListOperationResultListReturnParentRef=Ny,y.joinListOperationResultListReturnRef=Vy,y.joinListOperationSecondListArgument=My,y.joinListOperationSecondListArgumentParentRef=_y,y.joinListOperationSecondListArgumentRef=Py,y.joinListOperationSecondListDataType=wy,y.joinListWithLastSeparator=ie,y.joinStringsOperation=Pa,y.joinStringsOperationDynamicStringArgument=iy,y.joinStringsOperationDynamicStringArgumentParentRef=ry,y.joinStringsOperationDynamicStringArgumentRef=ey,y.joinStringsOperationDynamicStringDataType=ty,y.joinStringsOperationError=Qf,y.joinStringsOperationErrorParentRef=Xf,y.joinStringsOperationFirstStringArgument=Fs,y.joinStringsOperationFirstStringArgumentParentRef=kf,y.joinStringsOperationFirstStringArgumentRef=jf,y.joinStringsOperationFirstStringDataType=$f,y.joinStringsOperationResultStringDataType=xf,y.joinStringsOperationResultStringReturn=Oa,y.joinStringsOperationResultStringReturnParentRef=Kf,y.joinStringsOperationResultStringReturnRef=Ff,y.joinStringsOperationSecondStringArgument=xs,y.joinStringsOperationSecondStringArgumentParentRef=Hf,y.joinStringsOperationSecondStringArgumentRef=Gf,y.joinStringsOperationSecondStringDataType=Sf,y.joinStringsOperationSeparatorStringArgument=zf,y.joinStringsOperationSeparatorStringArgumentParentRef=Yf,y.joinStringsOperationSeparatorStringArgumentRef=Zf,y.joinStringsOperationSeparatorStringDataType=Wf,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=Jf,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=qf,y.keyValuePrototype=$n,y.lowercaseFirstLetter=Od,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=Rl,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=E0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=T0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=I0,y.manualFlowLoopActionDescriptor=Ks,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=v0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=m0,y.manualFlowLoopBodyActionDescriptor=Xs,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=R0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=b0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=D0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=A0,y.mapActionDescriptorToTypeItRepresents=zq,y.mergeEntityErrorsList=q9,y.mergeListOfEntities=Jq,y.methodDefaultValue=Fm,y.mockClientProject=kA,y.moreThanOrEqualCondition=Wn,y.moreThanOrEqualConditionLeftHandArgument=LE,y.moreThanOrEqualConditionLeftHandArgumentDataType=ME,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=_E,y.moreThanOrEqualConditionLeftHandArgumentParentRef=NE,y.moreThanOrEqualConditionRightHandArgument=GE,y.moreThanOrEqualConditionRightHandArgumentDataType=jE,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=UE,y.moreThanOrEqualConditionRightHandArgumentParentRef=$E,y.notEmptyCondition=an,y.notEmptyConditionArgument=gE,y.notEmptyConditionRef=CE,y.nullPrototype=Qp,y.numberAdditionOperation=Ss,y.numberAdditionOperationDynamicSummandArgument=Ef,y.numberAdditionOperationDynamicSummandArgumentType=Tf,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=vf,y.numberAdditionOperationError=mf,y.numberAdditionOperationErrorParentRef=hf,y.numberAdditionOperationFirstNumberArgument=il,y.numberAdditionOperationFirstNumberArgumentRef=of,y.numberAdditionOperationFirstNumberDataType=df,y.numberAdditionOperationRef=ff,y.numberAdditionOperationRefThree=al,y.numberAdditionOperationRefTwo=yf,y.numberAdditionOperationResultNumberDataType=pf,y.numberAdditionOperationResultNumberReturn=sl,y.numberAdditionOperationResultNumberReturnRef=cf,y.numberAdditionOperationSecondNumberArgument=nl,y.numberAdditionOperationSecondNumberArgumentRef=lf,y.numberAdditionOperationSecondNumberDataType=uf,y.numberPrototype=me,y.numberSubtractionOperation=dl,y.numberSubtractionOperationDynamicSubtrahendArgument=Lf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=Nf,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Mf,y.numberSubtractionOperationError=_f,y.numberSubtractionOperationErrorParentRef=Bf,y.numberSubtractionOperationFirstNumberArgument=Pf,y.numberSubtractionOperationFirstNumberArgumentRef=If,y.numberSubtractionOperationFirstNumberDataType=bf,y.numberSubtractionOperationRef=ol,y.numberSubtractionOperationRefThree=Cf,y.numberSubtractionOperationRefTwo=wf,y.numberSubtractionOperationResultNumberDataType=Of,y.numberSubtractionOperationResultNumberReturn=gf,y.numberSubtractionOperationResultNumberReturnRef=Df,y.numberSubtractionOperationSecondNumberArgument=Vf,y.numberSubtractionOperationSecondNumberArgumentRef=Rf,y.numberSubtractionOperationSecondNumberDataType=Af,y.numberValueAutogenerationSchema=rc,y.parallelExecutionOperation=Rr,y.parallelExecutionOperationError=Gh,y.parallelExecutionOperationErrorParentRef=$h,y.parallelExecutionOperationListOfExecutionResultsDataType=Lh,y.parallelExecutionOperationListOfExecutionResultsReturn=vl,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Nh,y.parallelExecutionOperationListOfFunctionsArgument=ml,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=Mh,y.parallelExecutionOperationListOfFunctionsArgumentRef=_h,y.parallelExecutionOperationListOfFunctionsBlueprint=Bh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=gh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=Ch,y.parallelExecutionOperationRef=Uh,y.parallelExecutionOperationRefThree=jh,y.persistedBuiltInBaseEntity=Ot,y.persistedBuiltInBaseEntityDatabaseProperty=Zn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=uE,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=GP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=cE,y.persistedBuiltInBaseEntityDatabasePropertyRef=lE,y.persistedBuiltInBaseEntityPrimaryKeyProperty=qn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=EE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=fE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=pE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=IE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=TE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=hE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=yE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=vE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=mE,y.processOutputGlobalValueDescriptorDataType=JE,y.processOutputGlobalValueDescriptorReturn=uo,y.processOutputGlobalValueDescriptorReturnRef=qE,y.projectPublicationCompletedGlobalEvent=lo,y.propertyToZodSchema=lI,y.relationalDatabaseBuiltInBaseEntity=Mr,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=xl,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=aE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=nE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=sE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=iE,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=Fl,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=rE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=eE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=tE,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=ro,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=JT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=ZT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=qT,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=ao,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=QT,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=KT,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=XT,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=no,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=HT,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=$P,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=zT,y.relationalDatabaseBuiltInBaseEntityRef=kn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=io,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=YT,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=jP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=WT,y.resolveActionDescriptorName=G1,y.resolveBaseEntityName=L1,y.resolveBuiltInBaseEntityDataTypeLabel=U1,y.resolveClonedEntityProject=ft,y.resolveConditionOperatorLabel=Cd,y.resolveDataType=Pd,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=_p,y.resolveDataTypeLabel=Vd,y.resolveDefinitionEntityDataTypeLabel=M7,y.resolveEntityDataTypeLabel=_7,y.resolveEntityName=G,y.resolveFirstCallsSecond=Nq,y.resolveFirstWritesSecond=Lq,y.resolvePrimaryKeyProperty=Xq,y.resolvePrimitiveEntityName=$1,y.resolveSearchName=j1,y.resolveVariableScope=C7,y.sequentialExecutionOperation=ti,y.sequentialExecutionOperationError=am,y.sequentialExecutionOperationErrorParentRef=nm,y.sequentialExecutionOperationListOfExecutionResultsDataType=tm,y.sequentialExecutionOperationListOfExecutionResultsReturn=El,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=im,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=em,y.sequentialExecutionOperationListOfFunctionsArgument=Tl,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=Qh,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=rm,y.sequentialExecutionOperationListOfFunctionsArgumentRef=Xh,y.sequentialExecutionOperationListOfFunctionsBlueprint=Kh,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=Hh,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=zh,y.softDeletePersistedEntityMethod=SP,y.softDeletePersistedEntityMethodParentRef=bE,y.sortCallsBasedOnExecutionDependencies=AO,y.sortChildrenEntitiesBasedOnExecutionDependencies=_q,y.splitListOperation=pl,y.splitListOperationError=th,y.splitListOperationErrorParentRef=eh,y.splitListOperationFirstOutputListDataType=Zy,y.splitListOperationFirstOutputListReturn=Hy,y.splitListOperationFirstOutputListReturnParentRef=zy,y.splitListOperationFirstOutputListReturnRef=cl,y.splitListOperationInputListArgument=Jy,y.splitListOperationInputListArgumentParentRef=qy,y.splitListOperationInputListArgumentRef=Sy,y.splitListOperationInputListDataType=Fy,y.splitListOperationSecondOutputListDataType=Ky,y.splitListOperationSecondOutputListReturn=Qy,y.splitListOperationSecondOutputListReturnParentRef=Xy,y.splitListOperationSplitIndexArgument=Yy,y.splitListOperationSplitIndexArgumentParentRef=Wy,y.splitListOperationSplitIndexArgumentRef=xy,y.splitListOperationSplitIndexDataType=ky,y.splitStringOperation=ll,y.splitStringOperationError=Iy,y.splitStringOperationErrorParentRef=Ey,y.splitStringOperationFirstPartResultStringDataType=ly,y.splitStringOperationFirstPartResultStringReturn=Ty,y.splitStringOperationFirstPartResultStringReturnParentRef=vy,y.splitStringOperationFirstPartResultStringReturnRef=dy,y.splitStringOperationIndexArgument=hy,y.splitStringOperationIndexArgumentParentRef=yy,y.splitStringOperationIndexArgumentRef=sy,y.splitStringOperationIndexDataType=oy,y.splitStringOperationSecondPartResultStringDataType=cy,y.splitStringOperationSecondPartResultStringReturn=LP,y.splitStringOperationSecondPartResultStringReturnParentRef=my,y.splitStringOperationSecondPartResultStringReturnRef=uy,y.splitStringOperationStringArgument=fy,y.splitStringOperationStringArgumentParentRef=py,y.splitStringOperationStringArgumentRef=ny,y.splitStringOperationStringDataType=ay,y.stringPrototype=ne,y.stringValueAutogenerationSchema=tc,y.suggestNewIdForEntity=yp,y.test_primitive_entities_export=jJ,y.toCamelCase=g7,y.toEntityState=nr,y.toKebabCase=N1,y.toLowerCaseKebabCase=wd,y.toPascalCase=B7,y.untypedDataPrototype=At,y.updateErrorsList=Ye,y.updateValueReader=Wq,y.urlDefaultValue=Lm,y.uuidPrototype=Qr,y.validateArgumentDeclarationName=pp,y.validateCalledByErrorIdInAction=Aq,y.validateCalledByIdInAction=Rq,y.validateCallers=uO,y.validateConditionEntityDeclaration=Pq,y.validateDataOperation=Qi,y.validateDataOperationDataToValidateArgument=Dm,y.validateDataOperationDataToValidateArgumentParentRef=Am,y.validateDataOperationDataToValidateArgumentRef=bm,y.validateDataOperationDataToValidateDataType=Rm,y.validateDataOperationEntityToMatchTypeArgument=Vm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=wm,y.validateDataOperationEntityToMatchTypeArgumentRef=Om,y.validateDataOperationEntityToMatchTypeDataType=Pm,y.validateDataOperationError=_m,y.validateDataOperationErrorParentRef=Bm,y.validateDataOperationOutputEntityDeclaration=gm,y.validateDataOperationOutputEntityDeclarationParentRef=Cm,y.validateDefinitionEntityName=gd,y.validateEntryCaller=lO,y.validateErrorCaller=dO,y.validateFunctionCallDeclaration=pO,y.validateFunctionDeclarationName=lp,y.validateGeneratedEntityParentIsNotBuiltInEntity=Tq,y.validateGeneration=mq,y.validateGenerationTarget=ot,y.validateGenerationUpdate=vq,y.validateLoopEntityDeclaration=wq,y.validateName=N7,y.validateOperationEntityDeclaration=fO,y.validatePropertyName=cp,y.validateReachability=fi,y.validateReadsValueInActionPayload=Dq,y.validateReferenceObject=Md,y.validateReferenceToOne=bp,y.validateReferences=Et,y.validateReturnDeclarationName=fp,y.validateSuccessCaller=oO,y.validateValueReaderGenerationUpdate=ws,y.validateValueWritter=wp,y.validateVariableDeclarationName=up,y.validateVariableInternalCallUse=Vp,y.valueAutogenerationCurrentDateAndTimeSchema=JA,y.valueAutogenerationGenericSchema=Xo,y.valueAutogenerationOptions=nc,y.valueAutogenerationOptionsSchema=qA,y.valueAutogenerationRandomBooleanSchema=ec,y.valueAutogenerationRandomDateBetweenSchema=tD,y.valueAutogenerationRandomDateFromSchema=QA,y.valueAutogenerationRandomDateSchema=td,y.valueAutogenerationRandomDateUntilSchema=eD,y.valueAutogenerationRandomNumberBetweenSchema=zA,y.valueAutogenerationRandomNumberFromSchema=WA,y.valueAutogenerationRandomNumberSchema=Qo,y.valueAutogenerationRandomNumberUntilSchema=YA,y.valueAutogenerationRandomSchema=ls,y.valueAutogenerationRandomTextBetweenSchema=XA,y.valueAutogenerationRandomTextFromSchema=HA,y.valueAutogenerationRandomTextSchema=ed,y.valueAutogenerationRandomTextUntilSchema=KA,y.valueAutogenerationRangeValueTypesSchema=ds,y.valueAutogenerationUniqueSchema=Qu,y.waitOperation=St,y.waitOperationMillisecondsNumberArgument=Ki,y.waitOperationMillisecondsNumberArgumentRef=xh,y.waitOperationMillisecondsNumberDataType=kh,y.waitOperationOperationError=Jh,y.waitOperationOperationErrorParentRef=qh,y.waitOperationRef=Zh,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
408
+ 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:r}}get allBasePropertiesFromExtendedAndImplementedEntities(){return u([...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 u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...a,...e]},[]),...this.implements.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...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 O({id:`${this.id}--${I.InvalidParentUpdate}`,code:I.InvalidParentUpdate,severity:D.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}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){return this.implements.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{hr.includes(e.type)||e.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=R.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Le(this,this.project);return(r=this.knownVersions)==null||r.set(this.version,e),e.properties=this.properties,e.methods=this.methods,e.abstractMethods=this.abstractMethods,e.extends=this.extends,e.implements=this.implements,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),r.push(...o.added),a.push(...o.removed)}return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const c=new Map;for(const[h,p]of this.knownVersions||new Map){if(c.set(h,p),p.activeVersion=!1,p.knownVersions)for(const[v,E]of p.knownVersions)c.set(v,E);p.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const c=await this.APILoadVersion({},e);if(!c)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Le(c,this.project)}return this.metaSync(o.toShallowJSON(),null),this.properties=o.properties,this.methods=o.methods,this.abstractMethods=o.abstractMethods,this.extends=o.extends,this.implements=o.implements,this.parent=o.parent,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];if(this.initialData.parent){const d=g(this.initialData.parent),o=this.project.get(d);o&&(this.setParent(o,null),e.push(o))}return this.initialData.extends.forEach(d=>{const o=g(d),l=this.project.get(o);l&&(this.addExtension(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),this.initialData.implements.forEach(d=>{const o=g(d),l=this.project.get(o);l&&(this.addImplementation(l),l.type!==n.BuiltInBaseEntity&&e.push(l))}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],r=[],a=[],d=[];this.initialized=!0,this.captureVersion();const{updated:o,added:l,removed:c,affected:h}=this.syncImplementationProperties(e);t.push(...o),r.push(...l),a.push(...c),d.push(...h);const{updated:p,added:v,removed:E,affected:P}=this.addExtendedProperties(e);return t.push(...p),r.push(...v),a.push(...E),d.push(...P),this.addSuggestions(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-self-to-project"))){const t=[this],r=[],a=[],d=[];if(this.parent.type===n.DataType){const o=this.parent;o.entity=this,t.push(o)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}setParent(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"set-parent"))){var r;return((r=this.parent)==null?void 0:r.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),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(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.methods=this.initialData.methods.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(e),r}),this.extends=this.initialData.extends.map(t=>V(t,this.project)),this.implements=this.initialData.implements.map(t=>V(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}syncImplementationProperties(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.implementedPropertiesFromOriginalParents,c=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return l.filter(p=>!c.find(E=>{var P;return((P=E.implements)==null?void 0:P.id)===p.id})).forEach(p=>{if(this.properties.find(w=>{var C;return((C=w.implements)==null?void 0:C.id)===p.id}))return;const E=this.properties.find(w=>w.name===p.name&&!!w.abstract&&!w.implements);if(E){E.implements=p,E.abstract=!1;return}const P=p.clone(e,this,R.UUID.uuid());P.initChildren(e),r.push(P),e==null||e.add(P,b.Added),P.setImplements(p,e),P.metaSync({abstract:!1},e),this.addProperty(P)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addExtendedProperties(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"add-extended-properties"))){const t=[],r=[],a=[],d=[],o=this.properties,l=this.extendedPropertiesFromOriginalParents,c=l.filter(p=>l.find(E=>{var P;return((P=E.implements)==null?void 0:P.id)===p.id})?!1:!p.abstract),h=new Set(o.map(p=>p.name));return c.forEach(p=>{if(h.has(p.name))return;h.add(p.name);const v=p.clone(e,this,R.UUID.uuid());v.initChildren(e),r.push(v),e==null||e.add(v,b.Added),this.addProperty(v)}),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSuggestions(){return this.implements.forEach(e=>{B5(this,e).forEach(a=>{const d=a.toJSON();d.id=`_suggestion--parent--${this.id}--${a.id}`;const o=V(d,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),_5(this,e).forEach(a=>{const d=`_suggestion--parent--${this.id}--${a.id}`,o=a.implementAsFunctionDeclaration(d),l=V(o,this.project);if(l.suggestion=!0,l.setParent(this,null),l.initChildren(null),l.inputs.forEach(c=>{c.suggestion=!0}),l.returnStatements.length){const c=l.returnStatements[0];c.suggestion=!0,c.outputs.forEach(h=>{h.suggestion=!0})}this.addSuggestedMethod(l)})}),this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),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,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await Le.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await Le.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await Le.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await Le.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await Le.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await Le.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){const r=[],a=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(a.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:c,removed:h,added:p}=l.entity.onDetachedDependencyRemoved(this,l.field,t);r.push(...c),a.push(...h),d.push(...p)}),this.properties.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),this.methods.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),this.abstractMethods.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),this.suggestedProperties.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),this.suggestedMethods.forEach(l=>{const{updated:c,removed:h}=l.remove({ignoreUpstream:!0},t);r.push(...c),a.push(...h)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const l=this.parent.setEntity(null);r.push(l)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:u(d),updated:u(r),removed:u(a),affected:u(o),self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){const t=[],r=[],a=[],d=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),this.properties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.methods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.abstractMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedProperties.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),this.suggestedMethods.forEach(o=>{const{updated:l}=o.restore({},e);r.push(...l)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:u(t),updated:u(r),removed:u(a),affected:u(d),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(r=>r.toFlat(e)),...this.implements.flatMap(r=>r.toFlat(e)),...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(r=>r.toFlatIds(e)),...this.implements.flatMap(r=>r.toFlatIds(e)),...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.parent.toFlatIds(e)])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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=Z){var r,a,d,o,l;let t;return(r=e.seenEntityMaps)!=null&&r.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||pt(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(d=e.seenEntities)!=null&&d.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:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!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(c=>c.toJSONClone({...e,newId:null})),methods:this.methods.map(c=>c.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(c=>c.toJSONClone({...e,newId:null})),implements:this.implements.map(c=>c.type===n.BuiltInBaseEntity?c.toJSON():c.toJSONClone({...e,newId:null})),extends:this.extends.map(c=>c.type===n.BuiltInBaseEntity?c.toJSON():c.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.toFlatJSON(e)),...this.implements.flatMap(r=>r.toFlatJSON(e)),...this.extends.flatMap(r=>r.toFlatJSON(e)),...this.parent.toFlatJSON(e)])}toGenerationTarget(){const e=this.parent.type===n.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(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.implements.filter(r=>r.type===n.DefinitionEntity).flatMap(r=>r.toFlatGenerationTarget(e)),...this.parent.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=g5(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=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"clone-entity")),t=null,r=null,a=!0){var w,C,U;let d=ft(t,this);const o=this.toJSON(),l=r||R.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const c=l.split("-id"),h=c[c.length-1||0]||l;o.id=l,o.version=R.UUID.uuid();const p=lt(o,d);t&&p.setParent(t,null),a&&p.subscribe(),p.initChildren(e),e==null||e.add(p,b.Added);const v=(w=this.properties)==null?void 0:w.map(S=>S.clone(e,p,R.UUID.uuid(),a));p.properties=v;const E=(C=this.methods)==null?void 0:C.map((S,B)=>S.clone(e,p,h+"-method-"+B+"-id",a));p.methods=E;const P=(U=this.abstractMethods)==null?void 0:U.map((S,B)=>S.clone(e,p,h+"-abstract-method-"+B+"-id",a));return p.abstractMethods=P,e==null||e.attemptAutoclose("clone-entity",this.id),p}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"implement-definition-entity")),r){const a=Sd(this,e,t,r);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),a}getAllInteractiveMethods(){const e=this.implements.filter(r=>r.type===n.DefinitionEntity||r.type===n.BuiltInBaseEntity&&r.interactive);return u([...this.methods,...this.extends.flatMap(r=>r.getAllInteractiveMethods()),...e.flatMap(r=>r.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const r=[],a=[],d=[],o=[];if(this.parent.type!==n.DataType||!this.parent.inferred)return t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[];e.forEach(p=>{l.find(E=>G(E,this.project)===G(p,this.project))||l.push(p)});const c=this.properties.filter(p=>!p.dataType);l.forEach(p=>{var U,S;const v=c.find(B=>G(B,this.project)===G(p,this.project));if(!v)return;const P=Pn(p.parent).getMasterInputWithValueWritterFromAllInstances(p),w=xr(P,t),C=w==null?void 0:w.clone(t,v,R.UUID.uuid(),!0);if(C){const B=(U=v.dataType)==null?void 0:U.merge(C,t);v.dataType&&(B==null?void 0:B.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),C.id!==((S=B==null?void 0:B.self)==null?void 0:S.id)&&C.remove({ignoreUpstream:!1},t),B!=null&&B.self&&(B.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(B.self,b.Added),v.setDataType(B.self),t==null||t.add(v,b.Updated))}p.setDeclaration(v),t==null||t.add(p,b.Updated)});const h=[];return l.forEach(p=>{if(!p.declaration){h.push(p);return}}),h.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(h.forEach(p=>{var B,$,k,W;const v=this.properties.find(ee=>G(ee,this.project)===G(p,this.project));if(v){if(p.setDeclaration(v),!v.getDataType(t)){const ce=Pn(p.parent).getMasterInputWithValueWritterFromAllInstances(p),Te=xr(ce),Q=Te==null?void 0:Te.clone(t,v,R.UUID.uuid(),!0);if(Q){const se=(B=v.dataType)==null?void 0:B.merge(Q,t);v.dataType&&(se==null?void 0:se.self.id)!==v.dataType.id&&v.dataType.remove({ignoreUpstream:!1},t),Q.id!==(($=se==null?void 0:se.self)==null?void 0:$.id)&&Q.remove({ignoreUpstream:!1},t),se!=null&&se.self&&(se.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(se.self,b.Added),v.setDataType(se.self),t==null||t.add(v,b.Updated))}}return}const E={id:R.UUID.uuid(),type:n.Property,version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:G(p,this.project),description:p.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:p.index,implements:null,dataType:null,parent:this.toReference()},P=V(E,this.project);P.setParent(this,t),P.initChildren(t),t==null||t.add(P,b.Added);const C=Pn(p.parent).getMasterInputWithValueWritterFromAllInstances(p),U=xr(C),S=U==null?void 0:U.clone(t,P,R.UUID.uuid(),!0);if(S){const ee=(k=P.dataType)==null?void 0:k.merge(S,t);P.dataType&&(ee==null?void 0:ee.self.id)!==P.dataType.id&&P.dataType.remove({ignoreUpstream:!1},t),S.id!==((W=ee==null?void 0:ee.self)==null?void 0:W.id)&&S.remove({ignoreUpstream:!1},t),ee!=null&&ee.self&&(ee.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(ee.self,b.Added),P.setDataType(ee.self),t==null||t.add(P,b.Updated))}return this.addProperty(P),p.setDeclaration(P),t==null||t.add(p,b.Updated),P}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:u(r),updated:u(a),removed:u(d),affected:u(o),self:this})}};f(Le,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(Le,"type",n.DefinitionEntity),f(Le,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),f(Le,"PARENT_TYPES",[...Le.USER_MANAGED_PARENT_TYPES]),f(Le,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),f(Le,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(Le,"BASE_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"MUTABLE_META_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,"x","y"]),f(Le,"INMUTABLE_META_PROPERTIES",[...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"META_PROPERTIES",[...Le.MUTABLE_META_PROPERTIES,...Le.INMUTABLE_META_PROPERTIES]),f(Le,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),f(Le,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(Le,"UPSTREAM_PROPERTIES",[...Le.MUTABLE_UPSTREAM_PROPERTIES,...Le.INMUTABLE_UPSTREAM_PROPERTIES]),f(Le,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),f(Le,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(Le,"DOWNSTREAM_PROPERTIES",[...Le.MUTABLE_DOWNSTREAM_PROPERTIES,...Le.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(Le,"PROPERTIES",[...Le.META_PROPERTIES,...Le.UPSTREAM_PROPERTIES,...Le.DOWNSTREAM_PROPERTIES]);let zi=Le;function nJ(i){const s=d6(),e=i.toJSON();s.safeParse(e).success;const r=[];return Ye(i.errors,r)}const Ns=class Ns extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"version");f(this,"name");f(this,"description",null);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",!1);f(this,"static");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"interactive",!1);f(this,"errors",[]);f(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(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.extends=this.initialData.extends.map(r=>V(r,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...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 APILoad(e=L,...t){return await Ns.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e)),...this.extends.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e)),...this.extends.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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=Z){return{id:this.id+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.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(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.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=nJ(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=this.project.addChangeSet(new A(this.project,"",T().toISOString(),null,!0,"implement-built-in-base-entity")),r){const a=Sd(this,e,t,r);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),a}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Ns&&e.push(...r.getAllInteractiveMethods())})),u(e)}};f(Ns,"repository",{APILoad:async(e,...t)=>null});let Yr=Ns;function aJ(i){const s=Q9(),e=i.toJSON();s.safeParse(e).success;const r=[];return Ye(i.errors,r)}const Qd=class Qd extends rt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"type",n.PrimitiveEntity);f(this,"static");f(this,"abstract");f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(r=>{const a=V(r,this.project);return a.setParent(this,null),a.initChildren(null),a}),this.methods=this.initialData.methods.map(r=>{const a=V(r,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(r=>{const a=V(r,this.project);return a.parent=this,a})}get allBasePropertiesFromExtendedAndImplementedEntities(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(a=>!a.abstract);return[...e,...r]},[]))}get extendedPropertiesFromOriginalParents(){return u(this.extends.reduce((e,t)=>{const r=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(a=>!a.abstract);return[...e,...r]},[]))}get implementedPropertiesFromOriginalParents(){return u([...this.extends.reduce((e,t)=>{const r=t.implementedPropertiesFromOriginalParents,a=[...t.ownDeclaredProperties].filter(d=>!!d.abstract&&!r.find(o=>o.name===d.name));return[...r,...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 APILoad(e=L,...t){return await Qd.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(r=>r.toFlat(e)),...this.methods.flatMap(r=>r.toFlat(e)),...this.abstractMethods.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(r=>r.toFlatIds(e)),...this.methods.flatMap(r=>r.toFlatIds(e)),...this.abstractMethods.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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=Z){return{id:this.id+"--"+R.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=Z){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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(r=>r.toFlatJSON(e)),...this.methods.flatMap(r=>r.toFlatJSON(e)),...this.abstractMethods.flatMap(r=>r.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(r=>r.toFlatGenerationTarget(e)),...this.methods.flatMap(r=>r.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(r=>r.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=aJ(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(r=>r.type===n.BuiltInBaseEntity&&r.interactive||r.type===n.PrimitiveEntity).forEach(r=>{r instanceof Yr&&e.push(...r.getAllInteractiveMethods())}),u(e)}};f(Qd,"repository",{APILoad:async(e,...t)=>null});let fr=Qd;function lt(i,s){if(!i)throw new Error("Entity is null");const e=s.get(i.id);switch(i.type){case n.LiteralValue:return e||new Bn(i,s);case n.DefinitionEntity:return e||new zi(i,s);case n.PrimitiveEntity:return e||new fr(i,s);case n.FunctionDeclaration:return e||new _i(i,s);case n.GlobalEvent:return e||new Vn(i,s);case n.DataType:return e||new wn(i,s);case n.Property:return e||new gi(i,s);case n.FunctionCall:return e||new qi(i,s);case n.Condition:return e||new Li(i,s);case n.Operation:return e||new Mi(i,s);case n.VariableDeclaration:return e||new ji(i,s);case n.VariableInstance:return e||new Ui(i,s);case n.OutputMap:return e||new Zr(i,s);case n.ReturnDeclaration:return e||new rr(i,s);case n.ArgumentDeclaration:return e||new Si(i,s);case n.InputMap:return e||new kr(i,s);case n.Project:return e||new R(i);case n.InstalledProject:return e||new Gi(i,s);case n.ActionDescriptor:return e||new qe(i,s);case n.ReturnStatement:return e||new Bi(i,s);case n.Loop:return e||new Ni(i,s);case n.Search:return e||new $i(i,s);case n.ValueDescriptor:return e||new Fi(i,s);case n.BuiltInBaseEntity:return e||new Yr(i,s);case n.InternalCall:return e||new gn(i,s);case n.ContinueStatement:return e||new $t(i,s);case n.BreakStatement:return e||new Cn(i,s);case n.GenericReference:return s.get(i.entityId);default:throw new Error("Invalid entity type: "+i.type)}}function V(i,s){if(!i)throw new Error("Entity is null");const e=lt(i,s);return e.subscribe(),e}function sJ(i,s){if(!i)throw new Error("Entity is null");switch(i.type){case n.LiteralValue:return Bn.fromGenerationTarget(i,s);case n.DefinitionEntity:return zi.fromGenerationTarget(i,s);case n.FunctionDeclaration:return _i.fromGenerationTarget(i,s);case n.GlobalEvent:return Vn.fromGenerationTarget(i,s);case n.DataType:return wn.fromGenerationTarget(i,s);case n.Property:return gi.fromGenerationTarget(i,s);case n.FunctionCall:return qi.fromGenerationTarget(i,s);case n.Condition:return Li.fromGenerationTarget(i,s);case n.Operation:return Mi.fromGenerationTarget(i,s);case n.VariableDeclaration:return ji.fromGenerationTarget(i,s);case n.VariableInstance:return Ui.fromGenerationTarget(i,s);case n.OutputMap:return Zr.fromGenerationTarget(i,s);case n.ReturnDeclaration:return rr.fromGenerationTarget(i,s);case n.ArgumentDeclaration:return Si.fromGenerationTarget(i,s);case n.InputMap:return kr.fromGenerationTarget(i,s);case n.InstalledProject:return Gi.fromGenerationTarget(i,s);case n.ReturnStatement:return Bi.fromGenerationTarget(i,s);case n.Loop:return Ni.fromGenerationTarget(i,s);case n.Search:return $i.fromGenerationTarget(i,s);case n.ActionDescriptor:return qe.fromGenerationTarget(i,s);case n.ValueDescriptor:return Fi.fromGenerationTarget(i,s);case n.InternalCall:return gn.fromGenerationTarget(i,s);case n.ContinueStatement:return $t.fromGenerationTarget(i,s);case n.BreakStatement:return Cn.fromGenerationTarget(i,s);default:throw new Error("Invalid entity type: "+i.type)}}const Z={seenEntityMaps:new Map,seenEntities:new Set};class bP{constructor(){f(this,"initialData")}}const L={cascade:!1},RP={APILoad:async(i,...s)=>null},oJ={APICreate:async(i,...s)=>i,APIUpdate:async(i,...s)=>i,APIDelete:async(i,...s)=>i,APIClone:async(i,...s)=>{},APILoadVersion:async(i,s,...e)=>null,...RP};class dJ{}class lJ extends bP{}class uJ{}class cJ{}class pJ{}class qp{}class fJ extends qp{}class yJ extends qp{}class hJ{}class yi{static initReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=V(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),s.readsValue.initChildren(null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}static hydrateReadsValue(s){if(s.initialData.readsValue&&s.initialData.readsValue.type!==n.GenericReference)s.readsValue=V(s.initialData.readsValue,s.project);else if(s.initialData.readsValue&&s.initialData.readsValue.type===n.GenericReference){const e=nr(s.initialData.readsValue,s.project);e&&(s.readsValue=e)}if(s.readsValue){if(Qe.includes(s.readsValue.type)){let e=s.parent;mt.includes(e.type)||(e=e.parent);const t=s.type===n.InputMap&&s.parent.type===n.Loop;t&&(e=s.parent.parent),s.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(s)?e.replaceDetachedChild(s,s.readsValue):t||e.subscribeDetachedChild(s.readsValue)}s.readsValue.addValueReader(s)}return s.readsValue}}class Ms{static initWritesValues(s,e){const t=s.initialData.writesValues.reduce((a,d)=>{if(d.type===n.GenericReference||s.writesValues.some(l=>l.id===d.id))return a;const o=V(d,s.project);return o.setValueWriter(s),Qe.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...a,o]},[]),r=[...s.writesValues];return s.writesValues=u([...r,...t]),s.writesValues}}class mJ{}const de=class de extends rt{constructor(e){super(e);f(this,"initialData");f(this,"id");f(this,"type",n.Project);f(this,"name",null);f(this,"description",null);f(this,"x");f(this,"y");f(this,"entities",[]);f(this,"projects",[]);f(this,"functions",[]);f(this,"events",[]);f(this,"variableDeclarations",[]);f(this,"variableInstances",[]);f(this,"conditions",[]);f(this,"operations",[]);f(this,"functionCalls",[]);f(this,"loops",[]);f(this,"searches",[]);f(this,"primitives",[]);f(this,"builtInBaseEntities",[]);f(this,"operationDeclarations",[]);f(this,"globalEventActionDescriptors",[]);f(this,"loopDeclarations",[]);f(this,"loopDeclarationsBodies",[]);f(this,"conditionDeclarations",[]);f(this,"valueDescriptors",[]);f(this,"dataTypes",[]);f(this,"project");f(this,"instances",{});f(this,"builtInInstances",{});f(this,"deletedInstances",{});f(this,"errors",[]);f(this,"references",[]);f(this,"history",[]);f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"onCloseChangeSetCallback",null);this.initialData=e,this.id=e.id,this.name=e.name,this.description=e.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!de.UUID||de.UUID.isBackup)&&(de.UUID=Lo==null?void 0:Lo()),de.UUID||(de.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),de.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:r=>r}}}static injectUUIDModule(e){de.UUID=e}static validateGenerationTarget(e,t){let r=JSON.parse(JSON.stringify(e));const a=[];return a.push(...ot(r)),{errors:a,modifiedData:r}}onCloseChangeSet(e){this.onCloseChangeSetCallback=e}closeChangeSet(e){this.onCloseChangeSetCallback&&this.onCloseChangeSetCallback(e)}addChangeSet(e){if(!this.history.length)return this.history.push(e),e;const t=this.history.find(a=>a.id===(e==null?void 0:e.id));if(t)return t;const r=this.history.findIndex(a=>T(a.timestamp).isBefore(T(e==null?void 0:e.timestamp)));return r===-1?this.history.push(e):this.history.splice(r,0,e),e}discardChangeSet(e){const t=this.history.findIndex(r=>r.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}undo(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}redo(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async r=>{await t.init(this),r(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(){const e=[],t=[],r=[],a=[];return Object.values(this.detachedDependents).forEach(d=>{const o=d.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),r.push(...o.removed),a.push(...o.affected)}),{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}onDetachedDependencyRemoved(e,t,r){const a=[],d=[],o=[],l=[];return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}onDetachedDependencyRestored(e,t,r){const a=[],d=[],o=[],l=[];return{updated:u(a),added:u(d),removed:u(o),affected:u(l),self:this}}subscribeToDependencies(){return this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=de.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t,r;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new de(this);return(r=this.knownVersions)==null||r.set(this.version,e),e.entities=this.entities,e.projects=this.projects,e.functions=this.functions,e.events=this.events,e.variableDeclarations=this.variableDeclarations,e.variableInstances=this.variableInstances,e.conditions=this.conditions,e.operations=this.operations,e.functionCalls=this.functionCalls,e.loops=this.loops,e.searches=this.searches,this}recursiveCaptureUpstreamVersions(e){const t=[],r=[],a=[],d=[];return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}async restoreVersion(e){var l;const t=[],r=[],a=[],d=[];if(this.version===e)return{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this};if(!this.knownVersions){const c=new Map;for(const[h,p]of this.knownVersions||new Map){if(c.set(h,p),p.activeVersion=!1,p.knownVersions)for(const[v,E]of p.knownVersions)c.set(v,E);p.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const c=await this.APILoadVersion({},e);if(!c)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new de(c)}return this.metaSync(o.toShallowJSON(),null),this.entities=o.entities,this.projects=o.projects,this.functions=o.functions,this.events=o.events,this.variableDeclarations=o.variableDeclarations,this.variableInstances=o.variableInstances,this.conditions=o.conditions,this.operations=o.operations,this.functionCalls=o.functionCalls,this.loops=o.loops,this.searches=o.searches,{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}hydrateAncestors(){const e=[],t=[],r=[],a=[];return{updated:u(e),added:u(t),removed:u(r),affected:u(a),self:this}}afterAllChildrenInitialized(e=null){const t=[],r=[],a=[],d=[];return this.initialized=!0,this.captureVersion(),this.validate(),{updated:u(t),added:u(r),removed:u(a),affected:u(d),self:this}}addSelfToProject(e){const t=[],r=[],a=[],d=[];return this.subscribe(),this.subscribeToDependencies(),{updated:u(t),added:u(r),removed:u(a),affected:u(d),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(e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.projects=this.initialData.projects.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.variableInstances=this.initialData.variableInstances.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.conditions=this.initialData.conditions.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.operations=this.initialData.operations.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functions=this.initialData.functions.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.events=this.initialData.events.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.functionCalls=this.initialData.functionCalls.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.loops=this.initialData.loops.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.searches=this.initialData.searches.map(t=>{const r=V(t,this);return r.setParent(this,null),r.initChildren(e),r}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeDeletedInstance(e){return(!this.deletedInstances[e.id]||this.deletedInstances[e.id]!==e)&&(this.deletedInstances[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}unsubscribeDeletedInstance(e){return delete this.deletedInstances[e.id],this}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getDeleted(e){return this.deletedInstances[e]||null}getManaged(e){return this.getBuiltIn(e)?null: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}metaSync(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-meta"))){const r=dt(this,e);return e.deleted===!0&&!this.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&this.deleted?t==null||t.add(this,b.Added):r&&(t==null||t.add(this,b.Updated)),super.metaSync(e),this.name=e.name||this.name,this.description=e.description||this.description,this.x=e.x||this.x,this.y=e.y||this.y,t==null||t.attemptAutoclose("sync-meta",this.id),this}async APILoad(e=L,...t){return await de.repository.APILoad(this.id,...t),this}async APICreate(e=L,...t){return await de.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=L,...t){return await de.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=L,...t){return await de.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=L,...t){return await de.repository.APIClone(this.id,...t),this}async APILoadVersion(e=L,t,...r){return await de.repository.APILoadVersion(this.id,t,...r)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],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,...this.entities.flatMap(r=>r.toFlat(e)),...this.functions.flatMap(r=>r.toFlat(e)),...this.events.flatMap(r=>r.toFlat(e)),...this.projects.flatMap(r=>r.toFlat(e)),...this.variableDeclarations.flatMap(r=>r.toFlat(e)),...this.variableInstances.flatMap(r=>r.toFlat(e)),...this.conditions.flatMap(r=>r.toFlat(e)),...this.operations.flatMap(r=>r.toFlat(e)),...this.functionCalls.flatMap(r=>r.toFlat(e)),...this.loops.flatMap(r=>r.toFlat(e)),...this.searches.flatMap(r=>r.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(r=>r.toFlatIds(e)),...this.functions.flatMap(r=>r.toFlatIds(e)),...this.events.flatMap(r=>r.toFlatIds(e)),...this.projects.flatMap(r=>r.toFlatIds(e)),...this.variableDeclarations.flatMap(r=>r.toFlatIds(e)),...this.variableInstances.flatMap(r=>r.toFlatIds(e)),...this.conditions.flatMap(r=>r.toFlatIds(e)),...this.operations.flatMap(r=>r.toFlatIds(e)),...this.functionCalls.flatMap(r=>r.toFlatIds(e)),...this.loops.flatMap(r=>r.toFlatIds(e)),...this.searches.flatMap(r=>r.toFlatIds(e))])}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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,r=new Set,a=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(d=>{if(a.includes(d)){t.set(d,d);return}t.set(d,de.UUID.uuid())}),r.add(this.id),{id:t.get(this.id),version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),projects:this.projects.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableDeclarations:this.variableDeclarations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),variableInstances:this.variableInstances.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),conditions:this.conditions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),operations:this.operations.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functions:this.functions.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),events:this.events.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),functionCalls:this.functionCalls.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),loops:this.loops.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null})),searches:this.searches.map(d=>d.toJSONClone({...e,seenEntityMaps:t,seenEntities:r,newId:null}))}}toReference(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+de.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=Z){var r;let t=this.id;return(r=e.seenEntityMaps)!=null&&r.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,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.toShallowJSON(),...this.entities.flatMap(r=>r.toFlatJSON(e)),...this.functions.flatMap(r=>r.toFlatJSON(e)),...this.events.flatMap(r=>r.toFlatJSON(e)),...this.projects.flatMap(r=>r.toFlatJSON(e)),...this.variableDeclarations.flatMap(r=>r.toFlatJSON(e)),...this.variableInstances.flatMap(r=>r.toFlatJSON(e)),...this.conditions.flatMap(r=>r.toFlatJSON(e)),...this.operations.flatMap(r=>r.toFlatJSON(e)),...this.functionCalls.flatMap(r=>r.toFlatJSON(e)),...this.loops.flatMap(r=>r.toFlatJSON(e)),...this.searches.flatMap(r=>r.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(r=>r.toFlatGenerationTarget(e)),...this.functions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.events.flatMap(r=>r.toFlatGenerationTarget(e)),...this.projects.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(r=>r.toFlatGenerationTarget(e)),...this.conditions.flatMap(r=>r.toFlatGenerationTarget(e)),...this.operations.flatMap(r=>r.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(r=>r.toFlatGenerationTarget(e)),...this.loops.flatMap(r=>r.toFlatGenerationTarget(e)),...this.searches.flatMap(r=>r.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=D5(),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=V(e,this);return this.addDefinitionEntity(t),t}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=V(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=V(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=V(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=V(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=V(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=V(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=V(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=V(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=V(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=V(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(r=>r.id===e.id);if(t>-1){const r=this.entities[t];return this.entities.splice(t,1),r}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(r=>r.id===e.id);if(t>-1){const r=this.functions[t];return this.functions.splice(t,1),r}return null}removeExternalProject(e){const t=this.projects.findIndex(r=>r.id===e.id);if(t>-1){const r=this.projects[t];return this.projects.splice(t,1),r}return null}removeGlobalEvent(e){const t=this.events.findIndex(r=>r.id===e.id);if(t>-1){const r=this.events[t];return this.events.splice(t,1),r}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(r=>r.id===e.id);if(t>-1){const r=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),r}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,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.functionCalls.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.operations.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.loops.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[]),...this.searches.reduce((t,r)=>{const a=it(r);return[...t,...a.filter(d=>d.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.functionCalls.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.conditions.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.operations.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.loops.reduce((t,r)=>{const a=We(r);return[...t,...a]},[]),...this.searches.reduce((t,r)=>{const a=We(r);return[...t,...a]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableInstance);return[...t,...d]},[])]}getVariableDeclarations(){return u([...this.variableDeclarations,...this.getEntryPoints().reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.functionCalls.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.conditions.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.operations.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.loops.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[]),...this.searches.reduce((t,r)=>{const d=We(r).filter(o=>o.type===n.VariableDeclaration);return[...t,...d]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(r=>{if(!r.declaration){const a=r.initialData,d=a.declaration.entityId||a.declaration.id,o=t.find(l=>l.id===d);o&&r.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===z.PERSISTED_ENTITY)||null}};f(de,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),f(de,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...r)=>null}),f(de,"type",n.Project),f(de,"USER_MANAGED_PARENT_TYPES",[]),f(de,"PARENT_TYPES",[...de.USER_MANAGED_PARENT_TYPES]),f(de,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(de,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(de,"BASE_PROPERTIES",[...de.MUTABLE_BASE_PROPERTIES,...de.INMUTABLE_BASE_PROPERTIES]),f(de,"MUTABLE_META_PROPERTIES",[...de.MUTABLE_BASE_PROPERTIES,"x","y"]),f(de,"INMUTABLE_META_PROPERTIES",[...de.INMUTABLE_BASE_PROPERTIES]),f(de,"META_PROPERTIES",[...de.MUTABLE_META_PROPERTIES,...de.INMUTABLE_META_PROPERTIES]),f(de,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(de,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),f(de,"UPSTREAM_PROPERTIES",[...de.MUTABLE_UPSTREAM_PROPERTIES,...de.INMUTABLE_UPSTREAM_PROPERTIES]),f(de,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),f(de,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(de,"DOWNSTREAM_PROPERTIES",[...de.MUTABLE_DOWNSTREAM_PROPERTIES,...de.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(de,"PROPERTIES",[...de.META_PROPERTIES,...de.UPSTREAM_PROPERTIES,...de.DOWNSTREAM_PROPERTIES]);let R=de;var AP=(i=>(i.PersistChangeSet="persist-change-set",i.CreateSingle="create-single",i.CreateBulk="create-bulk",i.CreateSingleNested="create-single-nested",i.CreateBulkNested="create-bulk-nested",i.Update="update",i.Clone="clone",i.Delete="delete",i.Load="load",i.LoadNested="load-nested",i.LoadVersion="load-version",i))(AP||{});class DP extends qe{constructor(e){super(Rr,e);f(this,"id",He.Parallel);f(this,"name",He.Parallel);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",Rr);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=Rr.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=Rr.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=Rr.error?V(Rr.error,this.project):null}}class OP extends qe{constructor(e){super(St,e);f(this,"id",St.id);f(this,"name",St.name);f(this,"description",St.description);f(this,"version",St.version);f(this,"autoexecutable",!1);f(this,"initialData",St);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=St.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=St.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=St.error?V(St.error,this.project):null}}class PP extends qe{constructor(e){super(ti,e);f(this,"id",He.Sequential);f(this,"name",He.Sequential);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",ti);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=ti.inputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.outputs=ti.outputs.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.error=ti.error?V(ti.error,this.project):null}}class vJ extends qe{constructor(s){super(wa,s)}}class TJ extends qe{constructor(s){super(Xi,s)}}class EJ extends qe{constructor(e){super(Qi,e);f(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var r;return((r=t.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"get-entity-to-match-validate-data"))){let r=null;if(e.readsValue){const d=e.readsValue.getDataType(t);d&&d.entity&&d.entity.type===n.DefinitionEntity&&(r=d.entity)}const a=e.getDefaultValue();return!r&&a&&a.valueAsTypeSingle&&!Array.isArray(a.valueAsTypeSingle)&&a.valueAsTypeSingle.type===n.DefinitionEntity&&(r=a.valueAsTypeSingle),r}syncOperationInstance(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const r=[],a=[],d=[],o=[],l=this.getEntityToMatchInputMap(e);if(l){const{added:p,updated:v,removed:E,affected:P}=this.syncEntityToMatchInputMapDataType(l,t);r.push(...v),a.push(...p),d.push(...E),o.push(...P)}const c=this.getDataToValidateInputMap(e);if(c){const{added:p,updated:v,removed:E,affected:P}=this.syncDataToValidateInputMapDataType(c,t);r.push(...v),a.push(...p),d.push(...E),o.push(...P)}const h=this.getOutputDataOutputMap(e);if(h){const{added:p,updated:v,removed:E,affected:P}=this.syncOutputDataOutputMapDataType(h,t);r.push(...v),a.push(...p),d.push(...E),o.push(...P)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:u(r),added:u(a),removed:u(d),affected:u(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var c,h,p;const r=[],a=[],d=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==F.operation[Ke.Validate].inputs.entityToMatch.id)return t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const v={id:R.UUID.uuid(),version:"1",createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,like:!0,inferred:!0,parent:e.toReference()},E=V(v,e.project);E.setParent(e,t),E.initChildren(t),t==null||t.add(E,b.Added),r.push(E),e.setDataType(E)}(h=e.dataType)==null||h.metaSync({inferred:!0,like:!1,asType:!0},t);const l=this.getEntityToMatch(e,t);return(p=e.dataType)==null||p.setEntity(l),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var p,v,E;const r=[],a=[],d=[],o=[];if(((p=e.declaration)==null?void 0:p.id)!==F.operation[Ke.Validate].inputs.dataToValidate.id)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const P={id:R.UUID.uuid(),version:"1",createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=V(P,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,b.Added),r.push(w),e.setDataType(w)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var p,v,E;const r=[],a=[],d=[],o=[];if(((p=e.declaration)==null?void 0:p.id)!==F.operation[Ke.Validate].outputs.outputEntity.id)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const l=this.getEntityToMatchInputMap(e.parent);if(!l)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(l,t))return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const P={id:R.UUID.uuid(),version:"1",createdAt:"2024-01-01T00:00:00.000Z",author:"1",previousVersion:null,deleted:!1,type:n.DataType,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=V(P,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,b.Added),r.push(w),e.setDataType(w)}(v=e.dataType)==null||v.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(l,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&a.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:u(a),added:u(r),removed:u(d),affected:u(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var r,a;if(((r=e.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].inputs.entityToMatch.id){const{added:d,updated:o,removed:l,affected:c}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:u(o),added:u(d),removed:u(l),affected:u(c),self:e.dataType}}else if(((a=e.declaration)==null?void 0:a.id)===F.operation[Ke.Validate].inputs.dataToValidate.id){const{added:d,updated:o,removed:l,affected:c}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:u(o),added:u(d),removed:u(l),affected:u(c),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new A(this.project,"",T().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var r;if(((r=e.declaration)==null?void 0:r.id)===F.operation[Ke.Validate].outputs.outputEntity.id){const{added:a,updated:d,removed:o,affected:l}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:u(d),added:u(a),removed:u(o),affected:u(l),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class IJ extends qe{constructor(s){super(ul,s)}}class bJ extends qe{constructor(s){super(pl,s)}}class RJ extends qe{constructor(s){super(fl,s)}}class AJ extends qe{constructor(s){super(ks,s)}}class DJ extends qe{constructor(s){super(Ss,s)}}class OJ extends qe{constructor(s){super(Pa,s)}}function PJ(i){const s=[new PP(i),new DP(i),new OP(i),new vJ(i),new TJ(i),new EJ(i),new AJ(i),new IJ(i),new RJ(i),new bJ(i),new DJ(i),new OJ(i),new qe(ll,i),new qe(dl,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}class wP extends Yr{constructor(e){super(Ot,e);f(this,"initialData");f(this,"id",z.PERSISTED_ENTITY);f(this,"version","1");f(this,"name",z.PERSISTED_ENTITY);f(this,"description",Ot.description);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",Ot.abstract);f(this,"static",Ot.static);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=Ot,this.project=e,this.id=Ot.id,this.version=Ot.version,this.name=Ot.name,this.static=Ot.static,this.abstract=Ot.abstract,this.properties=this.initialData.properties.map(t=>{const r=V(t,this.project);return r.setParent(this,null),r.initChildren(null),r}),this.methods=this.initialData.methods.map(t=>{const r=V(t,this.project);return r.parent=this,r}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const r=V(t,this.project);return r.parent=this,r}),this.extends=this.initialData.extends.map(t=>V(t,this.project))}}function wJ(i){const s=[new wP(i),new Yr(Ma,i),new Yr(Mr,i),new Yr(so,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.builtInBaseEntities=s,s}function VJ(i){const s=[new fr(ne,i),new fr(Kr,i),new fr(me,i),new fr(At,i),new fr(Xr,i),new fr(gr,i),new fr(Qr,i),new fr($n,i)];return s.forEach(e=>{i.subscribeBuiltInInstance(e)}),i.primitives=s,s}function CJ(i){const s=[new qe(lo,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.globalEventActionDescriptors=s,s}function gJ(i){const s=[new qe(Ba,i),new qe(mi,i),new qe(Ca,i),new qe(Fn,i),new qe(xn,i),new qe(Ks,i)];s.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarations=s;const e=[new qe(to,i),new qe(ga,i),new qe(Qs,i),new qe(Pl,i),new qe(Vl,i),new qe(Xs,i)];return e.forEach(t=>{t.initChildren(null),i.subscribeBuiltInInstance(t)}),i.loopDeclarationsBodies=e,s}function BJ(i){const s=[new Fi(uo,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.valueDescriptors=s,s}function _J(i){const s=[new qe(an,i),new qe(Wn,i)];return s.forEach(e=>{e.initChildren(null),i.subscribeBuiltInInstance(e)}),i.operationDeclarations=s,s}const Mn={},Xd={};async function MJ(i,s={}){const e={...kA};return e.id=i.id,s.empty?{data:{id:i.id,type:n.Project,version:R.UUID.uuid(),createdAt:T().toISOString(),author:"1",previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]}}:{data:e}}function Jp(i){const s=new R(i);return VJ(s),wJ(s),PJ(s),CJ(s),gJ(s),BJ(s),_J(s),Array.from(new Set([...s.getAllBuiltInIds(),...Wr()])).forEach(t=>{!s.builtInInstances[t]&&s.instances[t]&&(s.builtInInstances[t]=s.instances[t],delete s.instances[t])}),s}function NJ(i,{enrich:s}={enrich:!0}){const e=new Map,t=Array.from(new Set([...i.getAllBuiltInIds(),...Wr()]));Object.keys(i.instances).forEach(c=>{if(t.includes(c)){e.set(c,c);return}const h=i.get(c);if(!Kd(h,{...i.instances,...i.builtInInstances}).every(E=>!t.includes(E))){e.set(c,c);return}e.set(c,R.UUID.uuid())});const r=T().toISOString(),a=i.toShallowJSON({seenEntityMaps:e});a.previousVersion=null,a.createdAt=r,a.version=R.UUID.uuid();const d=Jp(a),o=s?d.addChangeSet(new A(d,"",r,d)):null,l=new gp(i);return l.visit(c=>{const h=c.toShallowJSON({seenEntityMaps:e});h.previousVersion=null,h.createdAt=r,h.version=R.UUID.uuid();const p=V(h,d);p.hydrateAncestors(),p.addSelfToProject(o),o==null||o.add(p,b.Added)}),s&&(l.visit(c=>{const h=d.get(e.get(c.id));h&&h.afterAllChildrenInitialized(o)}),d.afterAllChildrenInitialized(o)),d.instancesList.forEach(c=>{c.previousVersion=null}),o==null||o.close(),d}function VP(i,{enrich:s}={enrich:!0}){const e=Jp(i),t=s?e.addChangeSet(new A(e,"",T().toISOString(),e)):null;t&&(t.type=hp.Automatic);const r=new gp(i);return r.visit(a=>{const d=V(a,e);d.hydrateAncestors(),d.addSelfToProject(t)}),s&&(r.visit(a=>{const d=e.get(a.id);d&&d.afterAllChildrenInitialized(t)}),e.afterAllChildrenInitialized(t)),t==null||t.close(),e}async function LJ(i,s={}){if(i.id&&Mn[i.id])return Mn[i.id];if(i.id&&Xd[i.id])return await Xd[i.id],Mn[i.id];const e=MJ(i,s);i.id&&(Xd[i.id]=e);const t=await e;if(t.data){const r=VP(t.data);return Mn[i.id]=r,i.id&&delete Xd[i.id],r}return null}function UJ(i){return Mn[i.id]&&delete Mn[i.id],null}const jJ="test_primitive_entities_export";y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Pp,y.ALL_BUILT_IN_BASE_ENTITIES=VE,y.ALL_BUILT_IN_CONDITION_ENTITIES=xE,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=ZE,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=nT,y.ALL_BUILT_IN_LOOP_ENTITIES=iT,y.ALL_BUILT_IN_OPERATION_ENTITIES=h0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=sf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=YE,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=WE,y.ActionDescriptorState=qe,y.ActionInputMapState=dq,y.ActionOutputMapState=cq,y.AppendToListOperationInputIds=yh,y.AppendToListOperationOutputIds=hh,y.ArgumentDeclarationDependencyField=eO,y.ArgumentDeclarationState=Si,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Rp,y.BUILT_IN_BASE_ENTITY_IDS=F,y.BUILT_IN_ENTITY_TYPES=hr,y.BaseCanvasDraggableState=uJ,y.BaseEntityNames=z,y.BaseState=lJ,y.BaseValueDescriptorIds=Gs,y.BreakStatementDependencyField=vp,y.BreakStatementState=Cn,y.BuiltInBaseEntityState=Yr,y.CACHED_PROJECTS_BY_ID=Mn,y.CALLABLE_ENTITIES_EXPLANATION=Eq,y.CALLABLE_TYPES=Vr,y.CALLER_ENTITIES_EXPLANATION=aO,y.CALLER_TYPES=Cr,y.CALLS_UPDATE_EXPLANATION=ki,y.COMPARISON_CONDITIONS=SE,y.CONDITIONS=FE,y.CUSTOM_ENTITY_OPERATIONS=Mm,y.CallableEntityClass=pJ,y.CallerEntityClass=qp,y.ChangeSet=A,y.ChangeSetChangeCaptureType=hp,y.ChangeSetEntityChangeType=b,y.ChildEntityState=cJ,y.ComparisonOperatorTypes=ct,y.ConditionDependencyField=Y1,y.ConditionState=Li,y.ContinueStatementDependencyField=mp,y.ContinueStatementState=$t,y.CreateNewInputIds=om,y.CreateNewOutputIds=dm,y.DRAGGABLE_CALLABLE_TYPES=rl,y.DRAGGABLE_CALLER_TYPES=Hp,y.DRAGGABLE_ELEMENT_TYPES=$s,y.DRAGGABLE_EXECUTABLE_TYPES=MP,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=js,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=tl,y.DataTypeCompatibilityTypes=Er,y.DataTypeDependencyField=Z1,y.DataTypeParentChildRelation=Rt,y.DataTypeState=wn,y.DefinitionEntityDependencyField=IP,y.DefinitionEntityState=zi,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=oJ,y.ENTITIES_WITH_VALLUES_EXPLANATION=Ld,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=L,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=Z,y.ENTITY_TYPES=NP,y.ENTITY_WITH_DECLARATION_TYPES=BP,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=mt,y.ENTITY_WITH_NAMES_TYPES=Kp,y.ENTITY_WITH_PARENT_TYPES=CP,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Yp,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=gP,y.ENTITY_WITH_VALUE_TYPES=Wp,y.ENTRY_POINT_ENTITIES_EXPLANATION=Ps,y.ENTRY_POINT_TYPES=at,y.EVENT_TYPES=jn,y.EXECUTABLE_TYPES=_P,y.EXECUTION_OPERATIONS=sm,y.EntityAction=AP,y.EntityError=hn,y.EntityErrorSeverity=D,y.EntityGenerationError=O,y.EntityGenerationErrorCode=I,y.EntityInstanceErrorCode=q,y.EntityOperations=Ke,y.EntityType=n,y.EntityWithLogicScopeClass=mJ,y.EntityWithValueClass=hJ,y.EntryPointEntityClass=fJ,y.ExecutionOperations=He,y.ExecutionTerminationType=J1,y.FunctionCallDependencyField=hO,y.FunctionCallState=qi,y.FunctionDeclarationDependencyField=k1,y.FunctionDeclarationState=_i,y.GLOBAL_EVENT_DECLARATIONS=kE,y.GetLastInListOperationInputIds=rh,y.GetLastInListOperationOutputIds=ih,y.GlobalEventNames=Hr,y.GlobalEventState=Vn,y.HTTPOperations=Ct,y.HTTP_OPERATIONS=f0,y.InputMapDependencyField=X1,y.InputMapState=kr,y.InstalledProjectState=Gi,y.InternalCallDependencyField=K1,y.InternalCallState=gn,y.JoinListOperationInputIds=Ry,y.JoinListOperationOutputIds=Ay,y.LIST_OPERATIONS=Vh,y.ListOperations=fe,y.LiteralValueDependencyField=tO,y.LiteralValueState=Bn,y.LoopDependencyField=W1,y.LoopState=Ni,y.LoopTypes=K,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Zi,y.NUMBER_OPERATIONS=Uf,y.NumberOperations=Xe,y.OPERATION_DECLARATIONS=y0,y.OperationDependencyField=q1,y.OperationState=Mi,y.OutputMapDependencyField=Q1,y.OutputMapParentChildRelation=Un,y.OutputMapState=Zr,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Ud,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=xi,y.PASS_THROUGH_CALLABLE_TYPES=nt,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=zp,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=Op,y.ParallelExecutionOperation=DP,y.PassThroughCallableEntityClass=yJ,y.PersistedEntity=wP,y.PersistedEntityMethods=sr,y.PrimitiveEntityState=fr,y.PrimitiveTypes=M,y.ProjectState=R,y.PropertyDependencyField=F1,y.PropertyState=gi,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=RP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Iq,y.ReturnDeclarationDependencyField=x1,y.ReturnDeclarationState=rr,y.ReturnStatementDependencyField=Bd,y.ReturnStatementState=Bi,y.STANDALONE_CONDITIONS=BE,y.STRING_OPERATIONS=by,y.ScopeCompatibilityType=Hd,y.SearchDependencyField=H1,y.SearchState=$i,y.SequentialExecutionOperation=PP,y.SequentialExecutionOperationInputIds=Wh,y.SequentialExecutionOperationOutputIds=Yh,y.SharedEntityErrorCode=j,y.SharedStateFunctionality=bP,y.SplitListOperationInputIds=$y,y.SplitListOperationOutputIds=Gy,y.StandaloneOperatorTypes=yr,y.StringOperations=Ee,y.TERMINATION_TYPES=st,y.Traverser=gp,y.USER_MANAGED_ENTITY_TYPES=Xp,y.UserManagedEntityStateTemplate=dJ,y.VALUE_READING_ENTITIES_EXPLANATION=Dp,y.VALUE_READING_TYPES=hi,y.VALUE_WRITING_ENTITIES_EXPLANATION=sO,y.VALUE_WRITING_TYPES=ht,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Ap,y.VARIABLE_TYPES=Qe,y.ValueAutogenerationType=yt,y.ValueDescriptorDependencyField=rO,y.ValueDescriptorParentChildRelation=_,y.ValueDescriptorState=Fi,y.ValueReadingEntityClass=yi,y.ValueWritingEntityClass=Ms,y.VariableDeclarationDependencyField=z1,y.VariableDeclarationState=ji,y.VariableInputMapState=oq,y.VariableInstanceDependencyField=Tp,y.VariableInstanceState=Ui,y.VariableOutputMapState=uq,y.WaitOperation=OP,y.WaitOperationInputIds=Sh,y.WaitOperationOutputIds=Fh,y.appendToListOperation=ks,y.appendToListOperationElementToAppendArgument=hl,y.appendToListOperationElementToAppendArgumentParentRef=Ah,y.appendToListOperationElementToAppendArgumentRef=Th,y.appendToListOperationError=wh,y.appendToListOperationErrorParentRef=Ph,y.appendToListOperationListArgument=yl,y.appendToListOperationListArgumentParentRef=Rh,y.appendToListOperationListArgumentRef=mh,y.appendToListOperationListDataType=vh,y.appendToListOperationResultListDataType=bh,y.appendToListOperationResultListReturn=Oh,y.appendToListOperationResultListReturnParentRef=Dh,y.appendToListOperationResultListReturnRef=Ih,y.appendToListOperationSecondListDataType=Eh,y.asGenerationActionExample=qr,y.booleanPrototype=Kr,y.capitalizeFirstLetter=Wt,y.changeSetJSONRecordToUniqueIds=$7,y.checkAreDataTypesCompatible=Ir,y.checkAreDefinitionEntitiesCompatibleAsDataType=V1,y.checkArePropertiesCompatibleAsDataType=w1,y.checkHasMetadataChanged=dt,y.checkIsBranchDependentButNotDirectlyOnBranch=Vs,y.checkIsBranchDependentOnBranch=Cq,y.checkIsCallableEntityReachable=_s,y.checkIsCanvasEntity=Yq,y.checkIsDetachedBranch=yP,y.checkIsDetachedBranchShallow=kp,y.checkIsGlobalVariable=qq,y.checkIsGloballyDeclared=xp,y.checkIsMethod=vP,y.checkIsNestedScope=zd,y.checkScopeCompatibility=Bs,y.cloneProject=NJ,y.countedLoopActionDescriptor=Ba,y.countedLoopActionDescriptorDynamicReturnDeclaration=zv,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=Yv,y.countedLoopActionDescriptorStringArgumentDeclaration=Wv,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=qv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=kv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=xv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=Zv,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=Jv,y.countedLoopBodyActionDescriptor=to,y.countedLoopBodyActionDescriptorAnyDynamicArgument=eT,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Qv,y.countedLoopBodyActionDescriptorAnyDynamicReturn=rT,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=tT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=gl,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Kv,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Hv,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Xv,y.createDefinitionEntityFromJSONObject=Fd,y.createEntityError=ye,y.createNestedDataTypeForEntity=TO,y.createNewInstanceOperation=Xi,y.createNewInstanceOperationEntityToInstanciateArgument=mm,y.createNewInstanceOperationEntityToInstanciateArgumentRef=fm,y.createNewInstanceOperationEntityToInstanciateDataType=ym,y.createNewInstanceOperationError=Im,y.createNewInstanceOperationErrorParentRef=Em,y.createNewInstanceOperationNewEntityDataArgument=pm,y.createNewInstanceOperationNewEntityDataArgumentDataType=cm,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=um,y.createNewInstanceOperationNewEntityDataArgumentParentRef=lm,y.createNewInstanceOperationOutputEntityDeclaration=Tm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=vm,y.createNewInstanceOperationRef=hm,y.createSemanticId=S1,y.createStateFromGenerationTargetType=sJ,y.createStateFromType=lt,y.createStateFromTypeAndSubscribe=V,y.cronJobBuiltInBaseEntity=so,y.cronJobBuiltInBaseEntityExpressionProperty=PE,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=FP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=DE,y.cronJobBuiltInBaseEntityRef=OE,y.cronJobTriggeredFunctionDeclarationBlueprint=Zl,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=RE,y.dataTypeCompatibilityToErrorExplanation=yO,y.datePrototype=gr,y.dateValueAutogenerationSchema=ic,y.definitionEntityToZodSchema=uI,y.deletePersistedEntityMethod=kl,y.deletePersistedEntityMethodParentRef=oE,y.deleteRootProject=UJ,y.endpointBuiltInBaseEntity=Ma,y.endpointBuiltInBaseEntityRef=dT,y.endpointBuiltInBaseEntityRefFour=kT,y.endpointBuiltInBaseEntityRefThree=vT,y.endpointBuiltInBaseEntityRefTwo=fT,y.endpointBuiltInCorsProperty=lT,y.endpointBuiltInCorsPropertyDataType=oT,y.endpointBuiltInCorsPropertyDataTypeRef=aT,y.endpointBuiltInCorsPropertyRef=sT,y.endpointBuiltInMethodProperty=_l,y.endpointBuiltInMethodPropertyDataType=mT,y.endpointBuiltInMethodPropertyDataTypeRef=yT,y.endpointBuiltInMethodPropertyRef=hT,y.endpointBuiltInPathProperty=Bl,y.endpointBuiltInPathPropertyDataType=pT,y.endpointBuiltInPathPropertyDataTypeRef=uT,y.endpointBuiltInPathPropertyRef=cT,y.endpointPathParamsArgumentDeclaration=Nl,y.endpointPathParamsArgumentDeclarationRef=wT,y.endpointPathParamsVariableDataType=VT,y.endpointPathParamsVariableDataTypeRef=PT,y.endpointReachedTriggerActionDescriptor=Sl,y.endpointReachedTriggerActionDescriptorRef=CT,y.endpointReachedTriggerActionDescriptorRefFour=_T,y.endpointReachedTriggerActionDescriptorRefThree=BT,y.endpointReachedTriggerActionDescriptorRefTwo=gT,y.endpointRequestBodyArgumentDeclaration=Ul,y.endpointRequestBodyArgumentDeclarationRef=bT,y.endpointRequestBodyVariableDataType=RT,y.endpointRequestHeadersArgumentDeclaration=Ml,y.endpointRequestHeadersArgumentDeclarationRef=ET,y.endpointRequestHeadersVariableDataType=IT,y.endpointRequestHeadersVariableDataTypeRef=TT,y.endpointRequestQueryParamsArgumentDeclaration=Ll,y.endpointRequestQueryParamsArgumentDeclarationRef=DT,y.endpointRequestQueryParamsVariableDataType=OT,y.endpointRequestQueryParamsVariableDataTypeRef=AT,y.endpointResponseBodyDataType=FT,y.endpointResponseBodyReturnDeclaration=Gl,y.endpointResponseBodyReturnDeclarationRef=ST,y.endpointResponseCodeDataType=NT,y.endpointResponseCodeReturnDeclaration=jl,y.endpointResponseCodeReturnDeclarationRef=MT,y.endpointResponseHeadersDataType=$T,y.endpointResponseHeadersDataTypeRef=UT,y.endpointResponseHeadersReturnDeclaration=$l,y.endpointResponseHeadersReturnDeclarationRef=jT,y.endpointReturnStatementRef=LT,y.endpointReturnStatementRefThree=xT,y.endpointReturnStatementRefTwo=GT,y.enrichFromKnownEntities=Cs,y.enumOptionsProperty=af,y.enumOptionsPropertyDataType=rf,y.enumOptionsPropertyDataTypeRef=ef,y.enumOptionsPropertyRef=tf,y.enumPrototype=Xr,y.enumPrototypeRef=nf,y.executionBuiltInBaseEntity=oo,y.executionBuiltInEntityAbortMethod=ql,y.executionBuiltInEntityAbortMethodParentRef=wE,y.filterOutDuplicateEntities=u,y.filterOutDuplicateErrors=Z9,y.findEntityFromKeys=Bp,y.findReferenceToSelfInList=MO,y.findReferencesToSelfInProject=$q,y.flattenActionDescriptor=NO,y.flattenArgumentDeclaration=LO,y.flattenBreakStatement=UO,y.flattenBuiltInBaseEntity=jO,y.flattenCalls=Jr,y.flattenCanvasAncestorsUntil=xd,y.flattenCondition=$O,y.flattenContinueStatement=GO,y.flattenDataType=FO,y.flattenDefinitionEntity=SO,y.flattenDefinitionEntityExtensionAndImplementationTypes=Gp,y.flattenDefinitionEntityExtensionTypes=Yd,y.flattenDefinitionEntityExtensions=jp,y.flattenDefinitionEntityImplementations=$p,y.flattenDefinitionEntityImplementionTypes=Wd,y.flattenDerivedCanvasEntities=ir,y.flattenDetachedBranch=mP,y.flattenElementCalls=it,y.flattenElementCallsOnTheSameScope=jq,y.flattenEntity=N,y.flattenFunctionCall=xO,y.flattenFunctionDeclaration=kO,y.flattenGlobalEvent=ZO,y.flattenInputMap=qO,y.flattenInstalledProject=JO,y.flattenInternalCall=WO,y.flattenLiteralValue=YO,y.flattenLoop=zO,y.flattenOperation=HO,y.flattenOutputMap=KO,y.flattenPrimitiveEntity=XO,y.flattenProject=QO,y.flattenProjectElements=_O,y.flattenProperty=eP,y.flattenRelatedCanvasElementsOnTheLeft=pP,y.flattenRelatedCanvasElementsOnTheRight=cP,y.flattenReturnDeclaration=tP,y.flattenReturnStatement=rP,y.flattenSearch=iP,y.flattenValueDescriptor=nP,y.flattenVariableDeclaration=aP,y.flattenVariableInstance=sP,y.flattenVariableReads=BO,y.flattenVariableWrites=gO,y.flattenVariables=We,y.fromChangeSetToRecordChangeSet=rJ,y.fromZodParseToEntityGenerationErrors=Ep,y.generate=qV,y.generateActionExample=bq,y.generateExecutionDataType=V7,y.generateIdFromStrategy=pt,y.generateMutablePropertiesExplanation=_d,y.generateRandomBoolean=jI,y.generateRandomDate=yI,y.generateRandomDateAfter=cI,y.generateRandomDateBefore=pI,y.generateRandomDateBetweenRange=fI,y.generateRandomNumber=_I,y.generateRandomNumberAfter=CI,y.generateRandomNumberBefore=gI,y.generateRandomNumberBetweenRange=BI,y.generateRandomText=UI,y.generateRandomTextAfter=MI,y.generateRandomTextBefore=NI,y.generateRandomTextBetweenRange=LI,y.generateUniqueUUID=VI,y.getAllActionDescriptorsForConditions=Gd,y.getAllActionDescriptorsForGlobalEvents=jd,y.getAllActionDescriptorsForLoops=$d,y.getAllActionDescriptorsForOperations=Oq,y.getAllBuiltInEntityIds=Wr,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=cO,y.getBaseBuiltInEntities=Wi,y.getBaseSchemaBasedOnType=iO,y.getBuiltInEntityOwner=Yi,y.getCallableEntityReferenceSchema=Dt,y.getCallableEntityTypeSchema=hD,y.getCalledBy=pr,y.getCallerEntityReferenceSchema=Y3,y.getCallerEntityTypeSchema=W3,y.getCalls=Np,y.getCanvasEntitiesDerivedFromInternalCalls=uP,y.getCanvasEntitiesDerivedFromWrites=Ra,y.getCanvasEntityDerivedFromValueReadingEntity=Jd,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=lP,y.getCanvasEntityReferenceSchema=c5,y.getCanvasEntityTypeSchema=u5,y.getChildrenEntityWithValues=Bq,y.getColumnProperties=Qq,y.getCommonAncestor=Mp,y.getCommonChildren=EO,y.getDatabaseEntities=Kq,y.getDatabaseEntity=eJ,y.getDeclaration=Pn,y.getDeepestScope=EP,y.getDefinitionEntityExtends=Aa,y.getDraggableCallableEntityReferenceSchema=vD,y.getDraggableCallableEntityTypeSchema=mD,y.getDraggableCallerEntityReferenceSchema=H3,y.getDraggableCallerEntityTypeSchema=z3,y.getDraggableExecutableEntityReferenceSchema=e5,y.getDraggableExecutableEntityTypeSchema=Q3,y.getDraggablePassThroughCallableEntityReferenceSchema=vd,y.getDraggablePassThroughCallableEntityTypeSchema=md,y.getDraggablePlayableEntityReferenceSchema=a5,y.getDraggablePlayableEntityTypeSchema=n5,y.getEntityArgumentDeclarations=Up,y.getEntityInputMaps=oP,y.getEntityOutputMaps=xq,y.getEntityReferenceSchema=l5,y.getEntityReturnDeclarations=dP,y.getEntityTypeSchema=d5,y.getEntityWithLogicScopeReferenceSchema=ui,y.getEntityWithLogicScopeTypeSchema=t5,y.getEntityWithValueReferenceSchema=yD,y.getEntityWithValueTypeSchema=J3,y.getEntryPointEntityReferenceSchema=bt,y.getEntryPointEntityTypeSchema=wi,y.getEventEntityReferenceSchema=yd,y.getEventEntityTypeSchema=fd,y.getExecutableEntityReferenceSchema=X3,y.getExecutableEntityTypeSchema=K3,y.getExtendedBuiltInEntity=kq,y.getExtendedDefinitionEntity=Sp,y.getGenerationTargetSchemaBasedOnType=nO,y.getHeadIfPartOfDetachedBranch=hP,y.getHighestScope=TP,y.getImplementedBuiltInEntity=Zq,y.getIsInteractive=Fp,y.getLastInListOperation=fl,y.getLastInListOperationError=fh,y.getLastInListOperationErrorParentRef=ph,y.getLastInListOperationInputListArgument=lh,y.getLastInListOperationInputListArgumentParentRef=dh,y.getLastInListOperationInputListArgumentRef=nh,y.getLastInListOperationInputListDataType=ah,y.getLastInListOperationOutputElementDataType=oh,y.getLastInListOperationOutputElementReturn=ch,y.getLastInListOperationOutputElementReturnParentRef=uh,y.getLastInListOperationOutputElementReturnRef=sh,y.getLinkedEntitiesFromArgumentDeclaration=Uq,y.getLowestPersistedEntityImplementation=fP,y.getParentCallableEntity=IO,y.getParentCallerEntity=RO,y.getParentCanvasEntities=Yt,y.getParentCanvasEntity=wt,y.getParentCanvasEntityFromTransfer=kd,y.getParentEntryPoint=gq,y.getParentPassthroughCallableEntity=bO,y.getPassThroughCallableEntityReferenceSchema=et,y.getPassThroughCallableEntityTypeSchema=hd,y.getPeristedEntities=Hq,y.getPlayableEntityReferenceSchema=i5,y.getPlayableEntityTypeSchema=r5,y.getProject=LJ,y.getPrototypeByType=gs,y.getRecusriveParentsIds=Kd,y.getReferenceEntityId=g,y.getReferencedEntitiesStateOrErrors=Nd,y.getReferencedEntityStateOrErrors=Ip,y.getReferencedIds=qd,y.getRelatedCanvasElementsOnTheLeft=_n,y.getRelatedCanvasElementsOnTheLeftFromTransfer=Gq,y.getRelatedCanvasElementsOnTheRight=Ji,y.getRootEntryPointScopeOwner=Zp,y.getScopeOwner=zt,y.getStateClassFromType=tJ,y.getTerminationReferenceSchema=o5,y.getTerminationTypeSchema=s5,y.getUsedArgFromDeclaration=Sq,y.getUsedReturnFromDeclaration=Fq,y.getValueReadingEntityReferenceSchema=fD,y.getValueReadingEntityTypeSchema=li,y.getValueWritingEntityReferenceSchema=q3,y.getValueWritingEntityTypeSchema=ms,y.getVariableFromInputMapping=DO,y.getVariableFromReturnVariablePointer=wO,y.getVariableReferenceSchema=Pi,y.getVariableTypeSchema=In,y.getVariablesFromArgumentDeclarations=Zd,y.getVariablesFromInputMaps=OO,y.getVariablesFromOutputMapping=VO,y.getVariablesFromOutputMaps=CO,y.getVariablesFromReturnDeclarations=PO,y.getVariablesInSameOrHigherScope=dp,y.getWrites=Lp,y.groupCallsBasedOnParallelizableExecution=Mq,y.handleAfterEntityImplementationSideEffects=vO,y.handleBeforeEntityImplementationSideEffects=mO,y.httpRequestBodyArgument=Ws,y.httpRequestBodyArgumentRef=Jm,y.httpRequestBodyDataType=Wm,y.httpRequestHeadersArgument=Js,y.httpRequestHeadersArgumentRef=Zm,y.httpRequestHeadersDataType=qm,y.httpRequestMethodArgument=Zs,y.httpRequestMethodArgumentRef=xm,y.httpRequestMethodDataType=km,y.httpRequestMethodDataTypeRef=Sm,y.httpRequestOperation=wa,y.httpRequestOperationErrorValueDescriptor=bl,y.httpRequestOperationErrorValueDescriptorDatatype=p0,y.httpRequestOperationErrorValueDescriptorRef=c0,y.httpRequestOperationRef=o0,y.httpRequestOperationRefEight=l0,y.httpRequestOperationRefFive=a0,y.httpRequestOperationRefFour=n0,y.httpRequestOperationRefNine=u0,y.httpRequestOperationRefSeven=d0,y.httpRequestOperationRefSix=s0,y.httpRequestOperationRefThree=i0,y.httpRequestOperationRefTwo=r0,y.httpRequestQueryParamsArgument=Il,y.httpRequestQueryParamsArgumentRef=$m,y.httpRequestQueryParamsDataType=Gm,y.httpRequestVariableURLArgument=qs,y.httpRequestVariableURLArgumentRef=Um,y.httpRequestVariableURLDataType=jm,y.httpRequestVariableURLDataTypeRef=Nm,y.httpResponseBodyReturnDataType=t0,y.httpResponseBodyReturnDataTypeRef=Qm,y.httpResponseBodyReturnReturn=Hs,y.httpResponseBodyReturnReturnRef=e0,y.httpResponseCodeDataType=zm,y.httpResponseCodeReturn=Ys,y.httpResponseCodeReturnRef=Ym,y.httpResponseHeadersDataType=Xm,y.httpResponseHeadersDataTypeRef=Hm,y.httpResponseHeadersReturn=zs,y.httpResponseHeadersReturnRef=Km,y.implement=Sd,y.inferArgumentDeclarationDataType=C1,y.inferDataType=xr,y.inferInputMapDataType=ap,y.inferOutputMapDataType=op,y.inferPropertyDataType=_1,y.inferReturnDeclarationDataType=sp,y.inferValueDescriptorDataType=M1,y.inferVariableDeclarationDataType=B1,y.inferVariableInstanceDataType=g1,y.initBaseProjectEntity=Jp,y.initProject=VP,y.isPromise=Cp,y.iterateOverListActionDescriptorListArgumentDeclaration=J0,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=Z0,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=k0,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=q0,y.iterateOverListLoopActionDescriptor=mi,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=Y0,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=W0,y.iterateOverListLoopBodyActionDescriptor=ga,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=iv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=rv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=av,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=nv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=eo,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=H0,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=z0,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=K0,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=tv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Q0,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=X0,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=ev,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=uv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=dv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=ov,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=lv,y.iterateOverObjectKeysLoopActionDescriptor=Fn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=pv,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=cv,y.iterateOverObjectKeysLoopBodyActionDescriptor=Pl,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=bv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Iv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=Av,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=Rv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Ol,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=yv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=fv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=hv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Ev,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=vv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=mv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Tv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=Vv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=Pv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=Ov,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=wv,y.iterateOverObjectValuesLoopActionDescriptor=xn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=gv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=Cv,y.iterateOverObjectValuesLoopBodyActionDescriptor=Vl,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=Gv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=$v,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=Fv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Sv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=wl,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=_v,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Bv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Mv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=jv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Lv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Nv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Uv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=B0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=g0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=C0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=w0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=P0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=V0,y.iterateOverStringLoopActionDescriptor=Ca,y.iterateOverStringLoopBodyActionDescriptor=Qs,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=G0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=$0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=F0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=S0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Al,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=M0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=_0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=N0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Dl,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=U0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=L0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=j0,y.joinListOperation=ul,y.joinListOperationError=jy,y.joinListOperationErrorParentRef=Uy,y.joinListOperationFirstListArgument=By,y.joinListOperationFirstListArgumentParentRef=gy,y.joinListOperationFirstListArgumentRef=Dy,y.joinListOperationFirstListDataType=Oy,y.joinListOperationResultListDataType=Cy,y.joinListOperationResultListReturn=Ly,y.joinListOperationResultListReturnParentRef=Ny,y.joinListOperationResultListReturnRef=Vy,y.joinListOperationSecondListArgument=My,y.joinListOperationSecondListArgumentParentRef=_y,y.joinListOperationSecondListArgumentRef=Py,y.joinListOperationSecondListDataType=wy,y.joinListWithLastSeparator=ie,y.joinStringsOperation=Pa,y.joinStringsOperationDynamicStringArgument=iy,y.joinStringsOperationDynamicStringArgumentParentRef=ry,y.joinStringsOperationDynamicStringArgumentRef=ey,y.joinStringsOperationDynamicStringDataType=ty,y.joinStringsOperationError=Qf,y.joinStringsOperationErrorParentRef=Xf,y.joinStringsOperationFirstStringArgument=Fs,y.joinStringsOperationFirstStringArgumentParentRef=kf,y.joinStringsOperationFirstStringArgumentRef=jf,y.joinStringsOperationFirstStringDataType=$f,y.joinStringsOperationResultStringDataType=xf,y.joinStringsOperationResultStringReturn=Oa,y.joinStringsOperationResultStringReturnParentRef=Kf,y.joinStringsOperationResultStringReturnRef=Ff,y.joinStringsOperationSecondStringArgument=xs,y.joinStringsOperationSecondStringArgumentParentRef=Hf,y.joinStringsOperationSecondStringArgumentRef=Gf,y.joinStringsOperationSecondStringDataType=Sf,y.joinStringsOperationSeparatorStringArgument=zf,y.joinStringsOperationSeparatorStringArgumentParentRef=Yf,y.joinStringsOperationSeparatorStringArgumentRef=Zf,y.joinStringsOperationSeparatorStringDataType=Wf,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=Jf,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=qf,y.keyValuePrototype=$n,y.lowercaseFirstLetter=Od,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=Rl,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=E0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=T0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=I0,y.manualFlowLoopActionDescriptor=Ks,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=v0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=m0,y.manualFlowLoopBodyActionDescriptor=Xs,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=R0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=b0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=D0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=A0,y.mapActionDescriptorToTypeItRepresents=zq,y.mergeEntityErrorsList=q9,y.mergeListOfEntities=Jq,y.methodDefaultValue=Fm,y.mockClientProject=kA,y.moreThanOrEqualCondition=Wn,y.moreThanOrEqualConditionLeftHandArgument=LE,y.moreThanOrEqualConditionLeftHandArgumentDataType=ME,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=_E,y.moreThanOrEqualConditionLeftHandArgumentParentRef=NE,y.moreThanOrEqualConditionRightHandArgument=GE,y.moreThanOrEqualConditionRightHandArgumentDataType=jE,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=UE,y.moreThanOrEqualConditionRightHandArgumentParentRef=$E,y.notEmptyCondition=an,y.notEmptyConditionArgument=gE,y.notEmptyConditionRef=CE,y.nullPrototype=Qp,y.numberAdditionOperation=Ss,y.numberAdditionOperationDynamicSummandArgument=Ef,y.numberAdditionOperationDynamicSummandArgumentType=Tf,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=vf,y.numberAdditionOperationError=mf,y.numberAdditionOperationErrorParentRef=hf,y.numberAdditionOperationFirstNumberArgument=il,y.numberAdditionOperationFirstNumberArgumentRef=of,y.numberAdditionOperationFirstNumberDataType=df,y.numberAdditionOperationRef=ff,y.numberAdditionOperationRefThree=al,y.numberAdditionOperationRefTwo=yf,y.numberAdditionOperationResultNumberDataType=pf,y.numberAdditionOperationResultNumberReturn=sl,y.numberAdditionOperationResultNumberReturnRef=cf,y.numberAdditionOperationSecondNumberArgument=nl,y.numberAdditionOperationSecondNumberArgumentRef=lf,y.numberAdditionOperationSecondNumberDataType=uf,y.numberPrototype=me,y.numberSubtractionOperation=dl,y.numberSubtractionOperationDynamicSubtrahendArgument=Lf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=Nf,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Mf,y.numberSubtractionOperationError=_f,y.numberSubtractionOperationErrorParentRef=Bf,y.numberSubtractionOperationFirstNumberArgument=Pf,y.numberSubtractionOperationFirstNumberArgumentRef=If,y.numberSubtractionOperationFirstNumberDataType=bf,y.numberSubtractionOperationRef=ol,y.numberSubtractionOperationRefThree=Cf,y.numberSubtractionOperationRefTwo=wf,y.numberSubtractionOperationResultNumberDataType=Of,y.numberSubtractionOperationResultNumberReturn=gf,y.numberSubtractionOperationResultNumberReturnRef=Df,y.numberSubtractionOperationSecondNumberArgument=Vf,y.numberSubtractionOperationSecondNumberArgumentRef=Rf,y.numberSubtractionOperationSecondNumberDataType=Af,y.numberValueAutogenerationSchema=rc,y.parallelExecutionOperation=Rr,y.parallelExecutionOperationError=Gh,y.parallelExecutionOperationErrorParentRef=$h,y.parallelExecutionOperationListOfExecutionResultsDataType=Lh,y.parallelExecutionOperationListOfExecutionResultsReturn=vl,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Nh,y.parallelExecutionOperationListOfFunctionsArgument=ml,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=Mh,y.parallelExecutionOperationListOfFunctionsArgumentRef=_h,y.parallelExecutionOperationListOfFunctionsBlueprint=Bh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=gh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=Ch,y.parallelExecutionOperationRef=Uh,y.parallelExecutionOperationRefThree=jh,y.persistedBuiltInBaseEntity=Ot,y.persistedBuiltInBaseEntityDatabaseProperty=Zn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=uE,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=GP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=cE,y.persistedBuiltInBaseEntityDatabasePropertyRef=lE,y.persistedBuiltInBaseEntityPrimaryKeyProperty=qn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=EE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=fE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=pE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=IE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=TE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=hE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=yE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=vE,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=mE,y.processOutputGlobalValueDescriptorDataType=JE,y.processOutputGlobalValueDescriptorReturn=uo,y.processOutputGlobalValueDescriptorReturnRef=qE,y.projectPublicationCompletedGlobalEvent=lo,y.propertyToZodSchema=lI,y.relationalDatabaseBuiltInBaseEntity=Mr,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=xl,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=aE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=nE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=sE,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=iE,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=Fl,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=rE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=eE,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=tE,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=ro,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=JT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=ZT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=qT,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=ao,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=QT,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=KT,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=XT,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=no,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=HT,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=$P,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=zT,y.relationalDatabaseBuiltInBaseEntityRef=kn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=io,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=YT,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=jP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=WT,y.resolveActionDescriptorName=G1,y.resolveBaseEntityName=L1,y.resolveBuiltInBaseEntityDataTypeLabel=U1,y.resolveClonedEntityProject=ft,y.resolveConditionOperatorLabel=Cd,y.resolveDataType=Pd,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=_p,y.resolveDataTypeLabel=Vd,y.resolveDefinitionEntityDataTypeLabel=M7,y.resolveEntityDataTypeLabel=_7,y.resolveEntityName=G,y.resolveFirstCallsSecond=Nq,y.resolveFirstWritesSecond=Lq,y.resolvePrimaryKeyProperty=Xq,y.resolvePrimitiveEntityName=$1,y.resolveSearchName=j1,y.resolveVariableScope=C7,y.sequentialExecutionOperation=ti,y.sequentialExecutionOperationError=am,y.sequentialExecutionOperationErrorParentRef=nm,y.sequentialExecutionOperationListOfExecutionResultsDataType=tm,y.sequentialExecutionOperationListOfExecutionResultsReturn=El,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=im,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=em,y.sequentialExecutionOperationListOfFunctionsArgument=Tl,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=Qh,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=rm,y.sequentialExecutionOperationListOfFunctionsArgumentRef=Xh,y.sequentialExecutionOperationListOfFunctionsBlueprint=Kh,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=Hh,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=zh,y.softDeletePersistedEntityMethod=SP,y.softDeletePersistedEntityMethodParentRef=bE,y.sortCallsBasedOnExecutionDependencies=AO,y.sortChildrenEntitiesBasedOnExecutionDependencies=_q,y.splitListOperation=pl,y.splitListOperationError=th,y.splitListOperationErrorParentRef=eh,y.splitListOperationFirstOutputListDataType=Zy,y.splitListOperationFirstOutputListReturn=Hy,y.splitListOperationFirstOutputListReturnParentRef=zy,y.splitListOperationFirstOutputListReturnRef=cl,y.splitListOperationInputListArgument=Jy,y.splitListOperationInputListArgumentParentRef=qy,y.splitListOperationInputListArgumentRef=Sy,y.splitListOperationInputListDataType=Fy,y.splitListOperationSecondOutputListDataType=Ky,y.splitListOperationSecondOutputListReturn=Qy,y.splitListOperationSecondOutputListReturnParentRef=Xy,y.splitListOperationSplitIndexArgument=Yy,y.splitListOperationSplitIndexArgumentParentRef=Wy,y.splitListOperationSplitIndexArgumentRef=xy,y.splitListOperationSplitIndexDataType=ky,y.splitStringOperation=ll,y.splitStringOperationError=Iy,y.splitStringOperationErrorParentRef=Ey,y.splitStringOperationFirstPartResultStringDataType=ly,y.splitStringOperationFirstPartResultStringReturn=Ty,y.splitStringOperationFirstPartResultStringReturnParentRef=vy,y.splitStringOperationFirstPartResultStringReturnRef=dy,y.splitStringOperationIndexArgument=hy,y.splitStringOperationIndexArgumentParentRef=yy,y.splitStringOperationIndexArgumentRef=sy,y.splitStringOperationIndexDataType=oy,y.splitStringOperationSecondPartResultStringDataType=cy,y.splitStringOperationSecondPartResultStringReturn=LP,y.splitStringOperationSecondPartResultStringReturnParentRef=my,y.splitStringOperationSecondPartResultStringReturnRef=uy,y.splitStringOperationStringArgument=fy,y.splitStringOperationStringArgumentParentRef=py,y.splitStringOperationStringArgumentRef=ny,y.splitStringOperationStringDataType=ay,y.stringPrototype=ne,y.stringValueAutogenerationSchema=tc,y.suggestNewIdForEntity=yp,y.test_primitive_entities_export=jJ,y.toCamelCase=g7,y.toEntityState=nr,y.toKebabCase=N1,y.toLowerCaseKebabCase=wd,y.toPascalCase=B7,y.untypedDataPrototype=At,y.updateErrorsList=Ye,y.updateValueReader=Wq,y.urlDefaultValue=Lm,y.uuidPrototype=Qr,y.validateArgumentDeclarationName=pp,y.validateCalledByErrorIdInAction=Aq,y.validateCalledByIdInAction=Rq,y.validateCallers=uO,y.validateConditionEntityDeclaration=Pq,y.validateDataOperation=Qi,y.validateDataOperationDataToValidateArgument=Dm,y.validateDataOperationDataToValidateArgumentParentRef=Am,y.validateDataOperationDataToValidateArgumentRef=bm,y.validateDataOperationDataToValidateDataType=Rm,y.validateDataOperationEntityToMatchTypeArgument=Vm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=wm,y.validateDataOperationEntityToMatchTypeArgumentRef=Om,y.validateDataOperationEntityToMatchTypeDataType=Pm,y.validateDataOperationError=_m,y.validateDataOperationErrorParentRef=Bm,y.validateDataOperationOutputEntityDeclaration=gm,y.validateDataOperationOutputEntityDeclarationParentRef=Cm,y.validateDefinitionEntityName=gd,y.validateEntryCaller=lO,y.validateErrorCaller=dO,y.validateFunctionCallDeclaration=pO,y.validateFunctionDeclarationName=lp,y.validateGeneratedEntityParentIsNotBuiltInEntity=Tq,y.validateGeneration=mq,y.validateGenerationTarget=ot,y.validateGenerationUpdate=vq,y.validateLoopEntityDeclaration=wq,y.validateName=N7,y.validateOperationEntityDeclaration=fO,y.validatePropertyName=cp,y.validateReachability=fi,y.validateReadsValueInActionPayload=Dq,y.validateReferenceObject=Md,y.validateReferenceToOne=bp,y.validateReferences=Et,y.validateReturnDeclarationName=fp,y.validateSuccessCaller=oO,y.validateValueReaderGenerationUpdate=ws,y.validateValueWritter=wp,y.validateVariableDeclarationName=up,y.validateVariableInternalCallUse=Vp,y.valueAutogenerationCurrentDateAndTimeSchema=JA,y.valueAutogenerationGenericSchema=Xo,y.valueAutogenerationOptions=nc,y.valueAutogenerationOptionsSchema=qA,y.valueAutogenerationRandomBooleanSchema=ec,y.valueAutogenerationRandomDateBetweenSchema=tD,y.valueAutogenerationRandomDateFromSchema=QA,y.valueAutogenerationRandomDateSchema=td,y.valueAutogenerationRandomDateUntilSchema=eD,y.valueAutogenerationRandomNumberBetweenSchema=zA,y.valueAutogenerationRandomNumberFromSchema=WA,y.valueAutogenerationRandomNumberSchema=Qo,y.valueAutogenerationRandomNumberUntilSchema=YA,y.valueAutogenerationRandomSchema=ls,y.valueAutogenerationRandomTextBetweenSchema=XA,y.valueAutogenerationRandomTextFromSchema=HA,y.valueAutogenerationRandomTextSchema=ed,y.valueAutogenerationRandomTextUntilSchema=KA,y.valueAutogenerationRangeValueTypesSchema=ds,y.valueAutogenerationUniqueSchema=Qu,y.waitOperation=St,y.waitOperationMillisecondsNumberArgument=Ki,y.waitOperationMillisecondsNumberArgumentRef=xh,y.waitOperationMillisecondsNumberDataType=kh,y.waitOperationOperationError=Jh,y.waitOperationOperationErrorParentRef=qh,y.waitOperationRef=Zh,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});