@elyx-code/project-logic-tree 0.0.6200 → 0.0.6201

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -64144,6 +64144,9 @@ Alternatively you can update the parent data-type entity with 'update' action to
64144
64144
  modifiedData: r
64145
64145
  };
64146
64146
  }
64147
+ get interactive() {
64148
+ return this.implements.length ? this.implements.every((e) => e.interactive) : !0;
64149
+ }
64147
64150
  // Returns the properties that are not abstract from the entities extended by this entity
64148
64151
  get allBasePropertiesFromExtendedAndImplementedEntities() {
64149
64152
  return p([
@@ -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=[],i=[],s=[];return Object.values(this.detachedDependents).forEach(l=>{const o=l.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),i.push(...o.removed),s.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];if(t==="declaration"){const{updated:u,added:h,removed:c}=this.remove({ignoreUpstream:!1},i);s.push(...u),l.push(...h),o.push(...c)}if(t==="parent"){const{updated:u,added:h,removed:c}=this.remove({ignoreUpstream:!1},i);s.push(...u),l.push(...h),o.push(...c)}return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];if(t==="declaration"){const{updated:u,added:h,removed:c}=this.restore({},i);s.push(...u),l.push(...h),o.push(...c)}if(t==="parent"){const{updated:u,added:h,removed:c}=this.restore({},i);s.push(...u),l.push(...h),o.push(...c)}return{updated:p(s),added:p(l),removed:p(o),affected:p(d),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=m.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new qe(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[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=[],i=[],s=[],l=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[I,E]of c.knownVersions)u.set(I,E);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new qe(u,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:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent){const l=B(this.initialData.parent),o=this.project.get(l);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.declaration){const l=B(this.initialData.declaration),o=this.project.get(l);o&&(this.setDeclaration(o),e.push(o))}return this.initialData.calledByEntry.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addEntryCaller(d,null),e.push(d))}),this.initialData.calledBySuccess.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addSuccessCaller(d,null),e.push(d))}),this.initialData.calledByError.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addErrorCaller(d,null),e.push(d))}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],l=[];this.initialized=!0,this.captureVersion();const{updated:o,added:d,removed:u}=this.syncMissingFixedInputs(e),{updated:h,added:c,removed:I}=this.syncMissingFixedOutputs(e);return t.push(...o,...h),i.push(...d,...c),s.push(...u,...I),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-self-to-project"))){var o;const t=[this],i=[],s=[],l=[];return this.parent===this.project&&this.project.addFunctionCall(this),(o=this.process)==null||o.writesValues.forEach(d=>{d.setValueWriter(this.process,e),t.push(d)}),this.successCalls.forEach(d=>{d.addSuccessCaller(this,e),t.push(d)}),this.errorCalls.forEach(d=>{d.addErrorCaller(this,e),t.push(d)}),this.calledBySuccess.forEach(d=>{d.addSuccessCall(this,e),t.push(d)}),this.calledByError.forEach(d=>{d.addErrorCall(this,e),t.push(d)}),this.calledByEntry.forEach(d=>{d.addCall(this,e),t.push(d)}),this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-input"))){const i=this.inputs.findIndex(s=>s.id===e.id);return i>-1&&(this.inputs.splice(i,1),t&&(t==null||t.add(this,A.Affected))),t==null||t.attemptAutoclose("remove-input",this.id),this}addInput(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-input"))){return this.inputs.includes(e)?(t==null||t.attemptAutoclose("add-input",this.id),this):(this.inputs.push(e),t==null||t.add(this,A.Affected),t==null||t.attemptAutoclose("add-input",this.id),this)}addOutput(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-output"))){return this.outputs.includes(e)?(t==null||t.attemptAutoclose("add-output",this.id),this):(this.outputs.push(e),t==null||t.add(this,A.Affected),t==null||t.attemptAutoclose("add-output",this.id),this)}removeOutput(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-output"))){const i=this.outputs.findIndex(s=>s.id===e.id);return i>-1&&(this.outputs.splice(i,1),t&&(t==null||t.add(this,A.Affected))),t==null||t.attemptAutoclose("remove-output",this.id),this}addValueReader(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-value-reader"))){var i;return this.process&&!this.process.writesValues.includes(e)&&((i=this.process)==null||i.addValueReader(e,t),t==null||t.add(this,A.Affected)),t==null||t.attemptAutoclose("add-value-reader",this.id),this}removeValueReader(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-value-reader"))){var i;return this.process&&this.process.writesValues.includes(e)&&((i=this.process)==null||i.removeValueReader(e,t),t==null||t.add(this,A.Affected)),t==null||t.attemptAutoclose("remove-value-reader",this.id),this}addSuccessCaller(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-success-caller")),i=!1){return this.calledBySuccess.find(s=>s.id===e.id)||(this.calledBySuccess.push(e),t==null||t.add(this,A.Updated),i&&K(this,t)),t==null||t.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-error-caller")),i=!1){return this.calledByError.find(s=>s.id===e.id)||(this.calledByError.push(e),t==null||t.add(this,A.Updated),i&&K(this,t),t==null||t.attemptAutoclose("add-error-caller",this.id)),this}addEntryCaller(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-entry-caller")),i=!1){return this.calledByEntry.find(s=>s.id===e.id)||(this.calledByEntry.push(e),t==null||t.add(this,A.Updated),i&&K(this,t),t==null||t.attemptAutoclose("add-entry-caller",this.id)),this}addErrorCall(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-error-call")),i=!1){return this.errorCalls.find(s=>s.id===e.id)||(this.errorCalls.push(e),i&&K(this,t),t==null||t.add(this,A.Affected)),t==null||t.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-success-call")),i=!1){return this.successCalls.find(s=>s.id===e.id)||(this.successCalls.push(e),i&&K(this,t),t==null||t.add(this,A.Affected)),t==null||t.attemptAutoclose("add-success-call",this.id),this}removeCall(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-call")),i=!1){const s=this.successCalls.findIndex(o=>o.id===e.id);s>-1&&(this.successCalls.splice(s,1),t==null||t.add(this,A.Affected));const l=this.errorCalls.findIndex(o=>o.id===e.id);return l>-1&&(this.errorCalls.splice(l,1),t==null||t.add(this,A.Affected)),i&&K(this,t),t==null||t.attemptAutoclose("remove-call",this.id),this}removeCaller(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-caller")),i=!1){return this.calledBySuccess=this.calledBySuccess.filter(s=>s.id!==e.id?(t&&(t==null||t.add(this,A.Updated),t==null||t.add(s,A.Affected)),!0):!1),this.calledByError=this.calledByError.filter(s=>s.id!==e.id?(t&&(t==null||t.add(this,A.Updated),t==null||t.add(s,A.Affected)),!0):!1),this.calledByEntry=this.calledByEntry.filter(s=>s.id!==e.id?(t&&(t==null||t.add(this,A.Updated),t==null||t.add(s,A.Affected)),!0):!1),i&&K(this,t),t==null||t.attemptAutoclose("remove-caller",this.id),this}setParent(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,A.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}setDeclaration(e){return this.declaration=e,this}initChildren(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,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=C(this.initialData.declaration,this.project);this.declaration=t}else{const t=B(this.initialData.declaration),i=this.project.get(t);this.declaration=i}return this.successCalls=this.initialData.successCalls.map(t=>{const i=C(t,this.project);return i.addSuccessCaller(this),[n.BreakStatement,n.ContinueStatement].includes(i.type)?(i.setParent(this.parent.parent,null),i.initChildren(e)):i.type!==n.InternalCall&&(i.setParent(this.parent,null),i.initChildren(e)),i}),this.errorCalls=this.initialData.errorCalls.map(t=>{const i=C(t,this.project);return i.addErrorCaller(this),[n.BreakStatement,n.ContinueStatement].includes(i.type)?(i.setParent(this.parent.parent,null),i.initChildren(e)):i.type!==n.InternalCall&&(i.setParent(this.parent,null),i.initChildren(e)),i}),this.inputs=this.initialData.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.initialData.process&&(this.process=C(this.initialData.process,this.project),this.process.setParent(this,null),this.process.initChildren(e)),this.initialData.error&&(this.error=C(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.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"meta-sync"))){const i=ut(this,e),s=this.toMeta();return this.x=e.x||s.x,this.y=e.y||s.y,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await qe.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await qe.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await qe.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await qe.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await qe.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await qe.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-entity"))){var d;const i=[],s=[],l=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(s.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(u=>{const{updated:h,removed:c,added:I}=u.entity.onDetachedDependencyRemoved(this,u.field,t);i.push(...h),s.push(...c),l.push(...I)}),this.process){const{updated:u,removed:h}=(d=this.process)==null?void 0:d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}if(this.inputs.forEach(u=>{const{updated:h,removed:c}=u.remove({ignoreUpstream:!0},t);i.push(...h),s.push(...c)}),this.outputs.forEach(u=>{const{updated:h,removed:c}=u.remove({ignoreUpstream:!0},t);i.push(...h),s.push(...c)}),this.error){const{updated:u,removed:h}=this.error.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}return this.successCalls.forEach(u=>{i.push(u),u.removeCaller(this,t)}),this.errorCalls.forEach(u=>{i.push(u),u.removeCaller(this,t)}),e||this.calledBy.forEach(u=>{i.push(u),u.removeCall(this,t)}),t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(l),updated:p(i),removed:p(s),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],l=[];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);i.push(...o)}return this.inputs.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.outputs.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.successCalls.forEach(o=>{i.push(o),o.addSuccessCaller(this,e)}),this.errorCalls.forEach(o=>{i.push(o),o.addErrorCaller(this,e)}),this.calledBySuccess.forEach(o=>{i.push(o),o.addSuccessCall(this,e)}),this.calledByError.forEach(o=>{i.push(o),o.addErrorCall(this,e)}),this.calledByEntry.forEach(o=>{i.push(o),o.addCall(this,e)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(l),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.successCalls.flatMap(i=>i.toFlat(e)),...this.errorCalls.flatMap(i=>i.toFlat(e)),...this.inputs.flatMap(i=>i.toFlat(e)),...this.outputs.flatMap(i=>i.toFlat(e)),...this.process?this.process.toFlat(e):[],...this.error?this.error.toFlat(e):[],...this.calledBy.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.successCalls.flatMap(i=>i.toFlatIds(e)),...this.errorCalls.flatMap(i=>i.toFlatIds(e)),...this.inputs.flatMap(i=>i.toFlatIds(e)),...this.outputs.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type}}toJSON(e=new Set){var t,i;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(s=>s.toJSON(e)),errorCalls:this.errorCalls.map(s=>s.toJSON(e)),calledBySuccess:this.calledBySuccess.map(s=>s.toReference()),calledByError:this.calledByError.map(s=>s.toReference()),calledByEntry:this.calledByEntry.map(s=>s.toReference()),process:(t=this.process)==null?void 0:t.toJSON(e),declaration:this.declaration.toJSON(e),inputs:this.inputs.map(s=>s.toJSON(e)),outputs:this.outputs.map(s=>s.toJSON(e)),parent:this.parent.toReference(),error:(i=this.error)==null?void 0:i.toJSON(e)})}toJSONClone(e=q){var i,s,l,o,d,u,h;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||yt(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(l=e.seenEntities)!=null&&l.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(d=e.seenEntities)==null||d.add(this.id),{id:t,version:m.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(c=>c.toJSONClone({...e,newId:null})),errorCalls:this.errorCalls.map(c=>c.toJSONClone({...e,newId:null})),calledBySuccess:this.calledBySuccess.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),calledByError:this.calledByError.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),calledByEntry:this.calledByEntry.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),process:(u=this.process)==null?void 0:u.toJSONClone({...e,newId:null}),declaration:this.declaration.toJSONClone({...e,newId:null}),inputs:this.inputs.map(c=>c.toJSONClone({...e,newId:null})),outputs:this.outputs.map(c=>c.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=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.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(s=>s.toReference(e)),outputs:this.outputs.map(s=>s.toReference(e)),declaration:this.declaration.toReference(e),successCalls:this.successCalls.map(s=>s.toReference(e)),errorCalls:this.errorCalls.map(s=>s.toReference(e)),calledBySuccess:this.calledBySuccess.map(s=>s.toReference(e)),calledByError:this.calledByError.map(s=>s.toReference(e)),calledByEntry:this.calledByEntry.map(s=>s.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(i=>i.toFlatJSON(e)),...this.errorCalls.flatMap(i=>i.toFlatJSON(e)),...this.inputs.flatMap(i=>i.toFlatJSON(e)),...this.outputs.flatMap(i=>i.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(i=>i.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.inputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.outputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.process?this.process.toFlatGenerationTarget(e):[],...this.error?this.error.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(i=>i.clearErrors()),this.outputs.forEach(i=>i.clearErrors()),this.successCalls.forEach(i=>i.clearErrors()),this.errorCalls.forEach(i=>i.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=gJ(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 R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){var O,w;let l=ht(t,this);const o=this.toJSON(),d=i||m.UUID.uuid();o.inputs=[];const u=d.split("-id"),h=u[u.length-1||0]||d;o.id=d,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=pt(o,l);t?c.setParent(t,null):c.setParent(this.parent,null),s&&c.subscribe(),c.initChildren(e),e==null||e.add(c,A.Added);const I=(O=this.inputs)==null?void 0:O.map((V,j)=>V.clone(e,c,h+"-input-map-"+j+"-id",s));c.inputs=I;const E=(w=this.outputs)==null?void 0:w.map((V,j)=>V.clone(e,c,h+"-output-map-"+j+"-id",s));return c.outputs=E,this.error&&(c.error=this.error.clone(e,c,h+"-error-map-id",s)),this.process&&(c.process=this.process.clone(e,c,h+"-process-id",s)),e==null||e.attemptAutoclose("clone-entity",this.id),c}removeUnrecognizedInputs(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-unrecognized-inputs"))){const t=[],i=[],s=[],l=[];return this.inputs.forEach(o=>{if(!this.declaration.inputs.find(u=>{var h;return u.id===((h=o.declaration)==null?void 0:h.id)})){const u=o.remove({ignoreUpstream:!1},e);s.push(...u.removed),t.push(...u.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}removeUnrecognizedOutputs(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-unrecognized-outputs"))){const t=[],i=[],s=[],l=[];return this.outputs.forEach(o=>{if(!this.declaration.getUniqueReturnDeclarations().find(u=>{var h;return u.id===((h=o.declaration)==null?void 0:h.id)})){const u=o.remove({ignoreUpstream:!1},e);s.push(...u.removed),t.push(...u.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-outputs",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}syncMissingFixedInputs(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-missing-fixed-inputs"))){const t=[],i=[],s=[],l=[],o=this.declaration.inputs.filter(c=>!this.inputs.find(I=>I.declaration.id===c.id));this.inputs.sort((c,I)=>c.index-I.index),o.forEach(c=>{this.inputs.forEach(O=>{O.index>=c.index&&O.metaSync({index:O.index+1},e)});const I={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.InputMap,declaration:c.toJSON(),readsValue:null,defaultValue:null,index:c.index,name:null,description:null,parent:this.toReference()},E=C(I,this.project);E.setParent(this,e),E.initChildren(e),e==null||e.add(E,A.Added),E.addSelfToProject(e),i.push(E)}),this.inputs.sort((c,I)=>c.index-I.index);const{updated:d,added:u,removed:h}=this.removeUnrecognizedInputs(e);return t.push(...d),i.push(...u),s.push(...h),e==null||e.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}syncMissingFixedOutputs(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-missing-fixed-outputs"))){const t=[],i=[],s=[],l=[],o=[];this.outputs=this.initialData.outputs.map(I=>{const E=C(I,this.project);return o.push(E.index),E.setParent(this,null),E.initChildren(e),E});const d=this.declaration.getUniqueReturnDeclarations().filter(I=>!this.outputs.find(E=>E.declaration.id===I.id));this.outputs.sort((I,E)=>I.index-E.index),d.forEach((I,E)=>{this.outputs.forEach(j=>{j.index>=I.index&&j.index++});const O=o.includes(I.index)?this.outputs.length-1+E:I.index,w={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.OutputMap,declaration:I.toJSON(),defaultValue:null,writesValues:[],index:O,parent:this.toReference()},V=C(w,this.project);V.setParent(this,e),V.initChildren(e),e==null||e.add(V,A.Added),V.addSelfToProject(e)}),this.outputs.sort((I,E)=>I.index-E.index);const{updated:u,added:h,removed:c}=this.removeUnrecognizedOutputs(e);return t.push(...u),i.push(...h),s.push(...c),e==null||e.attemptAutoclose("sync-missing-fixed-outputs",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}};f(qe,"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,...i)=>null}),f(qe,"type",n.FunctionCall),f(qe,"USER_MANAGED_PARENT_TYPES",[...lt,n.Project]),f(qe,"PARENT_TYPES",[...qe.USER_MANAGED_PARENT_TYPES]),f(qe,"MUTABLE_BASE_PROPERTIES",[]),f(qe,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(qe,"BASE_PROPERTIES",[...qe.MUTABLE_BASE_PROPERTIES,...qe.INMUTABLE_BASE_PROPERTIES]),f(qe,"MUTABLE_META_PROPERTIES",["x","y"]),f(qe,"INMUTABLE_META_PROPERTIES",[...qe.INMUTABLE_BASE_PROPERTIES]),f(qe,"META_PROPERTIES",[...qe.MUTABLE_META_PROPERTIES,...qe.INMUTABLE_META_PROPERTIES]),f(qe,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),f(qe,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),f(qe,"UPSTREAM_PROPERTIES",[...qe.MUTABLE_UPSTREAM_PROPERTIES,...qe.INMUTABLE_UPSTREAM_PROPERTIES]),f(qe,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),f(qe,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(qe,"DOWNSTREAM_PROPERTIES",[...qe.MUTABLE_DOWNSTREAM_PROPERTIES,...qe.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(qe,"PROPERTIES",[...qe.META_PROPERTIES,...qe.UPSTREAM_PROPERTIES,...qe.DOWNSTREAM_PROPERTIES]);let Sr=qe;function gc(r){return r&&typeof r.then=="function"}class Zl{constructor(a){f(this,"order",[]);f(this,"flatRecord",{});f(this,"allBuiltInEntityIds",Vi());f(this,"onGoingVisits",{});this.flatten(a),this.orderEntities()}flatten(a){const e=new Set(Vi()),t=p(L(a,e,{ignoreBuiltInBaseEntities:!0})),i=new Set;for(const s of t)this.flatRecord[s.id]=s,i.add(s.id);this.order=Array.from(i)}moveEntityAfterDependencies(a){const{upstream:e}=zl(a,this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds});for(const t of Object.keys(e)){const i=this.order.indexOf(t),s=this.order.indexOf(a.id);if(i>s)return this.order.splice(s,1),this.order.splice(i,0,a.id),!0}return!1}orderEntities(){let a=!1;for(let e=0;e<this.order.length;e++){const t=this.order[e],i=this.flatRecord[t];if(this.moveEntityAfterDependencies(i)){a=!0;break}}a&&this.orderEntities()}getUpstreamOngoingDependenciesVisits(a,e){const{upstream:t}=zl(this.flatRecord[a],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}),i={};return Object.entries(this.onGoingVisits[e]||{}).forEach(([s,l])=>{Object.keys(t).includes(s)&&(i[s]=l)}),i}getDownstreamOngoingDependenciesVisits(a,e){const t=Object.keys(this.onGoingVisits[e]||{}),i=new Set(t.flatMap(l=>Object.keys(zl(this.flatRecord[l],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}).downstream))),s={};return Array.from(i).forEach(l=>{l===a&&(s[l]=this.onGoingVisits[e][l])}),s}async settlePromises(a,e){const t=Object.values(a);t.length&&await Promise.all(t),Object.keys(a).forEach(i=>{delete this.onGoingVisits[e][i]})}visit(a){const e=this.order;for(const t of e)a(this.flatRecord[t],this.flatRecord);return this}reverseVisit(a){const e=this.order.slice().reverse();for(const t of e)a(this.flatRecord[t],this.flatRecord);return this}async visitAsync(a){const e=this.order,t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const i of e){const s=this.getUpstreamOngoingDependenciesVisits(i,t);Object.keys(s).length&&await this.settlePromises(s,t);const l=a(this.flatRecord[i],this.flatRecord);gc(l)&&(this.onGoingVisits[t][i]=l)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}async reverseVisitAsync(a){const e=this.order.slice().reverse(),t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const i of e){const s=this.getDownstreamOngoingDependenciesVisits(i,t);Object.keys(s).length&&await this.settlePromises(s,t);const l=a(this.flatRecord[i],this.flatRecord);gc(l)&&(this.onGoingVisits[t][i]=l)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}}function D1(r,a){switch(r.id){case x["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const e=r.project.entities.filter(d=>!!d.implements.find(u=>u.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));if(e.find(d=>!!d.properties.find(u=>{var h;return u.implements&&u.implements.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=u.getDefaultValue())==null?void 0:h.value)===!0}))){const u=e[0].properties.find(c=>c.implements&&c.implements.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),h=u==null?void 0:u.defaultValue;if(h)h.value=!0;else if(u!=null&&u.dataType){const c={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:N.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:u==null?void 0:u.dataType.toReference()},I=C(c,r.project);return I.setParent(u==null?void 0:u.dataType,a),I.initChildren(a),a==null||a.add(I,A.Added),I.addSelfToProject(a),{newEntities:[I]}}return{newEntities:[]}}const i=r.project.get(x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),s=ql(i,"Main database",a);if(s.errors.length>0)return{newEntities:[]};const l=s.properties.find(d=>d.implements&&d.implements.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),o=l==null?void 0:l.defaultValue;if(o)o.value=!0;else if(l!=null&&l.dataType){const d={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:N.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:l==null?void 0:l.dataType.toReference()},u=C(d,r.project);u.setParent(l==null?void 0:l.dataType,a),u.initChildren(a),a==null||a.add(u,A.Added),u.addSelfToProject(a)}return{newEntities:[s]}}}return{newEntities:[]}}function O1(r,a){return r.implements.filter(t=>t.type===n.BuiltInBaseEntity).map(t=>{switch(t.id){case x["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const s=r.project.entities.filter(d=>d.implements.find(u=>u.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)).find(d=>!!d.properties.find(u=>{var h;return u.implements&&u.implements.id===x["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=u.getDefaultValue())==null?void 0:h.value)===!0}));if(!s)return{newEntities:[]};const l=r.properties.find(d=>d.implements&&d.implements.id===x["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),o=l==null?void 0:l.defaultValue;if(l&&(l!=null&&l.dataType)&&!o){const d={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:N.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:s,valueAsTypeList:null,parent:l==null?void 0:l.dataType.toReference()},u=C(d,r.project);return u.setParent(l==null?void 0:l.dataType,a),u.initChildren(a),a==null||a.add(u,A.Added),u.addSelfToProject(a),{newEntities:[u]}}return{newEntities:[]}}}}),{newEntities:[]}}function ql(r,a,e,t){const i=t||m.UUID.uuid(),s=m.UUID.uuid(),l={id:i,version:s,createdAt:(e==null?void 0:e.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:a,type:n.DefinitionEntity,description:null,static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[r],x:0,y:0,parent:r.project};D1(r,e);const o=C(l,r.project);return o.setParent(r.project,e),o.initChildren(e),e==null||e.add(o,A.Added),r.abstractMethods.map(d=>{const u=m.UUID.uuid(),h=d.implementAsFunctionDeclaration(e,o,u);return o.addMethod(h),e==null||e.add(h,A.Added),h}),o.afterAllChildrenInitialized(e),O1(o,e),o}function $c(r,a){return a.entities.find(i=>{const s=i.properties,l=s.map(c=>c.name),o=r.every(c=>l.includes(c)),d=l.filter(c=>!r.includes(c)),u=s.every(c=>!d.includes(c.name)||!c.required);return o&&u})||null}function P1(r,a,e,t=bt.OrDataTypeGroup){const i=[],s=[],l=[],o=[],u={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,options:null,implementationChooseOne:!1,entity:r.toJSON(),isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:t,parent:a.toReference()},h=C(u,r.project);return s.push(h),h.setParent(a,e),h.initChildren(e),e==null||e.add(h,A.Added),h.setEntity(r),h.addSelfToProject(e),{updated:p(i),added:p(s),removed:p(l),affected:p(o),self:h}}function Gc(r,a,e,t,i){var u,h,c,I,E,O,w,V;const s=[],l=[],o=[],d=[];switch(typeof r){case"string":let j=!1;const G=new Date(r);if(G instanceof Date&&!isNaN(G.valueOf())&&(j=!0),j){const _=a.project.getBuiltIn(x[n.PrimitiveEntity][N.Date].id);a.setEntity(_);break}else{const _=a.project.getBuiltIn(x[n.PrimitiveEntity][N.String].id);a.setEntity(_);break}case"number":a.setEntity(a.project.getBuiltIn(x[n.PrimitiveEntity][N.Number].id));break;case"boolean":a.setEntity(a.project.getBuiltIn(x[n.PrimitiveEntity][N.Boolean].id));break;case"object":if(r===null){a.setEntity(a.project.getBuiltIn(x[n.PrimitiveEntity][N.Null].id));break}else if(Array.isArray(r))if(a.metaSync({isList:!0},t),r.length>0){const _=r.slice(0,5).filter(Z=>Z!==void 0);if(_.every(Z=>typeof Z==typeof _[0])&&(typeof _[0]!="object"||_[0]===null))switch(typeof _[0]){case"string":a.setEntity(a.project.getBuiltIn(x[n.PrimitiveEntity][N.String].id));break;case"number":a.setEntity(a.project.getBuiltIn(x[n.PrimitiveEntity][N.Number].id));break;case"boolean":a.setEntity(a.project.getBuiltIn(x[n.PrimitiveEntity][N.Boolean].id));break;case"object":a.setEntity(a.project.getBuiltIn(x[n.PrimitiveEntity][N.Null].id));break}else{const Z=[];let S=!1;_.forEach(ce=>{var Ie,X,le,Kt;if(Array.isArray(ce)&&(S=!0),typeof ce=="object"&&!Array.isArray(ce)&&ce!==null){const Hi=Jl(ce,a.project,{...e,id:m.UUID.uuid()},t,i);Hi.hasCreated&&Z.push((Ie=Hi.changeSet)==null?void 0:Ie.self),s.push(...(X=Hi.changeSet)==null?void 0:X.updated),l.push(...(le=Hi.changeSet)==null?void 0:le.added),o.push(...(Kt=Hi.changeSet)==null?void 0:Kt.removed)}});const te=p(Z);if(!te.length&&!S){_.forEach(ce=>{const Ie={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,options:null,implementationChooseOne:!1,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:bt.OrDataTypeGroup,parent:a.toReference()},X=C(Ie,a.project);switch(X.setParent(a,t),X.initChildren(t),t==null||t.add(X,A.Added),X.addSelfToProject(t),typeof ce){case"string":X.setEntity(X.project.getBuiltIn(x[n.PrimitiveEntity][N.String].id));break;case"number":X.setEntity(X.project.getBuiltIn(x[n.PrimitiveEntity][N.Number].id));break;case"boolean":X.setEntity(X.project.getBuiltIn(x[n.PrimitiveEntity][N.Boolean].id));break;case"object":X.setEntity(X.project.getBuiltIn(x[n.PrimitiveEntity][N.Null].id));break}});break}else te.length===1&&!S?a.setEntity(te[0]):_.forEach(ce=>{if(typeof ce=="object"&&!Array.isArray(ce)&&ce!==null){const Ie=$c(Object.keys(ce),a.project);if(Ie){const X=P1(Ie||te[0],a,t,bt.OrDataTypeGroup);s.push(...X.updated),l.push(...X.added),o.push(...X.removed)}}else{const Ie={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,options:null,implementationChooseOne:!1,entity:null,isList:Array.isArray(ce),asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parentRelationType:bt.OrDataTypeGroup,parent:a.toReference()},X=C(Ie,a.project);X.setParent(a,t),X.initChildren(t),t==null||t.add(X,A.Added),X.addSelfToProject(t);const le=Gc(ce,X,{...e,id:m.UUID.uuid()},t,i);s.push(...le.updated),l.push(...le.added),o.push(...le.removed)}})}}else{const _=Jl(r[0],a.project,{...e},t,i);a.setEntity((u=_.changeSet)==null?void 0:u.self),s.push(...(h=_.changeSet)==null?void 0:h.updated),l.push(...(c=_.changeSet)==null?void 0:c.added),o.push(...(I=_.changeSet)==null?void 0:I.removed);break}else{const _=Jl(r,a.project,{...e},t,i);a.setEntity((E=_.changeSet)==null?void 0:E.self),s.push(...(O=_.changeSet)==null?void 0:O.updated),l.push(...(w=_.changeSet)==null?void 0:w.added),o.push(...(V=_.changeSet)==null?void 0:V.removed);break}}return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:a}}function Jl(r,a,e,t,i){const s=[],l=[],o=[],d=[],u=Object.keys(r),h=$c(u,a);if(h)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:h}};const c=i?e.name+" of "+i.name:e.name,E={id:e.id||m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:c,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:a.toReference()},O=C(E,a);return O.setParent(a,t),O.initChildren(t),t==null||t.add(O,A.Added),O.addSelfToProject(t),l.push(O),u.forEach((w,V)=>{const G={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:w,type:n.Property,description:null,static:!1,abstract:!1,defaultValue:null,constant:!1,dataType:null,implements:null,index:V,hidden:!1,private:!1,required:!0,parent:O.toReference()},_=C(G,a);_.setParent(O,t),_.initChildren(t),t==null||t.add(_,A.Added),_.addSelfToProject(t),l.push(_);const g=r[w],S={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,parent:_.toReference()},te=C(S,a);te.setParent(_,t),te.initChildren(t),t==null||t.add(te,A.Added),te.addSelfToProject(t),l.push(te);const ce=Gc(g,te,{...e,name:w,id:m.UUID.uuid()},t,i||O);s.push(...ce.updated),l.push(...ce.added),o.push(...ce.removed)}),{hasCreated:!0,changeSet:{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:O}}}function bs(r,a){const e=Nn(r);if(e.length===0)return{list:[],last:null};let t=null;return{list:e.flatMap(s=>{if(s===a)return t=s,[s];const l=bs(s,a);return l.last&&(t=l.last),[s,...l.list]}),last:t}}function Fc(r){const a=r.calledBy;if(a.length===0)return r.project;const e=a.reduce((t,i)=>{const s=Ft(i,r.project);return!s||s.type===n.Project?t:t.type===n.Project||bs(s,t).last?s:(bs(t,s).last,t)},r.project);return e.type===n.FunctionDeclaration&&e.parent.type===n.Loop?e.parent:e}function K(r,a){var i,s;let e=Fc(r);if(r.type===n.InternalCall)(i=r.parent)==null||i.setParent(e,a),(s=r.parent)==null||s.addSelfToProject(a);else if((r.type===n.ContinueStatement||r.type===n.BreakStatement)&&e.type!==n.Loop){r.remove({ignoreUpstream:!1},a);return}else if(r.type===n.ReturnStatement&&!lt.includes(e.type)){r.remove({ignoreUpstream:!1},a);return}else r.setParent(e,a),r.addSelfToProject(a);if(nt.includes(r.type))return;it(r).forEach(l=>{var d,u;const o=Fc(l);if(l.type===n.InternalCall)(d=l.parent)==null||d.setParent(o,a),(u=l.parent)==null||u.addSelfToProject(a);else if((l.type===n.ContinueStatement||l.type===n.BreakStatement)&&o.type!==n.Loop){l.remove({ignoreUpstream:!1},a);return}else if(l.type===n.ReturnStatement&&!lt.includes(o.type)){l.remove({ignoreUpstream:!1},a);return}else l.setParent(o,a),l.addSelfToProject(a)})}function w1(r,a,e=new Set){const t=Wr(r),i=Wr(a),s=t.filter(d=>!i.includes(d)),l=t.filter(d=>i.includes(d)),o=s.reduce((d,u)=>e.has(u.id)?d:(e.add(u.id),p([...d,...w1(u,a,e)])),[]);return p([...l,...o])}function _a(r,a){const e=bs(r,a);return e.last===a&&e.list.length>0&&e.list[0]!==a}function $J(r,a){return!!bs(r,a).last}function GJ(r){if(ot.includes(r.type))return r;if([...Bi,n.VariableDeclaration].includes(r.type)){const a=r.parent;return ot.includes(a.type)?a:null}return null}function xc(r,a){if(!r||!a)throw new Error("Both entities must be defined to find a common ancestor");if(r===a)return r;const e=r.parent;if(e){if(e===a)return a;if(e.type===n.Project)return null}else return null;const t=a.parent;if(t){if(t===r)return r;if(t.type===n.Project)return null}else return null;return xc(e,t)}function Pt(r){if(ka.includes(r.type)){if(r.type===n.FunctionDeclaration){const a=r.parent;if(a.type===n.DefinitionEntity)return a;if(a.type===n.Loop)return a}return r}else{const a=r.parent;return a?Pt(a):null}}function Sl(r,a){const e=Ma(r,a);if(!e)return null;if(ka.includes(e.type)){if(e.type===n.FunctionDeclaration){const t=Ma(e.parent,a);if(t){if(t.type===n.DefinitionEntity)return t;if(t.type===n.Loop)return t}}return e}else{const t=e.parent?Ma(e.parent,a):null;return t?Sl(t,a):null}}function C1(r){if(!r)return null;if(Bi.includes(r.type))return r;const a=r.parent;return a?C1(a):null}function V1(r){if(!r)return null;if(at.includes(r.type))return r;const a=r.parent;return a?V1(a):null}function B1(r){if(!r)return null;if(_i.includes(r.type))return r;const a=r.parent;return a?B1(a):null}function FJ(r){return r.type===n.VariableDeclaration?[r]:at.includes(r.type)?[...r.inputs,...r.outputs||[]]:nt.includes(r.type)?r.outputs:$n.includes(r.type)||r.type===n.FunctionDeclaration?r.inputs:[]}function xJ(r){const a=Wr(r),e=[],t=[];nf.includes(r.type)&&e.push(...kc(r));const i=a.filter(s=>{const l=e.includes(s);return l?!1:Bi.includes(s.type)&&!l?(t.push(s),!1):!0});return e.sort((s,l)=>_a(l,s)?-1:0),t.sort((s,l)=>_a(l,s)?-1:0),[...e,...t,...i]}function _1(r){return[...r].sort((a,e)=>_a(e,a)?-1:0)}function kJ(r){const a=_1(r),e=[];return a.forEach(t=>{const i=e[e.length-1];if(i){const s=i[i.length-1];_a(t,s)?e.push([t]):i.push(t)}else e.push([t])}),e}function Ht(r){const a=r.map(e=>Pt(e));return p(a)}function kc(r){return at.includes(r.type)?[...Ht(r.successCalls),...Ht(r.errorCalls)]:ot.includes(r.type)?Ht(r.calls):[]}function ZJ(r,a){return kc(r).includes(a)}function Zc(r){return r.writesValues||[]}function qJ(r,a){return Zc(r).includes(a)}function M1(r){var a;return et.includes((a=r==null?void 0:r.readsValue)==null?void 0:a.type)?r.readsValue:null}function JJ(r){return r.writesValues}function N1(r=[]){return r.map(M1).filter(a=>!!a)}function Wl(r=[]){return r.map(a=>a.writesValues).flat().filter(a=>et.includes(a.type))}function L1(r=[]){return r.map(a=>a.readsValue).filter(a=>!!a&&et.includes(a.type))}function U1(r){return et.includes(r.type)?r:null}function j1(r){return r.writesValues.map(U1).filter(a=>!!a)}function g1(r=[]){return r.reduce((a,e)=>e.type===n.OutputMap?[...a,...j1(e)]:a,[])}function it(r){return at.includes(r.type)?[...zi(Ht(r.successCalls)),...zi(Ht(r.errorCalls))]:ot.includes(r.type)?zi(Ht(r.calls)):[]}function SJ(r){return at.includes(r.type)?[...zi(Ht(r.successCalls)),...zi(Ht(r.errorCalls))]:ot.includes(r.type)?zi(Ht(r.calls)):[]}function $1(r,a=new Set){return r.writesValues.filter(t=>et.includes(t.type)&&!a.has(t.id)).reduce((t,i)=>a.has(i.id)?t:[...t,...ze(i,a)],[])}function G1(r,a=new Set){var t;return(((t=r.readsValue)==null?void 0:t.writesValues)||[]).filter(i=>et.includes(i.type)&&!a.has(i.id)).reduce((i,s)=>a.has(s.id)?i:[...i,...ze(s,a)],[])}function ze(r,a=new Set){if(a.has(r.id))return[];if(r.type===n.ReturnStatement)return L1(r.outputs).reduce((t,i)=>[...t,...ze(i,a)],[]);if(r.type===n.FunctionCall||r.type===n.Operation||r.type===n.Condition)return[...it(r).reduce((s,l)=>{const o=Pt(l);return[...s,...ze(o||l,a)]},[]),...N1(r.inputs),...g1(r.outputs)].reduce((s,l)=>[...s,...ze(l,a)],[]);if($n.includes(r.type)){const e=Wl(r.inputs),i=it(r).reduce((s,l)=>{const o=Pt(l);return[...s,...ze(o||l,a)]},[]);return e.push(...i),e.reduce((s,l)=>[...s,...ze(l,a)],[])}if(r.type===n.FunctionDeclaration){const e=[...Wl(r.inputs)],i=it(r).reduce((s,l)=>{const o=Pt(l);return[...s,...ze(o||l,a)]},[]);return e.push(...i),e.reduce((s,l)=>[...s,...ze(l)],[])}if(et.includes(r.type)){a.add(r.id);const t=it(r).reduce((i,s)=>{const l=Pt(s);return[...i,...ze(l||s,a)]},[]);return[r,...t,...G1(r,a),...$1(r,a)]}return[]}function ni(r,a=new Set){return a.has(r.id)?[]:(a.add(r.id),[...Wr(r).reduce((i,s)=>[...i,s,...ni(s,a)],[])])}function zi(r){return r.reduce((a,e)=>e.type===n.ReturnStatement||e.type===n.ContinueStatement||e.type===n.BreakStatement?[...a,e]:[...a,e,...it(e)],[])}function F1(r){const a=r.entities||[],e=[...a,...r.functions||[],...r.events||[],...r.projects||[]],t=a.reduce((d,u)=>[...d,...u.properties],[]),i=a.reduce((d,u)=>[...d,...u.methods],[]),s=i.reduce((d,u)=>[...d,...Wl(u.inputs),...zi(Ht(u.calls)),...u.returnStatements],[]),l=r.functions.reduce((d,u)=>[...d,...zi(Ht(u.calls)),...u.returnStatements],[]),o=r.events.reduce((d,u)=>[...d,...zi(Ht(u.calls)),...u.returnStatements],[]);return[...e,...t,...i,...s,...l,...o]}function x1(r,a){return a.filter(t=>{if(!t)return!1;switch(t.type){case n.FunctionCall:return t.inputs.find(i=>i.id===r.id)!==void 0||t.outputs.find(i=>i.id===r.id)!==void 0;case n.Condition:return t.successCalls.find(i=>i.id===r.id)!==void 0||t.errorCalls.find(i=>i.id===r.id)!==void 0||t.inputs.find(i=>i.id===r.id)!==void 0;case n.Operation:return t.outputs.find(i=>i.id===r.id)!==void 0;case n.VariableDeclaration:return at.includes(r.type)?hP(r).find(s=>{var l;return((l=s.readsValue)==null?void 0:l.id)===t.id})!==void 0:!1;case n.DefinitionEntity:return t.properties.find(i=>i.id===r.id)!==void 0||t.methods.find(i=>i.id===r.id)!==void 0;case n.FunctionDeclaration:return t.inputs.find(i=>i.id===r.id)!==void 0||(t.returnStatements.map(i=>i.outputs).flat()||[]).find(i=>i.id===r.id)!==void 0;default:return!1}})}function WJ(r){const a=F1(r.project);return x1(r,a)}function Ma(r,a){return r?typeof r=="string"?a[r]:r.type===n.GenericReference?a[r.entityId]:a[r.id]?a[r.id]:null:null}function zl(r,a={},e={ignoreBuiltInBaseEntities:!1,allBuiltInEntityIds:[]}){if(e.ignoreBuiltInBaseEntities&&(mi.includes(r.type)||(e.allBuiltInEntityIds||[]).includes(r.id)))return{upstream:{},downstream:{}};const t=r,i=r,s=r,l=r,o=r,d=r,u=r,h=r,c=r,I=r,E=r,O=r,w=r,V=[...w.readsValue?[w.readsValue]:[],...w.declaration?[w.declaration]:[],...(O.calledByEntry||[]).flatMap(g=>g),...(O.calledBySuccess||[]).flatMap(g=>g),...(O.calledByError||[]).flatMap(g=>g),...(s.extends||[]).flatMap(g=>g),...I.parent?[I.parent]:[]];Array.isArray(s.implements)?V.push(...s.implements.flatMap(g=>g)):c.implements&&V.push(c.implements),o.valueAsTypeList&&Array.isArray(o.valueAsTypeList)&&V.push(...o.valueAsTypeList.flatMap(g=>g)),o.valueAsTypeSingle&&V.push(o.valueAsTypeSingle);const j=[...(t.inputs||[]).flatMap(g=>g),...(E.inputsDeclarations||[]).flatMap(g=>g),...(t.outputs||[]).flatMap(g=>g),...(E.outputsDeclarations||[]).flatMap(g=>g),...(w.internalCalls||[]).flatMap(g=>g),...w.writesValues||[],...O.dataType?[O.dataType]:[],...d.body?[d.body]:[],...O.defaultValue?[O.defaultValue]:[],...(O.successCalls||[]).flatMap(g=>g),...(O.errorCalls||[]).flatMap(g=>g),...(s.properties||[]).flatMap(g=>g),...(s.methods||[]).flatMap(g=>g),...(s.abstractMethods||[]).flatMap(g=>g),...u.error?[u.error]:[],...u.process?[u.process]:[],...I.throws?[I.throws]:[],...(i.andChildrenGroup||[]).flatMap(g=>g),...(i.orChildrenGroup||[]).flatMap(g=>g),...(h.entities||[]).flatMap(g=>g),...(h.functions||[]).flatMap(g=>g),...(h.functionCalls||[]).flatMap(g=>g),...(h.events||[]).flatMap(g=>g),...(h.conditions||[]).flatMap(g=>g),...(h.operations||[]).flatMap(g=>g),...(h.loops||[]).flatMap(g=>g),...(h.variableDeclarations||[]).flatMap(g=>g),...(h.variableInstances||[]).flatMap(g=>g),...(h.searches||[]).flatMap(g=>g),...(h.projects||[]).flatMap(g=>g),...(l.calls||[]).flatMap(g=>g)];r.type===n.DataType&&(i.entity&&a[B(i.entity)]&&a[B(i.entity)].parent&&B(a[B(i.entity)].parent)===r.id?j.push(i.entity):i.entity&&V.push(i.entity));const G={},_={};return V.forEach(g=>{const Z=B(g);if(Z&&e.ignoreBuiltInBaseEntities&&(mi.includes(g.type)||(e.allBuiltInEntityIds||[]).includes(Z)))return;const S=g.version;Z&&(G[Z]=S)}),j.forEach(g=>{const Z=B(g);if(Z&&e.ignoreBuiltInBaseEntities&&(mi.includes(g.type)||(e.allBuiltInEntityIds||[]).includes(Z)))return;const S=g.version;Z&&(_[Z]=S)}),{upstream:G,downstream:_}}function zJ(r,a){const e=[];if(Bi.includes(r.type)){fi(r).forEach(s=>{const l=Sl(s,a);l&&e.push(l)});const i=[...r.inputs||[],...r.outputs||[]].map(s=>{const l=Ma(s,a);return l?vP(l,a):null}).filter(s=>s!==null);e.push(...p(i))}if(et.includes(r.type)){const t=Yl(r);t&&e.push(t)}return p(e)}function Nn(r){const a=[];if(Bi.includes(r.type)){r.calledBy.forEach(i=>{const s=Pt(i);s&&a.push(s)});const t=[...r.inputs||[],...r.outputs||[]].map(i=>Yl(i)).filter(i=>i!==null);a.push(...p(t))}if(et.includes(r.type)){const e=Yl(r);e&&a.push(e)}return p(a)}function fi(r){return[...r.calledByEntry||[],...r.calledByError||[],...r.calledBySuccess||[]].filter(a=>a.type!==n.GenericReference)}function k1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ActionDescriptor)throw new Error("Entity must be an action descriptor to be flattened");return[r,...r.inputs.flatMap(t=>L(t,a,e)),...r.outputs.flatMap(t=>L(t,a,e)),...r.error?L(r.error,a,e):[],...r.parent?L(r.parent,a,e):[]]}function Z1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ArgumentDeclaration)throw new Error("Entity must be an argument declaration to be flattened");return[r,...r.defaultValue?L(r.defaultValue,a):[],...r.writesValues.flatMap(t=>L(t,a,e)),...r.dataType?L(r.dataType,a,e):[],...r.parent?L(r.parent,a,e):[]]}function q1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.BreakStatement)throw new Error("Entity must be a break statement to be flattened");return[r,...r.outputs.flatMap(t=>L(t,a,e)),...r.throws?L(r.throws,a,e):[],...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function J1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.BuiltInBaseEntity)throw new Error("Entity must be a built-in base entity to be flattened");return[r,...(r.properties||[]).flatMap(t=>L(t,a,e)),...(r.methods||[]).flatMap(t=>L(t,a,e)),...(r.abstractMethods||[]).flatMap(t=>L(t,a,e)),...(r.extends||[]).flatMap(t=>L(t,a,e))]}function S1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Condition)throw new Error("Entity must be a condition to be flattened");return[r,...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.successCalls||[]).flatMap(t=>L(t,a,e)),...(r.errorCalls||[]).flatMap(t=>L(t,a,e)),...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function W1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ContinueStatement)throw new Error("Entity must be a continue statement to be flattened");return[r,...r.outputs.flatMap(t=>L(t,a,e)),...r.throws?L(r.throws,a,e):[],...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function z1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.DefinitionEntity)throw new Error("Entity must be a definition entity to be flattened");return[r,...(r.extends||[]).flatMap(t=>L(t,a,e)),...(r.implements||[]).flatMap(t=>L(t,a,e)),...(r.properties||[]).flatMap(t=>L(t,a,e)),...(r.methods||[]).flatMap(t=>L(t,a,e)),...(r.abstractMethods||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function Y1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.DataType)throw new Error("Entity must be a data type to be flattened");return[r,...(r.andChildrenGroup||[]).flatMap(t=>L(t,a,e)),...(r.orChildrenGroup||[]).flatMap(t=>L(t,a,e)),...r.entity?L(r.entity,a,e):[],...r.parent?L(r.parent,a,e):[]]}function H1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.FunctionCall)throw new Error("Entity must be a function call to be flattened");return[r,...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.outputs||[]).flatMap(t=>L(t,a,e)),...r.error?L(r.error,a,e):[],...r.process?L(r.process,a,e):[],...(fi(r)||[]).flatMap(t=>L(t,a,e)),...(r.successCalls||[]).flatMap(t=>L(t,a,e)),...(r.errorCalls||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function K1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.FunctionDeclaration)throw new Error("Entity must be a function declaration to be flattened");return[r,...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.calls||[]).flatMap(t=>L(t,a,e)),...r.implements?L(r.implements,a,e):[],...r.parent?L(r.parent,a,e):[]]}function X1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.GlobalEvent)throw new Error("Entity must be a global event to be flattened");return[r,...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.calls||[]).flatMap(t=>L(t,a,e)),...r.implements?L(r.implements,a,e):[],...r.parent?L(r.parent,a,e):[]]}function Q1(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.InputMap)throw new Error("Entity must be an input map to be flattened");return[r,...r.readsValue?L(r.readsValue,a,e):[],...r.declaration?L(r.declaration,a,e):[],...r.defaultValue?L(r.defaultValue,a,e):[],...r.parent?L(r.parent,a,e):[]]}function eP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.InstalledProject)throw new Error("Entity must be an installed project to be flattened");return[r,...(r.functions||[]).flatMap(t=>L(t,a,e)),...(r.events||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function tP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.InternalCall)throw new Error("Entity must be an internal call to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>L(t,a,e)),...(r.errorCalls||[]).flatMap(t=>L(t,a,e)),...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.outputs||[]).flatMap(t=>L(t,a,e)),...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.error?L(r.error,a,e):[],...r.process?L(r.process,a,e):[],...r.parent?L(r.parent,a,e):[]]}function iP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.LiteralValue)throw new Error("Entity must be a literal value to be flattened");return[r,...r.valueAsTypeSingle?L(r.valueAsTypeSingle,a,e):[],...r.valueAsTypeList&&Array.isArray(r.valueAsTypeList)?r.valueAsTypeList.flatMap(t=>L(t,a,e)):[],...r.parent?L(r.parent,a,e):[]]}function rP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Loop)throw new Error("Entity must be a loop to be flattened");return[r,...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.outputs||[]).flatMap(t=>L(t,a,e)),...(r.successCalls||[]).flatMap(t=>L(t,a,e)),...(r.errorCalls||[]).flatMap(t=>L(t,a,e)),...r.error?L(r.error,a,e):[],...r.process?L(r.process,a,e):[],...r.body?L(r.body,a,e):[],...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function nP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Operation)throw new Error("Entity must be an operation to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>L(t,a,e)),...(r.errorCalls||[]).flatMap(t=>L(t,a,e)),...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.outputs||[]).flatMap(t=>L(t,a,e)),...r.error?L(r.error,a,e):[],...r.process?L(r.process,a,e):[],...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function sP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.OutputMap)throw new Error("Entity must be an output map to be flattened");return[r,...(r.writesValues||[]).flatMap(t=>L(t,a,e)),...r.declaration?L(r.declaration,a,e):[],...r.defaultValue?L(r.defaultValue,a,e):[],...r.parent?L(r.parent,a,e):[]]}function aP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.PrimitiveEntity)throw new Error("Entity must be a primitive entity to be flattened");return[r,...(r.properties||[]).flatMap(t=>L(t,a,e)),...(r.methods||[]).flatMap(t=>L(t,a,e)),...(r.abstractMethods||[]).flatMap(t=>L(t,a,e))]}function oP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Project)throw new Error("Entity must be a project to be flattened");return[r,...(r.entities||[]).flatMap(t=>L(t,a,e)),...(r.functions||[]).flatMap(t=>L(t,a,e)),...(r.events||[]).flatMap(t=>L(t,a,e)),...(r.projects||[]).flatMap(t=>L(t,a,e)),...(r.variableDeclarations||[]).flatMap(t=>L(t,a,e)),...(r.variableInstances||[]).flatMap(t=>L(t,a,e)),...(r.operations||[]).flatMap(t=>L(t,a,e)),...(r.conditions||[]).flatMap(t=>L(t,a,e)),...(r.functionCalls||[]).flatMap(t=>L(t,a,e)),...(r.projects||[]).flatMap(t=>L(t,a,e)),...(r.loops||[]).flatMap(t=>L(t,a,e)),...(r.searches||[]).flatMap(t=>L(t,a,e))]}function lP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Property)throw new Error("Entity must be a property to be flattened");return[r,...r.defaultValue?L(r.defaultValue,a,e):[],...r.dataType?L(r.dataType,a,e):[],...r.parent?L(r.parent,a,e):[]]}function dP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ReturnDeclaration)throw new Error("Entity must be a return declaration to be flattened");return[r,...r.readsValue?L(r.readsValue,a,e):[],...r.defaultValue?L(r.defaultValue,a,e):[],...r.dataType?L(r.dataType,a,e):[],...r.parent?L(r.parent,a,e):[]]}function uP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ReturnStatement)throw new Error("Entity must be a return statement to be flattened");return[r,...(r.outputs||[]).flatMap(t=>L(t,a,e)),...r.throws?L(r.throws,a,e):[],...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function pP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Search)throw new Error("Entity must be a search to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>L(t,a,e)),...(r.errorCalls||[]).flatMap(t=>L(t,a,e)),...(r.inputsDeclarations||[]).flatMap(t=>L(t,a,e)),...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.outputsDeclarations||[]).flatMap(t=>L(t,a,e)),...(r.outputs||[]).flatMap(t=>L(t,a,e)),...r.error?L(r.error,a,e):[],...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.parent?L(r.parent,a,e):[]]}function cP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ValueDescriptor)throw new Error("Entity must be a value descriptor to be flattened");return[r,...r.defaultValue?L(r.defaultValue,a,e):[],...r.dataType?L(r.dataType,a,e):[],...r.parent?L(r.parent,a,e):[]]}function fP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.VariableDeclaration)throw new Error("Entity must be a variable declaration to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>L(t,a,e)),...(r.errorCalls||[]).flatMap(t=>L(t,a,e)),...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.outputs||[]).flatMap(t=>L(t,a,e)),...(r.internalCalls||[]).flatMap(t=>L(t,a,e)),...(r.writesValues||[]).flatMap(t=>L(t,a,e)),...r.readsValue?L(r.readsValue,a,e):[],...r.defaultValue?L(r.defaultValue,a,e):[],...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.dataType?L(r.dataType,a,e):[],...r.parent?L(r.parent,a,e):[]]}function yP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.VariableInstance)throw new Error("Entity must be a variable instance to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>L(t,a,e)),...(r.errorCalls||[]).flatMap(t=>L(t,a,e)),...(r.inputs||[]).flatMap(t=>L(t,a,e)),...(r.outputs||[]).flatMap(t=>L(t,a,e)),...(r.internalCalls||[]).flatMap(t=>L(t,a,e)),...(r.writesValues||[]).flatMap(t=>L(t,a,e)),...r.readsValue?L(r.readsValue,a,e):[],...r.defaultValue?L(r.defaultValue,a,e):[],...(fi(r)||[]).flatMap(t=>L(t,a,e)),...r.declaration?L(r.declaration,a,e):[],...r.parent?L(r.parent,a,e):[]]}function Vi(){const r=new Set,a=rE.flatMap(e=>L(e,r)).map(e=>e.id);if(!a.includes("http-request-error-return-delaration-id"))throw new Error("Built-in base entities must be included in the list");return a}function L(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(!r)throw new Error("Entity must be defined to be flattened");if(r.type===n.GenericReference)return[];if(e.ignoreBuiltInBaseEntities&&(mi.includes(r.type)||Vi().includes(r.id)))return[];if(a.has(r.id))return[];switch(r.type){case n.FunctionCall:return H1(r,a,e);case n.Operation:return nP(r,a,e);case n.Condition:return S1(r,a,e);case n.Loop:return rP(r,a,e);case n.Search:return pP(r,a,e);case n.GlobalEvent:return X1(r,a,e);case n.ReturnStatement:return uP(r,a,e);case n.ContinueStatement:return W1(r,a,e);case n.BreakStatement:return q1(r,a,e);case n.VariableDeclaration:return fP(r,a,e);case n.DefinitionEntity:return z1(r,a,e);case n.FunctionDeclaration:return K1(r,a,e);case n.Project:return oP(r,a,e);case n.ActionDescriptor:return k1(r,a,e);case n.ArgumentDeclaration:return Z1(r,a,e);case n.ReturnDeclaration:return dP(r,a,e);case n.ValueDescriptor:return cP(r,a,e);case n.InputMap:return Q1(r,a,e);case n.OutputMap:return sP(r,a,e);case n.DataType:return Y1(r,a,e);case n.InstalledProject:return eP(r,a,e);case n.InternalCall:return tP(r,a,e);case n.LiteralValue:return iP(r,a,e);case n.Property:return lP(r,a,e);case n.VariableInstance:return yP(r,a,e);case n.BuiltInBaseEntity:return e.ignoreBuiltInBaseEntities?[]:J1(r,a,e);case n.PrimitiveEntity:return e.ignoreBuiltInBaseEntities?[]:aP(r,a,e)}return[]}function qc(r){return r.type===n.FunctionCall||r.type===n.InternalCall||[n.Operation,n.Condition,n.Loop].includes(r.type)?r.declaration.inputs:r.type===n.FunctionDeclaration||$n.includes(r.type)?r.inputs:r.type===n.Search?r.inputsDeclarations:[]}function YJ(r,a){return a.type===n.Condition?a.inputs.find(e=>e.declaration.id===r.id):a.type===n.FunctionCall||a.type===n.Operation?a.inputs.find(e=>e.declaration.id===r.id):null}function hP(r){return at.includes(r.type)?r.inputs:[]}function mP(r){var a;return r.type===n.FunctionCall?((a=r.declaration.returnStatements[0])==null?void 0:a.outputs)||[]:[n.Operation,n.Condition,n.Loop].includes(r.type)?r.declaration.outputs:r.type===n.Search?r.outputsDeclarations:nt.includes(r.type)?r.outputs:[]}function HJ(r,a){return a.type===n.Condition?null:a.type===n.FunctionCall||a.type===n.Operation?a.outputs.find(e=>e.declaration.id===r.id):null}function KJ(r){return r.type===n.Condition?[]:at.includes(r.type)?r.outputs:[]}function Yl(r){const a=r.readsValue;return a?Pt(a):null}function vP(r,a){const e=r.readsValue;return e?Sl(e,a):null}function TP(r){const a=r.internalCalls||[];return p(Ht(p(a.flatMap(e=>[...e.successCalls,...e.errorCalls]))))}function Ds(r){const a=Zc(r),e=[];return a.forEach(t=>{if(et.includes(t.type))e.push(t);else if(mr.includes(t.type)){const i=t.parent;e.push(i)}}),e}function p(r){const a=new Set;return r.filter(e=>!e||a.has(e.id)?!1:(a.add(e.id),!0))}function Wr(r,a=!1){const e=[];if(r.type===n.Project&&e.push(...(r==null?void 0:r.entities)||[],...(r==null?void 0:r.functions)||[],...(r==null?void 0:r.variableDeclarations)||[],...(r==null?void 0:r.variableInstances)||[],...(r==null?void 0:r.searches)||[],...(r==null?void 0:r.loops)||[],...(r==null?void 0:r.operations)||[],...(r==null?void 0:r.conditions)||[],...(r==null?void 0:r.functionCalls)||[],...(r==null?void 0:r.events)||[],...(r==null?void 0:r.projects)||[]),lt.includes(r.type)&&e.push(...(r==null?void 0:r.detachedChildren)||[]),r.type===n.DefinitionEntity){const t=[...r.suggestedMethods,...r.methods].flatMap(i=>i.collapsed&&a?[]:Wr(i));e.push(...t)}if(r.type===n.Condition){const t=r.successCalls.map(s=>Pt(s)),i=r.errorCalls.map(s=>Pt(s));e.push(...t,...i)}if($n.includes(r.type)){if(r.collapsed&&a)return[];const t=r.inputs.map(s=>Ds(s)).flat(),i=r.calls.map(s=>Pt(s));e.push(...p(t),...i)}if(at.includes(r.type)&&r.type!==n.Condition&&r.type!==n.Loop){const t=r==null?void 0:r.outputs.map(l=>Ds(l)).flat(),i=r.successCalls.map(l=>Pt(l)),s=r.errorCalls.map(l=>Pt(l));e.push(...p(t),...i,...s)}if(et.includes(r.type)){const t=Ds(r),i=TP(r);e.push(...t,...i)}if(r.type===n.Loop){const t=r.outputs.map(l=>Ds(l)).flat();if(r.body){const l=Wr(r.body,a);e.push(...l)}const i=r.errorCalls.map(l=>Pt(l)),s=r.successCalls.map(l=>Pt(l));e.push(...p(t),...s,...i)}if(r.type===n.FunctionDeclaration){if(r.collapsed&&a)return[];const t=r.inputs.map(s=>Ds(s)).flat(),i=r.calls.map(s=>Pt(s));e.push(...p(t),...i)}return p(e)}function IP(r,a=!1){const e=Wr(r,a),t=[...e,...e.reduce((i,s)=>[...i,...IP(s,a)],[])];return p(t)}function EP(r){const a=Nn(r),e=[...a,...a.reduce((t,i)=>[...t,...EP(i)],[])];return p(e)}function Hl(r){return r.implements.reduce((a,e)=>e.type===n.DefinitionEntity?[...a,n.DefinitionEntity,...Hl(e),...Kl(e)]:[...a,e.name],[])}function Kl(r){return r.extends.reduce((a,e)=>e.type===n.DefinitionEntity?[...a,n.DefinitionEntity,...Kl(e),...Hl(e)]:[...a,e.name],[])}function Jc(r){return r.extends.reduce((a,e)=>e.type===n.DefinitionEntity?[...a,e,...Jc(e),...Sc(e)]:[...a,e],[])}function Sc(r){return r.implements.reduce((a,e)=>e.type===n.DefinitionEntity?[...a,e,...Sc(e),...Jc(e)]:[...a,e],[])}function Wc(r){return[...Kl(r),...Hl(r)].filter((e,t,i)=>i.indexOf(e)===t)}function AP(r){return r.implements.length===0&&r.extends.length===0?null:r.implements.find(t=>t.type===n.BuiltInBaseEntity&&t.name===z.PERSISTED_ENTITY)?r:[...r.implements,...r.extends].reduce((t,i)=>{if(i.type===n.DefinitionEntity){const s=AP(i);if(s)return s}return t},null)}function XJ(r){const a=r.extends.find(e=>e.type===n.BuiltInBaseEntity);return a&&a.type===n.BuiltInBaseEntity?a:null}function QJ(r){const a=r.implements.find(e=>e.type===n.BuiltInBaseEntity);return a&&a.type===n.BuiltInBaseEntity?a:null}function zc(r){const a=r.extends.find(e=>e.type===n.DefinitionEntity);return a&&a.type===n.DefinitionEntity?a:null}function zr(r){const a=[...r.implements,...r.extends].reduce((e,t)=>t.type===n.BuiltInBaseEntity?[...e,t]:t.type===n.DefinitionEntity?[...e,...zr(t)]:e,[]);return p(a)}function Yc(r){return r.type===n.PrimitiveEntity?!0:r.type===n.BuiltInBaseEntity?r.interactive:!zr(r).find(t=>!t.interactive)}function eS(r){return r.parent===r.project&&r.project.variableDeclarations.includes(r)}function Hc(r){return r.parent!==r.project?!1:n.VariableDeclaration===r.type?r.project.variableDeclarations.includes(r):n.VariableInstance===r.type?r.project.variableInstances.includes(r):n.FunctionCall===r.type?r.project.functionCalls.includes(r):n.Condition===r.type?r.project.conditions.includes(r):n.Operation===r.type?r.project.operations.includes(r):n.Loop===r.type?r.project.loops.includes(r):n.Search===r.type?r.project.searches.includes(r):!1}function RP(r){if([...ot,n.DefinitionEntity,n.InstalledProject,n.Project].includes(r.type)||Hc(r))return!1;const a=Nn(r);return a.length===0?!0:a.some(e=>RP(e))}function Kc(r){return[...ot,n.DefinitionEntity,n.InstalledProject,n.Project].includes(r.type)||Hc(r)?!1:Nn(r).length===0}function bP(r,a=0){if(Kc(r)){const e=Nn(r);return e.length===0?r:e.map(i=>bP(i,a+1)).reduce((i,s)=>i?s&&s.x<i.x?s:i:s,null)}return null}function DP(r){const a=[];if(Kc(r))a.push(r);else return[];return Nn(r).forEach(t=>{a.push(...DP(t))}),a}function OP(r){return r.type===n.FunctionDeclaration&&r.parent!==r.project&&!![n.DefinitionEntity,n.Loop,n.InstalledProject].includes(r.parent.type)}function tS(r,a){const e=new Map;return r.forEach(t=>{e.set(t.id,t)}),a.forEach(t=>{e.set(t.id,t)}),Array.from(e.values())}function Na(r){switch(r){case n.DefinitionEntity:return Hr;case n.FunctionDeclaration:return Nr;case n.VariableDeclaration:return $r;case n.VariableInstance:return gr;case n.FunctionCall:return Sr;case n.Operation:return Lr;case n.Condition:return jr;case n.ReturnStatement:return Mr;case n.Loop:return Ur;case n.Search:return Gr;case n.InputMap:return Ji;case n.OutputMap:return Si;case n.ArgumentDeclaration:return xr;case n.ReturnDeclaration:return ri;case n.Property:return _r;case n.InstalledProject:return Fr;case n.Project:return m;case n.BuiltInBaseEntity:return Yi;default:return null}}function Ft(r,a){if(lt.includes(r.type))return r;if(mi.includes(r.type))return null;const e=r.parent;if(!e)return null;if(e.type===n.GenericReference){const t=B(e);if(!t)return null;const i=a.get(t);return i?Ft(i,a):null}else return e===a?a:Ft(e,a)}function Xc(r,a){if(mi.includes(r.type)||a.getBuiltIn(r.id))return null;const e=yi(r.parent,a);return e?e===a?lt.includes(r.type)?r:null:e.type===n.DefinitionEntity?r:Xc(e,a):null}function Xl(r,a,e){if(r===a||a===e||r===e)return!1;const t=Ft(a.parent,e);return t===r?!0:Xl(t,a,e)}var Ql=(r=>(r.SameBothLocal="same-both-local",r.AInB="a-in-b",r.BInA="b-in-a",r.ParallelInCommonParent="parallel-in-common-parent",r.ParallelInProject="parallel-in-project",r.AIsGlobalBIsNot="a-is-global-b-is-not",r.BIsGlobalAIsNot="b-is-global-a-is-not",r.SameBothGlobal="same-both-global",r))(Ql||{});function La(r,a,e){const t=Ft(r,e),i=Ft(a,e);if(!t)throw new Error("Could not find scope owner for the entity: "+r.id);if(!i)throw new Error("Could not find scope owner for the entity: "+a.id);if(t===i&&t.type!==n.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:t};if(t===i&&t.type===n.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:t};if(t.type===n.Project&&i.type!==n.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:t};if(t.type!==n.Project&&i.type===n.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:i};if(Xl(t,i,e))return{compatible:!0,type:"b-in-a",commonAncestorScope:t};if(Xl(i,t,e))return{compatible:!0,type:"a-in-b",commonAncestorScope:i};const o=xc(t,i);return o===e?{compatible:!1,type:"parallel-in-project",commonAncestorScope:o}:o?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:Ft(o,e)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:e}}function PP(r,a,e){const t=La(r,a,e);if(!t.compatible||t.type!=="same-both-local")return null;if(r===a)return r;let i=Ft(r.parent,e);if(i){if(i===a)return a;if(i.type===n.Project)return r}else return r;for(;i;){if(i){if(i===a)return a;if(i.type===n.Project)return r}else return r;i=Ft(i.parent,e)}let s=Ft(a.parent,e);if(s){if(s===r)return r;if(s.type===n.Project)return a}else return a;for(;s;){if(s){if(s===r)return r;if(s.type===n.Project)return a}else return a;s=Ft(s.parent,e)}return null}function wP(r){return r.length===0?null:r.length===1?r[0]:r.reduce((e,t)=>{const i=PP(e,t,t.project);return!i||i===t?e:t},r[0])}function yi(r,a){if(!r)return null;let e;return typeof r=="string"?e=r:r.type===n.GenericReference?e=B(r):e=r.id,e===a.id?a:a.get(e)}function Yr(r){if(!r)return null;if(mi.includes(r.type))return r;if(r.type===n.Project)return null;if(r.project.getBuiltIn(r.id))return r;const a=r.parent;return!a||a.type===n.Project?null:Yr(a)}function Ua(r){const a=[];function e(s,l){return a.some(o=>o.blockedByCaller===s&&o.blockedByCalling===l)}function t(s,l){e(s,l)||a.push({blockedByCaller:s,blockedByCalling:l})}const i=Xc(r,r.project);return r.calledBySuccess.forEach(s=>{[...s.successCalls||[]].forEach(d=>{nt.includes(d.type)&&d!==r&&(it(r).find(c=>c===d)||t(s,d))});let o;if(at.includes(s.type)&&(o=s),o){const d=Ua(o);d.reachable||it(r).find(c=>c===s)||d.blocks.forEach(c=>{t(s,c.blockedByCalling)})}}),r.calledByError.forEach(s=>{[...s.errorCalls||[]].forEach(d=>{nt.includes(d.type)&&d!==r&&(it(r).find(c=>c===d)||t(s,d))});let o;if(at.includes(s.type)&&(o=s),o){const d=Ua(o);d.reachable||it(r).find(c=>c===s)||d.blocks.forEach(c=>{t(s,c.blockedByCalling)})}}),r.calledByEntry.forEach(s=>{if([...s.calls||[]].forEach(d=>{nt.includes(d.type)&&d!==r&&(it(r).find(c=>c===d)||t(s,d))}),s===i)return;let o;if(s.type===n.FunctionDeclaration){const d=Pt(s);if(d.type===n.DefinitionEntity)return;d.type===n.Loop&&(o=d)}if(o){const d=Ua(o);d.reachable||d.blocks.forEach(u=>{t(s,u.blockedByCalling)})}}),{reachable:a.length===0,entryPoint:i,blocks:a}}function iS(r){return ka.includes(r.type)?r.type===n.FunctionDeclaration?!OP(r):!0:!1}function rS(r){if(n.ActionDescriptor===r.type){if(r.project.operationDeclarations.find(s=>s.id===r.id))return n.Operation;if(r.project.globalEventActionDescriptors.find(s=>s.id===r.id))return n.GlobalEvent;if(r.project.loopDeclarations.find(s=>s.id===r.id))return n.Loop;if(r.project.conditionDeclarations.find(s=>s.id===r.id))return n.Condition}return r.type}function Os(r,a){if(r.type!==n.DefinitionEntity||r.abstract)return!1;const e=zc(r)||r;return!!Wc(e).includes(a)}function nS(r){const a=[];return r.entities.forEach(e=>{if(Os(e,z.PERSISTED_ENTITY)){a.push(e);return}}),p(a)}function sS(r){const a=[];return r.entities.forEach(e=>{if(Os(e,z.RELATIONAL_DATABASE)){a.push(e);return}}),p(a)}function aS(r){return r.type!==n.DefinitionEntity||r.abstract||!Os(r,z.PERSISTED_ENTITY)?null:(r==null?void 0:r.properties.find(e=>{var t;return((t=e.implements)==null?void 0:t.id)===x[n.BuiltInBaseEntity][z.PERSISTED_ENTITY].properties.primaryKey.id&&!e.abstract}))||null}function oS(r){if(r.type!==n.DefinitionEntity)return[];if(r.abstract)return[];if(!Os(r,z.PERSISTED_ENTITY))return[];const a=[],e=r.properties.filter(t=>{var i;return((i=t.implements)==null?void 0:i.id)!==x[n.BuiltInBaseEntity][z.PERSISTED_ENTITY].properties.database.id&&!t.abstract});return a.push(...e),a}function lS(r){var e;if(!r||r.type!==n.DefinitionEntity||!Os(r,z.PERSISTED_ENTITY))return null;const a=r.properties.find(t=>{var i;return((i=t.implements)==null?void 0:i.id)===x[n.BuiltInBaseEntity][z.PERSISTED_ENTITY].properties.database.id});return(e=a==null?void 0:a.getDefaultValue())==null?void 0:e.valueAsTypeSingle}function ht(r,a){var t;if(!af.includes(a.type)||!r)return a.project||null;let e=a.project;return r.type===n.Project?e=r:((t=a.project)==null?void 0:t.id)!==r.project.id&&(e=r.project),e}function dS(r){switch(r){case n.Project:return m;case n.InstalledProject:return Fr;case n.DefinitionEntity:return Hr;case n.FunctionDeclaration:return Nr;case n.GlobalEvent:return Vn;case n.VariableInstance:return gr;case n.VariableDeclaration:return $r;case n.InputMap:return Ji;case n.OutputMap:return Si;case n.Condition:return jr;case n.Operation:return Lr;case n.FunctionCall:return Sr;case n.ReturnDeclaration:return ri;case n.ArgumentDeclaration:return xr;case n.PrimitiveEntity:return si;case n.DataType:return Cn;case n.Property:return _r;case n.ActionDescriptor:return Se;case n.ReturnStatement:return Mr;case n.ContinueStatement:return Gt;case n.BreakStatement:return Bn;case n.Loop:return Ur;case n.Search:return Gr;case n.ValueDescriptor:return kr;case n.InternalCall:return _n;case n.LiteralValue:return Mn}return null}function uS(r){const a={added:{},updated:{},removed:{},affected:[],seenEntities:[],self:r==null?void 0:r.self};return r==null||r.added.forEach(e=>{a.added[e.id]=e}),r==null||r.updated.forEach(e=>{a.updated[e.id]=e}),r==null||r.removed.forEach(e=>{a.removed[e.id]=e}),a.affected=Array.from(new Set(r==null?void 0:r.affected.map(e=>e.id))),a}function ut(r,a){const e=Na(r.type);return e?!e.MUTABLE_META_PROPERTIES.every(i=>{const s=r[i],l=a[i];return l===void 0||s===l?!0:Array.isArray(s)&&Array.isArray(l)?s.length!==l.length?!1:s.every((o,d)=>o===l[d]):!1}):!1}function ed(r,a={}){if(r.type===n.Project)return[];if(!r.parent)return[];const e=B(r.parent);if(!e)return[];const t=a[e];return t?[t.id,...ed(t,a)]:[]}function pS(r){const a=[],e=new Set;return[...r.listAdded,...r.listUpdated,...r.listAffected].forEach(t=>{const i=Pt(t);!i||e.has(i.id)||(e.add(i.id),a.push(i))}),p(a)}function cS(r,a){const e=[];if(r.parent)if(r.id===r.parent)e.push(new P({id:`${r.id}--${r.parent}--${b.SelfReference}`,code:b.SelfReference,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const t=a.get(r.parent);t?[n.Project,n.DataType].includes(t.type)||e.push(new P({id:`${r.id}--${r.parent}--${b.InvalidParentReference}`,code:b.InvalidParentReference,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):e.push(new P({id:`${r.id}--${r.parent}--${b.ReferencedEntityNotFound}`,code:b.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return r.implements&&Array.isArray(r.implements)?r.implements.forEach(t=>{if(r.id===t){e.push(new P({id:`${r.id}--${t}--${b.SelfReference}`,code:b.SelfReference,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at one of the 'implements' references. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));return}const i=a.get(t);i?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(i.type)?i.abstract||e.push(new P({id:`${r.id}--${t}--${b.InvalidImplementsReference}`,code:b.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):e.push(new P({id:`${r.id}--${t}--${b.InvalidImplementsReference}`,code:b.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new P({id:`${r.id}--${t}--${b.ReferencedEntityNotFound}`,code:b.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.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 P({id:`${r.id}--${$.InvalidObjectStructure}`,code:$.InvalidObjectStructure,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' property that isn't an array.`,issue:null})),r.extends&&Array.isArray(r.extends)&&r.extends.forEach(t=>{const i=a.get(t);i?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(i.type)?i.abstract&&e.push(new P({id:`${r.id}--${t}--${b.InvalidExtendsReference}`,code:b.InvalidExtendsReference,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to a non-abstract entity. Did you want to use the property 'implements', which holds a list of references to absract entities, instead?`,issue:null})):e.push(new P({id:`${r.id}--${t}--${b.InvalidExtendsReference}`,code:b.InvalidExtendsReference,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new P({id:`${r.id}--${t}--${b.ReferencedEntityNotFound}`,code:b.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.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 CP=(r=>(r.Extends="extends",r.Implements="implements",r))(CP||{});const je=class je extends st{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 i=t;if(e.parent){const u=B(e.parent);i=t.get(u)}const s=[];e.implements&&e.implements.forEach(u=>{s.push(t.get(u)||t.getBuiltIn(u))});const l=[];e.extends&&e.extends.forEach(u=>{l.push(t.get(u)||t.getBuiltIn(u))});const o={id:e.id,version:m.UUID.uuid(),createdAt:T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:e.name,type:n.DefinitionEntity,description:e.description,static:e.static,abstract:e.abstract,properties:[],methods:[],abstractMethods:[],extends:l,implements:s,x:0,y:0,parent:i},d=C(o,t);return d.setParent(i,null),d.initChildren(null),d}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const s=[],l=cS(i,t),o=mc(i,t);s.push(...l,...o,...dt(i));const d=i.parent?t.get(i.parent):null;if(d&&d.type===n.DataType){const u=d;u.entity&&s.push(new P({id:`${e.id}--${b.NewEntityWouldOverriteExisting}`,code:b.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 '${u.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
  ${Wi({describe_entity:u.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:s,modifiedData:i}}get allBasePropertiesFromExtendedAndImplementedEntities(){return p([...this.extends.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract),...e],[])])}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[]),...this.implements.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...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 P({id:`${this.id}--${b.InvalidParentUpdate}`,code:b.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=[],i=[],s=[];return Object.values(this.detachedDependents).forEach(l=>{const o=l.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),i.push(...o.removed),s.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}subscribeToDependencies(){return this.implements.forEach(e=>{mi.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{mi.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=m.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new je(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[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=[],i=[],s=[],l=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[I,E]of c.knownVersions)u.set(I,E);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new je(u,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:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent){const l=B(this.initialData.parent),o=this.project.get(l);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return this.initialData.extends.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addExtension(d),d.type!==n.BuiltInBaseEntity&&e.push(d))}),this.initialData.implements.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addImplementation(d),d.type!==n.BuiltInBaseEntity&&e.push(d))}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],l=[];this.initialized=!0,this.captureVersion();const{updated:o,added:d,removed:u,affected:h}=this.syncImplementationProperties(e);t.push(...o),i.push(...d),s.push(...u),l.push(...h);const{updated:c,added:I,removed:E,affected:O}=this.addExtendedProperties(e);return t.push(...c),i.push(...I),s.push(...E),l.push(...O),this.addSuggestions(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-self-to-project"))){const t=[this],i=[],s=[],l=[];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:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}setParent(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,A.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 R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.methods=this.initialData.methods.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.extends=this.initialData.extends.map(t=>C(t,this.project)),this.implements=this.initialData.implements.map(t=>C(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}syncImplementationProperties(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],i=[],s=[],l=[],o=this.properties,d=this.implementedPropertiesFromOriginalParents,u=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return d.filter(c=>!u.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})).forEach(c=>{if(this.properties.find(w=>{var V;return((V=w.implements)==null?void 0:V.id)===c.id}))return;const E=this.properties.find(w=>w.name===c.name&&!!w.abstract&&!w.implements);if(E){E.implements=c,E.abstract=!1;return}const O=c.clone(e,this,m.UUID.uuid());O.initChildren(e),i.push(O),e==null||e.add(O,A.Added),O.setImplements(c,e),O.metaSync({abstract:!1},e),this.addProperty(O)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addExtendedProperties(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-extended-properties"))){const t=[],i=[],s=[],l=[],o=this.properties,d=this.extendedPropertiesFromOriginalParents,u=d.filter(c=>d.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})?!1:!c.abstract),h=new Set(o.map(c=>c.name));return u.forEach(c=>{if(h.has(c.name))return;h.add(c.name);const I=c.clone(e,this,m.UUID.uuid());I.initChildren(e),i.push(I),e==null||e.add(I,A.Added),this.addProperty(I)}),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSuggestions(){return this.implements.forEach(e=>{FZ(this,e).forEach(s=>{const l=s.toJSON();l.id=`_suggestion--parent--${this.id}--${s.id}`;const o=C(l,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),xZ(this,e).forEach(s=>{const l=`_suggestion--parent--${this.id}--${s.id}`,o=s.implementAsFunctionDeclaration(null,this,l),d=C(o,this.project);if(d.suggestion=!0,d.setParent(this,null),d.initChildren(null),this.methods=this.methods.filter(u=>u.id!==l),d.inputs.forEach(u=>{u.suggestion=!0}),d.returnStatements.length){const u=d.returnStatements[0];u.suggestion=!0,u.outputs.forEach(h=>{h.suggestion=!0})}this.addSuggestedMethod(d)})}),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"meta-sync"))){const i=ut(this,e),s=this.toMeta();return this.name=e.name||s.name,this.description=e.description||s.description,this.x=e.x||s.x,this.y=e.y||s.y,this.static=e.static||s.static,this.abstract=e.abstract||s.abstract,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await je.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await je.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await je.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await je.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await je.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await je.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-entity"))){const i=[],s=[],l=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(s.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(d=>{const{updated:u,removed:h,added:c}=d.entity.onDetachedDependencyRemoved(this,d.field,t);i.push(...u),s.push(...h),l.push(...c)}),this.properties.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),this.methods.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),this.abstractMethods.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),this.suggestedProperties.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),this.suggestedMethods.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const d=this.parent.setEntity(null);i.push(d)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(l),updated:p(i),removed:p(s),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],l=[];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:d}=o.restore({},e);i.push(...d)}),this.methods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.abstractMethods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.suggestedProperties.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.suggestedMethods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(l),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(i=>i.toFlat(e)),...this.implements.flatMap(i=>i.toFlat(e)),...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(i=>i.toFlatIds(e)),...this.implements.flatMap(i=>i.toFlatIds(e)),...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.parent.toFlatIds(e)])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,static:this.static,abstract:this.abstract,x:this.x,y:this.y,type:this.type,name:this.name}}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=q){var i,s,l,o,d;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||yt(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(l=e.seenEntities)!=null&&l.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(d=e.seenEntities)==null||d.add(this.id),{id:t,version:m.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),author:m.sessionAuthor,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(u=>u.toJSONClone({...e,newId:null})),methods:this.methods.map(u=>u.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(u=>u.toJSONClone({...e,newId:null})),implements:this.implements.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),extends:this.extends.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.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(s=>s.toReference(e)),methods:this.methods.map(s=>s.toReference(e)),abstractMethods:this.abstractMethods.map(s=>s.toReference(e)),implements:this.implements.map(s=>s.toReference(e)),extends:this.extends.map(s=>s.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(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e)),...this.implements.flatMap(i=>i.toFlatJSON(e)),...this.extends.flatMap(i=>i.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(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.DefinitionEntity).flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.DefinitionEntity).flatMap(i=>i.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=GZ(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 R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){var w,V,j;let l=ht(t,this);const o=this.toJSON(),d=i||m.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const u=d.split("-id"),h=u[u.length-1||0]||d;o.id=d,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=pt(o,l);t&&c.setParent(t,null),s&&c.subscribe(),c.initChildren(e),e==null||e.add(c,A.Added);const I=(w=this.properties)==null?void 0:w.map(G=>G.clone(e,c,m.UUID.uuid(),s));c.properties=I;const E=(V=this.methods)==null?void 0:V.map((G,_)=>G.clone(e,c,h+"-method-"+_+"-id",s));c.methods=E;const O=(j=this.abstractMethods)==null?void 0:j.map((G,_)=>G.clone(e,c,h+"-abstract-method-"+_+"-id",s));return c.abstractMethods=O,e==null||e.attemptAutoclose("clone-entity",this.id),c}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"implement-definition-entity")),i){const s=ql(this,e,t,i);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),s}getAllInteractiveMethods(){const e=this.implements.filter(i=>i.type===n.DefinitionEntity||i.type===n.BuiltInBaseEntity&&i.interactive);return p([...this.methods,...this.extends.flatMap(i=>i.getAllInteractiveMethods()),...e.flatMap(i=>i.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const i=[],s=[],l=[],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 d=[];e.forEach(c=>{d.find(E=>F(E,this.project)===F(c,this.project))||d.push(c)});const u=this.properties.filter(c=>!c.dataType);d.forEach(c=>{var j,G;const I=u.find(_=>F(_,this.project)===F(c,this.project));if(!I)return;const O=wn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),w=qi(O,t),V=w==null?void 0:w.clone(t,I,m.UUID.uuid(),!0);if(V){const _=(j=I.dataType)==null?void 0:j.merge(V,t);I.dataType&&(_==null?void 0:_.self.id)!==I.dataType.id&&I.dataType.remove({ignoreUpstream:!1},t),V.id!==((G=_==null?void 0:_.self)==null?void 0:G.id)&&V.remove({ignoreUpstream:!1},t),_!=null&&_.self&&(_.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(_.self,A.Added),I.setDataType(_.self),t==null||t.add(I,A.Updated))}c.setDeclaration(I),t==null||t.add(c,A.Updated)});const h=[];return d.forEach(c=>{if(!c.declaration){h.push(c);return}}),h.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(h.forEach(c=>{var _,g,Z,S;const I=this.properties.find(te=>F(te,this.project)===F(c,this.project));if(I){if(c.setDeclaration(I),!I.getDataType(t)){const ce=wn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),Ie=qi(ce),X=Ie==null?void 0:Ie.clone(t,I,m.UUID.uuid(),!0);if(X){const le=(_=I.dataType)==null?void 0:_.merge(X,t);I.dataType&&(le==null?void 0:le.self.id)!==I.dataType.id&&I.dataType.remove({ignoreUpstream:!1},t),X.id!==((g=le==null?void 0:le.self)==null?void 0:g.id)&&X.remove({ignoreUpstream:!1},t),le!=null&&le.self&&(le.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(le.self,A.Added),I.setDataType(le.self),t==null||t.add(I,A.Updated))}}return}const E={id:m.UUID.uuid(),type:n.Property,version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:F(c,this.project),description:c.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:c.index,implements:null,dataType:null,parent:this.toReference()},O=C(E,this.project);O.setParent(this,t),O.initChildren(t),t==null||t.add(O,A.Added);const V=wn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),j=qi(V),G=j==null?void 0:j.clone(t,O,m.UUID.uuid(),!0);if(G){const te=(Z=O.dataType)==null?void 0:Z.merge(G,t);O.dataType&&(te==null?void 0:te.self.id)!==O.dataType.id&&O.dataType.remove({ignoreUpstream:!1},t),G.id!==((S=te==null?void 0:te.self)==null?void 0:S.id)&&G.remove({ignoreUpstream:!1},t),te!=null&&te.self&&(te.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(te.self,A.Added),O.setDataType(te.self),t==null||t.add(O,A.Updated))}return this.addProperty(O),c.setDeclaration(O),t==null||t.add(c,A.Updated),O}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:p(i),updated:p(s),removed:p(l),affected:p(o),self:this})}};f(je,"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,...i)=>null}),f(je,"type",n.DefinitionEntity),f(je,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),f(je,"PARENT_TYPES",[...je.USER_MANAGED_PARENT_TYPES]),f(je,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),f(je,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(je,"BASE_PROPERTIES",[...je.MUTABLE_BASE_PROPERTIES,...je.INMUTABLE_BASE_PROPERTIES]),f(je,"MUTABLE_META_PROPERTIES",[...je.MUTABLE_BASE_PROPERTIES,"x","y"]),f(je,"INMUTABLE_META_PROPERTIES",[...je.INMUTABLE_BASE_PROPERTIES]),f(je,"META_PROPERTIES",[...je.MUTABLE_META_PROPERTIES,...je.INMUTABLE_META_PROPERTIES]),f(je,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),f(je,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(je,"UPSTREAM_PROPERTIES",[...je.MUTABLE_UPSTREAM_PROPERTIES,...je.INMUTABLE_UPSTREAM_PROPERTIES]),f(je,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),f(je,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(je,"DOWNSTREAM_PROPERTIES",[...je.MUTABLE_DOWNSTREAM_PROPERTIES,...je.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(je,"PROPERTIES",[...je.META_PROPERTIES,...je.UPSTREAM_PROPERTIES,...je.DOWNSTREAM_PROPERTIES]);let Hr=je;function fS(r){const a=v3(),e=r.toJSON();a.safeParse(e).success;const i=[];return Ye(r.errors,i)}const $a=class $a extends st{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(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.extends=this.initialData.extends.map(i=>C(i,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract);return[...e,...i]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...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=U,...t){return await $a.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.extends.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.extends.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,interactive:this.interactive,abstract:this.abstract,static:this.static,type:this.type,name:this.name}}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=q){return{id:this.id+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=q){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(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.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(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.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=fS(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 R(this.project,m.sessionAuthor,T().toISOString(),null,!0,"implement-built-in-base-entity")),i){const s=ql(this,e,t,i);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),s}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof $a&&e.push(...i.getAllInteractiveMethods())})),p(e)}};f($a,"repository",{APILoad:async(e,...t)=>null});let Yi=$a;function yS(r){const a=l3(),e=r.toJSON();a.safeParse(e).success;const i=[];return Ye(r.errors,i)}const nd=class nd extends st{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(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.parent=this,s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.parent=this,s})}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract);return[...e,...i]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...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=U,...t){return await nd.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,static:this.static,abstract:this.abstract,type:this.type,name:this.name}}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=q){return{id:this.id+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=q){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(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.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(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.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=yS(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(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Yi&&e.push(...i.getAllInteractiveMethods())}),p(e)}};f(nd,"repository",{APILoad:async(e,...t)=>null});let si=nd;function pt(r,a){if(!r)throw new Error("Entity is null");const e=a.get(r.id);switch(r.type){case n.LiteralValue:return e||new Mn(r,a);case n.DefinitionEntity:return e||new Hr(r,a);case n.PrimitiveEntity:return e||new si(r,a);case n.FunctionDeclaration:return e||new Nr(r,a);case n.GlobalEvent:return e||new Vn(r,a);case n.DataType:return e||new Cn(r,a);case n.Property:return e||new _r(r,a);case n.FunctionCall:return e||new Sr(r,a);case n.Condition:return e||new jr(r,a);case n.Operation:return e||new Lr(r,a);case n.VariableDeclaration:return e||new $r(r,a);case n.VariableInstance:return e||new gr(r,a);case n.OutputMap:return e||new Si(r,a);case n.ReturnDeclaration:return e||new ri(r,a);case n.ArgumentDeclaration:return e||new xr(r,a);case n.InputMap:return e||new Ji(r,a);case n.Project:return e||new m(r);case n.InstalledProject:return e||new Fr(r,a);case n.ActionDescriptor:return e||new Se(r,a);case n.ReturnStatement:return e||new Mr(r,a);case n.Loop:return e||new Ur(r,a);case n.Search:return e||new Gr(r,a);case n.ValueDescriptor:return e||new kr(r,a);case n.BuiltInBaseEntity:return e||new Yi(r,a);case n.InternalCall:return e||new _n(r,a);case n.ContinueStatement:return e||new Gt(r,a);case n.BreakStatement:return e||new Bn(r,a);case n.GenericReference:return a.get(r.entityId);default:throw new Error("Invalid entity type: "+r.type)}}function C(r,a){if(!r)throw new Error("Entity is null");const e=pt(r,a);return e.subscribe(),e}function hS(r,a){if(!r)throw new Error("Entity is null");switch(r.type){case n.LiteralValue:return Mn.fromGenerationTarget(r,a);case n.DefinitionEntity:return Hr.fromGenerationTarget(r,a);case n.FunctionDeclaration:return Nr.fromGenerationTarget(r,a);case n.GlobalEvent:return Vn.fromGenerationTarget(r,a);case n.DataType:return Cn.fromGenerationTarget(r,a);case n.Property:return _r.fromGenerationTarget(r,a);case n.FunctionCall:return Sr.fromGenerationTarget(r,a);case n.Condition:return jr.fromGenerationTarget(r,a);case n.Operation:return Lr.fromGenerationTarget(r,a);case n.VariableDeclaration:return $r.fromGenerationTarget(r,a);case n.VariableInstance:return gr.fromGenerationTarget(r,a);case n.OutputMap:return Si.fromGenerationTarget(r,a);case n.ReturnDeclaration:return ri.fromGenerationTarget(r,a);case n.ArgumentDeclaration:return xr.fromGenerationTarget(r,a);case n.InputMap:return Ji.fromGenerationTarget(r,a);case n.InstalledProject:return Fr.fromGenerationTarget(r,a);case n.ReturnStatement:return Mr.fromGenerationTarget(r,a);case n.Loop:return Ur.fromGenerationTarget(r,a);case n.Search:return Gr.fromGenerationTarget(r,a);case n.ActionDescriptor:return Se.fromGenerationTarget(r,a);case n.ValueDescriptor:return kr.fromGenerationTarget(r,a);case n.InternalCall:return _n.fromGenerationTarget(r,a);case n.ContinueStatement:return Gt.fromGenerationTarget(r,a);case n.BreakStatement:return Bn.fromGenerationTarget(r,a);default:throw new Error("Invalid entity type: "+r.type)}}const q={seenEntityMaps:new Map,seenEntities:new Set,timestamp:T().toISOString()};class VP{constructor(){f(this,"initialData")}}const U={cascade:!1},BP={APILoad:async(r,...a)=>null},mS={APICreate:async(r,...a)=>r,APIUpdate:async(r,...a)=>r,APIDelete:async(r,...a)=>r,APIClone:async(r,...a)=>{},APILoadVersion:async(r,a,...e)=>null,...BP};class vS{}class TS extends VP{}class IS{}class ES{}class AS{}class Qc{}class RS extends Qc{}class bS extends Qc{}class DS{}class hr{static initReadsValue(a){if(a.initialData.readsValue&&a.initialData.readsValue.type!==n.GenericReference)a.readsValue=C(a.initialData.readsValue,a.project);else if(a.initialData.readsValue&&a.initialData.readsValue.type===n.GenericReference){const e=yi(a.initialData.readsValue,a.project);e&&(a.readsValue=e)}if(a.readsValue){if(et.includes(a.readsValue.type)){let e=a.parent;lt.includes(e.type)||(e=e.parent);const t=a.type===n.InputMap&&a.parent.type===n.Loop;t&&(e=a.parent.parent),a.readsValue.setParent(e,null),a.readsValue.initChildren(null),!t&&e.detachedChildren.includes(a)?e.replaceDetachedChild(a,a.readsValue):t||e.subscribeDetachedChild(a.readsValue)}a.readsValue.addValueReader(a,null)}return a.readsValue}static hydrateReadsValue(a){if(a.initialData.readsValue&&a.initialData.readsValue.type!==n.GenericReference)a.readsValue=C(a.initialData.readsValue,a.project);else if(a.initialData.readsValue&&a.initialData.readsValue.type===n.GenericReference){const e=yi(a.initialData.readsValue,a.project);e&&(a.readsValue=e)}if(a.readsValue){if(et.includes(a.readsValue.type)){let e=a.parent;lt.includes(e.type)||(e=e.parent);const t=a.type===n.InputMap&&a.parent.type===n.Loop;t&&(e=a.parent.parent),a.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(a)?e.replaceDetachedChild(a,a.readsValue):t||e.subscribeDetachedChild(a.readsValue)}a.readsValue.addValueReader(a,null)}return a.readsValue}}class ja{static initWritesValues(a,e){const t=a.initialData.writesValues.reduce((s,l)=>{if(l.type===n.GenericReference||a.writesValues.some(d=>d.id===l.id))return s;const o=C(l,a.project);return o.setValueWriter(a,null),et.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...s,o]},[]),i=[...a.writesValues];return a.writesValues=p([...i,...t]),a.writesValues}}class OS{}const ae=class ae extends st{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{(!ae.UUID||ae.UUID.isBackup)&&(ae.UUID=Go==null?void 0:Go()),ae.UUID||(ae.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),ae.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:i=>i}}}static injectUUIDModule(e){ae.UUID=e}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const s=[];return s.push(...dt(i)),{errors:s,modifiedData:i}}async closePendingCallbacks(){for(let e=0;e<this.history.length;e++){const t=this.history[e];t.dirty&&await t.closeAsync()}}async onCloseChangeSet(e){this.onCloseChangeSetCallback=e,await this.closePendingCallbacks()}async closeChangeSet(e){if(this.onCloseChangeSetCallback){const t=await this.onCloseChangeSetCallback(e);return t.success&&(e.dirty=!1),t}return{success:!1}}toLatestChangeSet(e,t,i,s=!1,l="here-this"){if(!this.history.length)return new R(this,e,t,i,s,l);const o=this.history[this.history.length-1];return o.open?o:this.addChangeSet(new R(this,e,t,i,s,l))}addChangeSet(e){if(!this.history.length)return this.history.push(e),e;const t=this.history.find(l=>l.id===(e==null?void 0:e.id));if(t)return t;const i=this.history.find(l=>l.open);if(i)throw console.log("previouslyStillOpen: ",i),console.log("new change set: ",e),new Error(`There is already an open change-set with id '${i.id}'.`);const s=this.history.findIndex(l=>T(l.timestamp).isBefore(T(e==null?void 0:e.timestamp)));return s===-1?this.history.push(e):this.history.splice(s,0,e),e}discardChangeSet(e){const t=this.history.findIndex(i=>i.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}undo(){const e=[],t=[],i=[],s=[];return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}redo(){const e=[],t=[],i=[],s=[];return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async i=>{await t.init(this),i(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=[],i=[],s=[];return Object.values(this.detachedDependents).forEach(l=>{const o=l.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),i.push(...o.removed),s.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];return{updated:p(s),added:p(l),removed:p(o),affected:p(d),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=ae.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new ae(this);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[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=[],i=[],s=[],l=[];return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[I,E]of c.knownVersions)u.set(I,E);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new ae(u)}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:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=null){const t=[],i=[],s=[],l=[];return this.initialized=!0,this.captureVersion(),this.validate(),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e){const t=[],i=[],s=[],l=[];return this.subscribe(),this.subscribeToDependencies(),{updated:p(t),added:p(i),removed:p(s),affected:p(l),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 R(this.project,ae.sessionAuthor,T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.projects=this.initialData.projects.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.variableInstances=this.initialData.variableInstances.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.conditions=this.initialData.conditions.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.operations=this.initialData.operations.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.functions=this.initialData.functions.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.events=this.initialData.events.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.functionCalls=this.initialData.functionCalls.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.loops=this.initialData.loops.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.searches=this.initialData.searches.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),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 R(this.project,ae.sessionAuthor,T().toISOString(),this,!0,"meta-sync"))){const i=ut(this,e),s=this.toMeta();return this.name=e.name||s.name,this.description=e.description||s.description,this.x=e.x||s.x,this.y=e.y||s.y,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await ae.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await ae.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await ae.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await ae.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await ae.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await ae.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,ae.sessionAuthor,T().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,ae.sessionAuthor,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(i=>i.toFlat(e)),...this.functions.flatMap(i=>i.toFlat(e)),...this.events.flatMap(i=>i.toFlat(e)),...this.projects.flatMap(i=>i.toFlat(e)),...this.variableDeclarations.flatMap(i=>i.toFlat(e)),...this.variableInstances.flatMap(i=>i.toFlat(e)),...this.conditions.flatMap(i=>i.toFlat(e)),...this.operations.flatMap(i=>i.toFlat(e)),...this.functionCalls.flatMap(i=>i.toFlat(e)),...this.loops.flatMap(i=>i.toFlat(e)),...this.searches.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(i=>i.toFlatIds(e)),...this.functions.flatMap(i=>i.toFlatIds(e)),...this.events.flatMap(i=>i.toFlatIds(e)),...this.projects.flatMap(i=>i.toFlatIds(e)),...this.variableDeclarations.flatMap(i=>i.toFlatIds(e)),...this.variableInstances.flatMap(i=>i.toFlatIds(e)),...this.conditions.flatMap(i=>i.toFlatIds(e)),...this.operations.flatMap(i=>i.toFlatIds(e)),...this.functionCalls.flatMap(i=>i.toFlatIds(e)),...this.loops.flatMap(i=>i.toFlatIds(e)),...this.searches.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,type:this.type,name:this.name}}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,i=new Set,s=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(l=>{if(s.includes(l)){t.set(l,l);return}t.set(l,ae.UUID.uuid())}),i.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(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),projects:this.projects.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),variableDeclarations:this.variableDeclarations.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),variableInstances:this.variableInstances.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),conditions:this.conditions.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),operations:this.operations.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),functions:this.functions.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),events:this.events.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),functionCalls:this.functionCalls.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),loops:this.loops.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),searches:this.searches.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null}))}}toReference(e=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+ae.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.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(s=>s.toReference(e)),functions:this.functions.map(s=>s.toReference(e)),events:this.events.map(s=>s.toReference(e)),projects:this.projects.map(s=>s.toReference(e)),variableDeclarations:this.variableDeclarations.map(s=>s.toReference(e)),variableInstances:this.variableInstances.map(s=>s.toReference(e)),conditions:this.conditions.map(s=>s.toReference(e)),operations:this.operations.map(s=>s.toReference(e)),functionCalls:this.functionCalls.map(s=>s.toReference(e)),loops:this.loops.map(s=>s.toReference(e)),searches:this.searches.map(s=>s.toReference(e))}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(i=>i.toFlatJSON(e)),...this.functions.flatMap(i=>i.toFlatJSON(e)),...this.events.flatMap(i=>i.toFlatJSON(e)),...this.projects.flatMap(i=>i.toFlatJSON(e)),...this.variableDeclarations.flatMap(i=>i.toFlatJSON(e)),...this.variableInstances.flatMap(i=>i.toFlatJSON(e)),...this.conditions.flatMap(i=>i.toFlatJSON(e)),...this.operations.flatMap(i=>i.toFlatJSON(e)),...this.functionCalls.flatMap(i=>i.toFlatJSON(e)),...this.loops.flatMap(i=>i.toFlatJSON(e)),...this.searches.flatMap(i=>i.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(i=>i.toFlatGenerationTarget(e)),...this.functions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.events.flatMap(i=>i.toFlatGenerationTarget(e)),...this.projects.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(i=>i.toFlatGenerationTarget(e)),...this.conditions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.operations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.loops.flatMap(i=>i.toFlatGenerationTarget(e)),...this.searches.flatMap(i=>i.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=NZ(),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=C(e,this);return this.addDefinitionEntity(t),t}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=C(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=C(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=C(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=C(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=C(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=C(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=C(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=C(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=C(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=C(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(i=>i.id===e.id);if(t>-1){const i=this.entities[t];return this.entities.splice(t,1),i}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(i=>i.id===e.id);if(t>-1){const i=this.functions[t];return this.functions.splice(t,1),i}return null}removeExternalProject(e){const t=this.projects.findIndex(i=>i.id===e.id);if(t>-1){const i=this.projects[t];return this.projects.splice(t,1),i}return null}removeGlobalEvent(e){const t=this.events.findIndex(i=>i.id===e.id);if(t>-1){const i=this.events[t];return this.events.splice(t,1),i}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(i=>i.id===e.id);if(t>-1){const i=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),i}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,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.functionCalls.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.operations.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.loops.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.searches.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.functionCalls.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.conditions.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.loops.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.searches.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.operations.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.loops.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.searches.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.functionCalls.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.conditions.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.operations.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.loops.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.searches.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.functionCalls.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.conditions.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.operations.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.loops.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.searches.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[])]}getVariableDeclarations(){return p([...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.functionCalls.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.conditions.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.operations.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.loops.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.searches.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(i=>{if(!i.declaration){const s=i.initialData,l=s.declaration.entityId||s.declaration.id,o=t.find(d=>d.id===l);o&&i.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===z.PERSISTED_ENTITY)||null}};f(ae,"sessionAuthor","1"),f(ae,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),f(ae,"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,...i)=>null}),f(ae,"type",n.Project),f(ae,"USER_MANAGED_PARENT_TYPES",[]),f(ae,"PARENT_TYPES",[...ae.USER_MANAGED_PARENT_TYPES]),f(ae,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(ae,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(ae,"BASE_PROPERTIES",[...ae.MUTABLE_BASE_PROPERTIES,...ae.INMUTABLE_BASE_PROPERTIES]),f(ae,"MUTABLE_META_PROPERTIES",[...ae.MUTABLE_BASE_PROPERTIES,"x","y"]),f(ae,"INMUTABLE_META_PROPERTIES",[...ae.INMUTABLE_BASE_PROPERTIES]),f(ae,"META_PROPERTIES",[...ae.MUTABLE_META_PROPERTIES,...ae.INMUTABLE_META_PROPERTIES]),f(ae,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(ae,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),f(ae,"UPSTREAM_PROPERTIES",[...ae.MUTABLE_UPSTREAM_PROPERTIES,...ae.INMUTABLE_UPSTREAM_PROPERTIES]),f(ae,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),f(ae,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(ae,"DOWNSTREAM_PROPERTIES",[...ae.MUTABLE_DOWNSTREAM_PROPERTIES,...ae.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(ae,"PROPERTIES",[...ae.META_PROPERTIES,...ae.UPSTREAM_PROPERTIES,...ae.DOWNSTREAM_PROPERTIES]);let m=ae;var _P=(r=>(r.PersistChangeSet="persist-change-set",r.CreateSingle="create-single",r.CreateBulk="create-bulk",r.CreateSingleNested="create-single-nested",r.CreateBulkNested="create-bulk-nested",r.Update="update",r.Clone="clone",r.Delete="delete",r.Load="load",r.LoadNested="load-nested",r.LoadVersion="load-version",r))(_P||{});class MP extends Se{constructor(e){super(bi,e);f(this,"id",Ke.Parallel);f(this,"name",Ke.Parallel);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",bi);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=bi.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=bi.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=bi.error?C(bi.error,this.project):null}}class NP extends Se{constructor(e){super(kt,e);f(this,"id",kt.id);f(this,"name",kt.name);f(this,"description",kt.description);f(this,"version",kt.version);f(this,"autoexecutable",!1);f(this,"initialData",kt);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=kt.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=kt.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=kt.error?C(kt.error,this.project):null}}class LP extends Se{constructor(e){super(ir,e);f(this,"id",Ke.Sequential);f(this,"name",Ke.Sequential);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",ir);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=ir.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=ir.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=ir.error?C(ir.error,this.project):null}}class PS extends Se{constructor(a){super(Vs,a)}}class wS extends Se{constructor(a){super(Qr,a)}}class CS extends Se{constructor(e){super(en,e);f(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"get-entity-to-match-validate-data"))){let i=null;if(e.readsValue){const l=e.readsValue.getDataType(t);l&&l.entity&&l.entity.type===n.DefinitionEntity&&(i=l.entity)}const s=e.getDefaultValue();return!i&&s&&s.valueAsTypeSingle&&!Array.isArray(s.valueAsTypeSingle)&&s.valueAsTypeSingle.type===n.DefinitionEntity&&(i=s.valueAsTypeSingle),i}syncOperationInstance(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const i=[],s=[],l=[],o=[],d=this.getEntityToMatchInputMap(e);if(d){const{added:c,updated:I,removed:E,affected:O}=this.syncEntityToMatchInputMapDataType(d,t);i.push(...I),s.push(...c),l.push(...E),o.push(...O)}const u=this.getDataToValidateInputMap(e);if(u){const{added:c,updated:I,removed:E,affected:O}=this.syncDataToValidateInputMapDataType(u,t);i.push(...I),s.push(...c),l.push(...E),o.push(...O)}const h=this.getOutputDataOutputMap(e);if(h){const{added:c,updated:I,removed:E,affected:O}=this.syncOutputDataOutputMapDataType(h,t);i.push(...I),s.push(...c),l.push(...E),o.push(...O)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:p(i),added:p(s),removed:p(l),affected:p(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var u,h,c;const i=[],s=[],l=[],o=[];if(((u=e.declaration)==null?void 0:u.id)!==x.operation[Xe.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 I={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,like:!0,inferred:!0,parent:e.toReference()},E=C(I,e.project);E.setParent(e,t),E.initChildren(t),t==null||t.add(E,A.Added),i.push(E),e.setDataType(E)}(h=e.dataType)==null||h.metaSync({inferred:!0,like:!1,asType:!0},t);const d=this.getEntityToMatch(e,t);return(c=e.dataType)==null||c.setEntity(d),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var c,I,E;const i=[],s=[],l=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==x.operation[Xe.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 d=this.getEntityToMatchInputMap(e.parent);if(!d)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(d,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 O={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=C(O,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,A.Added),i.push(w),e.setDataType(w)}(I=e.dataType)==null||I.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(d,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var c,I,E;const i=[],s=[],l=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==x.operation[Xe.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 d=this.getEntityToMatchInputMap(e.parent);if(!d)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(d,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 O={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=C(O,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,A.Added),i.push(w),e.setDataType(w)}(I=e.dataType)==null||I.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(d,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var i,s;if(((i=e.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].inputs.entityToMatch.id){const{added:l,updated:o,removed:d,affected:u}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:p(o),added:p(l),removed:p(d),affected:p(u),self:e.dataType}}else if(((s=e.declaration)==null?void 0:s.id)===x.operation[Xe.Validate].inputs.dataToValidate.id){const{added:l,updated:o,removed:d,affected:u}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:p(o),added:p(l),removed:p(d),affected:p(u),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var i;if(((i=e.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].outputs.outputEntity.id){const{added:s,updated:l,removed:o,affected:d}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:p(l),added:p(s),removed:p(o),affected:p(d),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class VS extends Se{constructor(a){super(md,a)}}class BS extends Se{constructor(a){super(Td,a)}}class _S extends Se{constructor(a){super(Id,a)}}class MS extends Se{constructor(a){super(Wa,a)}}class NS extends Se{constructor(a){super(qa,a)}}class LS extends Se{constructor(a){super(Cs,a)}}function US(r){const a=[new LP(r),new MP(r),new NP(r),new PS(r),new wS(r),new CS(r),new MS(r),new VS(r),new _S(r),new BS(r),new NS(r),new LS(r),new Se(hd,r),new Se(yd,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.operationDeclarations=a,a}class UP extends Yi{constructor(e){super(wt,e);f(this,"initialData");f(this,"id",z.PERSISTED_ENTITY);f(this,"version","1");f(this,"name",z.PERSISTED_ENTITY);f(this,"description",wt.description);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",wt.abstract);f(this,"static",wt.static);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=wt,this.project=e,this.id=wt.id,this.version=wt.version,this.name=wt.name,this.static=wt.static,this.abstract=wt.abstract,this.properties=this.initialData.properties.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.methods=this.initialData.methods.map(t=>{const i=C(t,this.project);return i.parent=this,i}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const i=C(t,this.project);return i.parent=this,i}),this.extends=this.initialData.extends.map(t=>C(t,this.project))}}function jS(r){const a=[new UP(r),new Yi(js,r),new Yi(Ui,r),new Yi(po,r)];return a.forEach(e=>{r.subscribeBuiltInInstance(e)}),r.builtInBaseEntities=a,a}function gS(r){const a=[new si(se,r),new si(Xi,r),new si(ve,r),new si(ld,r),new si(Dt,r),new si(Qi,r),new si(Mi,r),new si(er,r),new si(Gn,r)];return a.forEach(e=>{r.subscribeBuiltInInstance(e)}),r.primitives=a,a}function $S(r){const a=[new Se(fo,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.globalEventActionDescriptors=a,a}function GS(r){const a=[new Se(Ns,r),new Se(vr,r),new Se(_s,r),new Se(kn,r),new Se(Zn,r),new Se(to,r)];a.forEach(t=>{t.initChildren(null),r.subscribeBuiltInInstance(t)}),r.loopDeclarations=a;const e=[new Se(so,r),new Se(Ms,r),new Se(ro,r),new Se(Md,r),new Se(Ld,r),new Se(io,r)];return e.forEach(t=>{t.initChildren(null),r.subscribeBuiltInInstance(t)}),r.loopDeclarationsBodies=e,a}function FS(r){const a=[new kr(yo,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.valueDescriptors=a,a}function xS(r){const a=[new Se(an,r),new Se(zn,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.conditionDeclarations=a,a}const Ln={},td={},ga={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function jP(r,{enrich:a}={enrich:!0}){const e=r.project,t=r.record,i=new Zl(e),s=new Set;t[e.id]=e,s.add(e.id);const l=T().toISOString();Object.values(t).forEach(u=>{!u||i.allBuiltInEntityIds.includes(u.id)||s.add(u.id)}),i.order=Array.from(s),i.flatRecord=t,i.orderEntities();const o=id(r.project);o.instances[e.id]=o;const d=a?o.addChangeSet(new R(o,"",l,o)):null;return i.visit(u=>{if(u.id===o.id)return;const h=C(u,o);h.hydrateAncestors(),h.addSelfToProject(null)}),a?(i.visit(u=>{const h=o.get(u.id);h&&h.afterAllChildrenInitialized(d)}),o.afterAllChildrenInitialized(d)):rd(o,l).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),o.instancesList.forEach(u=>{u.previousVersion=null}),d==null||d.close(),o}async function kS(r,a=ga){const e={...ga,...a};if(e.empty)return{data:{project:{id:r.id,type:n.Project,version:m.UUID.uuid(),createdAt:T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(e.mock){const i={...sp};return i.id=r.id,{data:{project:i,record:{}}}}return console.log("Fetching project from external API"),new Promise(async i=>{if(e.onFetch){const s=await e.onFetch(r.id);if(s){i({data:s});return}}else i({data:null})})}function id(r){const a=new m(r);return gS(a),jS(a),US(a),$S(a),GS(a),FS(a),xS(a),Array.from(new Set([...a.getAllBuiltInIds(),...Vi()])).forEach(t=>{if(!a.builtInInstances[t]&&a.instances[t])a.builtInInstances[t]=a.instances[t],delete a.instances[t];else if(!a.builtInInstances[t])throw new Error(`Built in entity was not properly initialized: ${t}`)}),a}function rd(r,a){return r.instancesList.filter(t=>T(t.createdAt).isAfter(T(a)||!!t.previousVersion))}function ZS(r,{enrich:a}={enrich:!0}){const e=new Map,t=Array.from(new Set([...r.getAllBuiltInIds(),...Vi()]));Object.keys(r.instances).forEach(u=>{if(t.includes(u)){e.set(u,u);return}const h=r.get(u);if(!ed(h,{...r.instances,...r.builtInInstances}).every(E=>!t.includes(E))){e.set(u,u);return}e.set(u,m.UUID.uuid())});const i=T().toISOString(),s=r.toShallowJSON({seenEntityMaps:e});s.previousVersion=null,s.createdAt=i,s.version=m.UUID.uuid();const l=id(s),o=a?l.addChangeSet(new R(l,"",i,l)):null,d=new Zl(r);return d.visit(u=>{const h=u.toShallowJSON({seenEntityMaps:e});u.type===n.ValueDescriptor&&u.name==="Iteration result"&&(console.log("Og entity shallow copy: ",h),console.log("Og entity full: ",u)),h.previousVersion=null,h.createdAt=i,h.version=m.UUID.uuid();const c=C(h,l);c.hydrateAncestors(),c.addSelfToProject(o),o==null||o.add(c,A.Added)}),a?(d.visit(u=>{const h=l.get(e.get(u.id));h&&h.afterAllChildrenInitialized(o)}),l.afterAllChildrenInitialized(o)):rd(l,i).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),l.instancesList.forEach(u=>{u.previousVersion=null}),o==null||o.close(),l}function gP(r,{enrich:a}={enrich:!0}){const e=id(r),t=T().toISOString(),i=a?e.addChangeSet(new R(e,"",t,e)):null;i&&(i.type=bc.Automatic);const s=new Zl(r);return s.visit(l=>{const o=C(l,e);o.hydrateAncestors(),o.addSelfToProject(i)}),a?(s.visit(l=>{const o=e.get(l.id);o&&o.afterAllChildrenInitialized(i)}),e.afterAllChildrenInitialized(i)):rd(e,t).forEach(o=>{o.remove({ignoreUpstream:!0},null)}),i==null||i.close(),e}async function qS(r,a=ga){const e={...ga,...a};if(r.id&&Ln[r.id]&&!e.ignoreCache)return Ln[r.id];if(r.id&&td[r.id]&&!e.ignoreCache)return await td[r.id],Ln[r.id];const t=kS(r,e);r.id&&(td[r.id]=t);const i=await t;if(i.data){let s;return e.mock?s=gP(sp,{enrich:!!e.enrich}):i.data instanceof m?s=i.data:s=jP(i.data,{enrich:!!e.enrich}),Ln[r.id]=s,r.id&&delete td[r.id],s}return null}function JS(r){return Ln[r.id]&&delete Ln[r.id],null}const SS="test_primitive_entities_export";y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Lc,y.ALL_BUILT_IN_BASE_ENTITIES=gI,y.ALL_BUILT_IN_CONDITION_ENTITIES=KI,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=QI,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=fT,y.ALL_BUILT_IN_LOOP_ENTITIES=cT,y.ALL_BUILT_IN_OPERATION_ENTITIES=D0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=cf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=rE,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=iE,y.ActionDescriptorState=Se,y.ActionInputMapState=vJ,y.ActionOutputMapState=EJ,y.AppendToListOperationInputIds=Eh,y.AppendToListOperationOutputIds=Ah,y.ArgumentDeclarationDependencyField=l1,y.ArgumentDeclarationState=xr,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Bc,y.BUILT_IN_BASE_ENTITY_IDS=x,y.BUILT_IN_ENTITY_TYPES=mi,y.BaseCanvasDraggableState=IS,y.BaseEntityNames=z,y.BaseState=TS,y.BaseValueDescriptorIds=Za,y.BreakStatementDependencyField=Oc,y.BreakStatementState=Bn,y.BuiltInBaseEntityState=Yi,y.CACHED_PROJECTS_BY_ID=Ln,y.CALLABLE_ENTITIES_EXPLANATION=CJ,y.CALLABLE_TYPES=Bi,y.CALLER_ENTITIES_EXPLANATION=f1,y.CALLER_TYPES=_i,y.CALLS_UPDATE_EXPLANATION=qr,y.COMPARISON_CONDITIONS=YI,y.CONDITIONS=HI,y.CUSTOM_ENTITY_OPERATIONS=km,y.CallableEntityClass=AS,y.CallerEntityClass=Qc,y.ChangeSet=R,y.ChangeSetChangeCaptureType=bc,y.ChangeSetEntityChangeType=A,y.ChildEntityState=ES,y.ComparisonOperatorTypes=ft,y.ConditionDependencyField=i1,y.ConditionState=jr,y.ContinueStatementDependencyField=Dc,y.ContinueStatementState=Gt,y.CreateNewInputIds=mm,y.CreateNewOutputIds=vm,y.DRAGGABLE_CALLABLE_TYPES=od,y.DRAGGABLE_CALLER_TYPES=nf,y.DRAGGABLE_ELEMENT_TYPES=ka,y.DRAGGABLE_EXECUTABLE_TYPES=kP,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=xa,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=ad,y.DataTypeCompatibilityTypes=Ei,y.DataTypeDependencyField=XO,y.DataTypeParentChildRelation=bt,y.DataTypeState=Cn,y.DefinitionEntityDependencyField=CP,y.DefinitionEntityState=Hr,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=mS,y.ENTITIES_WITH_VALLUES_EXPLANATION=$l,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=U,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=q,y.ENTITY_TYPES=ZP,y.ENTITY_WITH_DECLARATION_TYPES=FP,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=lt,y.ENTITY_WITH_NAMES_TYPES=sf,y.ENTITY_WITH_PARENT_TYPES=$P,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=tf,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=GP,y.ENTITY_WITH_VALUE_TYPES=ef,y.ENTRY_POINT_ENTITIES_EXPLANATION=Va,y.ENTRY_POINT_TYPES=ot,y.EVENT_TYPES=$n,y.EXECUTABLE_TYPES=xP,y.EXECUTION_OPERATIONS=hm,y.EntityAction=_P,y.EntityError=mn,y.EntityErrorSeverity=D,y.EntityGenerationError=P,y.EntityGenerationErrorCode=b,y.EntityInstanceErrorCode=J,y.EntityOperations=Xe,y.EntityType=n,y.EntityWithLogicScopeClass=OS,y.EntityWithValueClass=DS,y.EntryPointEntityClass=RS,y.ExecutionOperations=Ke,y.ExecutionTerminationType=e1,y.FunctionCallDependencyField=b1,y.FunctionCallState=Sr,y.FunctionDeclarationDependencyField=KO,y.FunctionDeclarationState=Nr,y.GET_PROJECT_OPTIONS_DEFAULTS=ga,y.GLOBAL_EVENT_DECLARATIONS=XI,y.GetLastInListOperationInputIds=lh,y.GetLastInListOperationOutputIds=dh,y.GlobalEventNames=Ki,y.GlobalEventState=Vn,y.HTTPOperations=Bt,y.HTTP_OPERATIONS=R0,y.InputMapDependencyField=a1,y.InputMapState=Ji,y.InstalledProjectState=Fr,y.InternalCallDependencyField=s1,y.InternalCallState=_n,y.JoinListOperationInputIds=Cy,y.JoinListOperationOutputIds=Vy,y.LIST_OPERATIONS=Lh,y.ListOperations=ye,y.LiteralValueDependencyField=d1,y.LiteralValueState=Mn,y.LoopDependencyField=t1,y.LoopState=Ur,y.LoopTypes=Q,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Jr,y.NUMBER_OPERATIONS=kf,y.NumberOperations=Qe,y.OPERATION_DECLARATIONS=b0,y.OperationDependencyField=QO,y.OperationState=Lr,y.OutputMapDependencyField=o1,y.OutputMapParentChildRelation=gn,y.OutputMapState=Si,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Gl,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=Zr,y.PASS_THROUGH_CALLABLE_TYPES=at,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=rf,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=Nc,y.ParallelExecutionOperation=MP,y.PassThroughCallableEntityClass=bS,y.PersistedEntity=UP,y.PersistedEntityMethods=oi,y.PrimitiveEntityState=si,y.PrimitiveTypes=N,y.ProjectState=m,y.PropertyDependencyField=YO,y.PropertyState=_r,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=BP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=VJ,y.ReturnDeclarationDependencyField=HO,y.ReturnDeclarationState=ri,y.ReturnStatementDependencyField=Ll,y.ReturnStatementState=Mr,y.STANDALONE_CONDITIONS=FI,y.STRING_OPERATIONS=wy,y.ScopeCompatibilityType=Ql,y.SearchDependencyField=n1,y.SearchState=Gr,y.SequentialExecutionOperation=LP,y.SequentialExecutionOperationInputIds=im,y.SequentialExecutionOperationOutputIds=rm,y.SharedEntityErrorCode=$,y.SharedStateFunctionality=VP,y.SplitListOperationInputIds=qy,y.SplitListOperationOutputIds=Jy,y.StandaloneOperatorTypes=hi,y.StringOperations=Ee,y.TERMINATION_TYPES=nt,y.Traverser=Zl,y.USER_MANAGED_ENTITY_TYPES=af,y.UserManagedEntityStateTemplate=vS,y.VALUE_READING_ENTITIES_EXPLANATION=Mc,y.VALUE_READING_TYPES=mr,y.VALUE_WRITING_ENTITIES_EXPLANATION=y1,y.VALUE_WRITING_TYPES=vt,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=_c,y.VARIABLE_TYPES=et,y.ValueAutogenerationType=mt,y.ValueDescriptorDependencyField=u1,y.ValueDescriptorParentChildRelation=M,y.ValueDescriptorState=kr,y.ValueReadingEntityClass=hr,y.ValueWritingEntityClass=ja,y.VariableDeclarationDependencyField=r1,y.VariableDeclarationState=$r,y.VariableInputMapState=mJ,y.VariableInstanceDependencyField=Pc,y.VariableInstanceState=gr,y.VariableOutputMapState=IJ,y.WaitOperation=NP,y.WaitOperationInputIds=Yh,y.WaitOperationOutputIds=Hh,y.appendToListOperation=Wa,y.appendToListOperationElementToAppendArgument=Ad,y.appendToListOperationElementToAppendArgumentParentRef=Vh,y.appendToListOperationElementToAppendArgumentRef=Dh,y.appendToListOperationError=Nh,y.appendToListOperationErrorParentRef=Mh,y.appendToListOperationListArgument=Ed,y.appendToListOperationListArgumentParentRef=Ch,y.appendToListOperationListArgumentRef=Rh,y.appendToListOperationListDataType=bh,y.appendToListOperationResultListDataType=wh,y.appendToListOperationResultListReturn=_h,y.appendToListOperationResultListReturnParentRef=Bh,y.appendToListOperationResultListReturnRef=Ph,y.appendToListOperationSecondListDataType=Oh,y.applyNewScope=K,y.asGenerationActionExample=Wi,y.booleanPrototype=Xi,y.calculateNewParentBasedOnCallers=Fc,y.capitalizeFirstLetter=Yt,y.changeSetJSONRecordToUniqueIds=Wq,y.checkAreDataTypesCompatible=Ai,y.checkAreDefinitionEntitiesCompatibleAsDataType=jO,y.checkArePropertiesCompatibleAsDataType=UO,y.checkHasMetadataChanged=ut,y.checkIsBranchDependentButNotDirectlyOnBranch=_a,y.checkIsBranchDependentOnBranch=$J,y.checkIsCallableEntityReachable=Ua,y.checkIsCanvasEntity=iS,y.checkIsDetachedBranch=RP,y.checkIsDetachedBranchShallow=Kc,y.checkIsGlobalVariable=eS,y.checkIsGloballyDeclared=Hc,y.checkIsMethod=OP,y.checkIsNestedScope=Xl,y.checkScopeCompatibility=La,y.cloneProject=ZS,y.countedLoopActionDescriptor=Ns,y.countedLoopActionDescriptorDynamicReturnDeclaration=nT,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=rT,y.countedLoopActionDescriptorStringArgumentDeclaration=iT,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=eT,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=Xv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=Kv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=Qv,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=tT,y.countedLoopBodyActionDescriptor=so,y.countedLoopBodyActionDescriptorAnyDynamicArgument=dT,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=lT,y.countedLoopBodyActionDescriptorAnyDynamicReturn=pT,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=uT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=jd,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=aT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=sT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=oT,y.createDefinitionEntityFromJSONObject=Jl,y.createEntityError=he,y.createNestedDataTypeForEntity=P1,y.createNewInstanceOperation=Qr,y.createNewInstanceOperationEntityToInstanciateArgument=Om,y.createNewInstanceOperationEntityToInstanciateArgumentRef=Rm,y.createNewInstanceOperationEntityToInstanciateDataType=bm,y.createNewInstanceOperationError=Vm,y.createNewInstanceOperationErrorParentRef=Cm,y.createNewInstanceOperationNewEntityDataArgument=Am,y.createNewInstanceOperationNewEntityDataArgumentDataType=Em,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=Im,y.createNewInstanceOperationNewEntityDataArgumentParentRef=Tm,y.createNewInstanceOperationOutputEntityDeclaration=wm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=Pm,y.createNewInstanceOperationRef=Dm,y.createSemanticId=zO,y.createStateFromGenerationTargetType=hS,y.createStateFromType=pt,y.createStateFromTypeAndSubscribe=C,y.cronJobBuiltInBaseEntity=po,y.cronJobBuiltInBaseEntityExpressionProperty=UI,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=HP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=NI,y.cronJobBuiltInBaseEntityRef=LI,y.cronJobTriggeredFunctionDeclarationBlueprint=Hd,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=_I,y.dataTypeCompatibilityToErrorExplanation=R1,y.datePrototype=Mi,y.dateValueAutogenerationSchema=up,y.definitionEntityToZodSchema=IE,y.deletePersistedEntityMethod=Yd,y.deletePersistedEntityMethodParentRef=mI,y.deleteRootProject=JS,y.endpointBuiltInBaseEntity=js,y.endpointBuiltInBaseEntityRef=vT,y.endpointBuiltInBaseEntityRefFour=XT,y.endpointBuiltInBaseEntityRefThree=PT,y.endpointBuiltInBaseEntityRefTwo=RT,y.endpointBuiltInCorsProperty=TT,y.endpointBuiltInCorsPropertyDataType=mT,y.endpointBuiltInCorsPropertyDataTypeRef=yT,y.endpointBuiltInCorsPropertyRef=hT,y.endpointBuiltInMethodProperty=$d,y.endpointBuiltInMethodPropertyDataType=OT,y.endpointBuiltInMethodPropertyDataTypeRef=bT,y.endpointBuiltInMethodPropertyRef=DT,y.endpointBuiltInPathProperty=gd,y.endpointBuiltInPathPropertyDataType=AT,y.endpointBuiltInPathPropertyDataTypeRef=IT,y.endpointBuiltInPathPropertyRef=ET,y.endpointPathParamsArgumentDeclaration=Fd,y.endpointPathParamsArgumentDeclarationRef=jT,y.endpointPathParamsVariableDataType=gT,y.endpointPathParamsVariableDataTypeRef=UT,y.endpointReachedTriggerActionDescriptor=Sd,y.endpointReachedTriggerActionDescriptorRef=$T,y.endpointReachedTriggerActionDescriptorRefFour=xT,y.endpointReachedTriggerActionDescriptorRefThree=FT,y.endpointReachedTriggerActionDescriptorRefTwo=GT,y.endpointRequestBodyArgumentDeclaration=kd,y.endpointRequestBodyArgumentDeclarationRef=BT,y.endpointRequestBodyVariableDataType=_T,y.endpointRequestHeadersArgumentDeclaration=Gd,y.endpointRequestHeadersArgumentDeclarationRef=CT,y.endpointRequestHeadersVariableDataType=VT,y.endpointRequestHeadersVariableDataTypeRef=wT,y.endpointRequestQueryParamsArgumentDeclaration=xd,y.endpointRequestQueryParamsArgumentDeclarationRef=NT,y.endpointRequestQueryParamsVariableDataType=LT,y.endpointRequestQueryParamsVariableDataTypeRef=MT,y.endpointResponseBodyDataType=HT,y.endpointResponseBodyReturnDeclaration=Jd,y.endpointResponseBodyReturnDeclarationRef=YT,y.endpointResponseCodeDataType=ZT,y.endpointResponseCodeReturnDeclaration=Zd,y.endpointResponseCodeReturnDeclarationRef=kT,y.endpointResponseHeadersDataType=WT,y.endpointResponseHeadersDataTypeRef=JT,y.endpointResponseHeadersReturnDeclaration=qd,y.endpointResponseHeadersReturnDeclarationRef=ST,y.endpointReturnStatementRef=qT,y.endpointReturnStatementRefThree=KT,y.endpointReturnStatementRefTwo=zT,y.enrichFromKnownEntities=Ma,y.enumOptionsProperty=pf,y.enumOptionsPropertyDataType=df,y.enumOptionsPropertyDataTypeRef=of,y.enumOptionsPropertyRef=lf,y.enumPrototype=Qi,y.enumPrototypeRef=uf,y.executionBuiltInBaseEntity=co,y.executionBuiltInEntityAbortMethod=Kd,y.executionBuiltInEntityAbortMethodParentRef=jI,y.filterOutDuplicateEntities=p,y.filterOutDuplicateErrors=Q6,y.findEntityFromKeys=$c,y.findReferenceToSelfInList=x1,y.findReferencesToSelfInProject=WJ,y.flattenActionDescriptor=k1,y.flattenArgumentDeclaration=Z1,y.flattenBreakStatement=q1,y.flattenBuiltInBaseEntity=J1,y.flattenCalls=zi,y.flattenCanvasAncestorsUntil=bs,y.flattenCondition=S1,y.flattenContinueStatement=W1,y.flattenDataType=Y1,y.flattenDefinitionEntity=z1,y.flattenDefinitionEntityExtensionAndImplementationTypes=Wc,y.flattenDefinitionEntityExtensionTypes=Kl,y.flattenDefinitionEntityExtensions=Jc,y.flattenDefinitionEntityImplementations=Sc,y.flattenDefinitionEntityImplementionTypes=Hl,y.flattenDerivedCanvasEntities=ni,y.flattenDetachedBranch=DP,y.flattenElementCalls=it,y.flattenElementCallsOnTheSameScope=SJ,y.flattenEntity=L,y.flattenFunctionCall=H1,y.flattenFunctionDeclaration=K1,y.flattenGlobalEvent=X1,y.flattenInputMap=Q1,y.flattenInstalledProject=eP,y.flattenInternalCall=tP,y.flattenLiteralValue=iP,y.flattenLoop=rP,y.flattenOperation=nP,y.flattenOutputMap=sP,y.flattenPrimitiveEntity=aP,y.flattenProject=oP,y.flattenProjectElements=F1,y.flattenProperty=lP,y.flattenRelatedCanvasElementsOnTheLeft=EP,y.flattenRelatedCanvasElementsOnTheRight=IP,y.flattenReturnDeclaration=dP,y.flattenReturnStatement=uP,y.flattenSearch=pP,y.flattenValueDescriptor=cP,y.flattenVariableDeclaration=fP,y.flattenVariableInstance=yP,y.flattenVariableReads=G1,y.flattenVariableWrites=$1,y.flattenVariables=ze,y.fromChangeSetToRecordChangeSet=uS,y.fromZodParseToEntityGenerationErrors=wc,y.generate=eV,y.generateActionExample=BJ,y.generateExecutionDataType=gq,y.generateIdFromStrategy=yt,y.generateMutablePropertiesExplanation=Ul,y.generateRandomBoolean=SE,y.generateRandomDate=bE,y.generateRandomDateAfter=EE,y.generateRandomDateBefore=AE,y.generateRandomDateBetweenRange=RE,y.generateRandomNumber=xE,y.generateRandomNumberAfter=$E,y.generateRandomNumberBefore=GE,y.generateRandomNumberBetweenRange=FE,y.generateRandomText=JE,y.generateRandomTextAfter=kE,y.generateRandomTextBefore=ZE,y.generateRandomTextBetweenRange=qE,y.generateUniqueUUID=gE,y.getAllActionDescriptorsForConditions=kl,y.getAllActionDescriptorsForGlobalEvents=Fl,y.getAllActionDescriptorsForLoops=xl,y.getAllActionDescriptorsForOperations=LJ,y.getAllBuiltInEntityIds=Vi,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=I1,y.getBaseBuiltInEntities=zr,y.getBaseSchemaBasedOnType=p1,y.getBuiltInEntityOwner=Yr,y.getCallableEntityReferenceSchema=Ot,y.getCallableEntityTypeSchema=bD,y.getCalledBy=fi,y.getCallerEntityReferenceSchema=rZ,y.getCallerEntityTypeSchema=iZ,y.getCalls=kc,y.getCanvasEntitiesDerivedFromInternalCalls=TP,y.getCanvasEntitiesDerivedFromWrites=Ds,y.getCanvasEntityDerivedFromValueReadingEntity=Yl,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=vP,y.getCanvasEntityReferenceSchema=EZ,y.getCanvasEntityTypeSchema=IZ,y.getChildrenEntityWithValues=FJ,y.getColumnProperties=oS,y.getCommonAncestor=xc,y.getCommonChildren=w1,y.getDatabaseEntities=sS,y.getDatabaseEntity=lS,y.getDeclaration=wn,y.getDeepestScope=wP,y.getDefinitionEntityExtends=Os,y.getDraggableCallableEntityReferenceSchema=OD,y.getDraggableCallableEntityTypeSchema=DD,y.getDraggableCallerEntityReferenceSchema=sZ,y.getDraggableCallerEntityTypeSchema=nZ,y.getDraggableExecutableEntityReferenceSchema=dZ,y.getDraggableExecutableEntityTypeSchema=lZ,y.getDraggablePassThroughCallableEntityReferenceSchema=Al,y.getDraggablePassThroughCallableEntityTypeSchema=El,y.getDraggablePlayableEntityReferenceSchema=yZ,y.getDraggablePlayableEntityTypeSchema=fZ,y.getEntitiesCreatedSinceInitialization=rd,y.getEntityArgumentDeclarations=qc,y.getEntityInputMaps=hP,y.getEntityOutputMaps=KJ,y.getEntityReferenceSchema=TZ,y.getEntityReturnDeclarations=mP,y.getEntityTypeSchema=vZ,y.getEntityWithLogicScopeReferenceSchema=pr,y.getEntityWithLogicScopeTypeSchema=uZ,y.getEntityWithValueReferenceSchema=RD,y.getEntityWithValueTypeSchema=tZ,y.getEntryPointEntityReferenceSchema=Rt,y.getEntryPointEntityTypeSchema=Cr,y.getEventEntityReferenceSchema=Tl,y.getEventEntityTypeSchema=vl,y.getExecutableEntityReferenceSchema=oZ,y.getExecutableEntityTypeSchema=aZ,y.getExtendedBuiltInEntity=XJ,y.getExtendedDefinitionEntity=zc,y.getGenerationTargetSchemaBasedOnType=c1,y.getHeadIfPartOfDetachedBranch=bP,y.getHighestScope=PP,y.getImplementedBuiltInEntity=QJ,y.getIsInteractive=Yc,y.getLastInListOperation=Id,y.getLastInListOperationError=Ih,y.getLastInListOperationErrorParentRef=Th,y.getLastInListOperationInputListArgument=hh,y.getLastInListOperationInputListArgumentParentRef=yh,y.getLastInListOperationInputListArgumentRef=uh,y.getLastInListOperationInputListDataType=ph,y.getLastInListOperationOutputElementDataType=fh,y.getLastInListOperationOutputElementReturn=vh,y.getLastInListOperationOutputElementReturnParentRef=mh,y.getLastInListOperationOutputElementReturnRef=ch,y.getLinkedEntitiesFromArgumentDeclaration=JJ,y.getLowestPersistedEntityImplementation=AP,y.getParentCallableEntity=C1,y.getParentCallerEntity=B1,y.getParentCanvasEntities=Ht,y.getParentCanvasEntity=Pt,y.getParentCanvasEntityFromTransfer=Sl,y.getParentEntryPoint=GJ,y.getParentPassthroughCallableEntity=V1,y.getPassThroughCallableEntityReferenceSchema=tt,y.getPassThroughCallableEntityTypeSchema=Il,y.getPeristedEntities=nS,y.getPlayableEntityReferenceSchema=cZ,y.getPlayableEntityTypeSchema=pZ,y.getProject=qS,y.getPrototypeByType=Na,y.getRecusriveParentsIds=ed,y.getReferenceEntityId=B,y.getReferencedEntitiesStateOrErrors=gl,y.getReferencedEntityStateOrErrors=Cc,y.getReferencedIds=zl,y.getRelatedCanvasElementsOnTheLeft=Nn,y.getRelatedCanvasElementsOnTheLeftFromTransfer=zJ,y.getRelatedCanvasElementsOnTheRight=Wr,y.getRootEntryPointScopeOwner=Xc,y.getScopeOwner=Ft,y.getStateClassFromType=dS,y.getTerminationReferenceSchema=mZ,y.getTerminationTypeSchema=hZ,y.getTouchedCanvasEntitiesFromChangeSet=pS,y.getUsedArgFromDeclaration=YJ,y.getUsedReturnFromDeclaration=HJ,y.getValueReadingEntityReferenceSchema=AD,y.getValueReadingEntityTypeSchema=ur,y.getValueWritingEntityReferenceSchema=eZ,y.getValueWritingEntityTypeSchema=Ia,y.getVariableFromInputMapping=M1,y.getVariableFromReturnVariablePointer=U1,y.getVariableReferenceSchema=wr,y.getVariableTypeSchema=An,y.getVariablesFromArgumentDeclarations=Wl,y.getVariablesFromInputMaps=N1,y.getVariablesFromOutputMapping=j1,y.getVariablesFromOutputMaps=g1,y.getVariablesFromReturnDeclarations=L1,y.getVariablesInSameOrHigherScope=hc,y.getWrites=Zc,y.groupCallsBasedOnParallelizableExecution=kJ,y.handleAfterEntityImplementationSideEffects=O1,y.handleBeforeEntityImplementationSideEffects=D1,y.httpRequestBodyArgument=Ka,y.httpRequestBodyArgumentRef=t0,y.httpRequestBodyDataType=i0,y.httpRequestHeadersArgument=Ha,y.httpRequestHeadersArgumentRef=Qm,y.httpRequestHeadersDataType=e0,y.httpRequestMethodArgument=za,y.httpRequestMethodArgumentRef=Km,y.httpRequestMethodDataType=Xm,y.httpRequestMethodDataTypeRef=Ym,y.httpRequestOperation=Vs,y.httpRequestOperationErrorValueDescriptor=wd,y.httpRequestOperationErrorValueDescriptorDatatype=A0,y.httpRequestOperationErrorValueDescriptorRef=E0,y.httpRequestOperationRef=m0,y.httpRequestOperationRefEight=T0,y.httpRequestOperationRefFive=y0,y.httpRequestOperationRefFour=f0,y.httpRequestOperationRefNine=I0,y.httpRequestOperationRefSeven=v0,y.httpRequestOperationRefSix=h0,y.httpRequestOperationRefThree=c0,y.httpRequestOperationRefTwo=p0,y.httpRequestQueryParamsArgument=Pd,y.httpRequestQueryParamsArgumentRef=Wm,y.httpRequestQueryParamsDataType=zm,y.httpRequestVariableURLArgument=Ya,y.httpRequestVariableURLArgumentRef=Jm,y.httpRequestVariableURLDataType=Sm,y.httpRequestVariableURLDataTypeRef=Zm,y.httpResponseBodyReturnDataType=u0,y.httpResponseBodyReturnDataTypeRef=l0,y.httpResponseBodyReturnReturn=eo,y.httpResponseBodyReturnReturnRef=d0,y.httpResponseCodeDataType=n0,y.httpResponseCodeReturn=Xa,y.httpResponseCodeReturnRef=r0,y.httpResponseHeadersDataType=o0,y.httpResponseHeadersDataTypeRef=s0,y.httpResponseHeadersReturn=Qa,y.httpResponseHeadersReturnRef=a0,y.implement=ql,y.inferArgumentDeclarationDataType=gO,y.inferDataType=qi,y.inferInputMapDataType=cc,y.inferOutputMapDataType=yc,y.inferPropertyDataType=FO,y.inferReturnDeclarationDataType=fc,y.inferValueDescriptorDataType=xO,y.inferVariableDeclarationDataType=GO,y.inferVariableInstanceDataType=$O,y.initBaseProjectEntity=id,y.initProject=gP,y.initProjectFromFetchResult=jP,y.isPromise=gc,y.iterateOverListActionDescriptorListArgumentDeclaration=tv,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=Q0,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=X0,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=ev,y.iterateOverListLoopActionDescriptor=vr,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=rv,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=iv,y.iterateOverListLoopBodyActionDescriptor=Ms,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=cv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=pv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=yv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=fv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=no,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=sv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=nv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=av,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=uv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=lv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=ov,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=dv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=Iv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=vv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=mv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=Tv,y.iterateOverObjectKeysLoopActionDescriptor=kn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=Av,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=Ev,y.iterateOverObjectKeysLoopBodyActionDescriptor=Md,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=Bv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Vv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=Mv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=_v,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=_d,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=bv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Rv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Dv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Cv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Pv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Ov,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=wv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=gv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=Uv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=Lv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=jv,y.iterateOverObjectValuesLoopActionDescriptor=Zn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=Gv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=$v,y.iterateOverObjectValuesLoopBodyActionDescriptor=Ld,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=zv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Wv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=Hv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Yv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Nd,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=xv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Fv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=kv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Sv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=qv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Zv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Jv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=F0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=G0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=$0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=j0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=U0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=g0,y.iterateOverStringLoopActionDescriptor=_s,y.iterateOverStringLoopBodyActionDescriptor=ro,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=z0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=W0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=H0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=Y0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Vd,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=k0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=x0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Z0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Bd,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=J0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=q0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=S0,y.joinListOperation=md,y.joinListOperationError=Zy,y.joinListOperationErrorParentRef=ky,y.joinListOperationFirstListArgument=gy,y.joinListOperationFirstListArgumentParentRef=jy,y.joinListOperationFirstListArgumentRef=By,y.joinListOperationFirstListDataType=_y,y.joinListOperationResultListDataType=Uy,y.joinListOperationResultListReturn=xy,y.joinListOperationResultListReturnParentRef=Fy,y.joinListOperationResultListReturnRef=Ly,y.joinListOperationSecondListArgument=Gy,y.joinListOperationSecondListArgumentParentRef=$y,y.joinListOperationSecondListArgumentRef=My,y.joinListOperationSecondListDataType=Ny,y.joinListWithLastSeparator=ne,y.joinStringsOperation=Cs,y.joinStringsOperationDynamicStringArgument=dy,y.joinStringsOperationDynamicStringArgumentParentRef=ly,y.joinStringsOperationDynamicStringArgumentRef=ay,y.joinStringsOperationDynamicStringDataType=oy,y.joinStringsOperationError=sy,y.joinStringsOperationErrorParentRef=ny,y.joinStringsOperationFirstStringArgument=Ja,y.joinStringsOperationFirstStringArgumentParentRef=Yf,y.joinStringsOperationFirstStringArgumentRef=Zf,y.joinStringsOperationFirstStringDataType=qf,y.joinStringsOperationResultStringDataType=zf,y.joinStringsOperationResultStringReturn=ws,y.joinStringsOperationResultStringReturnParentRef=ry,y.joinStringsOperationResultStringReturnRef=Wf,y.joinStringsOperationSecondStringArgument=Sa,y.joinStringsOperationSecondStringArgumentParentRef=iy,y.joinStringsOperationSecondStringArgumentRef=Jf,y.joinStringsOperationSecondStringDataType=Sf,y.joinStringsOperationSeparatorStringArgument=ty,y.joinStringsOperationSeparatorStringArgumentParentRef=ey,y.joinStringsOperationSeparatorStringArgumentRef=Hf,y.joinStringsOperationSeparatorStringDataType=Qf,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=Xf,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=Kf,y.keyValuePrototype=Gn,y.lowercaseFirstLetter=Vl,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=Cd,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=C0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=w0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=V0,y.manualFlowLoopActionDescriptor=to,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=P0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=O0,y.manualFlowLoopBodyActionDescriptor=io,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=_0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=B0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=N0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=M0,y.mapActionDescriptorToTypeItRepresents=rS,y.mergeEntityErrorsList=e3,y.mergeListOfEntities=tS,y.methodDefaultValue=Hm,y.mockClientProject=sp,y.moreThanOrEqualCondition=zn,y.moreThanOrEqualConditionLeftHandArgument=qI,y.moreThanOrEqualConditionLeftHandArgumentDataType=kI,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=xI,y.moreThanOrEqualConditionLeftHandArgumentParentRef=ZI,y.moreThanOrEqualConditionRightHandArgument=zI,y.moreThanOrEqualConditionRightHandArgumentDataType=SI,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=JI,y.moreThanOrEqualConditionRightHandArgumentParentRef=WI,y.notEmptyCondition=an,y.notEmptyConditionArgument=GI,y.notEmptyConditionRef=$I,y.nullPrototype=ld,y.numberAdditionOperation=qa,y.numberAdditionOperationDynamicSummandArgument=Of,y.numberAdditionOperationDynamicSummandArgumentType=Df,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=bf,y.numberAdditionOperationError=Rf,y.numberAdditionOperationErrorParentRef=Af,y.numberAdditionOperationFirstNumberArgument=dd,y.numberAdditionOperationFirstNumberArgumentRef=ff,y.numberAdditionOperationFirstNumberDataType=yf,y.numberAdditionOperationRef=If,y.numberAdditionOperationRefThree=pd,y.numberAdditionOperationRefTwo=Ef,y.numberAdditionOperationResultNumberDataType=Tf,y.numberAdditionOperationResultNumberReturn=cd,y.numberAdditionOperationResultNumberReturnRef=vf,y.numberAdditionOperationSecondNumberArgument=ud,y.numberAdditionOperationSecondNumberArgumentRef=hf,y.numberAdditionOperationSecondNumberDataType=mf,y.numberPrototype=ve,y.numberSubtractionOperation=yd,y.numberSubtractionOperationDynamicSubtrahendArgument=xf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=Ff,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Gf,y.numberSubtractionOperationError=$f,y.numberSubtractionOperationErrorParentRef=gf,y.numberSubtractionOperationFirstNumberArgument=Mf,y.numberSubtractionOperationFirstNumberArgumentRef=Pf,y.numberSubtractionOperationFirstNumberDataType=wf,y.numberSubtractionOperationRef=fd,y.numberSubtractionOperationRefThree=Uf,y.numberSubtractionOperationRefTwo=Nf,y.numberSubtractionOperationResultNumberDataType=_f,y.numberSubtractionOperationResultNumberReturn=jf,y.numberSubtractionOperationResultNumberReturnRef=Bf,y.numberSubtractionOperationSecondNumberArgument=Lf,y.numberSubtractionOperationSecondNumberArgumentRef=Cf,y.numberSubtractionOperationSecondNumberDataType=Vf,y.numberValueAutogenerationSchema=dp,y.parallelExecutionOperation=bi,y.parallelExecutionOperationError=zh,y.parallelExecutionOperationErrorParentRef=Wh,y.parallelExecutionOperationListOfExecutionResultsDataType=qh,y.parallelExecutionOperationListOfExecutionResultsReturn=bd,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Zh,y.parallelExecutionOperationListOfFunctionsArgument=Rd,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=kh,y.parallelExecutionOperationListOfFunctionsArgumentRef=xh,y.parallelExecutionOperationListOfFunctionsBlueprint=Fh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=$h,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=gh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=jh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=Uh,y.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Gh,y.parallelExecutionOperationRef=Jh,y.parallelExecutionOperationRefThree=Sh,y.persistedBuiltInBaseEntity=wt,y.persistedBuiltInBaseEntityDatabaseProperty=Jn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=II,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=zP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=EI,y.persistedBuiltInBaseEntityDatabasePropertyRef=TI,y.persistedBuiltInBaseEntityPrimaryKeyProperty=Sn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=CI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=RI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=AI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=VI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=wI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=DI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=bI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=PI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=OI,y.processOutputGlobalValueDescriptorDataType=tE,y.processOutputGlobalValueDescriptorReturn=yo,y.processOutputGlobalValueDescriptorReturnRef=eE,y.projectPublicationCompletedGlobalEvent=fo,y.propertyToZodSchema=TE,y.relationalDatabaseBuiltInBaseEntity=Ui,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=zd,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=yI,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=fI,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=hI,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=cI,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=Wd,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=pI,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=dI,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=uI,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=ao,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=tI,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=QT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=eI,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=uo,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=lI,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=aI,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=oI,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=lo,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=sI,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=WP,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=nI,y.relationalDatabaseBuiltInBaseEntityRef=qn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=oo,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=rI,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=SP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=iI,y.resolveActionDescriptorName=WO,y.resolveBaseEntityName=ZO,y.resolveBuiltInBaseEntityDataTypeLabel=qO,y.resolveClonedEntityProject=ht,y.resolveConditionOperatorLabel=Nl,y.resolveDataType=Bl,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Gc,y.resolveDataTypeLabel=Ml,y.resolveDefinitionEntityDataTypeLabel=kq,y.resolveEntityDataTypeLabel=xq,y.resolveEntityName=F,y.resolveFirstCallsSecond=ZJ,y.resolveFirstWritesSecond=qJ,y.resolvePrimaryKeyProperty=aS,y.resolvePrimitiveEntityName=SO,y.resolveSearchName=JO,y.resolveVariableScope=$q,y.sequentialExecutionOperation=ir,y.sequentialExecutionOperationError=ym,y.sequentialExecutionOperationErrorParentRef=fm,y.sequentialExecutionOperationListOfExecutionResultsDataType=um,y.sequentialExecutionOperationListOfExecutionResultsReturn=Od,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=cm,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=dm,y.sequentialExecutionOperationListOfFunctionsArgument=Dd,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=lm,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=pm,y.sequentialExecutionOperationListOfFunctionsArgumentRef=om,y.sequentialExecutionOperationListOfFunctionsBlueprint=am,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=sm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=nm,y.softDeletePersistedEntityMethod=YP,y.softDeletePersistedEntityMethodParentRef=BI,y.sortCallsBasedOnExecutionDependencies=_1,y.sortChildrenEntitiesBasedOnExecutionDependencies=xJ,y.splitListOperation=Td,y.splitListOperationError=oh,y.splitListOperationErrorParentRef=ah,y.splitListOperationFirstOutputListDataType=Hy,y.splitListOperationFirstOutputListReturn=ih,y.splitListOperationFirstOutputListReturnParentRef=th,y.splitListOperationFirstOutputListReturnRef=vd,y.splitListOperationInputListArgument=Xy,y.splitListOperationInputListArgumentParentRef=Ky,y.splitListOperationInputListArgumentRef=Sy,y.splitListOperationInputListDataType=Wy,y.splitListOperationSecondOutputListDataType=rh,y.splitListOperationSecondOutputListReturn=sh,y.splitListOperationSecondOutputListReturnParentRef=nh,y.splitListOperationSplitIndexArgument=eh,y.splitListOperationSplitIndexArgumentParentRef=Qy,y.splitListOperationSplitIndexArgumentRef=zy,y.splitListOperationSplitIndexDataType=Yy,y.splitStringOperation=hd,y.splitStringOperationError=Py,y.splitStringOperationErrorParentRef=Oy,y.splitStringOperationFirstPartResultStringDataType=hy,y.splitStringOperationFirstPartResultStringReturn=Dy,y.splitStringOperationFirstPartResultStringReturnParentRef=by,y.splitStringOperationFirstPartResultStringReturnRef=yy,y.splitStringOperationIndexArgument=Ay,y.splitStringOperationIndexArgumentParentRef=Ey,y.splitStringOperationIndexArgumentRef=cy,y.splitStringOperationIndexDataType=fy,y.splitStringOperationSecondPartResultStringDataType=vy,y.splitStringOperationSecondPartResultStringReturn=qP,y.splitStringOperationSecondPartResultStringReturnParentRef=Ry,y.splitStringOperationSecondPartResultStringReturnRef=my,y.splitStringOperationStringArgument=Iy,y.splitStringOperationStringArgumentParentRef=Ty,y.splitStringOperationStringArgumentRef=uy,y.splitStringOperationStringDataType=py,y.stringPrototype=se,y.stringValueAutogenerationSchema=lp,y.suggestNewIdForEntity=Rc,y.test_primitive_entities_export=SS,y.toCamelCase=Gq,y.toEntityState=yi,y.toKebabCase=kO,y.toLowerCaseKebabCase=_l,y.toPascalCase=Fq,y.untypedDataPrototype=Dt,y.updateErrorsList=Ye,y.urlDefaultValue=qm,y.uuidPrototype=er,y.validateArgumentDeclarationName=Ec,y.validateCalledByErrorIdInAction=MJ,y.validateCalledByIdInAction=_J,y.validateCallers=T1,y.validateConditionEntityDeclaration=UJ,y.validateDataOperation=en,y.validateDataOperationDataToValidateArgument=Nm,y.validateDataOperationDataToValidateArgumentParentRef=Mm,y.validateDataOperationDataToValidateArgumentRef=Bm,y.validateDataOperationDataToValidateDataType=_m,y.validateDataOperationEntityToMatchTypeArgument=gm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=jm,y.validateDataOperationEntityToMatchTypeArgumentRef=Lm,y.validateDataOperationEntityToMatchTypeDataType=Um,y.validateDataOperationError=xm,y.validateDataOperationErrorParentRef=Fm,y.validateDataOperationOutputEntityDeclaration=Gm,y.validateDataOperationOutputEntityDeclarationParentRef=$m,y.validateDefinitionEntityName=mc,y.validateEntryCaller=v1,y.validateErrorCaller=m1,y.validateFunctionCallDeclaration=E1,y.validateFunctionDeclarationName=vc,y.validateGeneratedEntityParentIsNotBuiltInEntity=wJ,y.validateGeneration=OJ,y.validateGenerationTarget=dt,y.validateGenerationUpdate=PJ,y.validateLoopEntityDeclaration=jJ,y.validateName=Zq,y.validateOperationEntityDeclaration=A1,y.validatePropertyName=Ic,y.validateReachability=yr,y.validateReadsValueInActionPayload=NJ,y.validateReferenceObject=jl,y.validateReferenceToOne=Vc,y.validateReferences=Et,y.validateReturnDeclarationName=Ac,y.validateSuccessCaller=h1,y.validateValueReaderGenerationUpdate=Ba,y.validateValueWritter=Uc,y.validateVariableDeclarationName=Tc,y.validateVariableInternalCallUse=jc,y.valueAutogenerationCurrentDateAndTimeSchema=eD,y.valueAutogenerationGenericSchema=il,y.valueAutogenerationOptions=pp,y.valueAutogenerationOptionsSchema=Qb,y.valueAutogenerationRandomBooleanSchema=op,y.valueAutogenerationRandomDateBetweenSchema=dD,y.valueAutogenerationRandomDateFromSchema=oD,y.valueAutogenerationRandomDateSchema=sl,y.valueAutogenerationRandomDateUntilSchema=lD,y.valueAutogenerationRandomNumberBetweenSchema=rD,y.valueAutogenerationRandomNumberFromSchema=tD,y.valueAutogenerationRandomNumberSchema=rl,y.valueAutogenerationRandomNumberUntilSchema=iD,y.valueAutogenerationRandomSchema=ca,y.valueAutogenerationRandomTextBetweenSchema=aD,y.valueAutogenerationRandomTextFromSchema=nD,y.valueAutogenerationRandomTextSchema=nl,y.valueAutogenerationRandomTextUntilSchema=sD,y.valueAutogenerationRangeValueTypesSchema=pa,y.valueAutogenerationUniqueSchema=ap,y.waitOperation=kt,y.waitOperationMillisecondsNumberArgument=Xr,y.waitOperationMillisecondsNumberArgumentRef=Kh,y.waitOperationMillisecondsNumberDataType=Xh,y.waitOperationOperationError=tm,y.waitOperationOperationErrorParentRef=em,y.waitOperationRef=Qh,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:s,modifiedData:i}}get interactive(){return this.implements.length?this.implements.every(e=>e.interactive):!0}get allBasePropertiesFromExtendedAndImplementedEntities(){return p([...this.extends.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract),...e],[])])}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[]),...this.implements.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...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 P({id:`${this.id}--${b.InvalidParentUpdate}`,code:b.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=[],i=[],s=[];return Object.values(this.detachedDependents).forEach(l=>{const o=l.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),i.push(...o.removed),s.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}subscribeToDependencies(){return this.implements.forEach(e=>{mi.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{mi.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=m.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new je(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[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=[],i=[],s=[],l=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[I,E]of c.knownVersions)u.set(I,E);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new je(u,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:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent){const l=B(this.initialData.parent),o=this.project.get(l);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return this.initialData.extends.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addExtension(d),d.type!==n.BuiltInBaseEntity&&e.push(d))}),this.initialData.implements.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addImplementation(d),d.type!==n.BuiltInBaseEntity&&e.push(d))}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],l=[];this.initialized=!0,this.captureVersion();const{updated:o,added:d,removed:u,affected:h}=this.syncImplementationProperties(e);t.push(...o),i.push(...d),s.push(...u),l.push(...h);const{updated:c,added:I,removed:E,affected:O}=this.addExtendedProperties(e);return t.push(...c),i.push(...I),s.push(...E),l.push(...O),this.addSuggestions(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-self-to-project"))){const t=[this],i=[],s=[],l=[];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:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}setParent(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,A.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 R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.methods=this.initialData.methods.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.extends=this.initialData.extends.map(t=>C(t,this.project)),this.implements=this.initialData.implements.map(t=>C(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}syncImplementationProperties(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],i=[],s=[],l=[],o=this.properties,d=this.implementedPropertiesFromOriginalParents,u=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return d.filter(c=>!u.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})).forEach(c=>{if(this.properties.find(w=>{var V;return((V=w.implements)==null?void 0:V.id)===c.id}))return;const E=this.properties.find(w=>w.name===c.name&&!!w.abstract&&!w.implements);if(E){E.implements=c,E.abstract=!1;return}const O=c.clone(e,this,m.UUID.uuid());O.initChildren(e),i.push(O),e==null||e.add(O,A.Added),O.setImplements(c,e),O.metaSync({abstract:!1},e),this.addProperty(O)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addExtendedProperties(e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-extended-properties"))){const t=[],i=[],s=[],l=[],o=this.properties,d=this.extendedPropertiesFromOriginalParents,u=d.filter(c=>d.find(E=>{var O;return((O=E.implements)==null?void 0:O.id)===c.id})?!1:!c.abstract),h=new Set(o.map(c=>c.name));return u.forEach(c=>{if(h.has(c.name))return;h.add(c.name);const I=c.clone(e,this,m.UUID.uuid());I.initChildren(e),i.push(I),e==null||e.add(I,A.Added),this.addProperty(I)}),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSuggestions(){return this.implements.forEach(e=>{FZ(this,e).forEach(s=>{const l=s.toJSON();l.id=`_suggestion--parent--${this.id}--${s.id}`;const o=C(l,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),xZ(this,e).forEach(s=>{const l=`_suggestion--parent--${this.id}--${s.id}`,o=s.implementAsFunctionDeclaration(null,this,l),d=C(o,this.project);if(d.suggestion=!0,d.setParent(this,null),d.initChildren(null),this.methods=this.methods.filter(u=>u.id!==l),d.inputs.forEach(u=>{u.suggestion=!0}),d.returnStatements.length){const u=d.returnStatements[0];u.suggestion=!0,u.outputs.forEach(h=>{h.suggestion=!0})}this.addSuggestedMethod(d)})}),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"meta-sync"))){const i=ut(this,e),s=this.toMeta();return this.name=e.name||s.name,this.description=e.description||s.description,this.x=e.x||s.x,this.y=e.y||s.y,this.static=e.static||s.static,this.abstract=e.abstract||s.abstract,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await je.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await je.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await je.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await je.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await je.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await je.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-entity"))){const i=[],s=[],l=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(s.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(d=>{const{updated:u,removed:h,added:c}=d.entity.onDetachedDependencyRemoved(this,d.field,t);i.push(...u),s.push(...h),l.push(...c)}),this.properties.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),this.methods.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),this.abstractMethods.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),this.suggestedProperties.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),this.suggestedMethods.forEach(d=>{const{updated:u,removed:h}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...h)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const d=this.parent.setEntity(null);i.push(d)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(l),updated:p(i),removed:p(s),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],l=[];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:d}=o.restore({},e);i.push(...d)}),this.methods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.abstractMethods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.suggestedProperties.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.suggestedMethods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(l),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(i=>i.toFlat(e)),...this.implements.flatMap(i=>i.toFlat(e)),...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(i=>i.toFlatIds(e)),...this.implements.flatMap(i=>i.toFlatIds(e)),...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.parent.toFlatIds(e)])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,static:this.static,abstract:this.abstract,x:this.x,y:this.y,type:this.type,name:this.name}}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=q){var i,s,l,o,d;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||yt(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(l=e.seenEntities)!=null&&l.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(d=e.seenEntities)==null||d.add(this.id),{id:t,version:m.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),author:m.sessionAuthor,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(u=>u.toJSONClone({...e,newId:null})),methods:this.methods.map(u=>u.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(u=>u.toJSONClone({...e,newId:null})),implements:this.implements.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),extends:this.extends.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.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(s=>s.toReference(e)),methods:this.methods.map(s=>s.toReference(e)),abstractMethods:this.abstractMethods.map(s=>s.toReference(e)),implements:this.implements.map(s=>s.toReference(e)),extends:this.extends.map(s=>s.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(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e)),...this.implements.flatMap(i=>i.toFlatJSON(e)),...this.extends.flatMap(i=>i.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(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.DefinitionEntity).flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.DefinitionEntity).flatMap(i=>i.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=GZ(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 R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){var w,V,j;let l=ht(t,this);const o=this.toJSON(),d=i||m.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const u=d.split("-id"),h=u[u.length-1||0]||d;o.id=d,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=pt(o,l);t&&c.setParent(t,null),s&&c.subscribe(),c.initChildren(e),e==null||e.add(c,A.Added);const I=(w=this.properties)==null?void 0:w.map(G=>G.clone(e,c,m.UUID.uuid(),s));c.properties=I;const E=(V=this.methods)==null?void 0:V.map((G,_)=>G.clone(e,c,h+"-method-"+_+"-id",s));c.methods=E;const O=(j=this.abstractMethods)==null?void 0:j.map((G,_)=>G.clone(e,c,h+"-abstract-method-"+_+"-id",s));return c.abstractMethods=O,e==null||e.attemptAutoclose("clone-entity",this.id),c}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"implement-definition-entity")),i){const s=ql(this,e,t,i);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),s}getAllInteractiveMethods(){const e=this.implements.filter(i=>i.type===n.DefinitionEntity||i.type===n.BuiltInBaseEntity&&i.interactive);return p([...this.methods,...this.extends.flatMap(i=>i.getAllInteractiveMethods()),...e.flatMap(i=>i.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const i=[],s=[],l=[],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 d=[];e.forEach(c=>{d.find(E=>F(E,this.project)===F(c,this.project))||d.push(c)});const u=this.properties.filter(c=>!c.dataType);d.forEach(c=>{var j,G;const I=u.find(_=>F(_,this.project)===F(c,this.project));if(!I)return;const O=wn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),w=qi(O,t),V=w==null?void 0:w.clone(t,I,m.UUID.uuid(),!0);if(V){const _=(j=I.dataType)==null?void 0:j.merge(V,t);I.dataType&&(_==null?void 0:_.self.id)!==I.dataType.id&&I.dataType.remove({ignoreUpstream:!1},t),V.id!==((G=_==null?void 0:_.self)==null?void 0:G.id)&&V.remove({ignoreUpstream:!1},t),_!=null&&_.self&&(_.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(_.self,A.Added),I.setDataType(_.self),t==null||t.add(I,A.Updated))}c.setDeclaration(I),t==null||t.add(c,A.Updated)});const h=[];return d.forEach(c=>{if(!c.declaration){h.push(c);return}}),h.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(h.forEach(c=>{var _,g,Z,S;const I=this.properties.find(te=>F(te,this.project)===F(c,this.project));if(I){if(c.setDeclaration(I),!I.getDataType(t)){const ce=wn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),Ie=qi(ce),X=Ie==null?void 0:Ie.clone(t,I,m.UUID.uuid(),!0);if(X){const le=(_=I.dataType)==null?void 0:_.merge(X,t);I.dataType&&(le==null?void 0:le.self.id)!==I.dataType.id&&I.dataType.remove({ignoreUpstream:!1},t),X.id!==((g=le==null?void 0:le.self)==null?void 0:g.id)&&X.remove({ignoreUpstream:!1},t),le!=null&&le.self&&(le.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(le.self,A.Added),I.setDataType(le.self),t==null||t.add(I,A.Updated))}}return}const E={id:m.UUID.uuid(),type:n.Property,version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:F(c,this.project),description:c.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:c.index,implements:null,dataType:null,parent:this.toReference()},O=C(E,this.project);O.setParent(this,t),O.initChildren(t),t==null||t.add(O,A.Added);const V=wn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),j=qi(V),G=j==null?void 0:j.clone(t,O,m.UUID.uuid(),!0);if(G){const te=(Z=O.dataType)==null?void 0:Z.merge(G,t);O.dataType&&(te==null?void 0:te.self.id)!==O.dataType.id&&O.dataType.remove({ignoreUpstream:!1},t),G.id!==((S=te==null?void 0:te.self)==null?void 0:S.id)&&G.remove({ignoreUpstream:!1},t),te!=null&&te.self&&(te.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(te.self,A.Added),O.setDataType(te.self),t==null||t.add(O,A.Updated))}return this.addProperty(O),c.setDeclaration(O),t==null||t.add(c,A.Updated),O}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:p(i),updated:p(s),removed:p(l),affected:p(o),self:this})}};f(je,"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,...i)=>null}),f(je,"type",n.DefinitionEntity),f(je,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),f(je,"PARENT_TYPES",[...je.USER_MANAGED_PARENT_TYPES]),f(je,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),f(je,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(je,"BASE_PROPERTIES",[...je.MUTABLE_BASE_PROPERTIES,...je.INMUTABLE_BASE_PROPERTIES]),f(je,"MUTABLE_META_PROPERTIES",[...je.MUTABLE_BASE_PROPERTIES,"x","y"]),f(je,"INMUTABLE_META_PROPERTIES",[...je.INMUTABLE_BASE_PROPERTIES]),f(je,"META_PROPERTIES",[...je.MUTABLE_META_PROPERTIES,...je.INMUTABLE_META_PROPERTIES]),f(je,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),f(je,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(je,"UPSTREAM_PROPERTIES",[...je.MUTABLE_UPSTREAM_PROPERTIES,...je.INMUTABLE_UPSTREAM_PROPERTIES]),f(je,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),f(je,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(je,"DOWNSTREAM_PROPERTIES",[...je.MUTABLE_DOWNSTREAM_PROPERTIES,...je.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(je,"PROPERTIES",[...je.META_PROPERTIES,...je.UPSTREAM_PROPERTIES,...je.DOWNSTREAM_PROPERTIES]);let Hr=je;function fS(r){const a=v3(),e=r.toJSON();a.safeParse(e).success;const i=[];return Ye(r.errors,i)}const $a=class $a extends st{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(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.extends=this.initialData.extends.map(i=>C(i,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract);return[...e,...i]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...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=U,...t){return await $a.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.extends.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.extends.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,interactive:this.interactive,abstract:this.abstract,static:this.static,type:this.type,name:this.name}}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=q){return{id:this.id+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=q){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(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.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(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.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=fS(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 R(this.project,m.sessionAuthor,T().toISOString(),null,!0,"implement-built-in-base-entity")),i){const s=ql(this,e,t,i);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),s}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof $a&&e.push(...i.getAllInteractiveMethods())})),p(e)}};f($a,"repository",{APILoad:async(e,...t)=>null});let Yi=$a;function yS(r){const a=l3(),e=r.toJSON();a.safeParse(e).success;const i=[];return Ye(r.errors,i)}const nd=class nd extends st{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(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.parent=this,s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.parent=this,s})}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract);return[...e,...i]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...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=U,...t){return await nd.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,static:this.static,abstract:this.abstract,type:this.type,name:this.name}}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=q){return{id:this.id+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=q){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(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.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(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.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=yS(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(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Yi&&e.push(...i.getAllInteractiveMethods())}),p(e)}};f(nd,"repository",{APILoad:async(e,...t)=>null});let si=nd;function pt(r,a){if(!r)throw new Error("Entity is null");const e=a.get(r.id);switch(r.type){case n.LiteralValue:return e||new Mn(r,a);case n.DefinitionEntity:return e||new Hr(r,a);case n.PrimitiveEntity:return e||new si(r,a);case n.FunctionDeclaration:return e||new Nr(r,a);case n.GlobalEvent:return e||new Vn(r,a);case n.DataType:return e||new Cn(r,a);case n.Property:return e||new _r(r,a);case n.FunctionCall:return e||new Sr(r,a);case n.Condition:return e||new jr(r,a);case n.Operation:return e||new Lr(r,a);case n.VariableDeclaration:return e||new $r(r,a);case n.VariableInstance:return e||new gr(r,a);case n.OutputMap:return e||new Si(r,a);case n.ReturnDeclaration:return e||new ri(r,a);case n.ArgumentDeclaration:return e||new xr(r,a);case n.InputMap:return e||new Ji(r,a);case n.Project:return e||new m(r);case n.InstalledProject:return e||new Fr(r,a);case n.ActionDescriptor:return e||new Se(r,a);case n.ReturnStatement:return e||new Mr(r,a);case n.Loop:return e||new Ur(r,a);case n.Search:return e||new Gr(r,a);case n.ValueDescriptor:return e||new kr(r,a);case n.BuiltInBaseEntity:return e||new Yi(r,a);case n.InternalCall:return e||new _n(r,a);case n.ContinueStatement:return e||new Gt(r,a);case n.BreakStatement:return e||new Bn(r,a);case n.GenericReference:return a.get(r.entityId);default:throw new Error("Invalid entity type: "+r.type)}}function C(r,a){if(!r)throw new Error("Entity is null");const e=pt(r,a);return e.subscribe(),e}function hS(r,a){if(!r)throw new Error("Entity is null");switch(r.type){case n.LiteralValue:return Mn.fromGenerationTarget(r,a);case n.DefinitionEntity:return Hr.fromGenerationTarget(r,a);case n.FunctionDeclaration:return Nr.fromGenerationTarget(r,a);case n.GlobalEvent:return Vn.fromGenerationTarget(r,a);case n.DataType:return Cn.fromGenerationTarget(r,a);case n.Property:return _r.fromGenerationTarget(r,a);case n.FunctionCall:return Sr.fromGenerationTarget(r,a);case n.Condition:return jr.fromGenerationTarget(r,a);case n.Operation:return Lr.fromGenerationTarget(r,a);case n.VariableDeclaration:return $r.fromGenerationTarget(r,a);case n.VariableInstance:return gr.fromGenerationTarget(r,a);case n.OutputMap:return Si.fromGenerationTarget(r,a);case n.ReturnDeclaration:return ri.fromGenerationTarget(r,a);case n.ArgumentDeclaration:return xr.fromGenerationTarget(r,a);case n.InputMap:return Ji.fromGenerationTarget(r,a);case n.InstalledProject:return Fr.fromGenerationTarget(r,a);case n.ReturnStatement:return Mr.fromGenerationTarget(r,a);case n.Loop:return Ur.fromGenerationTarget(r,a);case n.Search:return Gr.fromGenerationTarget(r,a);case n.ActionDescriptor:return Se.fromGenerationTarget(r,a);case n.ValueDescriptor:return kr.fromGenerationTarget(r,a);case n.InternalCall:return _n.fromGenerationTarget(r,a);case n.ContinueStatement:return Gt.fromGenerationTarget(r,a);case n.BreakStatement:return Bn.fromGenerationTarget(r,a);default:throw new Error("Invalid entity type: "+r.type)}}const q={seenEntityMaps:new Map,seenEntities:new Set,timestamp:T().toISOString()};class VP{constructor(){f(this,"initialData")}}const U={cascade:!1},BP={APILoad:async(r,...a)=>null},mS={APICreate:async(r,...a)=>r,APIUpdate:async(r,...a)=>r,APIDelete:async(r,...a)=>r,APIClone:async(r,...a)=>{},APILoadVersion:async(r,a,...e)=>null,...BP};class vS{}class TS extends VP{}class IS{}class ES{}class AS{}class Qc{}class RS extends Qc{}class bS extends Qc{}class DS{}class hr{static initReadsValue(a){if(a.initialData.readsValue&&a.initialData.readsValue.type!==n.GenericReference)a.readsValue=C(a.initialData.readsValue,a.project);else if(a.initialData.readsValue&&a.initialData.readsValue.type===n.GenericReference){const e=yi(a.initialData.readsValue,a.project);e&&(a.readsValue=e)}if(a.readsValue){if(et.includes(a.readsValue.type)){let e=a.parent;lt.includes(e.type)||(e=e.parent);const t=a.type===n.InputMap&&a.parent.type===n.Loop;t&&(e=a.parent.parent),a.readsValue.setParent(e,null),a.readsValue.initChildren(null),!t&&e.detachedChildren.includes(a)?e.replaceDetachedChild(a,a.readsValue):t||e.subscribeDetachedChild(a.readsValue)}a.readsValue.addValueReader(a,null)}return a.readsValue}static hydrateReadsValue(a){if(a.initialData.readsValue&&a.initialData.readsValue.type!==n.GenericReference)a.readsValue=C(a.initialData.readsValue,a.project);else if(a.initialData.readsValue&&a.initialData.readsValue.type===n.GenericReference){const e=yi(a.initialData.readsValue,a.project);e&&(a.readsValue=e)}if(a.readsValue){if(et.includes(a.readsValue.type)){let e=a.parent;lt.includes(e.type)||(e=e.parent);const t=a.type===n.InputMap&&a.parent.type===n.Loop;t&&(e=a.parent.parent),a.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(a)?e.replaceDetachedChild(a,a.readsValue):t||e.subscribeDetachedChild(a.readsValue)}a.readsValue.addValueReader(a,null)}return a.readsValue}}class ja{static initWritesValues(a,e){const t=a.initialData.writesValues.reduce((s,l)=>{if(l.type===n.GenericReference||a.writesValues.some(d=>d.id===l.id))return s;const o=C(l,a.project);return o.setValueWriter(a,null),et.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...s,o]},[]),i=[...a.writesValues];return a.writesValues=p([...i,...t]),a.writesValues}}class OS{}const ae=class ae extends st{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{(!ae.UUID||ae.UUID.isBackup)&&(ae.UUID=Go==null?void 0:Go()),ae.UUID||(ae.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),ae.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:i=>i}}}static injectUUIDModule(e){ae.UUID=e}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const s=[];return s.push(...dt(i)),{errors:s,modifiedData:i}}async closePendingCallbacks(){for(let e=0;e<this.history.length;e++){const t=this.history[e];t.dirty&&await t.closeAsync()}}async onCloseChangeSet(e){this.onCloseChangeSetCallback=e,await this.closePendingCallbacks()}async closeChangeSet(e){if(this.onCloseChangeSetCallback){const t=await this.onCloseChangeSetCallback(e);return t.success&&(e.dirty=!1),t}return{success:!1}}toLatestChangeSet(e,t,i,s=!1,l="here-this"){if(!this.history.length)return new R(this,e,t,i,s,l);const o=this.history[this.history.length-1];return o.open?o:this.addChangeSet(new R(this,e,t,i,s,l))}addChangeSet(e){if(!this.history.length)return this.history.push(e),e;const t=this.history.find(l=>l.id===(e==null?void 0:e.id));if(t)return t;const i=this.history.find(l=>l.open);if(i)throw console.log("previouslyStillOpen: ",i),console.log("new change set: ",e),new Error(`There is already an open change-set with id '${i.id}'.`);const s=this.history.findIndex(l=>T(l.timestamp).isBefore(T(e==null?void 0:e.timestamp)));return s===-1?this.history.push(e):this.history.splice(s,0,e),e}discardChangeSet(e){const t=this.history.findIndex(i=>i.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}undo(){const e=[],t=[],i=[],s=[];return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}redo(){const e=[],t=[],i=[],s=[];return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async i=>{await t.init(this),i(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=[],i=[],s=[];return Object.values(this.detachedDependents).forEach(l=>{const o=l.entity.afterAllChildrenInitialized();e.push(...o.updated),t.push(...o.added),i.push(...o.removed),s.push(...o.affected)}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];return{updated:p(s),added:p(l),removed:p(o),affected:p(d),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=ae.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new ae(this);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[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=[],i=[],s=[],l=[];return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[h,c]of this.knownVersions||new Map){if(u.set(h,c),c.activeVersion=!1,c.knownVersions)for(const[I,E]of c.knownVersions)u.set(I,E);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new ae(u)}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:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=null){const t=[],i=[],s=[],l=[];return this.initialized=!0,this.captureVersion(),this.validate(),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e){const t=[],i=[],s=[],l=[];return this.subscribe(),this.subscribeToDependencies(),{updated:p(t),added:p(i),removed:p(s),affected:p(l),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 R(this.project,ae.sessionAuthor,T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.projects=this.initialData.projects.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.variableInstances=this.initialData.variableInstances.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.conditions=this.initialData.conditions.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.operations=this.initialData.operations.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.functions=this.initialData.functions.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.events=this.initialData.events.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.functionCalls=this.initialData.functionCalls.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.loops=this.initialData.loops.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.searches=this.initialData.searches.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),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 R(this.project,ae.sessionAuthor,T().toISOString(),this,!0,"meta-sync"))){const i=ut(this,e),s=this.toMeta();return this.name=e.name||s.name,this.description=e.description||s.description,this.x=e.x||s.x,this.y=e.y||s.y,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await ae.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await ae.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await ae.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await ae.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await ae.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await ae.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new R(this.project,ae.sessionAuthor,T().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new R(this.project,ae.sessionAuthor,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(i=>i.toFlat(e)),...this.functions.flatMap(i=>i.toFlat(e)),...this.events.flatMap(i=>i.toFlat(e)),...this.projects.flatMap(i=>i.toFlat(e)),...this.variableDeclarations.flatMap(i=>i.toFlat(e)),...this.variableInstances.flatMap(i=>i.toFlat(e)),...this.conditions.flatMap(i=>i.toFlat(e)),...this.operations.flatMap(i=>i.toFlat(e)),...this.functionCalls.flatMap(i=>i.toFlat(e)),...this.loops.flatMap(i=>i.toFlat(e)),...this.searches.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(i=>i.toFlatIds(e)),...this.functions.flatMap(i=>i.toFlatIds(e)),...this.events.flatMap(i=>i.toFlatIds(e)),...this.projects.flatMap(i=>i.toFlatIds(e)),...this.variableDeclarations.flatMap(i=>i.toFlatIds(e)),...this.variableInstances.flatMap(i=>i.toFlatIds(e)),...this.conditions.flatMap(i=>i.toFlatIds(e)),...this.operations.flatMap(i=>i.toFlatIds(e)),...this.functionCalls.flatMap(i=>i.toFlatIds(e)),...this.loops.flatMap(i=>i.toFlatIds(e)),...this.searches.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,type:this.type,name:this.name}}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,i=new Set,s=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(l=>{if(s.includes(l)){t.set(l,l);return}t.set(l,ae.UUID.uuid())}),i.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(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),projects:this.projects.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),variableDeclarations:this.variableDeclarations.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),variableInstances:this.variableInstances.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),conditions:this.conditions.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),operations:this.operations.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),functions:this.functions.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),events:this.events.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),functionCalls:this.functionCalls.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),loops:this.loops.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),searches:this.searches.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null}))}}toReference(e=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+ae.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=q){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.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(s=>s.toReference(e)),functions:this.functions.map(s=>s.toReference(e)),events:this.events.map(s=>s.toReference(e)),projects:this.projects.map(s=>s.toReference(e)),variableDeclarations:this.variableDeclarations.map(s=>s.toReference(e)),variableInstances:this.variableInstances.map(s=>s.toReference(e)),conditions:this.conditions.map(s=>s.toReference(e)),operations:this.operations.map(s=>s.toReference(e)),functionCalls:this.functionCalls.map(s=>s.toReference(e)),loops:this.loops.map(s=>s.toReference(e)),searches:this.searches.map(s=>s.toReference(e))}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(i=>i.toFlatJSON(e)),...this.functions.flatMap(i=>i.toFlatJSON(e)),...this.events.flatMap(i=>i.toFlatJSON(e)),...this.projects.flatMap(i=>i.toFlatJSON(e)),...this.variableDeclarations.flatMap(i=>i.toFlatJSON(e)),...this.variableInstances.flatMap(i=>i.toFlatJSON(e)),...this.conditions.flatMap(i=>i.toFlatJSON(e)),...this.operations.flatMap(i=>i.toFlatJSON(e)),...this.functionCalls.flatMap(i=>i.toFlatJSON(e)),...this.loops.flatMap(i=>i.toFlatJSON(e)),...this.searches.flatMap(i=>i.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(i=>i.toFlatGenerationTarget(e)),...this.functions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.events.flatMap(i=>i.toFlatGenerationTarget(e)),...this.projects.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(i=>i.toFlatGenerationTarget(e)),...this.conditions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.operations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.loops.flatMap(i=>i.toFlatGenerationTarget(e)),...this.searches.flatMap(i=>i.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=NZ(),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=C(e,this);return this.addDefinitionEntity(t),t}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=C(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=C(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=C(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=C(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=C(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=C(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=C(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=C(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=C(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=C(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(i=>i.id===e.id);if(t>-1){const i=this.entities[t];return this.entities.splice(t,1),i}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(i=>i.id===e.id);if(t>-1){const i=this.functions[t];return this.functions.splice(t,1),i}return null}removeExternalProject(e){const t=this.projects.findIndex(i=>i.id===e.id);if(t>-1){const i=this.projects[t];return this.projects.splice(t,1),i}return null}removeGlobalEvent(e){const t=this.events.findIndex(i=>i.id===e.id);if(t>-1){const i=this.events[t];return this.events.splice(t,1),i}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(i=>i.id===e.id);if(t>-1){const i=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),i}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,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.functionCalls.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.operations.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.loops.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.searches.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.functionCalls.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.conditions.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.loops.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.searches.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.operations.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.loops.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.searches.reduce((t,i)=>{const s=it(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.functionCalls.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.conditions.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.operations.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.loops.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[]),...this.searches.reduce((t,i)=>{const s=ze(i);return[...t,...s]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.functionCalls.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.conditions.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.operations.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.loops.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.searches.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[])]}getVariableDeclarations(){return p([...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.functionCalls.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.conditions.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.operations.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.loops.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.searches.reduce((t,i)=>{const l=ze(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(i=>{if(!i.declaration){const s=i.initialData,l=s.declaration.entityId||s.declaration.id,o=t.find(d=>d.id===l);o&&i.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===z.PERSISTED_ENTITY)||null}};f(ae,"sessionAuthor","1"),f(ae,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),f(ae,"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,...i)=>null}),f(ae,"type",n.Project),f(ae,"USER_MANAGED_PARENT_TYPES",[]),f(ae,"PARENT_TYPES",[...ae.USER_MANAGED_PARENT_TYPES]),f(ae,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(ae,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(ae,"BASE_PROPERTIES",[...ae.MUTABLE_BASE_PROPERTIES,...ae.INMUTABLE_BASE_PROPERTIES]),f(ae,"MUTABLE_META_PROPERTIES",[...ae.MUTABLE_BASE_PROPERTIES,"x","y"]),f(ae,"INMUTABLE_META_PROPERTIES",[...ae.INMUTABLE_BASE_PROPERTIES]),f(ae,"META_PROPERTIES",[...ae.MUTABLE_META_PROPERTIES,...ae.INMUTABLE_META_PROPERTIES]),f(ae,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(ae,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),f(ae,"UPSTREAM_PROPERTIES",[...ae.MUTABLE_UPSTREAM_PROPERTIES,...ae.INMUTABLE_UPSTREAM_PROPERTIES]),f(ae,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),f(ae,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(ae,"DOWNSTREAM_PROPERTIES",[...ae.MUTABLE_DOWNSTREAM_PROPERTIES,...ae.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(ae,"PROPERTIES",[...ae.META_PROPERTIES,...ae.UPSTREAM_PROPERTIES,...ae.DOWNSTREAM_PROPERTIES]);let m=ae;var _P=(r=>(r.PersistChangeSet="persist-change-set",r.CreateSingle="create-single",r.CreateBulk="create-bulk",r.CreateSingleNested="create-single-nested",r.CreateBulkNested="create-bulk-nested",r.Update="update",r.Clone="clone",r.Delete="delete",r.Load="load",r.LoadNested="load-nested",r.LoadVersion="load-version",r))(_P||{});class MP extends Se{constructor(e){super(bi,e);f(this,"id",Ke.Parallel);f(this,"name",Ke.Parallel);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",bi);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=bi.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=bi.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=bi.error?C(bi.error,this.project):null}}class NP extends Se{constructor(e){super(kt,e);f(this,"id",kt.id);f(this,"name",kt.name);f(this,"description",kt.description);f(this,"version",kt.version);f(this,"autoexecutable",!1);f(this,"initialData",kt);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=kt.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=kt.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=kt.error?C(kt.error,this.project):null}}class LP extends Se{constructor(e){super(ir,e);f(this,"id",Ke.Sequential);f(this,"name",Ke.Sequential);f(this,"description","Execute a list of actions one after the other");f(this,"version","1");f(this,"autoexecutable",!0);f(this,"initialData",ir);f(this,"type",n.ActionDescriptor);f(this,"inputs",[]);f(this,"outputs",[]);f(this,"error",null);f(this,"project");this.project=e,this.inputs=ir.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=ir.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=ir.error?C(ir.error,this.project):null}}class PS extends Se{constructor(a){super(Vs,a)}}class wS extends Se{constructor(a){super(Qr,a)}}class CS extends Se{constructor(e){super(en,e);f(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"get-entity-to-match-validate-data"))){let i=null;if(e.readsValue){const l=e.readsValue.getDataType(t);l&&l.entity&&l.entity.type===n.DefinitionEntity&&(i=l.entity)}const s=e.getDefaultValue();return!i&&s&&s.valueAsTypeSingle&&!Array.isArray(s.valueAsTypeSingle)&&s.valueAsTypeSingle.type===n.DefinitionEntity&&(i=s.valueAsTypeSingle),i}syncOperationInstance(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const i=[],s=[],l=[],o=[],d=this.getEntityToMatchInputMap(e);if(d){const{added:c,updated:I,removed:E,affected:O}=this.syncEntityToMatchInputMapDataType(d,t);i.push(...I),s.push(...c),l.push(...E),o.push(...O)}const u=this.getDataToValidateInputMap(e);if(u){const{added:c,updated:I,removed:E,affected:O}=this.syncDataToValidateInputMapDataType(u,t);i.push(...I),s.push(...c),l.push(...E),o.push(...O)}const h=this.getOutputDataOutputMap(e);if(h){const{added:c,updated:I,removed:E,affected:O}=this.syncOutputDataOutputMapDataType(h,t);i.push(...I),s.push(...c),l.push(...E),o.push(...O)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:p(i),added:p(s),removed:p(l),affected:p(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var u,h,c;const i=[],s=[],l=[],o=[];if(((u=e.declaration)==null?void 0:u.id)!==x.operation[Xe.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 I={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,like:!0,inferred:!0,parent:e.toReference()},E=C(I,e.project);E.setParent(e,t),E.initChildren(t),t==null||t.add(E,A.Added),i.push(E),e.setDataType(E)}(h=e.dataType)==null||h.metaSync({inferred:!0,like:!1,asType:!0},t);const d=this.getEntityToMatch(e,t);return(c=e.dataType)==null||c.setEntity(d),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var c,I,E;const i=[],s=[],l=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==x.operation[Xe.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 d=this.getEntityToMatchInputMap(e.parent);if(!d)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(d,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 O={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=C(O,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,A.Added),i.push(w),e.setDataType(w)}(I=e.dataType)==null||I.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(d,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var c,I,E;const i=[],s=[],l=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==x.operation[Xe.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 d=this.getEntityToMatchInputMap(e.parent);if(!d)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(d,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 O={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:"1",previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,like:!0,inferred:!0,parent:e.toReference()},w=C(O,e.project);w.setParent(e,t),w.initChildren(t),t==null||t.add(w,A.Added),i.push(w),e.setDataType(w)}(I=e.dataType)==null||I.metaSync({inferred:!0,like:!0,asType:!1},t);const h=this.getEntityToMatch(d,t);return(E=e.dataType)==null||E.setEntity(h),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var i,s;if(((i=e.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].inputs.entityToMatch.id){const{added:l,updated:o,removed:d,affected:u}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:p(o),added:p(l),removed:p(d),affected:p(u),self:e.dataType}}else if(((s=e.declaration)==null?void 0:s.id)===x.operation[Xe.Validate].inputs.dataToValidate.id){const{added:l,updated:o,removed:d,affected:u}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:p(o),added:p(l),removed:p(d),affected:p(u),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new R(this.project,m.sessionAuthor,T().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var i;if(((i=e.declaration)==null?void 0:i.id)===x.operation[Xe.Validate].outputs.outputEntity.id){const{added:s,updated:l,removed:o,affected:d}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:p(l),added:p(s),removed:p(o),affected:p(d),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class VS extends Se{constructor(a){super(md,a)}}class BS extends Se{constructor(a){super(Td,a)}}class _S extends Se{constructor(a){super(Id,a)}}class MS extends Se{constructor(a){super(Wa,a)}}class NS extends Se{constructor(a){super(qa,a)}}class LS extends Se{constructor(a){super(Cs,a)}}function US(r){const a=[new LP(r),new MP(r),new NP(r),new PS(r),new wS(r),new CS(r),new MS(r),new VS(r),new _S(r),new BS(r),new NS(r),new LS(r),new Se(hd,r),new Se(yd,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.operationDeclarations=a,a}class UP extends Yi{constructor(e){super(wt,e);f(this,"initialData");f(this,"id",z.PERSISTED_ENTITY);f(this,"version","1");f(this,"name",z.PERSISTED_ENTITY);f(this,"description",wt.description);f(this,"type",n.BuiltInBaseEntity);f(this,"abstract",wt.abstract);f(this,"static",wt.static);f(this,"properties",[]);f(this,"methods",[]);f(this,"abstractMethods",[]);f(this,"extends",[]);f(this,"errors",[]);f(this,"project");this.initialData=wt,this.project=e,this.id=wt.id,this.version=wt.version,this.name=wt.name,this.static=wt.static,this.abstract=wt.abstract,this.properties=this.initialData.properties.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.methods=this.initialData.methods.map(t=>{const i=C(t,this.project);return i.parent=this,i}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const i=C(t,this.project);return i.parent=this,i}),this.extends=this.initialData.extends.map(t=>C(t,this.project))}}function jS(r){const a=[new UP(r),new Yi(js,r),new Yi(Ui,r),new Yi(po,r)];return a.forEach(e=>{r.subscribeBuiltInInstance(e)}),r.builtInBaseEntities=a,a}function gS(r){const a=[new si(se,r),new si(Xi,r),new si(ve,r),new si(ld,r),new si(Dt,r),new si(Qi,r),new si(Mi,r),new si(er,r),new si(Gn,r)];return a.forEach(e=>{r.subscribeBuiltInInstance(e)}),r.primitives=a,a}function $S(r){const a=[new Se(fo,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.globalEventActionDescriptors=a,a}function GS(r){const a=[new Se(Ns,r),new Se(vr,r),new Se(_s,r),new Se(kn,r),new Se(Zn,r),new Se(to,r)];a.forEach(t=>{t.initChildren(null),r.subscribeBuiltInInstance(t)}),r.loopDeclarations=a;const e=[new Se(so,r),new Se(Ms,r),new Se(ro,r),new Se(Md,r),new Se(Ld,r),new Se(io,r)];return e.forEach(t=>{t.initChildren(null),r.subscribeBuiltInInstance(t)}),r.loopDeclarationsBodies=e,a}function FS(r){const a=[new kr(yo,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.valueDescriptors=a,a}function xS(r){const a=[new Se(an,r),new Se(zn,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.conditionDeclarations=a,a}const Ln={},td={},ga={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function jP(r,{enrich:a}={enrich:!0}){const e=r.project,t=r.record,i=new Zl(e),s=new Set;t[e.id]=e,s.add(e.id);const l=T().toISOString();Object.values(t).forEach(u=>{!u||i.allBuiltInEntityIds.includes(u.id)||s.add(u.id)}),i.order=Array.from(s),i.flatRecord=t,i.orderEntities();const o=id(r.project);o.instances[e.id]=o;const d=a?o.addChangeSet(new R(o,"",l,o)):null;return i.visit(u=>{if(u.id===o.id)return;const h=C(u,o);h.hydrateAncestors(),h.addSelfToProject(null)}),a?(i.visit(u=>{const h=o.get(u.id);h&&h.afterAllChildrenInitialized(d)}),o.afterAllChildrenInitialized(d)):rd(o,l).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),o.instancesList.forEach(u=>{u.previousVersion=null}),d==null||d.close(),o}async function kS(r,a=ga){const e={...ga,...a};if(e.empty)return{data:{project:{id:r.id,type:n.Project,version:m.UUID.uuid(),createdAt:T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(e.mock){const i={...sp};return i.id=r.id,{data:{project:i,record:{}}}}return console.log("Fetching project from external API"),new Promise(async i=>{if(e.onFetch){const s=await e.onFetch(r.id);if(s){i({data:s});return}}else i({data:null})})}function id(r){const a=new m(r);return gS(a),jS(a),US(a),$S(a),GS(a),FS(a),xS(a),Array.from(new Set([...a.getAllBuiltInIds(),...Vi()])).forEach(t=>{if(!a.builtInInstances[t]&&a.instances[t])a.builtInInstances[t]=a.instances[t],delete a.instances[t];else if(!a.builtInInstances[t])throw new Error(`Built in entity was not properly initialized: ${t}`)}),a}function rd(r,a){return r.instancesList.filter(t=>T(t.createdAt).isAfter(T(a)||!!t.previousVersion))}function ZS(r,{enrich:a}={enrich:!0}){const e=new Map,t=Array.from(new Set([...r.getAllBuiltInIds(),...Vi()]));Object.keys(r.instances).forEach(u=>{if(t.includes(u)){e.set(u,u);return}const h=r.get(u);if(!ed(h,{...r.instances,...r.builtInInstances}).every(E=>!t.includes(E))){e.set(u,u);return}e.set(u,m.UUID.uuid())});const i=T().toISOString(),s=r.toShallowJSON({seenEntityMaps:e});s.previousVersion=null,s.createdAt=i,s.version=m.UUID.uuid();const l=id(s),o=a?l.addChangeSet(new R(l,"",i,l)):null,d=new Zl(r);return d.visit(u=>{const h=u.toShallowJSON({seenEntityMaps:e});u.type===n.ValueDescriptor&&u.name==="Iteration result"&&(console.log("Og entity shallow copy: ",h),console.log("Og entity full: ",u)),h.previousVersion=null,h.createdAt=i,h.version=m.UUID.uuid();const c=C(h,l);c.hydrateAncestors(),c.addSelfToProject(o),o==null||o.add(c,A.Added)}),a?(d.visit(u=>{const h=l.get(e.get(u.id));h&&h.afterAllChildrenInitialized(o)}),l.afterAllChildrenInitialized(o)):rd(l,i).forEach(h=>{h.remove({ignoreUpstream:!0},null)}),l.instancesList.forEach(u=>{u.previousVersion=null}),o==null||o.close(),l}function gP(r,{enrich:a}={enrich:!0}){const e=id(r),t=T().toISOString(),i=a?e.addChangeSet(new R(e,"",t,e)):null;i&&(i.type=bc.Automatic);const s=new Zl(r);return s.visit(l=>{const o=C(l,e);o.hydrateAncestors(),o.addSelfToProject(i)}),a?(s.visit(l=>{const o=e.get(l.id);o&&o.afterAllChildrenInitialized(i)}),e.afterAllChildrenInitialized(i)):rd(e,t).forEach(o=>{o.remove({ignoreUpstream:!0},null)}),i==null||i.close(),e}async function qS(r,a=ga){const e={...ga,...a};if(r.id&&Ln[r.id]&&!e.ignoreCache)return Ln[r.id];if(r.id&&td[r.id]&&!e.ignoreCache)return await td[r.id],Ln[r.id];const t=kS(r,e);r.id&&(td[r.id]=t);const i=await t;if(i.data){let s;return e.mock?s=gP(sp,{enrich:!!e.enrich}):i.data instanceof m?s=i.data:s=jP(i.data,{enrich:!!e.enrich}),Ln[r.id]=s,r.id&&delete td[r.id],s}return null}function JS(r){return Ln[r.id]&&delete Ln[r.id],null}const SS="test_primitive_entities_export";y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Lc,y.ALL_BUILT_IN_BASE_ENTITIES=gI,y.ALL_BUILT_IN_CONDITION_ENTITIES=KI,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=QI,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=fT,y.ALL_BUILT_IN_LOOP_ENTITIES=cT,y.ALL_BUILT_IN_OPERATION_ENTITIES=D0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=cf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=rE,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=iE,y.ActionDescriptorState=Se,y.ActionInputMapState=vJ,y.ActionOutputMapState=EJ,y.AppendToListOperationInputIds=Eh,y.AppendToListOperationOutputIds=Ah,y.ArgumentDeclarationDependencyField=l1,y.ArgumentDeclarationState=xr,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Bc,y.BUILT_IN_BASE_ENTITY_IDS=x,y.BUILT_IN_ENTITY_TYPES=mi,y.BaseCanvasDraggableState=IS,y.BaseEntityNames=z,y.BaseState=TS,y.BaseValueDescriptorIds=Za,y.BreakStatementDependencyField=Oc,y.BreakStatementState=Bn,y.BuiltInBaseEntityState=Yi,y.CACHED_PROJECTS_BY_ID=Ln,y.CALLABLE_ENTITIES_EXPLANATION=CJ,y.CALLABLE_TYPES=Bi,y.CALLER_ENTITIES_EXPLANATION=f1,y.CALLER_TYPES=_i,y.CALLS_UPDATE_EXPLANATION=qr,y.COMPARISON_CONDITIONS=YI,y.CONDITIONS=HI,y.CUSTOM_ENTITY_OPERATIONS=km,y.CallableEntityClass=AS,y.CallerEntityClass=Qc,y.ChangeSet=R,y.ChangeSetChangeCaptureType=bc,y.ChangeSetEntityChangeType=A,y.ChildEntityState=ES,y.ComparisonOperatorTypes=ft,y.ConditionDependencyField=i1,y.ConditionState=jr,y.ContinueStatementDependencyField=Dc,y.ContinueStatementState=Gt,y.CreateNewInputIds=mm,y.CreateNewOutputIds=vm,y.DRAGGABLE_CALLABLE_TYPES=od,y.DRAGGABLE_CALLER_TYPES=nf,y.DRAGGABLE_ELEMENT_TYPES=ka,y.DRAGGABLE_EXECUTABLE_TYPES=kP,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=xa,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=ad,y.DataTypeCompatibilityTypes=Ei,y.DataTypeDependencyField=XO,y.DataTypeParentChildRelation=bt,y.DataTypeState=Cn,y.DefinitionEntityDependencyField=CP,y.DefinitionEntityState=Hr,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=mS,y.ENTITIES_WITH_VALLUES_EXPLANATION=$l,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=U,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=q,y.ENTITY_TYPES=ZP,y.ENTITY_WITH_DECLARATION_TYPES=FP,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=lt,y.ENTITY_WITH_NAMES_TYPES=sf,y.ENTITY_WITH_PARENT_TYPES=$P,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=tf,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=GP,y.ENTITY_WITH_VALUE_TYPES=ef,y.ENTRY_POINT_ENTITIES_EXPLANATION=Va,y.ENTRY_POINT_TYPES=ot,y.EVENT_TYPES=$n,y.EXECUTABLE_TYPES=xP,y.EXECUTION_OPERATIONS=hm,y.EntityAction=_P,y.EntityError=mn,y.EntityErrorSeverity=D,y.EntityGenerationError=P,y.EntityGenerationErrorCode=b,y.EntityInstanceErrorCode=J,y.EntityOperations=Xe,y.EntityType=n,y.EntityWithLogicScopeClass=OS,y.EntityWithValueClass=DS,y.EntryPointEntityClass=RS,y.ExecutionOperations=Ke,y.ExecutionTerminationType=e1,y.FunctionCallDependencyField=b1,y.FunctionCallState=Sr,y.FunctionDeclarationDependencyField=KO,y.FunctionDeclarationState=Nr,y.GET_PROJECT_OPTIONS_DEFAULTS=ga,y.GLOBAL_EVENT_DECLARATIONS=XI,y.GetLastInListOperationInputIds=lh,y.GetLastInListOperationOutputIds=dh,y.GlobalEventNames=Ki,y.GlobalEventState=Vn,y.HTTPOperations=Bt,y.HTTP_OPERATIONS=R0,y.InputMapDependencyField=a1,y.InputMapState=Ji,y.InstalledProjectState=Fr,y.InternalCallDependencyField=s1,y.InternalCallState=_n,y.JoinListOperationInputIds=Cy,y.JoinListOperationOutputIds=Vy,y.LIST_OPERATIONS=Lh,y.ListOperations=ye,y.LiteralValueDependencyField=d1,y.LiteralValueState=Mn,y.LoopDependencyField=t1,y.LoopState=Ur,y.LoopTypes=Q,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Jr,y.NUMBER_OPERATIONS=kf,y.NumberOperations=Qe,y.OPERATION_DECLARATIONS=b0,y.OperationDependencyField=QO,y.OperationState=Lr,y.OutputMapDependencyField=o1,y.OutputMapParentChildRelation=gn,y.OutputMapState=Si,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Gl,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=Zr,y.PASS_THROUGH_CALLABLE_TYPES=at,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=rf,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=Nc,y.ParallelExecutionOperation=MP,y.PassThroughCallableEntityClass=bS,y.PersistedEntity=UP,y.PersistedEntityMethods=oi,y.PrimitiveEntityState=si,y.PrimitiveTypes=N,y.ProjectState=m,y.PropertyDependencyField=YO,y.PropertyState=_r,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=BP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=VJ,y.ReturnDeclarationDependencyField=HO,y.ReturnDeclarationState=ri,y.ReturnStatementDependencyField=Ll,y.ReturnStatementState=Mr,y.STANDALONE_CONDITIONS=FI,y.STRING_OPERATIONS=wy,y.ScopeCompatibilityType=Ql,y.SearchDependencyField=n1,y.SearchState=Gr,y.SequentialExecutionOperation=LP,y.SequentialExecutionOperationInputIds=im,y.SequentialExecutionOperationOutputIds=rm,y.SharedEntityErrorCode=$,y.SharedStateFunctionality=VP,y.SplitListOperationInputIds=qy,y.SplitListOperationOutputIds=Jy,y.StandaloneOperatorTypes=hi,y.StringOperations=Ee,y.TERMINATION_TYPES=nt,y.Traverser=Zl,y.USER_MANAGED_ENTITY_TYPES=af,y.UserManagedEntityStateTemplate=vS,y.VALUE_READING_ENTITIES_EXPLANATION=Mc,y.VALUE_READING_TYPES=mr,y.VALUE_WRITING_ENTITIES_EXPLANATION=y1,y.VALUE_WRITING_TYPES=vt,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=_c,y.VARIABLE_TYPES=et,y.ValueAutogenerationType=mt,y.ValueDescriptorDependencyField=u1,y.ValueDescriptorParentChildRelation=M,y.ValueDescriptorState=kr,y.ValueReadingEntityClass=hr,y.ValueWritingEntityClass=ja,y.VariableDeclarationDependencyField=r1,y.VariableDeclarationState=$r,y.VariableInputMapState=mJ,y.VariableInstanceDependencyField=Pc,y.VariableInstanceState=gr,y.VariableOutputMapState=IJ,y.WaitOperation=NP,y.WaitOperationInputIds=Yh,y.WaitOperationOutputIds=Hh,y.appendToListOperation=Wa,y.appendToListOperationElementToAppendArgument=Ad,y.appendToListOperationElementToAppendArgumentParentRef=Vh,y.appendToListOperationElementToAppendArgumentRef=Dh,y.appendToListOperationError=Nh,y.appendToListOperationErrorParentRef=Mh,y.appendToListOperationListArgument=Ed,y.appendToListOperationListArgumentParentRef=Ch,y.appendToListOperationListArgumentRef=Rh,y.appendToListOperationListDataType=bh,y.appendToListOperationResultListDataType=wh,y.appendToListOperationResultListReturn=_h,y.appendToListOperationResultListReturnParentRef=Bh,y.appendToListOperationResultListReturnRef=Ph,y.appendToListOperationSecondListDataType=Oh,y.applyNewScope=K,y.asGenerationActionExample=Wi,y.booleanPrototype=Xi,y.calculateNewParentBasedOnCallers=Fc,y.capitalizeFirstLetter=Yt,y.changeSetJSONRecordToUniqueIds=Wq,y.checkAreDataTypesCompatible=Ai,y.checkAreDefinitionEntitiesCompatibleAsDataType=jO,y.checkArePropertiesCompatibleAsDataType=UO,y.checkHasMetadataChanged=ut,y.checkIsBranchDependentButNotDirectlyOnBranch=_a,y.checkIsBranchDependentOnBranch=$J,y.checkIsCallableEntityReachable=Ua,y.checkIsCanvasEntity=iS,y.checkIsDetachedBranch=RP,y.checkIsDetachedBranchShallow=Kc,y.checkIsGlobalVariable=eS,y.checkIsGloballyDeclared=Hc,y.checkIsMethod=OP,y.checkIsNestedScope=Xl,y.checkScopeCompatibility=La,y.cloneProject=ZS,y.countedLoopActionDescriptor=Ns,y.countedLoopActionDescriptorDynamicReturnDeclaration=nT,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=rT,y.countedLoopActionDescriptorStringArgumentDeclaration=iT,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=eT,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=Xv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=Kv,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=Qv,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=tT,y.countedLoopBodyActionDescriptor=so,y.countedLoopBodyActionDescriptorAnyDynamicArgument=dT,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=lT,y.countedLoopBodyActionDescriptorAnyDynamicReturn=pT,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=uT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=jd,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=aT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=sT,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=oT,y.createDefinitionEntityFromJSONObject=Jl,y.createEntityError=he,y.createNestedDataTypeForEntity=P1,y.createNewInstanceOperation=Qr,y.createNewInstanceOperationEntityToInstanciateArgument=Om,y.createNewInstanceOperationEntityToInstanciateArgumentRef=Rm,y.createNewInstanceOperationEntityToInstanciateDataType=bm,y.createNewInstanceOperationError=Vm,y.createNewInstanceOperationErrorParentRef=Cm,y.createNewInstanceOperationNewEntityDataArgument=Am,y.createNewInstanceOperationNewEntityDataArgumentDataType=Em,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=Im,y.createNewInstanceOperationNewEntityDataArgumentParentRef=Tm,y.createNewInstanceOperationOutputEntityDeclaration=wm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=Pm,y.createNewInstanceOperationRef=Dm,y.createSemanticId=zO,y.createStateFromGenerationTargetType=hS,y.createStateFromType=pt,y.createStateFromTypeAndSubscribe=C,y.cronJobBuiltInBaseEntity=po,y.cronJobBuiltInBaseEntityExpressionProperty=UI,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=HP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=NI,y.cronJobBuiltInBaseEntityRef=LI,y.cronJobTriggeredFunctionDeclarationBlueprint=Hd,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=_I,y.dataTypeCompatibilityToErrorExplanation=R1,y.datePrototype=Mi,y.dateValueAutogenerationSchema=up,y.definitionEntityToZodSchema=IE,y.deletePersistedEntityMethod=Yd,y.deletePersistedEntityMethodParentRef=mI,y.deleteRootProject=JS,y.endpointBuiltInBaseEntity=js,y.endpointBuiltInBaseEntityRef=vT,y.endpointBuiltInBaseEntityRefFour=XT,y.endpointBuiltInBaseEntityRefThree=PT,y.endpointBuiltInBaseEntityRefTwo=RT,y.endpointBuiltInCorsProperty=TT,y.endpointBuiltInCorsPropertyDataType=mT,y.endpointBuiltInCorsPropertyDataTypeRef=yT,y.endpointBuiltInCorsPropertyRef=hT,y.endpointBuiltInMethodProperty=$d,y.endpointBuiltInMethodPropertyDataType=OT,y.endpointBuiltInMethodPropertyDataTypeRef=bT,y.endpointBuiltInMethodPropertyRef=DT,y.endpointBuiltInPathProperty=gd,y.endpointBuiltInPathPropertyDataType=AT,y.endpointBuiltInPathPropertyDataTypeRef=IT,y.endpointBuiltInPathPropertyRef=ET,y.endpointPathParamsArgumentDeclaration=Fd,y.endpointPathParamsArgumentDeclarationRef=jT,y.endpointPathParamsVariableDataType=gT,y.endpointPathParamsVariableDataTypeRef=UT,y.endpointReachedTriggerActionDescriptor=Sd,y.endpointReachedTriggerActionDescriptorRef=$T,y.endpointReachedTriggerActionDescriptorRefFour=xT,y.endpointReachedTriggerActionDescriptorRefThree=FT,y.endpointReachedTriggerActionDescriptorRefTwo=GT,y.endpointRequestBodyArgumentDeclaration=kd,y.endpointRequestBodyArgumentDeclarationRef=BT,y.endpointRequestBodyVariableDataType=_T,y.endpointRequestHeadersArgumentDeclaration=Gd,y.endpointRequestHeadersArgumentDeclarationRef=CT,y.endpointRequestHeadersVariableDataType=VT,y.endpointRequestHeadersVariableDataTypeRef=wT,y.endpointRequestQueryParamsArgumentDeclaration=xd,y.endpointRequestQueryParamsArgumentDeclarationRef=NT,y.endpointRequestQueryParamsVariableDataType=LT,y.endpointRequestQueryParamsVariableDataTypeRef=MT,y.endpointResponseBodyDataType=HT,y.endpointResponseBodyReturnDeclaration=Jd,y.endpointResponseBodyReturnDeclarationRef=YT,y.endpointResponseCodeDataType=ZT,y.endpointResponseCodeReturnDeclaration=Zd,y.endpointResponseCodeReturnDeclarationRef=kT,y.endpointResponseHeadersDataType=WT,y.endpointResponseHeadersDataTypeRef=JT,y.endpointResponseHeadersReturnDeclaration=qd,y.endpointResponseHeadersReturnDeclarationRef=ST,y.endpointReturnStatementRef=qT,y.endpointReturnStatementRefThree=KT,y.endpointReturnStatementRefTwo=zT,y.enrichFromKnownEntities=Ma,y.enumOptionsProperty=pf,y.enumOptionsPropertyDataType=df,y.enumOptionsPropertyDataTypeRef=of,y.enumOptionsPropertyRef=lf,y.enumPrototype=Qi,y.enumPrototypeRef=uf,y.executionBuiltInBaseEntity=co,y.executionBuiltInEntityAbortMethod=Kd,y.executionBuiltInEntityAbortMethodParentRef=jI,y.filterOutDuplicateEntities=p,y.filterOutDuplicateErrors=Q6,y.findEntityFromKeys=$c,y.findReferenceToSelfInList=x1,y.findReferencesToSelfInProject=WJ,y.flattenActionDescriptor=k1,y.flattenArgumentDeclaration=Z1,y.flattenBreakStatement=q1,y.flattenBuiltInBaseEntity=J1,y.flattenCalls=zi,y.flattenCanvasAncestorsUntil=bs,y.flattenCondition=S1,y.flattenContinueStatement=W1,y.flattenDataType=Y1,y.flattenDefinitionEntity=z1,y.flattenDefinitionEntityExtensionAndImplementationTypes=Wc,y.flattenDefinitionEntityExtensionTypes=Kl,y.flattenDefinitionEntityExtensions=Jc,y.flattenDefinitionEntityImplementations=Sc,y.flattenDefinitionEntityImplementionTypes=Hl,y.flattenDerivedCanvasEntities=ni,y.flattenDetachedBranch=DP,y.flattenElementCalls=it,y.flattenElementCallsOnTheSameScope=SJ,y.flattenEntity=L,y.flattenFunctionCall=H1,y.flattenFunctionDeclaration=K1,y.flattenGlobalEvent=X1,y.flattenInputMap=Q1,y.flattenInstalledProject=eP,y.flattenInternalCall=tP,y.flattenLiteralValue=iP,y.flattenLoop=rP,y.flattenOperation=nP,y.flattenOutputMap=sP,y.flattenPrimitiveEntity=aP,y.flattenProject=oP,y.flattenProjectElements=F1,y.flattenProperty=lP,y.flattenRelatedCanvasElementsOnTheLeft=EP,y.flattenRelatedCanvasElementsOnTheRight=IP,y.flattenReturnDeclaration=dP,y.flattenReturnStatement=uP,y.flattenSearch=pP,y.flattenValueDescriptor=cP,y.flattenVariableDeclaration=fP,y.flattenVariableInstance=yP,y.flattenVariableReads=G1,y.flattenVariableWrites=$1,y.flattenVariables=ze,y.fromChangeSetToRecordChangeSet=uS,y.fromZodParseToEntityGenerationErrors=wc,y.generate=eV,y.generateActionExample=BJ,y.generateExecutionDataType=gq,y.generateIdFromStrategy=yt,y.generateMutablePropertiesExplanation=Ul,y.generateRandomBoolean=SE,y.generateRandomDate=bE,y.generateRandomDateAfter=EE,y.generateRandomDateBefore=AE,y.generateRandomDateBetweenRange=RE,y.generateRandomNumber=xE,y.generateRandomNumberAfter=$E,y.generateRandomNumberBefore=GE,y.generateRandomNumberBetweenRange=FE,y.generateRandomText=JE,y.generateRandomTextAfter=kE,y.generateRandomTextBefore=ZE,y.generateRandomTextBetweenRange=qE,y.generateUniqueUUID=gE,y.getAllActionDescriptorsForConditions=kl,y.getAllActionDescriptorsForGlobalEvents=Fl,y.getAllActionDescriptorsForLoops=xl,y.getAllActionDescriptorsForOperations=LJ,y.getAllBuiltInEntityIds=Vi,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=I1,y.getBaseBuiltInEntities=zr,y.getBaseSchemaBasedOnType=p1,y.getBuiltInEntityOwner=Yr,y.getCallableEntityReferenceSchema=Ot,y.getCallableEntityTypeSchema=bD,y.getCalledBy=fi,y.getCallerEntityReferenceSchema=rZ,y.getCallerEntityTypeSchema=iZ,y.getCalls=kc,y.getCanvasEntitiesDerivedFromInternalCalls=TP,y.getCanvasEntitiesDerivedFromWrites=Ds,y.getCanvasEntityDerivedFromValueReadingEntity=Yl,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=vP,y.getCanvasEntityReferenceSchema=EZ,y.getCanvasEntityTypeSchema=IZ,y.getChildrenEntityWithValues=FJ,y.getColumnProperties=oS,y.getCommonAncestor=xc,y.getCommonChildren=w1,y.getDatabaseEntities=sS,y.getDatabaseEntity=lS,y.getDeclaration=wn,y.getDeepestScope=wP,y.getDefinitionEntityExtends=Os,y.getDraggableCallableEntityReferenceSchema=OD,y.getDraggableCallableEntityTypeSchema=DD,y.getDraggableCallerEntityReferenceSchema=sZ,y.getDraggableCallerEntityTypeSchema=nZ,y.getDraggableExecutableEntityReferenceSchema=dZ,y.getDraggableExecutableEntityTypeSchema=lZ,y.getDraggablePassThroughCallableEntityReferenceSchema=Al,y.getDraggablePassThroughCallableEntityTypeSchema=El,y.getDraggablePlayableEntityReferenceSchema=yZ,y.getDraggablePlayableEntityTypeSchema=fZ,y.getEntitiesCreatedSinceInitialization=rd,y.getEntityArgumentDeclarations=qc,y.getEntityInputMaps=hP,y.getEntityOutputMaps=KJ,y.getEntityReferenceSchema=TZ,y.getEntityReturnDeclarations=mP,y.getEntityTypeSchema=vZ,y.getEntityWithLogicScopeReferenceSchema=pr,y.getEntityWithLogicScopeTypeSchema=uZ,y.getEntityWithValueReferenceSchema=RD,y.getEntityWithValueTypeSchema=tZ,y.getEntryPointEntityReferenceSchema=Rt,y.getEntryPointEntityTypeSchema=Cr,y.getEventEntityReferenceSchema=Tl,y.getEventEntityTypeSchema=vl,y.getExecutableEntityReferenceSchema=oZ,y.getExecutableEntityTypeSchema=aZ,y.getExtendedBuiltInEntity=XJ,y.getExtendedDefinitionEntity=zc,y.getGenerationTargetSchemaBasedOnType=c1,y.getHeadIfPartOfDetachedBranch=bP,y.getHighestScope=PP,y.getImplementedBuiltInEntity=QJ,y.getIsInteractive=Yc,y.getLastInListOperation=Id,y.getLastInListOperationError=Ih,y.getLastInListOperationErrorParentRef=Th,y.getLastInListOperationInputListArgument=hh,y.getLastInListOperationInputListArgumentParentRef=yh,y.getLastInListOperationInputListArgumentRef=uh,y.getLastInListOperationInputListDataType=ph,y.getLastInListOperationOutputElementDataType=fh,y.getLastInListOperationOutputElementReturn=vh,y.getLastInListOperationOutputElementReturnParentRef=mh,y.getLastInListOperationOutputElementReturnRef=ch,y.getLinkedEntitiesFromArgumentDeclaration=JJ,y.getLowestPersistedEntityImplementation=AP,y.getParentCallableEntity=C1,y.getParentCallerEntity=B1,y.getParentCanvasEntities=Ht,y.getParentCanvasEntity=Pt,y.getParentCanvasEntityFromTransfer=Sl,y.getParentEntryPoint=GJ,y.getParentPassthroughCallableEntity=V1,y.getPassThroughCallableEntityReferenceSchema=tt,y.getPassThroughCallableEntityTypeSchema=Il,y.getPeristedEntities=nS,y.getPlayableEntityReferenceSchema=cZ,y.getPlayableEntityTypeSchema=pZ,y.getProject=qS,y.getPrototypeByType=Na,y.getRecusriveParentsIds=ed,y.getReferenceEntityId=B,y.getReferencedEntitiesStateOrErrors=gl,y.getReferencedEntityStateOrErrors=Cc,y.getReferencedIds=zl,y.getRelatedCanvasElementsOnTheLeft=Nn,y.getRelatedCanvasElementsOnTheLeftFromTransfer=zJ,y.getRelatedCanvasElementsOnTheRight=Wr,y.getRootEntryPointScopeOwner=Xc,y.getScopeOwner=Ft,y.getStateClassFromType=dS,y.getTerminationReferenceSchema=mZ,y.getTerminationTypeSchema=hZ,y.getTouchedCanvasEntitiesFromChangeSet=pS,y.getUsedArgFromDeclaration=YJ,y.getUsedReturnFromDeclaration=HJ,y.getValueReadingEntityReferenceSchema=AD,y.getValueReadingEntityTypeSchema=ur,y.getValueWritingEntityReferenceSchema=eZ,y.getValueWritingEntityTypeSchema=Ia,y.getVariableFromInputMapping=M1,y.getVariableFromReturnVariablePointer=U1,y.getVariableReferenceSchema=wr,y.getVariableTypeSchema=An,y.getVariablesFromArgumentDeclarations=Wl,y.getVariablesFromInputMaps=N1,y.getVariablesFromOutputMapping=j1,y.getVariablesFromOutputMaps=g1,y.getVariablesFromReturnDeclarations=L1,y.getVariablesInSameOrHigherScope=hc,y.getWrites=Zc,y.groupCallsBasedOnParallelizableExecution=kJ,y.handleAfterEntityImplementationSideEffects=O1,y.handleBeforeEntityImplementationSideEffects=D1,y.httpRequestBodyArgument=Ka,y.httpRequestBodyArgumentRef=t0,y.httpRequestBodyDataType=i0,y.httpRequestHeadersArgument=Ha,y.httpRequestHeadersArgumentRef=Qm,y.httpRequestHeadersDataType=e0,y.httpRequestMethodArgument=za,y.httpRequestMethodArgumentRef=Km,y.httpRequestMethodDataType=Xm,y.httpRequestMethodDataTypeRef=Ym,y.httpRequestOperation=Vs,y.httpRequestOperationErrorValueDescriptor=wd,y.httpRequestOperationErrorValueDescriptorDatatype=A0,y.httpRequestOperationErrorValueDescriptorRef=E0,y.httpRequestOperationRef=m0,y.httpRequestOperationRefEight=T0,y.httpRequestOperationRefFive=y0,y.httpRequestOperationRefFour=f0,y.httpRequestOperationRefNine=I0,y.httpRequestOperationRefSeven=v0,y.httpRequestOperationRefSix=h0,y.httpRequestOperationRefThree=c0,y.httpRequestOperationRefTwo=p0,y.httpRequestQueryParamsArgument=Pd,y.httpRequestQueryParamsArgumentRef=Wm,y.httpRequestQueryParamsDataType=zm,y.httpRequestVariableURLArgument=Ya,y.httpRequestVariableURLArgumentRef=Jm,y.httpRequestVariableURLDataType=Sm,y.httpRequestVariableURLDataTypeRef=Zm,y.httpResponseBodyReturnDataType=u0,y.httpResponseBodyReturnDataTypeRef=l0,y.httpResponseBodyReturnReturn=eo,y.httpResponseBodyReturnReturnRef=d0,y.httpResponseCodeDataType=n0,y.httpResponseCodeReturn=Xa,y.httpResponseCodeReturnRef=r0,y.httpResponseHeadersDataType=o0,y.httpResponseHeadersDataTypeRef=s0,y.httpResponseHeadersReturn=Qa,y.httpResponseHeadersReturnRef=a0,y.implement=ql,y.inferArgumentDeclarationDataType=gO,y.inferDataType=qi,y.inferInputMapDataType=cc,y.inferOutputMapDataType=yc,y.inferPropertyDataType=FO,y.inferReturnDeclarationDataType=fc,y.inferValueDescriptorDataType=xO,y.inferVariableDeclarationDataType=GO,y.inferVariableInstanceDataType=$O,y.initBaseProjectEntity=id,y.initProject=gP,y.initProjectFromFetchResult=jP,y.isPromise=gc,y.iterateOverListActionDescriptorListArgumentDeclaration=tv,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=Q0,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=X0,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=ev,y.iterateOverListLoopActionDescriptor=vr,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=rv,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=iv,y.iterateOverListLoopBodyActionDescriptor=Ms,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=cv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=pv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=yv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=fv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=no,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=sv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=nv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=av,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=uv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=lv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=ov,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=dv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=Iv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=vv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=mv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=Tv,y.iterateOverObjectKeysLoopActionDescriptor=kn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=Av,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=Ev,y.iterateOverObjectKeysLoopBodyActionDescriptor=Md,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=Bv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Vv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=Mv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=_v,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=_d,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=bv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Rv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Dv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Cv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Pv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Ov,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=wv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=gv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=Uv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=Lv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=jv,y.iterateOverObjectValuesLoopActionDescriptor=Zn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=Gv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=$v,y.iterateOverObjectValuesLoopBodyActionDescriptor=Ld,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=zv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Wv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=Hv,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Yv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Nd,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=xv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Fv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=kv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Sv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=qv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Zv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Jv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=F0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=G0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=$0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=j0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=U0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=g0,y.iterateOverStringLoopActionDescriptor=_s,y.iterateOverStringLoopBodyActionDescriptor=ro,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=z0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=W0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=H0,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=Y0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Vd,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=k0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=x0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Z0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Bd,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=J0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=q0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=S0,y.joinListOperation=md,y.joinListOperationError=Zy,y.joinListOperationErrorParentRef=ky,y.joinListOperationFirstListArgument=gy,y.joinListOperationFirstListArgumentParentRef=jy,y.joinListOperationFirstListArgumentRef=By,y.joinListOperationFirstListDataType=_y,y.joinListOperationResultListDataType=Uy,y.joinListOperationResultListReturn=xy,y.joinListOperationResultListReturnParentRef=Fy,y.joinListOperationResultListReturnRef=Ly,y.joinListOperationSecondListArgument=Gy,y.joinListOperationSecondListArgumentParentRef=$y,y.joinListOperationSecondListArgumentRef=My,y.joinListOperationSecondListDataType=Ny,y.joinListWithLastSeparator=ne,y.joinStringsOperation=Cs,y.joinStringsOperationDynamicStringArgument=dy,y.joinStringsOperationDynamicStringArgumentParentRef=ly,y.joinStringsOperationDynamicStringArgumentRef=ay,y.joinStringsOperationDynamicStringDataType=oy,y.joinStringsOperationError=sy,y.joinStringsOperationErrorParentRef=ny,y.joinStringsOperationFirstStringArgument=Ja,y.joinStringsOperationFirstStringArgumentParentRef=Yf,y.joinStringsOperationFirstStringArgumentRef=Zf,y.joinStringsOperationFirstStringDataType=qf,y.joinStringsOperationResultStringDataType=zf,y.joinStringsOperationResultStringReturn=ws,y.joinStringsOperationResultStringReturnParentRef=ry,y.joinStringsOperationResultStringReturnRef=Wf,y.joinStringsOperationSecondStringArgument=Sa,y.joinStringsOperationSecondStringArgumentParentRef=iy,y.joinStringsOperationSecondStringArgumentRef=Jf,y.joinStringsOperationSecondStringDataType=Sf,y.joinStringsOperationSeparatorStringArgument=ty,y.joinStringsOperationSeparatorStringArgumentParentRef=ey,y.joinStringsOperationSeparatorStringArgumentRef=Hf,y.joinStringsOperationSeparatorStringDataType=Qf,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=Xf,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=Kf,y.keyValuePrototype=Gn,y.lowercaseFirstLetter=Vl,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=Cd,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=C0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=w0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=V0,y.manualFlowLoopActionDescriptor=to,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=P0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=O0,y.manualFlowLoopBodyActionDescriptor=io,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=_0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=B0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=N0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=M0,y.mapActionDescriptorToTypeItRepresents=rS,y.mergeEntityErrorsList=e3,y.mergeListOfEntities=tS,y.methodDefaultValue=Hm,y.mockClientProject=sp,y.moreThanOrEqualCondition=zn,y.moreThanOrEqualConditionLeftHandArgument=qI,y.moreThanOrEqualConditionLeftHandArgumentDataType=kI,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=xI,y.moreThanOrEqualConditionLeftHandArgumentParentRef=ZI,y.moreThanOrEqualConditionRightHandArgument=zI,y.moreThanOrEqualConditionRightHandArgumentDataType=SI,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=JI,y.moreThanOrEqualConditionRightHandArgumentParentRef=WI,y.notEmptyCondition=an,y.notEmptyConditionArgument=GI,y.notEmptyConditionRef=$I,y.nullPrototype=ld,y.numberAdditionOperation=qa,y.numberAdditionOperationDynamicSummandArgument=Of,y.numberAdditionOperationDynamicSummandArgumentType=Df,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=bf,y.numberAdditionOperationError=Rf,y.numberAdditionOperationErrorParentRef=Af,y.numberAdditionOperationFirstNumberArgument=dd,y.numberAdditionOperationFirstNumberArgumentRef=ff,y.numberAdditionOperationFirstNumberDataType=yf,y.numberAdditionOperationRef=If,y.numberAdditionOperationRefThree=pd,y.numberAdditionOperationRefTwo=Ef,y.numberAdditionOperationResultNumberDataType=Tf,y.numberAdditionOperationResultNumberReturn=cd,y.numberAdditionOperationResultNumberReturnRef=vf,y.numberAdditionOperationSecondNumberArgument=ud,y.numberAdditionOperationSecondNumberArgumentRef=hf,y.numberAdditionOperationSecondNumberDataType=mf,y.numberPrototype=ve,y.numberSubtractionOperation=yd,y.numberSubtractionOperationDynamicSubtrahendArgument=xf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=Ff,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Gf,y.numberSubtractionOperationError=$f,y.numberSubtractionOperationErrorParentRef=gf,y.numberSubtractionOperationFirstNumberArgument=Mf,y.numberSubtractionOperationFirstNumberArgumentRef=Pf,y.numberSubtractionOperationFirstNumberDataType=wf,y.numberSubtractionOperationRef=fd,y.numberSubtractionOperationRefThree=Uf,y.numberSubtractionOperationRefTwo=Nf,y.numberSubtractionOperationResultNumberDataType=_f,y.numberSubtractionOperationResultNumberReturn=jf,y.numberSubtractionOperationResultNumberReturnRef=Bf,y.numberSubtractionOperationSecondNumberArgument=Lf,y.numberSubtractionOperationSecondNumberArgumentRef=Cf,y.numberSubtractionOperationSecondNumberDataType=Vf,y.numberValueAutogenerationSchema=dp,y.parallelExecutionOperation=bi,y.parallelExecutionOperationError=zh,y.parallelExecutionOperationErrorParentRef=Wh,y.parallelExecutionOperationListOfExecutionResultsDataType=qh,y.parallelExecutionOperationListOfExecutionResultsReturn=bd,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Zh,y.parallelExecutionOperationListOfFunctionsArgument=Rd,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=kh,y.parallelExecutionOperationListOfFunctionsArgumentRef=xh,y.parallelExecutionOperationListOfFunctionsBlueprint=Fh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=$h,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=gh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=jh,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=Uh,y.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Gh,y.parallelExecutionOperationRef=Jh,y.parallelExecutionOperationRefThree=Sh,y.persistedBuiltInBaseEntity=wt,y.persistedBuiltInBaseEntityDatabaseProperty=Jn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=II,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=zP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=EI,y.persistedBuiltInBaseEntityDatabasePropertyRef=TI,y.persistedBuiltInBaseEntityPrimaryKeyProperty=Sn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=CI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=RI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=AI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=VI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=wI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=DI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=bI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=PI,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=OI,y.processOutputGlobalValueDescriptorDataType=tE,y.processOutputGlobalValueDescriptorReturn=yo,y.processOutputGlobalValueDescriptorReturnRef=eE,y.projectPublicationCompletedGlobalEvent=fo,y.propertyToZodSchema=TE,y.relationalDatabaseBuiltInBaseEntity=Ui,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=zd,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=yI,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=fI,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=hI,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=cI,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=Wd,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=pI,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=dI,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=uI,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=ao,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=tI,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=QT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=eI,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=uo,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=lI,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=aI,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=oI,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=lo,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=sI,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=WP,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=nI,y.relationalDatabaseBuiltInBaseEntityRef=qn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=oo,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=rI,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=SP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=iI,y.resolveActionDescriptorName=WO,y.resolveBaseEntityName=ZO,y.resolveBuiltInBaseEntityDataTypeLabel=qO,y.resolveClonedEntityProject=ht,y.resolveConditionOperatorLabel=Nl,y.resolveDataType=Bl,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Gc,y.resolveDataTypeLabel=Ml,y.resolveDefinitionEntityDataTypeLabel=kq,y.resolveEntityDataTypeLabel=xq,y.resolveEntityName=F,y.resolveFirstCallsSecond=ZJ,y.resolveFirstWritesSecond=qJ,y.resolvePrimaryKeyProperty=aS,y.resolvePrimitiveEntityName=SO,y.resolveSearchName=JO,y.resolveVariableScope=$q,y.sequentialExecutionOperation=ir,y.sequentialExecutionOperationError=ym,y.sequentialExecutionOperationErrorParentRef=fm,y.sequentialExecutionOperationListOfExecutionResultsDataType=um,y.sequentialExecutionOperationListOfExecutionResultsReturn=Od,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=cm,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=dm,y.sequentialExecutionOperationListOfFunctionsArgument=Dd,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=lm,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=pm,y.sequentialExecutionOperationListOfFunctionsArgumentRef=om,y.sequentialExecutionOperationListOfFunctionsBlueprint=am,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=sm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=nm,y.softDeletePersistedEntityMethod=YP,y.softDeletePersistedEntityMethodParentRef=BI,y.sortCallsBasedOnExecutionDependencies=_1,y.sortChildrenEntitiesBasedOnExecutionDependencies=xJ,y.splitListOperation=Td,y.splitListOperationError=oh,y.splitListOperationErrorParentRef=ah,y.splitListOperationFirstOutputListDataType=Hy,y.splitListOperationFirstOutputListReturn=ih,y.splitListOperationFirstOutputListReturnParentRef=th,y.splitListOperationFirstOutputListReturnRef=vd,y.splitListOperationInputListArgument=Xy,y.splitListOperationInputListArgumentParentRef=Ky,y.splitListOperationInputListArgumentRef=Sy,y.splitListOperationInputListDataType=Wy,y.splitListOperationSecondOutputListDataType=rh,y.splitListOperationSecondOutputListReturn=sh,y.splitListOperationSecondOutputListReturnParentRef=nh,y.splitListOperationSplitIndexArgument=eh,y.splitListOperationSplitIndexArgumentParentRef=Qy,y.splitListOperationSplitIndexArgumentRef=zy,y.splitListOperationSplitIndexDataType=Yy,y.splitStringOperation=hd,y.splitStringOperationError=Py,y.splitStringOperationErrorParentRef=Oy,y.splitStringOperationFirstPartResultStringDataType=hy,y.splitStringOperationFirstPartResultStringReturn=Dy,y.splitStringOperationFirstPartResultStringReturnParentRef=by,y.splitStringOperationFirstPartResultStringReturnRef=yy,y.splitStringOperationIndexArgument=Ay,y.splitStringOperationIndexArgumentParentRef=Ey,y.splitStringOperationIndexArgumentRef=cy,y.splitStringOperationIndexDataType=fy,y.splitStringOperationSecondPartResultStringDataType=vy,y.splitStringOperationSecondPartResultStringReturn=qP,y.splitStringOperationSecondPartResultStringReturnParentRef=Ry,y.splitStringOperationSecondPartResultStringReturnRef=my,y.splitStringOperationStringArgument=Iy,y.splitStringOperationStringArgumentParentRef=Ty,y.splitStringOperationStringArgumentRef=uy,y.splitStringOperationStringDataType=py,y.stringPrototype=se,y.stringValueAutogenerationSchema=lp,y.suggestNewIdForEntity=Rc,y.test_primitive_entities_export=SS,y.toCamelCase=Gq,y.toEntityState=yi,y.toKebabCase=kO,y.toLowerCaseKebabCase=_l,y.toPascalCase=Fq,y.untypedDataPrototype=Dt,y.updateErrorsList=Ye,y.urlDefaultValue=qm,y.uuidPrototype=er,y.validateArgumentDeclarationName=Ec,y.validateCalledByErrorIdInAction=MJ,y.validateCalledByIdInAction=_J,y.validateCallers=T1,y.validateConditionEntityDeclaration=UJ,y.validateDataOperation=en,y.validateDataOperationDataToValidateArgument=Nm,y.validateDataOperationDataToValidateArgumentParentRef=Mm,y.validateDataOperationDataToValidateArgumentRef=Bm,y.validateDataOperationDataToValidateDataType=_m,y.validateDataOperationEntityToMatchTypeArgument=gm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=jm,y.validateDataOperationEntityToMatchTypeArgumentRef=Lm,y.validateDataOperationEntityToMatchTypeDataType=Um,y.validateDataOperationError=xm,y.validateDataOperationErrorParentRef=Fm,y.validateDataOperationOutputEntityDeclaration=Gm,y.validateDataOperationOutputEntityDeclarationParentRef=$m,y.validateDefinitionEntityName=mc,y.validateEntryCaller=v1,y.validateErrorCaller=m1,y.validateFunctionCallDeclaration=E1,y.validateFunctionDeclarationName=vc,y.validateGeneratedEntityParentIsNotBuiltInEntity=wJ,y.validateGeneration=OJ,y.validateGenerationTarget=dt,y.validateGenerationUpdate=PJ,y.validateLoopEntityDeclaration=jJ,y.validateName=Zq,y.validateOperationEntityDeclaration=A1,y.validatePropertyName=Ic,y.validateReachability=yr,y.validateReadsValueInActionPayload=NJ,y.validateReferenceObject=jl,y.validateReferenceToOne=Vc,y.validateReferences=Et,y.validateReturnDeclarationName=Ac,y.validateSuccessCaller=h1,y.validateValueReaderGenerationUpdate=Ba,y.validateValueWritter=Uc,y.validateVariableDeclarationName=Tc,y.validateVariableInternalCallUse=jc,y.valueAutogenerationCurrentDateAndTimeSchema=eD,y.valueAutogenerationGenericSchema=il,y.valueAutogenerationOptions=pp,y.valueAutogenerationOptionsSchema=Qb,y.valueAutogenerationRandomBooleanSchema=op,y.valueAutogenerationRandomDateBetweenSchema=dD,y.valueAutogenerationRandomDateFromSchema=oD,y.valueAutogenerationRandomDateSchema=sl,y.valueAutogenerationRandomDateUntilSchema=lD,y.valueAutogenerationRandomNumberBetweenSchema=rD,y.valueAutogenerationRandomNumberFromSchema=tD,y.valueAutogenerationRandomNumberSchema=rl,y.valueAutogenerationRandomNumberUntilSchema=iD,y.valueAutogenerationRandomSchema=ca,y.valueAutogenerationRandomTextBetweenSchema=aD,y.valueAutogenerationRandomTextFromSchema=nD,y.valueAutogenerationRandomTextSchema=nl,y.valueAutogenerationRandomTextUntilSchema=sD,y.valueAutogenerationRangeValueTypesSchema=pa,y.valueAutogenerationUniqueSchema=ap,y.waitOperation=kt,y.waitOperationMillisecondsNumberArgument=Xr,y.waitOperationMillisecondsNumberArgumentRef=Kh,y.waitOperationMillisecondsNumberDataType=Xh,y.waitOperationOperationError=tm,y.waitOperationOperationErrorParentRef=em,y.waitOperationRef=Qh,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
@@ -68,6 +68,7 @@ export declare class DefinitionEntityState extends VersionedState implements Bas
68
68
  errors: EntityGenerationError[];
69
69
  modifiedData: IDefinitionEntityGenerationTarget;
70
70
  };
71
+ get interactive(): boolean;
71
72
  get allBasePropertiesFromExtendedAndImplementedEntities(): PropertyState[];
72
73
  get extendedPropertiesFromOriginalParents(): PropertyState[];
73
74
  get implementedPropertiesFromOriginalParents(): PropertyState[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6200",
3
+ "version": "0.0.6201",
4
4
  "author": "Sergio Herrero",
5
5
  "license": "UNLICENSED",
6
6
  "description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",