@elyx-code/project-logic-tree 0.0.6336 → 0.0.6337

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
@@ -96810,9 +96810,11 @@ const je = class je extends oB {
96810
96810
  ...a.added,
96811
96811
  ...a.updated,
96812
96812
  ...a.removed
96813
- }, m = a.seenEntities.filter(
96814
- (b) => !a.affected.includes(b)
96815
- );
96813
+ }, m = [
96814
+ ...Object.keys(a.added),
96815
+ ...Object.keys(a.updated),
96816
+ ...Object.keys(a.removed)
96817
+ ];
96816
96818
  m.forEach((b) => {
96817
96819
  var R;
96818
96820
  if (!t[b]) {
@@ -96851,13 +96853,15 @@ const je = class je extends oB {
96851
96853
  const I = this.get(
96852
96854
  b.id
96853
96855
  );
96854
- I && (I.updateWithShallowTransfer(
96856
+ I ? (console.log("Applying changes to: ", I == null ? void 0 : I.id), I.updateWithShallowTransfer(
96855
96857
  b,
96856
96858
  l
96857
96859
  ), l.add(
96858
96860
  I,
96859
96861
  G.Updated
96860
- ));
96862
+ )) : console.warn(
96863
+ `Active version of ${b.id} not found`
96864
+ );
96861
96865
  } catch (I) {
96862
96866
  console.error("Error: ", I), console.error("Errored entity: ", b);
96863
96867
  }
@@ -400,5 +400,5 @@ If an entity is called by another, they must be in the same scope, which means t
400
400
  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:a,modifiedData:n}}subscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(m=>{const v=m.entity.afterAllChildrenInitialized(n);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),n==null||n.attemptAutoclose("sync-dependents",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}onDetachedDependencyRemoved(n,a,l){const p=[],t=[],m=[],v=[];if(a==="declaration"){const{updated:b,added:_,removed:I}=this.remove({ignoreUpstream:!1},l);p.push(...b),t.push(..._),m.push(...I)}if(a==="parent"){const{updated:b,added:_,removed:I}=this.remove({ignoreUpstream:!1},l);p.push(...b),t.push(..._),m.push(...I)}return{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}onDetachedDependencyRestored(n,a,l){const p=[],t=[],m=[],v=[];if(a==="declaration"){const{updated:b,added:_,removed:I}=this.restore({},l);p.push(...b),t.push(..._),m.push(...I)}if(a==="parent"){const{updated:b,added:_,removed:I}=this.restore({},l);p.push(...b),t.push(..._),m.push(...I)}return{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}unsubscribeFromDependencies(){var n;return(n=this.parent)==null||n.unsubscribeDependents([{entity:this,field:"parent"}]),this.declaration.unsubscribeDependents([{entity:this,field:"declaration"}]),this}subscribeToDependencies(){var n;return(n=this.parent)==null||n.subscribeDependents([{entity:this,field:"parent"}]),this.declaration.subscribeDependents([{entity:this,field:"declaration"}]),this}increaseVersion(n){if(n&&!N(n).isValid())throw new Error(`The shared timestamp '${n}' is not a valid ISO 8601 date string.`);return n&&N(n).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=P.UUID.uuid(),this.createdAt=N(n).toISOString()||N().toISOString(),this)}captureVersion(){var a;const n=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Vt(this,this.project);return n.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,n):new Map([[this.version,n]]),n.inputs=[...this.inputs],n.outputs=[...this.outputs],n.error=this.error,n.successCalls=[...this.successCalls],n.errorCalls=[...this.errorCalls],n.process=this.process,n.declaration=this.declaration,n.calledBySuccess=[...this.calledBySuccess],n.calledByError=[...this.calledByError],n.calledByEntry=[...this.calledByEntry],n.parent=this.parent,this}recursiveCaptureUpstreamVersions(n){const a=[],l=[],p=[],t=[];if(this.parent){this.parent.increaseVersion(n);const m=this.parent.recursiveCaptureUpstreamVersions(n);a.push(this.parent,...m.updated),l.push(...m.added),p.push(...m.removed)}return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}async restoreVersion(n){var v;const a=[],l=[],p=[],t=[];if(this.version===n)return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this};if(!this.knownVersions){const b=new Map;for(const[_,I]of this.knownVersions||new Map){if(b.set(_,I),I.activeVersion=!1,I.knownVersions)for(const[V,B]of I.knownVersions)b.set(V,B);I.knownVersions=null}}let m=(v=this.knownVersions)==null?void 0:v.get(n);if(!m){const b=await this.APILoadVersion({},n);if(!b)throw new Error(`Version with id '${n}' for entity with id '${this.id}' not found.`);m=new Vt(b,this.project)}return this.metaSync(m.toShallowJSON(),null),this.previousVersion=m.previousVersion,this.version=m.version,this.createdAt=m.createdAt,this.author=m.author,this.deleted=m.deleted,this.inputs=m.inputs,this.outputs=m.outputs,this.error=m.error,this.successCalls=m.successCalls,this.errorCalls=m.errorCalls,this.process=m.process,this.declaration=m.declaration,this.calledBySuccess=m.calledBySuccess,this.calledByError=m.calledByError,this.calledByEntry=m.calledByEntry,this.parent=m.parent,{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}updateWithShallowTransfer(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(n,a),this.version=n.version,this.createdAt=n.createdAt,this.author=n.author,this.deleted=n.deleted,this.previousVersion=n.previousVersion,this.unsubscribeFromDependencies(),n.parent){const l=W(n.parent),p=this.project.get(l),t=this.parent;if(t&&t.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(n.declaration){const l=W(n.declaration),p=this.project.get(l);p&&this.setDeclaration(p)}return n.calledByEntry.forEach(l=>{const p=W(l),t=this.project.get(p);t&&(this.addEntryCaller(t,a),t.addCall(this,a))}),[...this.calledByEntry].forEach(l=>{n.calledByEntry.find(t=>t.id===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),n.calledBySuccess.forEach(l=>{const p=W(l),t=this.project.get(p);t&&(this.addSuccessCaller(t,a),t.addSuccessCall(this,a))}),[...this.calledBySuccess].forEach(l=>{n.calledBySuccess.find(t=>t.id===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),n.calledByError.forEach(l=>{const p=W(l),t=this.project.get(p);t&&(this.addErrorCaller(t,a),t.addErrorCall(this,a))}),[...this.calledBySuccess].forEach(l=>{n.calledBySuccess.find(t=>t.id===l.id)||(this.removeCaller(l,a),l.removeCall(this,a))}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const n=[],a=[],l=[],p=[];if(this.initialData.parent){const t=W(this.initialData.parent),m=this.project.get(t);if(m)this.setParent(m,null),n.push(m);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${t}' 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 t=W(this.initialData.declaration),m=this.project.get(t);m&&(this.setDeclaration(m),n.push(m))}return this.initialData.calledByEntry.forEach(t=>{const m=W(t),v=this.project.get(m);v&&this.addEntryCaller(v,null)}),this.initialData.calledBySuccess.forEach(t=>{const m=W(t),v=this.project.get(m);v&&this.addSuccessCaller(v,null)}),this.initialData.calledByError.forEach(t=>{const m=W(t),v=this.project.get(m);v&&this.addErrorCaller(v,null)}),{updated:w(n),added:w(a),removed:w(l),affected:w(p),self:this}}afterAllChildrenInitialized(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],l=[],p=[],t=[];this.initialized=!0;const{updated:m,added:v,removed:b}=this.syncInputs(n),{updated:_,added:I,removed:V}=this.syncOutputs(n);return a.push(...m,..._),l.push(...v,...I),p.push(...b,...V),this.captureVersion(),n==null||n.attemptAutoclose("after-all-children-initialized",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addSelfToProject(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-self-to-project"))){var m;const a=[this],l=[],p=[],t=[];return this.parent===this.project&&this.project.addFunctionCall(this),(m=this.process)==null||m.writesValues.forEach(v=>{v.setValueWriter(this.process,n),a.push(v)}),this.successCalls.forEach(v=>{v.addSuccessCaller(this,n),a.push(v)}),this.errorCalls.forEach(v=>{v.addErrorCaller(this,n),a.push(v)}),this.calledBySuccess.forEach(v=>{v.addSuccessCall(this,n),a.push(v)}),this.calledByError.forEach(v=>{v.addErrorCall(this,n),a.push(v)}),this.calledByEntry.forEach(v=>{v.addCall(this,n),a.push(v)}),this.subscribe(),this.subscribeToDependencies(),n==null||n.attemptAutoclose("add-self-to-project",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-input"))){const l=this.inputs.findIndex(p=>p.id===n.id);return l>-1&&(this.inputs.splice(l,1),a&&(a==null||a.add(this,G.Affected))),a==null||a.attemptAutoclose("remove-input",this.id),this}addInput(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-input"))){return this.inputs.includes(n)?(a==null||a.attemptAutoclose("add-input",this.id),this):(this.inputs.push(n),a==null||a.add(this,G.Affected),a==null||a.attemptAutoclose("add-input",this.id),this)}addOutput(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-output"))){return this.outputs.includes(n)?(a==null||a.attemptAutoclose("add-output",this.id),this):(this.outputs.push(n),a==null||a.add(this,G.Affected),a==null||a.attemptAutoclose("add-output",this.id),this)}removeOutput(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-output"))){const l=this.outputs.findIndex(p=>p.id===n.id);return l>-1&&(this.outputs.splice(l,1),a&&(a==null||a.add(this,G.Affected))),a==null||a.attemptAutoclose("remove-output",this.id),this}addValueReader(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-value-reader"))){var l;return this.process&&!this.process.writesValues.includes(n)&&((l=this.process)==null||l.addValueReader(n,a),a==null||a.add(this,G.Affected)),a==null||a.attemptAutoclose("add-value-reader",this.id),this}removeValueReader(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-value-reader"))){var l;return this.process&&this.process.writesValues.includes(n)&&((l=this.process)==null||l.removeValueReader(n,a),a==null||a.add(this,G.Affected)),a==null||a.attemptAutoclose("remove-value-reader",this.id),this}addSuccessCaller(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-success-caller")),l=!1){return this.calledBySuccess.find(p=>p.id===n.id)||(this.calledBySuccess.push(n),a==null||a.add(this,G.Updated),l&&Me(this,a)),a==null||a.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-error-caller")),l=!1){return this.calledByError.find(p=>p.id===n.id)||(this.calledByError.push(n),a==null||a.add(this,G.Updated),l&&Me(this,a)),a==null||a.attemptAutoclose("add-error-caller",this.id),this}addEntryCaller(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-entry-caller")),l=!1){return this.calledByEntry.find(p=>p.id===n.id)||(this.calledByEntry.push(n),a==null||a.add(this,G.Updated),l&&Me(this,a)),a==null||a.attemptAutoclose("add-entry-caller",this.id),this}addErrorCall(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-error-call")),l=!1){return this.errorCalls.find(p=>p.id===n.id)||(this.errorCalls.push(n),l&&Me(this,a),a==null||a.add(this,G.Affected)),a==null||a.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-success-call")),l=!1){return this.successCalls.find(p=>p.id===n.id)||(this.successCalls.push(n),l&&Me(this,a),a==null||a.add(this,G.Affected)),a==null||a.attemptAutoclose("add-success-call",this.id),this}removeCall(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-call")),l=!1){const p=this.successCalls.findIndex(m=>m.id===n.id);p>-1&&(this.successCalls.splice(p,1),a==null||a.add(this,G.Affected));const t=this.errorCalls.findIndex(m=>m.id===n.id);return t>-1&&(this.errorCalls.splice(t,1),a==null||a.add(this,G.Affected)),l&&Me(this,a),a==null||a.attemptAutoclose("remove-call",this.id),this}removeCaller(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-caller")),l=!1){return this.calledBySuccess=this.calledBySuccess.filter(p=>p.id!==n.id?!0:(a==null||a.add(this,G.Updated),a==null||a.add(p,G.Affected),!1)),this.calledByError=this.calledByError.filter(p=>p.id!==n.id?!0:(a==null||a.add(this,G.Updated),a==null||a.add(p,G.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(p=>p.id!==n.id?!0:(a==null||a.add(this,G.Updated),a==null||a.add(p,G.Affected),!1)),l&&Me(this,a),a==null||a.attemptAutoclose("remove-caller",this.id),this}setParent(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(n==null?void 0:n.id)&&(this.parent=n,a&&(a==null||a.add(this,G.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}setDeclaration(n){return this.declaration=n,this}initChildren(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.declaration.type===f.FunctionDeclaration){const a=z(this.initialData.declaration,this.project);this.declaration=a}else{const a=W(this.initialData.declaration),l=this.project.get(a);this.declaration=l}return this.successCalls=this.initialData.successCalls.map(a=>{const l=z(a,this.project);if(l.addSuccessCaller(this),[f.BreakStatement,f.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(n);else if(l.type===f.ReturnStatement){const p=Rr(this,this.project);l.setParent(p,null),l.initChildren(n)}else l.type!==f.InternalCall&&(l.setParent(this.parent,null),l.initChildren(n));return l}),this.errorCalls=this.initialData.errorCalls.map(a=>{const l=z(a,this.project);if(l.addErrorCaller(this),[f.BreakStatement,f.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(n);else if(l.type===f.ReturnStatement){const p=Rr(this,this.project);l.setParent(p,null),l.initChildren(n)}else l.type!==f.InternalCall&&(l.setParent(this.parent,null),l.initChildren(n));return l}),this.inputs=this.initialData.inputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(n),l}),this.initialData.process&&(this.process=z(this.initialData.process,this.project),this.process.setParent(this,null),this.process.initChildren(n)),this.initialData.error&&(this.error=z(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(n)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(n),n==null||n.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=cr(this,n),p=this.toMeta();return this.x=n.x||p.x,this.y=n.y||p.y,super.metaSync(n),n.deleted===!0&&!p.deleted?a==null||a.add(this,G.Removed):n.deleted===!1&&p.deleted?a==null||a.add(this,G.Added):l&&(a==null||a.add(this,G.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(n=oe,...a){return await Vt.repository.APILoad(this.id,...a),this}async APICreate(n=oe,...a){return await Vt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(n=oe,...a){return await Vt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(n=oe,...a){return await Vt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(n=oe,...a){return await Vt.repository.APIClone(this.id,...a),this}async APILoadVersion(n=oe,a,...l){return await Vt.repository.APILoadVersion(this.id,a,...l)}removeFromParent(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-from-parent"))){const a=[],l=[],p=[],t=[];return this.parent.type===f.Project?(this.parent.removeFunctionCall(this),t.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),n==null||n.attemptAutoclose("remove-from-parent",this.id),{added:w(p),updated:w(a),removed:w(l),affected:w(t),self:this}}remove({ignoreUpstream:n}={ignoreUpstream:!1},a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){var v;const l=[],p=[],t=[],m=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(b=>{const{updated:_,removed:I,added:V}=b.entity.onDetachedDependencyRemoved(this,b.field,a);l.push(..._),p.push(...I),t.push(...V)}),this.process){const{updated:b,removed:_}=(v=this.process)==null?void 0:v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}if(this.inputs.forEach(b=>{const{updated:_,removed:I}=b.remove({ignoreUpstream:!0},a);l.push(..._),p.push(...I)}),this.outputs.forEach(b=>{const{updated:_,removed:I}=b.remove({ignoreUpstream:!0},a);l.push(..._),p.push(...I)}),this.error){const{updated:b,removed:_}=this.error.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}if(this.successCalls.forEach(b=>{l.push(b),b.removeCaller(this,a)}),this.errorCalls.forEach(b=>{l.push(b),b.removeCaller(this,a)}),!n){const b=this.removeFromParent(a);t.push(...b.added),l.push(...b.updated),p.push(...b.removed),m.push(...b.affected),this.calledBy.forEach(_=>{l.push(_),_.removeCall(this,a)})}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:w(t),updated:w(l),removed:w(p),affected:w(m),self:this}}restore({}={},n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"restore-entity"))){const a=[],l=[],p=[],t=[];if(n!=null&&n.hasAdded(this.id))return n==null||n.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},n),Object.values(this.detachedDependents).forEach(m=>{const{updated:v,removed:b,added:_}=m.entity.onDetachedDependencyRestored(this,m.field,n);l.push(...v),p.push(...b),a.push(..._)}),this.process){const{updated:m}=this.process.restore({},n);l.push(...m)}return this.inputs.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.outputs.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.successCalls.forEach(m=>{l.push(m),m.addSuccessCaller(this,n)}),this.errorCalls.forEach(m=>{l.push(m),m.addErrorCaller(this,n)}),this.calledBySuccess.forEach(m=>{l.push(m),m.addSuccessCall(this,n)}),this.calledByError.forEach(m=>{l.push(m),m.addErrorCall(this,n)}),this.calledByEntry.forEach(m=>{l.push(m),m.addCall(this,n)}),n==null||n.attemptAutoclose("restore-entity",this.id),{added:w(a),updated:w(l),removed:w(p),affected:w(t),self:this}}toFlat(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this,...this.successCalls.flatMap(l=>l.toFlat(n)),...this.errorCalls.flatMap(l=>l.toFlat(n)),...this.inputs.flatMap(l=>l.toFlat(n)),...this.outputs.flatMap(l=>l.toFlat(n)),...this.process?this.process.toFlat(n):[],...this.error?this.error.toFlat(n):[],...this.calledBy.flatMap(l=>l.toFlat(n))])}toFlatIds(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.id,...this.successCalls.flatMap(l=>l.toFlatIds(n)),...this.errorCalls.flatMap(l=>l.toFlatIds(n)),...this.inputs.flatMap(l=>l.toFlatIds(n)),...this.outputs.flatMap(l=>l.toFlatIds(n))])}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(n=new Set){var a,l;return n.has(this.id)?this.toReference():(n.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(p=>p.toJSON(n)),errorCalls:this.errorCalls.map(p=>p.toJSON(n)),calledBySuccess:this.calledBySuccess.map(p=>p.toReference()),calledByError:this.calledByError.map(p=>p.toReference()),calledByEntry:this.calledByEntry.map(p=>p.toReference()),process:(a=this.process)==null?void 0:a.toJSON(n),declaration:this.declaration.toJSON(n),inputs:this.inputs.map(p=>p.toJSON(n)),outputs:this.outputs.map(p=>p.toJSON(n)),parent:this.parent.toReference(),error:(l=this.error)==null?void 0:l.toJSON(n)})}toJSONClone(n=Ce){var l,p,t,m,v,b,_;let a;return(l=n.seenEntityMaps)!=null&&l.has(this.id)?a=n.seenEntityMaps.get(this.id):(a=n.newId||hr(this,this.project,n.uuidStrategy),n.seenEntityMaps&&n.seenEntityMaps.set(this.id,a)),(p=n.seenEntities)!=null&&p.has(a)||(t=n.seenEntities)!=null&&t.has(this.id)?this.toReference({seenEntityMaps:n.seenEntityMaps}):((m=n.seenEntities)==null||m.add(a),(v=n.seenEntities)==null||v.add(this.id),{id:a,version:P.UUID.uuid(),createdAt:n.timestamp||N().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(I=>I.toJSONClone({...n,newId:null})),errorCalls:this.errorCalls.map(I=>I.toJSONClone({...n,newId:null})),calledBySuccess:this.calledBySuccess.map(I=>I.toReference({seenEntityMaps:n.seenEntityMaps})),calledByError:this.calledByError.map(I=>I.toReference({seenEntityMaps:n.seenEntityMaps})),calledByEntry:this.calledByEntry.map(I=>I.toReference({seenEntityMaps:n.seenEntityMaps})),process:(b=this.process)==null?void 0:b.toJSONClone({...n,newId:null}),declaration:this.declaration.toJSONClone({...n,newId:null}),inputs:this.inputs.map(I=>I.toJSONClone({...n,newId:null})),outputs:this.outputs.map(I=>I.toJSONClone({...n,newId:null})),error:(_=this.error)==null?void 0:_.toJSONClone({...n,newId:null}),parent:this.parent.toReference({seenEntityMaps:n.seenEntityMaps})})}toReference(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a,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(n):null,inputs:this.inputs.map(p=>p.toReference(n)),outputs:this.outputs.map(p=>p.toReference(n)),declaration:this.declaration.toReference(n),successCalls:this.successCalls.map(p=>p.toReference(n)),errorCalls:this.errorCalls.map(p=>p.toReference(n)),calledBySuccess:this.calledBySuccess.map(p=>p.toReference(n)),calledByError:this.calledByError.map(p=>p.toReference(n)),calledByEntry:this.calledByEntry.map(p=>p.toReference(n)),error:this.error?this.error.toReference(n):null,parent:this.parent.toReference(n)}}toFlatJSON(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...this.successCalls.flatMap(l=>l.toFlatJSON(n)),...this.errorCalls.flatMap(l=>l.toFlatJSON(n)),...this.inputs.flatMap(l=>l.toFlatJSON(n)),...this.outputs.flatMap(l=>l.toFlatJSON(n)),...this.process?this.process.toFlatJSON(n):[],...this.error?this.error.toFlatJSON(n):[]])}toGenerationTarget(){const n=this.parent.type===f.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(a=>a.id),calledBySuccess:this.calledBySuccess.map(a=>a.id),calledByError:this.calledByError.map(a=>a.id),declaration:this.declaration.id,parent:n}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...this.successCalls.flatMap(l=>l.toFlatGenerationTarget(n)),...this.errorCalls.flatMap(l=>l.toFlatGenerationTarget(n)),...this.inputs.flatMap(l=>l.toFlatGenerationTarget(n)),...this.outputs.flatMap(l=>l.toFlatGenerationTarget(n)),...this.process?this.process.toFlatGenerationTarget(n):[],...this.error?this.error.toFlatGenerationTarget(n):[]])}clearErrors(){var n,a;return this.errors=[],this.inputs.forEach(l=>l.clearErrors()),this.outputs.forEach(l=>l.clearErrors()),this.successCalls.forEach(l=>l.clearErrors()),this.errorCalls.forEach(l=>l.clearErrors()),(n=this.process)==null||n.clearErrors(),(a=this.error)==null||a.clearErrors(),this}validate(){const n=lU(this);return this.errors=n,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(a=>a.getErrors()),...this.outputs.flatMap(a=>a.getErrors()),...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"clone-entity")),a=null,l=null,p=!0){var K,q;let t=yr(a,this);const m=this.toJSON(),v=l||P.UUID.uuid();m.inputs=[];const b=v.split("-id"),_=b[b.length-1||0]||v;m.id=v,m.version=P.UUID.uuid(),m.createdAt=(n==null?void 0:n.timestamp)||N().toISOString(),m.author=(n==null?void 0:n.author)||"1",m.previousVersion=null,m.deleted=!1;const I=er(m,t);a?I.setParent(a,null):I.setParent(this.parent,null),p&&I.subscribe(),I.initChildren(n),n==null||n.add(I,G.Added);const V=(K=this.inputs)==null?void 0:K.map((Z,Q)=>Z.clone(n,I,_+"-input-map-"+Q+"-id",p));I.inputs=V;const B=(q=this.outputs)==null?void 0:q.map((Z,Q)=>Z.clone(n,I,_+"-output-map-"+Q+"-id",p));return I.outputs=B,this.error&&(I.error=this.error.clone(n,I,_+"-error-map-id",p)),this.process&&(I.process=this.process.clone(n,I,_+"-process-id",p)),n==null||n.attemptAutoclose("clone-entity",this.id),I}removeUnrecognizedInputs(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-inputs"))){const a=[],l=[],p=[],t=[];return this.inputs.forEach(v=>{if(!this.declaration.inputs.find(_=>{var I;return _.id===((I=v.declaration)==null?void 0:I.id)})){const _=v.remove({ignoreUpstream:!1},n);p.push(..._.removed),a.push(..._.updated)}}),this.inputs.filter((v,b)=>{const _=this.inputs.findIndex(V=>V.declaration===v.declaration&&V!==v);if(_===-1)return!1;const I=this.inputs[_];return N(I==null?void 0:I.createdAt).isSame(N(v.createdAt))?b>_:!!N(I==null?void 0:I.createdAt).isAfter(v.createdAt)}).forEach(v=>{const b=v.remove({ignoreUpstream:!1},n);p.push(...b.removed),a.push(...b.updated)}),n==null||n.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}removeUnrecognizedOutputs(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-outputs"))){const a=[],l=[],p=[],t=[];return this.outputs.forEach(v=>{if(!this.declaration.getUniqueReturnDeclarations().find(_=>{var I;return _.id===((I=v.declaration)==null?void 0:I.id)})){const _=v.remove({ignoreUpstream:!1},n);p.push(..._.removed),a.push(..._.updated)}}),this.outputs.filter((v,b)=>{const _=this.outputs.findIndex(V=>V.declaration===v.declaration&&V!==v);if(_===-1)return!1;const I=this.outputs[_];return N(I==null?void 0:I.createdAt).isSame(N(v.createdAt))?b>_:!!N(I==null?void 0:I.createdAt).isAfter(v.createdAt)}).forEach(v=>{const b=v.remove({ignoreUpstream:!1},n);p.push(...b.removed),a.push(...b.updated)}),n==null||n.attemptAutoclose("remove-unrecognized-outputs",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}syncInputs(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-missing-fixed-inputs"))){const a=[],l=[],p=[],t=[],m=this.declaration.inputs.filter(I=>!this.inputs.find(V=>V.declaration.id===I.id));this.inputs.sort((I,V)=>I.index-V.index),m.forEach(I=>{this.inputs.forEach(K=>{K.index>=I.index&&K.metaSync({index:K.index+1},n)});const V={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.InputMap,declaration:I.toJSON(),readsValue:null,defaultValue:null,index:I.index,name:null,description:null,parent:this.toReference()},B=z(V,this.project);B.setParent(this,n),B.initChildren(n),n==null||n.add(B,G.Added),B.addSelfToProject(n),l.push(B)}),this.inputs.sort((I,V)=>I.index-V.index);const{updated:v,added:b,removed:_}=this.removeUnrecognizedInputs(n);return a.push(...v),l.push(...b),p.push(..._),n==null||n.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}syncOutputs(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-missing-fixed-outputs"))){const a=[],l=[],p=[],t=[],m=[];this.outputs=this.initialData.outputs.reduce((V,B)=>{if(B.type===f.GenericReference){const q=ss(B,this.project);return q?[...V,q]:V}const K=z(B,this.project);return m.push(K.index),K.setParent(this,null),K.initChildren(n),[...V,K]},[]);const v=this.declaration.getUniqueReturnDeclarations().filter(V=>!this.outputs.find(B=>B.declaration.id===V.id));this.outputs.sort((V,B)=>V.index-B.index),v.forEach((V,B)=>{this.outputs.forEach(Q=>{Q.index>=V.index&&Q.index++});const K=m.includes(V.index)?this.outputs.length-1+B:V.index,q={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.OutputMap,declaration:V.toJSON(),defaultValue:null,writesValues:[],index:K,parent:this.toReference()},Z=z(q,this.project);Z.setParent(this,n),Z.initChildren(n),n==null||n.add(Z,G.Added),Z.addSelfToProject(n)}),this.outputs.sort((V,B)=>V.index-B.index);const{updated:b,added:_,removed:I}=this.removeUnrecognizedOutputs(n);return a.push(...b),l.push(..._),p.push(...I),n==null||n.attemptAutoclose("sync-missing-fixed-outputs",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}};g(Vt,"repository",{APICreate:async(n,...a)=>n,APIUpdate:async(n,...a)=>n,APIDelete:async(n,...a)=>n,APIClone:async(n,...a)=>{},APILoad:async(n,...a)=>null,APILoadVersion:async(n,a,...l)=>null}),g(Vt,"type",f.FunctionCall),g(Vt,"USER_MANAGED_PARENT_TYPES",[...br,f.Project]),g(Vt,"PARENT_TYPES",[...Vt.USER_MANAGED_PARENT_TYPES]),g(Vt,"MUTABLE_BASE_PROPERTIES",[]),g(Vt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(Vt,"BASE_PROPERTIES",[...Vt.MUTABLE_BASE_PROPERTIES,...Vt.INMUTABLE_BASE_PROPERTIES]),g(Vt,"MUTABLE_META_PROPERTIES",["x","y"]),g(Vt,"INMUTABLE_META_PROPERTIES",[...Vt.INMUTABLE_BASE_PROPERTIES]),g(Vt,"META_PROPERTIES",[...Vt.MUTABLE_META_PROPERTIES,...Vt.INMUTABLE_META_PROPERTIES]),g(Vt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),g(Vt,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),g(Vt,"UPSTREAM_PROPERTIES",[...Vt.MUTABLE_UPSTREAM_PROPERTIES,...Vt.INMUTABLE_UPSTREAM_PROPERTIES]),g(Vt,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),g(Vt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Vt,"DOWNSTREAM_PROPERTIES",[...Vt.MUTABLE_DOWNSTREAM_PROPERTIES,...Vt.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Vt,"PROPERTIES",[...Vt.META_PROPERTIES,...Vt.UPSTREAM_PROPERTIES,...Vt.DOWNSTREAM_PROPERTIES]);let Fa=Vt;function vb(u){return u&&typeof u.then=="function"}class Ga{constructor(d){g(this,"order",[]);g(this,"flatRecord",{});g(this,"allBuiltInEntityIds",bs());g(this,"onGoingVisits",{});this.flatten(d),this.orderEntities()}flatten(d){const n=new Set(bs()),a=w(ae(d,n,{ignoreBuiltInBaseEntities:!0})),l=new Set;for(const p of a)this.flatRecord[p.id]=p,l.add(p.id);this.order=Array.from(l)}moveEntityAfterDependencies(d){const{upstream:n}=ip(d,this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds});for(const a of Object.keys(n)){const l=this.order.indexOf(a),p=this.order.indexOf(d.id);if(l>p)return this.order.splice(p,1),this.order.splice(l,0,d.id),!0}return!1}orderEntities(){let d=!1;for(let n=0;n<this.order.length;n++){const a=this.order[n],l=this.flatRecord[a];if(l||console.warn(`Entity with id ${a} not found in flatRecord. Skipping...`),this.moveEntityAfterDependencies(l)){d=!0;break}}d&&this.orderEntities()}getUpstreamOngoingDependenciesVisits(d,n){const{upstream:a}=ip(this.flatRecord[d],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}),l={};return Object.entries(this.onGoingVisits[n]||{}).forEach(([p,t])=>{Object.keys(a).includes(p)&&(l[p]=t)}),l}getDownstreamOngoingDependenciesVisits(d,n){const a=Object.keys(this.onGoingVisits[n]||{}),l=new Set(a.flatMap(t=>Object.keys(ip(this.flatRecord[t],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}).downstream))),p={};return Array.from(l).forEach(t=>{t===d&&(p[t]=this.onGoingVisits[n][t])}),p}async settlePromises(d,n){const a=Object.values(d);a.length&&await Promise.all(a),Object.keys(d).forEach(l=>{delete this.onGoingVisits[n][l]})}visit(d){const n=this.order;for(const a of n)d(this.flatRecord[a],this.flatRecord);return this}reverseVisit(d){const n=this.order.slice().reverse();for(const a of n)d(this.flatRecord[a],this.flatRecord);return this}async visitAsync(d){const n=this.order,a=Math.random().toString(36).substring(7);this.onGoingVisits[a]={};for(const l of n){const p=this.getUpstreamOngoingDependenciesVisits(l,a);Object.keys(p).length&&await this.settlePromises(p,a);const t=d(this.flatRecord[l],this.flatRecord);vb(t)&&(this.onGoingVisits[a][l]=t)}return await this.settlePromises(this.onGoingVisits[a],a),this.onGoingVisits[a]={},this}async reverseVisitAsync(d){const n=this.order.slice().reverse(),a=Math.random().toString(36).substring(7);this.onGoingVisits[a]={};for(const l of n){const p=this.getDownstreamOngoingDependenciesVisits(l,a);Object.keys(p).length&&await this.settlePromises(p,a);const t=d(this.flatRecord[l],this.flatRecord);vb(t)&&(this.onGoingVisits[a][l]=t)}return await this.settlePromises(this.onGoingVisits[a],a),this.onGoingVisits[a]={},this}}function uU(u,d){switch(u.id){case fe["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const n=u.project.entities.filter(v=>!!v.implements.find(b=>b.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)),a=n.find(v=>{const b=v.properties.find(V=>V.implements&&V.implements.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),_=b==null?void 0:b.getDefaultValue();return(_==null?void 0:_.value)===!0});if(!a&&n.length){const b=n[0].properties.find(I=>I.implements&&I.implements.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),_=b==null?void 0:b.defaultValue;if(_)_.metaSync({value:!0},d);else if(b!=null&&b.dataType){const I={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(d==null?void 0:d.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.LiteralValue,name:ee.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:b==null?void 0:b.toReference()},V=z(I,u.project);return V.setParent(b,d),V.initChildren(d),d==null||d.add(V,G.Added),V.addSelfToProject(d),{newEntities:[V]}}return{newEntities:[]}}else if(a)return{newEntities:[]};const l=u.project.get(fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),p=hy(l,"Main database",d);if(p.errors.length>0)return{newEntities:[]};const t=p.properties.find(v=>v.implements&&v.implements.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),m=t==null?void 0:t.defaultValue;if(m)m.metaSync({value:!0},d);else if(t!=null&&t.dataType){const v={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(d==null?void 0:d.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.LiteralValue,name:ee.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:t==null?void 0:t.toReference()},b=z(v,u.project);b.setParent(t,d),b.initChildren(d),d==null||d.add(b,G.Added),b.addSelfToProject(d)}return{newEntities:[p]}}}return{newEntities:[]}}function cU(u,d){const n=[],a=[],l=[],p=[];return u.implements.filter(m=>m.type===f.BuiltInBaseEntity).forEach(m=>{var v;switch(m.id){case fe["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const b=u.project.entities.filter(B=>B.implements.find(K=>K.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));let _=b.find(B=>!!B.properties.find(K=>{var q;return K.implements&&K.implements.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((q=K.getDefaultValue())==null?void 0:q.value)===!0}));if(!_&&b.length)_=b[0];else if(!_&&!b.length){_=u.project.getBuiltIn(fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",d);const K=_.properties.find(q=>{var Z;return((Z=q.implements)==null?void 0:Z.id)===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id});(v=K==null?void 0:K.defaultValue)==null||v.metaSync({value:!0},d),a.push(_)}const I=u.properties.find(B=>B.implements&&B.implements.id===fe["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),V=I==null?void 0:I.defaultValue;if(I&&!V){const B={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(d==null?void 0:d.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.LiteralValue,name:ee.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:(_==null?void 0:_.toJSON())||null,valueAsTypeList:null,parent:I==null?void 0:I.toReference()},K=z(B,u.project);K.hydrateAncestors(),K.setParent(I,d),K.addSelfToProject(d),K.initChildren(d),d==null||d.add(K,G.Added),a.push(K);return}else V&&!V.valueAsTypeSingle&&V.setValueAsTypeSingle(_||null,d);return}}}),{self:u,updated:w(n),added:w(a),removed:w(l),affected:w(p)}}function hy(u,d,n,a){const l=a||P.UUID.uuid(),p=P.UUID.uuid(),t={id:l,version:p,createdAt:(n==null?void 0:n.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:d,type:f.DefinitionEntity,description:null,static:u.static,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[u.toJSON()],x:0,y:0,parent:u.project.toReference()};uU(u,n);const m=z(t,u.project);return m.hydrateAncestors(),n==null||n.add(m,G.Added),m.addSelfToProject(n),m.addImplementation(u),m.setParent(u.project,n),m.initChildren(n),cU(m,n),m}function Eb(u,d){return d.entities.find(l=>{const p=l.properties,t=p.map(I=>I.name),m=u.every(I=>t.includes(I)),v=t.filter(I=>!u.includes(I)),b=p.every(I=>!v.includes(I.name)||!I.required);return m&&b})||null}function pU(u,d,n,a=xr.OrDataTypeGroup){const l=[],p=[],t=[],m=[],b={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:null,implementationChooseOne:!1,entity:u.toJSON(),isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:null,interactiveEntities:null,actionEntities:null,like:!0,inferred:!1,parentRelationType:a,parent:d.toReference()},_=z(b,u.project);return p.push(_),_.setParent(d,n),_.initChildren(n),n==null||n.add(_,G.Added),_.setEntity(u,n),_.addSelfToProject(n),{updated:w(l),added:w(p),removed:w(t),affected:w(m),self:_}}function Tb(u,d,n,a,l){var b,_,I,V,B,K,q,Z;const p=[],t=[],m=[],v=[];switch(typeof u){case"string":let Q=!1;const ue=new Date(u);if(ue instanceof Date&&!isNaN(ue.valueOf())&&(Q=!0),Q){const re=d.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Date].id);d.setEntity(re,a);break}else{const re=d.project.getBuiltIn(fe[f.PrimitiveEntity][ee.String].id);d.setEntity(re,a);break}case"number":d.setEntity(d.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Number].id),a);break;case"boolean":d.setEntity(d.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Boolean].id),a);break;case"object":if(u===null){d.setEntity(d.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Null].id),a);break}else if(Array.isArray(u))if(d.metaSync({isList:!0},a),u.length>0){const re=u.slice(0,5).filter(X=>X!==void 0);if(re.every(X=>typeof X==typeof re[0])&&(typeof re[0]!="object"||re[0]===null))switch(typeof re[0]){case"string":d.setEntity(d.project.getBuiltIn(fe[f.PrimitiveEntity][ee.String].id),a);break;case"number":d.setEntity(d.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Number].id),a);break;case"boolean":d.setEntity(d.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Boolean].id),a);break;case"object":d.setEntity(d.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Null].id),a);break}else{const X=[];let Ee=!1;re.forEach(de=>{var ye,H,ce,De;if(Array.isArray(de)&&(Ee=!0),typeof de=="object"&&!Array.isArray(de)&&de!==null){const He=yy(de,d.project,{...n,id:P.UUID.uuid()},a,l);He.hasCreated&&X.push((ye=He.changeSet)==null?void 0:ye.self),p.push(...(H=He.changeSet)==null?void 0:H.updated),t.push(...(ce=He.changeSet)==null?void 0:ce.added),m.push(...(De=He.changeSet)==null?void 0:De.removed)}});const se=w(X);if(!se.length&&!Ee){re.forEach(de=>{const ye={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:null,implementationChooseOne:!1,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:!1,interactiveEntities:!0,actionEntities:!1,like:!0,inferred:!1,parentRelationType:xr.OrDataTypeGroup,parent:d.toReference()},H=z(ye,d.project);switch(H.setParent(d,a),H.initChildren(a),a==null||a.add(H,G.Added),H.addSelfToProject(a),typeof de){case"string":H.setEntity(H.project.getBuiltIn(fe[f.PrimitiveEntity][ee.String].id),a);break;case"number":H.setEntity(H.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Number].id),a);break;case"boolean":H.setEntity(H.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Boolean].id),a);break;case"object":H.setEntity(H.project.getBuiltIn(fe[f.PrimitiveEntity][ee.Null].id),a);break}});break}else se.length===1&&!Ee?d.setEntity(se[0],a):re.forEach(de=>{if(typeof de=="object"&&!Array.isArray(de)&&de!==null){const ye=Eb(Object.keys(de),d.project);if(ye){const H=pU(ye||se[0],d,a,xr.OrDataTypeGroup);p.push(...H.updated),t.push(...H.added),m.push(...H.removed)}}else{const ye={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,options:null,implementationChooseOne:!1,entity:null,isList:Array.isArray(de),asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:!1,interactiveEntities:!0,actionEntities:!1,like:!0,inferred:!1,parentRelationType:xr.OrDataTypeGroup,parent:d.toReference()},H=z(ye,d.project);H.setParent(d,a),H.initChildren(a),a==null||a.add(H,G.Added),H.addSelfToProject(a);const ce=Tb(de,H,{...n,id:P.UUID.uuid()},a,l);p.push(...ce.updated),t.push(...ce.added),m.push(...ce.removed)}})}}else{const re=yy(u[0],d.project,{...n},a,l);d.setEntity((b=re.changeSet)==null?void 0:b.self,a),p.push(...(_=re.changeSet)==null?void 0:_.updated),t.push(...(I=re.changeSet)==null?void 0:I.added),m.push(...(V=re.changeSet)==null?void 0:V.removed);break}else{const re=yy(u,d.project,{...n},a,l);d.setEntity((B=re.changeSet)==null?void 0:B.self,a),p.push(...(K=re.changeSet)==null?void 0:K.updated),t.push(...(q=re.changeSet)==null?void 0:q.added),m.push(...(Z=re.changeSet)==null?void 0:Z.removed);break}}return{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:d}}function yy(u,d,n,a,l){const p=[],t=[],m=[],v=[],b=Object.keys(u),_=Eb(b,d);if(_)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:_}};const I=l?n.name+" of "+l.name:n.name,B={id:n.id||P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:I,type:f.DefinitionEntity,description:n.description||null,static:n.static||!1,abstract:n.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:d.toReference()},K=z(B,d);return K.setParent(d,a),K.initChildren(a),a==null||a.add(K,G.Added),K.addSelfToProject(a),t.push(K),b.forEach((q,Z)=>{const ue={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:q,type:f.Property,description:null,static:!1,abstract:!1,defaultValue:null,constant:!1,dataType:null,implements:null,extends:null,index:Z,hidden:!1,private:!1,required:!0,parent:K.toReference()},re=z(ue,d);re.setParent(K,a),re.initChildren(a),a==null||a.add(re,G.Added),re.addSelfToProject(a),t.push(re);const _e=u[q],Ee={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:!1,interactiveEntities:!0,actionEntities:!1,like:!0,inferred:!1,parent:re.toReference()},se=z(Ee,d);se.setParent(re,a),se.initChildren(a),a==null||a.add(se,G.Added),se.addSelfToProject(a),t.push(se);const de=Tb(_e,se,{...n,name:q,id:P.UUID.uuid()},a,l||K);p.push(...de.updated),t.push(...de.added),m.push(...de.removed)}),{hasCreated:!0,changeSet:{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:K}}}function ra(u,d,n,a){const l=[];return!u.length||!d.length?{errors:l,overlap:!1}:(u.length>d.length?u.forEach(p=>{const t=d.find(v=>v.name===p.name),m=d.find(v=>{var b,_;return!!p.implements&&((b=v.implements)==null?void 0:b.id)===((_=p.implements)==null?void 0:_.id)});if(t){const v=new xt({id:p.id+"--"+t.id+"--"+a,message:`Entity of type ${p.type} named "${p.name}" with id "${p.id}" overrides a base ${t.type} ${t.name} with id "${t.id}" that has the same name`,issue:null,severity:S.Error,code:a,entity:p,firstRelationship:t});l.push(v)}if(m){const v=new xt({id:p.id+"--"+m.id+"--"+n,message:`Entity of type ${p.type} named "${p.name}" with id "${p.id}" overrides a base ${m.type} ${m.name} with id "${m.id}" that implements the same base descriptor`,issue:null,severity:S.Error,code:n,entity:p,firstRelationship:m});l.push(v)}}):d.forEach(p=>{var v;const t=u.find(b=>b.name===p.name),m=u.find(b=>{var _,I;return!!b.implements&&((_=b.implements)==null?void 0:_.id)===((I=p.implements)==null?void 0:I.id)});if(t){const b=new xt({id:t.id+"--"+p.id+"--"+a,message:`Entity of type ${t.type} named "${t.name}" with id "${t.id}" overrides a base entity ${p.name} with id "${p.id}" that has the same name`,issue:null,severity:S.Error,code:a,entity:t,firstRelationship:p});l.push(b)}if(m){const b=new xt({id:m.id+"--"+p.id+"--"+n,message:`Entity of type ${m.type} named "${m.name}" with id "${m.id}" overrides a base entity ${p.name} with id "${p.id}" that implements the same base ${(v=m==null?void 0:m.implements)==null?void 0:v.type}`,issue:null,severity:S.Error,code:n,entity:m,firstRelationship:p});l.push(b)}}),{errors:l,overlap:!!l.length})}function xhe(u,d){return u.abstract||(u.properties.forEach(a=>{a.abstract||a.metaSync({abstract:!0},d)}),Object.values(u.detachedDependents).forEach(a=>{a.field===xT.Entity&&a.entity.remove({ignoreUpstream:!1},d)}),u.metaSync({abstract:!0},d)),u}function Fhe(u,d){return u.abstract&&(u.properties.forEach(a=>{a.abstract&&a.metaSync({abstract:!1},d)}),Object.values(u.detachedDependents).forEach(a=>{(a.field===Ry.Implements||a.field===Ry.Extends)&&a.entity.onDetachedDependencyRemoved(u,a.field,d)}),u.metaSync({abstract:!1},d)),u}function Ghe(u,d){return u.static||(u.properties.forEach(a=>{a.static||a.metaSync({static:!0},d)}),u.metaSync({static:!0},d)),u}function Khe(u,d){return u.static&&u.metaSync({static:!1},d),u}var fU=(u=>(u.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",u.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",u))(fU||{});function hU(u,d){const n=[],a=d;if(!a)return{errors:n,override:d};if(typeof a!="string")return{errors:[],override:d};if(a.includes(" ")){const l=new xt({id:u.id+"--string-value-must-not-have-spaces",message:`Entity of type ${u.type} with id "${u.id}" has an invalid value "${d}". The value cannot contain spaces.`,issue:null,severity:S.Error,code:"string-value-must-not-have-spaces",entity:u});n.push(l)}return{errors:n,override:a.replace(/\s/g,"-")}}function yU(u,d){const n=[],a=d;if(!a)return{errors:n,override:d};if(typeof a!="string")return{errors:[],override:d};if(a.includes(" ")){const l=new xt({id:u.id+"--string-value-must-not-have-spaces",message:`Entity of type ${u.type} with id "${u.id}" has an invalid value "${d}". The value cannot contain spaces or dashes.`,issue:null,severity:S.Error,code:"string-value-must-not-have-spaces",entity:u});n.push(l)}if(a.includes("-")){const l=new xt({id:u.id+"--string-value-must-not-have-dashes",message:`Entity of type ${u.type} with id "${u.id}" has an invalid value "${d}". The value cannot contain spaces or dashes.`,issue:null,severity:S.Error,code:"string-value-must-not-have-dashes",entity:u});n.push(l)}return{errors:n,override:a.replace(/\s|-/g,"_")}}function bb(u,d){var n;if(u.type===f.LiteralValue){let a=(n=u.value)==null?void 0:n.toString();try{a=JSON.stringify(u.value,null,2)}catch{}return`${u.type}: ${u.id} (${pe(u,d)}) = ${a}`}if(u.type===f.DataType){if(u instanceof ji||u.increaseVersion)return`${u.type}: ${u.id} (${Xl(u)})`;try{const a=Xl(u);return`${u.type}: ${u.id} (${a})`}catch{}}return`${u.type}: ${u.id} (${pe(u,d)})`}function ad(u,d){const n=Uo(u);if(n.length===0)return{list:[],last:null};let a=null;return{list:n.flatMap(p=>{if(p===d)return a=p,[p];const t=ad(p,d);return t.last&&(a=t.last),[p,...t.list]}),last:a}}function Ab(u){const d=u.calledBy;if(d.length===0)return u.project;const n=d.reduce((a,l)=>{const p=yi(l,u.project);return!p||p.type===f.Project?a:a.type===f.Project||ad(p,a).last?p:(ad(a,p).last,a)},u.project);return n.type===f.FunctionDeclaration&&n.parent.type===f.Loop?n.parent:n}function Me(u,d){var l,p;let n=Ab(u);if(u.type===f.InternalCall)(l=u.parent)==null||l.setParent(n,d),(p=u.parent)==null||p.addSelfToProject(d);else if((u.type===f.ContinueStatement||u.type===f.BreakStatement)&&n.type!==f.Loop){u.remove({ignoreUpstream:!1},d);return}else if(u.type===f.ReturnStatement&&!br.includes(n.type)){u.remove({ignoreUpstream:!1},d);return}else u.setParent(n,d),u.addSelfToProject(d);if(sr.includes(u.type))return;at(u).forEach(t=>{var v,b;const m=Ab(t);if(t.type===f.InternalCall)(v=t.parent)==null||v.setParent(m,d),(b=t.parent)==null||b.addSelfToProject(d);else if((t.type===f.ContinueStatement||t.type===f.BreakStatement)&&m.type!==f.Loop){t.remove({ignoreUpstream:!1},d);return}else if(t.type===f.ReturnStatement&&!br.includes(m.type)){t.remove({ignoreUpstream:!1},d);return}else t.setParent(m,d),t.addSelfToProject(d)})}function mU(u,d,n=new Set){const a=Ka(u),l=Ka(d),p=a.filter(v=>!l.includes(v)),t=a.filter(v=>l.includes(v)),m=p.reduce((v,b)=>n.has(b.id)?v:(n.add(b.id),w([...v,...mU(b,d,n)])),[]);return w([...t,...m])}function tp(u,d){const n=ad(u,d);return n.last===d&&n.list.length>0&&n.list[0]!==d}function khe(u,d){return!!ad(u,d).last}function qhe(u){if(Xt.includes(u.type))return u;if([...tn,f.VariableDeclaration].includes(u.type)){const d=u.parent;return Xt.includes(d.type)?d:null}return null}function Ib(u,d){if(!u||!d)throw new Error("Both entities must be defined to find a common ancestor");if(u===d)return u;const n=u.parent;if(n){if(n===d)return d;if(n.type===f.Project)return null}else return null;const a=d.parent;if(a){if(a===u)return u;if(a.type===f.Project)return null}else return null;return Ib(n,a)}function Pr(u){if(nf.includes(u.type)){if(u.type===f.FunctionDeclaration){const d=u.parent;if(d.type===f.DefinitionEntity)return Pr(d);if(d.type===f.Loop)return d}return u.type===f.DefinitionEntity&&u.parent.type===f.DataType?Pr(u.parent):u}else{const d=u.parent;return d?Pr(d):null}}function my(u,d){const n=rp(u,d);if(!n)return null;if(nf.includes(n.type)){if(n.type===f.FunctionDeclaration){const a=rp(n.parent,d);if(a){if(a.type===f.DefinitionEntity)return a;if(a.type===f.Loop)return a}}return n}else{const a=n.parent?rp(n.parent,d):null;return a?my(a,d):null}}function vU(u){if(!u)return null;if(tn.includes(u.type))return u;const d=u.parent;return d?vU(d):null}function EU(u){if(!u)return null;if(dr.includes(u.type))return u;const d=u.parent;return d?EU(d):null}function TU(u){if(!u)return null;if(rn.includes(u.type))return u;const d=u.parent;return d?TU(d):null}function She(u){return u.type===f.VariableDeclaration?[u]:dr.includes(u.type)?[...u.inputs,...u.outputs||[]]:sr.includes(u.type)?u.outputs:cl.includes(u.type)||u.type===f.FunctionDeclaration?u.inputs:[]}function Zhe(u){const d=Ka(u),n=[],a=[];t1.includes(u.type)&&n.push(...wb(u));const l=d.filter(p=>{const t=n.includes(p);return t?!1:tn.includes(p.type)&&!t?(a.push(p),!1):!0});return n.sort((p,t)=>tp(t,p)?-1:0),a.sort((p,t)=>tp(t,p)?-1:0),[...n,...a,...l]}function bU(u){return[...u].sort((d,n)=>tp(n,d)?-1:0)}function Jhe(u){const d=bU(u),n=[];return d.forEach(a=>{const l=n[n.length-1];if(l){const p=l[l.length-1];tp(a,p)?n.push([a]):l.push(a)}else n.push([a])}),n}function ei(u){const d=u.map(n=>Pr(n));return w(d)}function wb(u){return dr.includes(u.type)?[...ei(u.successCalls),...ei(u.errorCalls)]:Xt.includes(u.type)?ei(u.calls):[]}function Whe(u,d){return wb(u).includes(d)}function Rb(u){return u.writesValues||[]}function Yhe(u,d){return Rb(u).includes(d)}function AU(u){var d;return lr.includes((d=u==null?void 0:u.readsValue)==null?void 0:d.type)?u.readsValue:null}function zhe(u){return u.writesValues}function IU(u=[]){return u.map(AU).filter(d=>!!d)}function vy(u=[]){return u.map(d=>d.writesValues).flat().filter(d=>lr.includes(d.type))}function wU(u=[]){return u.map(d=>d.readsValue).filter(d=>!!d&&lr.includes(d.type))}function RU(u){return lr.includes(u.type)?u:null}function _U(u){return u.writesValues.map(RU).filter(d=>!!d)}function DU(u=[]){return u.reduce((d,n)=>n.type===f.OutputMap?[...d,..._U(n)]:d,[])}function at(u){return u.type===f.Loop?w([...Ts(ei(u.successCalls)),...Ts(ei(u.errorCalls)),...u.body?at(u.body):[]]):dr.includes(u.type)?w([...Ts(ei(u.successCalls)),...Ts(ei(u.errorCalls))]):Xt.includes(u.type)?w(Ts(ei(u.calls))):[]}function Hhe(u){return dr.includes(u.type)?[...Ts(ei(u.successCalls)),...Ts(ei(u.errorCalls))]:Xt.includes(u.type)?Ts(ei(u.calls)):[]}function gU(u,d=new Set){return u.writesValues.filter(a=>lr.includes(a.type)&&!d.has(a.id)).reduce((a,l)=>d.has(l.id)?a:[...a,...kt(l,d)],[])}function $U(u,d=new Set){var a;return(((a=u.readsValue)==null?void 0:a.writesValues)||[]).filter(l=>lr.includes(l.type)&&!d.has(l.id)).reduce((l,p)=>d.has(p.id)?l:[...l,...kt(p,d)],[])}function kt(u,d=new Set){if(d.has(u.id))return[];if(u.type===f.ReturnStatement)return wU(u.outputs).reduce((a,l)=>[...a,...kt(l,d)],[]);if(u.type===f.FunctionCall||u.type===f.Operation||u.type===f.Condition)return[...at(u).reduce((p,t)=>{const m=Pr(t);return[...p,...kt(m||t,d)]},[]),...IU(u.inputs),...DU(u.outputs)].reduce((p,t)=>[...p,...kt(t,d)],[]);if(cl.includes(u.type)){const n=vy(u.inputs),l=at(u).reduce((p,t)=>{const m=Pr(t);return[...p,...kt(m||t,d)]},[]);return n.push(...l),n.reduce((p,t)=>[...p,...kt(t,d)],[])}if(u.type===f.FunctionDeclaration){const n=[...vy(u.inputs)],l=at(u).reduce((p,t)=>{const m=Pr(t);return[...p,...kt(m||t,d)]},[]);return n.push(...l),n.reduce((p,t)=>[...p,...kt(t)],[])}if(lr.includes(u.type)){d.add(u.id);const a=at(u).reduce((l,p)=>{const t=Pr(p);return[...l,...kt(t||p,d)]},[]);return[u,...a,...$U(u,d),...gU(u,d)]}return[]}function Fi(u,d=new Set){return d.has(u.id)?[]:(d.add(u.id),[...Ka(u).reduce((l,p)=>[...l,p,...Fi(p,d)],[])])}function Ts(u){return u.reduce((d,n)=>n.type===f.ReturnStatement||n.type===f.ContinueStatement||n.type===f.BreakStatement?[...d,n]:[...d,n,...at(n)],[])}function OU(u){const d=u.entities||[],n=[...d,...u.functions||[],...u.events||[],...u.projects||[]],a=d.reduce((v,b)=>[...v,...b.properties],[]),l=d.reduce((v,b)=>[...v,...b.methods],[]),p=l.reduce((v,b)=>[...v,...vy(b.inputs),...Ts(ei(b.calls)),...b.returnStatements],[]),t=u.functions.reduce((v,b)=>[...v,...Ts(ei(b.calls)),...b.returnStatements],[]),m=u.events.reduce((v,b)=>[...v,...Ts(ei(b.calls)),...b.returnStatements],[]);return[...n,...a,...l,...p,...t,...m]}function CU(u,d){return d.filter(a=>{if(!a)return!1;switch(a.type){case f.FunctionCall:return a.inputs.find(l=>l.id===u.id)!==void 0||a.outputs.find(l=>l.id===u.id)!==void 0;case f.Condition:return a.successCalls.find(l=>l.id===u.id)!==void 0||a.errorCalls.find(l=>l.id===u.id)!==void 0||a.inputs.find(l=>l.id===u.id)!==void 0;case f.Operation:return a.outputs.find(l=>l.id===u.id)!==void 0;case f.VariableDeclaration:return dr.includes(u.type)?nj(u).find(p=>{var t;return((t=p.readsValue)==null?void 0:t.id)===a.id})!==void 0:!1;case f.DefinitionEntity:return a.properties.find(l=>l.id===u.id)!==void 0||a.methods.find(l=>l.id===u.id)!==void 0;case f.FunctionDeclaration:return a.inputs.find(l=>l.id===u.id)!==void 0||(a.returnStatements.map(l=>l.outputs).flat()||[]).find(l=>l.id===u.id)!==void 0;default:return!1}})}function Xhe(u){const d=OU(u.project);return CU(u,d)}function rp(u,d){return u?typeof u=="string"?d[u]:u.type===f.GenericReference?d[u.entityId]:d[u.id]?d[u.id]:null:null}function PU(u={},d){const n={};return Object.keys(u).forEach(a=>{const l=d.get(a)||a,p=u[a];n[l]=p}),n}function ip(u,d={},n={}){const a={ignoreBuiltInBaseEntities:!1,allBuiltInEntityIds:[],entityMaps:new Map,...n};if(a.ignoreBuiltInBaseEntities&&(Pi.includes(u.type)||(a.allBuiltInEntityIds||[]).includes(u.id)))return{upstream:{},downstream:{}};const l=u,p=u,t=u,m=u,v=u,b=u,_=u,I=u,V=u,B=u,K=u,q=u,Z=u,Q=[...Z.readsValue?[Z.readsValue]:[],...Z.declaration?[Z.declaration]:[],...(q.calledByEntry||[]).flatMap(X=>X),...(q.calledBySuccess||[]).flatMap(X=>X),...(q.calledByError||[]).flatMap(X=>X),...B.parent?[B.parent]:[]];Array.isArray(t.implements)?Q.push(...t.implements.flatMap(X=>X)):V.implements&&Q.push(V.implements),Array.isArray(t.extends)?Q.push(...t.extends.flatMap(X=>X)):V.extends&&Q.push(V.extends),v.valueAsTypeList&&Array.isArray(v.valueAsTypeList)&&Q.push(...v.valueAsTypeList.flatMap(X=>X)),v.valueAsTypeSingle&&Q.push(v.valueAsTypeSingle);const ue=[...(l.inputs||[]).flatMap(X=>X),...(K.inputsDeclarations||[]).flatMap(X=>X),...(l.outputs||[]).flatMap(X=>X),...(K.outputsDeclarations||[]).flatMap(X=>X),...(Z.internalCalls||[]).flatMap(X=>X),...Z.writesValues||[],...q.dataType?[q.dataType]:[],...b.body?[b.body]:[],...q.defaultValue?[q.defaultValue]:[],...(q.successCalls||[]).flatMap(X=>X),...(q.errorCalls||[]).flatMap(X=>X),...(t.properties||[]).flatMap(X=>X),...(t.methods||[]).flatMap(X=>X),...(t.abstractMethods||[]).flatMap(X=>X),..._.error?[_.error]:[],..._.process?[_.process]:[],...B.throws?[B.throws]:[],...(p.andChildrenGroup||[]).flatMap(X=>X),...(p.orChildrenGroup||[]).flatMap(X=>X),...(I.entities||[]).flatMap(X=>X),...(I.functions||[]).flatMap(X=>X),...(I.functionCalls||[]).flatMap(X=>X),...(I.events||[]).flatMap(X=>X),...(I.conditions||[]).flatMap(X=>X),...(I.operations||[]).flatMap(X=>X),...(I.loops||[]).flatMap(X=>X),...(I.variableDeclarations||[]).flatMap(X=>X),...(I.variableInstances||[]).flatMap(X=>X),...(I.searches||[]).flatMap(X=>X),...(I.projects||[]).flatMap(X=>X),...(m.calls||[]).flatMap(X=>X)];u.type===f.DataType&&(p.entity&&d[W(p.entity)]&&d[W(p.entity)].parent&&W(d[W(p.entity)].parent)===u.id?ue.push(p.entity):p.entity&&Q.push(p.entity));const re={},_e={};return Q.forEach(X=>{var de;const Ee=W(X);if(Ee&&a.ignoreBuiltInBaseEntities&&(Pi.includes(X.type)||(a.allBuiltInEntityIds||[]).includes(Ee)))return;const se=X.version;if(Ee){const ye=((de=a.entityMaps)==null?void 0:de.get(Ee))||Ee;re[ye]=se}}),ue.forEach(X=>{var de;const Ee=W(X);if(Ee&&a.ignoreBuiltInBaseEntities&&(Pi.includes(X.type)||(a.allBuiltInEntityIds||[]).includes(Ee)))return;const se=X.version;if(Ee){const ye=((de=a.entityMaps)==null?void 0:de.get(Ee))||Ee;_e[ye]=se}}),{upstream:re,downstream:_e}}function Qhe(u,d){const n=[];if(tn.includes(u.type)){is(u).forEach(p=>{const t=my(p,d);t&&n.push(t)});const l=[...u.inputs||[],...u.outputs||[]].map(p=>{const t=rp(p,d);return t?oj(t,d):null}).filter(p=>p!==null);n.push(...w(l))}if(lr.includes(u.type)){const a=Ey(u);a&&n.push(a)}return w(n)}function Uo(u){const d=[];if(tn.includes(u.type)){u.calledBy.forEach(l=>{const p=Pr(l);p&&d.push(p)});const a=[...u.inputs||[],...u.outputs||[]].map(l=>Ey(l)).filter(l=>l!==null);d.push(...w(a))}if(lr.includes(u.type)){const n=Ey(u);n&&d.push(n)}return w(d)}function is(u){return[...u.calledByEntry||[],...u.calledByError||[],...u.calledBySuccess||[]].filter(d=>d.type!==f.GenericReference)}function VU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.ActionDescriptor)throw new Error("Entity must be an action descriptor to be flattened");return[u,...u.inputs.flatMap(a=>ae(a,d,n)),...u.outputs.flatMap(a=>ae(a,d,n)),...u.error?ae(u.error,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function NU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.ArgumentDeclaration)throw new Error("Entity must be an argument declaration to be flattened");return[u,...u.defaultValue?ae(u.defaultValue,d):[],...u.writesValues.flatMap(a=>ae(a,d,n)),...u.dataType?ae(u.dataType,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function LU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.BreakStatement)throw new Error("Entity must be a break statement to be flattened");return[u,...u.outputs.flatMap(a=>ae(a,d,n)),...u.throws?ae(u.throws,d,n):[],...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function MU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.BuiltInBaseEntity)throw new Error("Entity must be a built-in base entity to be flattened");return[u,...(u.properties||[]).flatMap(a=>ae(a,d,n)),...(u.methods||[]).flatMap(a=>ae(a,d,n)),...(u.abstractMethods||[]).flatMap(a=>ae(a,d,n)),...(u.extends||[]).flatMap(a=>ae(a,d,n))]}function BU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.Condition)throw new Error("Entity must be a condition to be flattened");return[u,...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.successCalls||[]).flatMap(a=>ae(a,d,n)),...(u.errorCalls||[]).flatMap(a=>ae(a,d,n)),...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function UU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.ContinueStatement)throw new Error("Entity must be a continue statement to be flattened");return[u,...u.outputs.flatMap(a=>ae(a,d,n)),...u.throws?ae(u.throws,d,n):[],...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function jU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.DefinitionEntity)throw new Error("Entity must be a definition entity to be flattened");return[u,...(u.extends||[]).flatMap(a=>ae(a,d,n)),...(u.implements||[]).flatMap(a=>ae(a,d,n)),...(u.properties||[]).flatMap(a=>ae(a,d,n)),...(u.methods||[]).flatMap(a=>ae(a,d,n)),...(u.abstractMethods||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function xU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.DataType)throw new Error("Entity must be a data type to be flattened");return[u,...(u.andChildrenGroup||[]).flatMap(a=>ae(a,d,n)),...(u.orChildrenGroup||[]).flatMap(a=>ae(a,d,n)),...u.entity?ae(u.entity,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function FU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.FunctionCall)throw new Error("Entity must be a function call to be flattened");return[u,...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.outputs||[]).flatMap(a=>ae(a,d,n)),...u.error?ae(u.error,d,n):[],...u.process?ae(u.process,d,n):[],...(is(u)||[]).flatMap(a=>ae(a,d,n)),...(u.successCalls||[]).flatMap(a=>ae(a,d,n)),...(u.errorCalls||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function GU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.FunctionDeclaration)throw new Error("Entity must be a function declaration to be flattened");return[u,...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.calls||[]).flatMap(a=>ae(a,d,n)),...u.implements?ae(u.implements,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function KU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.GlobalEvent)throw new Error("Entity must be a global event to be flattened");return[u,...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.calls||[]).flatMap(a=>ae(a,d,n)),...u.implements?ae(u.implements,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function kU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.InputMap)throw new Error("Entity must be an input map to be flattened");return[u,...u.readsValue?ae(u.readsValue,d,n):[],...u.declaration?ae(u.declaration,d,n):[],...u.defaultValue?ae(u.defaultValue,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function qU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.InstalledProject)throw new Error("Entity must be an installed project to be flattened");return[u,...(u.functions||[]).flatMap(a=>ae(a,d,n)),...(u.events||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function SU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.InternalCall)throw new Error("Entity must be an internal call to be flattened");return[u,...(u.successCalls||[]).flatMap(a=>ae(a,d,n)),...(u.errorCalls||[]).flatMap(a=>ae(a,d,n)),...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.outputs||[]).flatMap(a=>ae(a,d,n)),...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.error?ae(u.error,d,n):[],...u.process?ae(u.process,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function ZU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.LiteralValue)throw new Error("Entity must be a literal value to be flattened");return[u,...u.valueAsTypeSingle?ae(u.valueAsTypeSingle,d,n):[],...u.valueAsTypeList&&Array.isArray(u.valueAsTypeList)?u.valueAsTypeList.flatMap(a=>ae(a,d,n)):[],...u.parent?ae(u.parent,d,n):[]]}function JU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.Loop)throw new Error("Entity must be a loop to be flattened");return[u,...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.outputs||[]).flatMap(a=>ae(a,d,n)),...(u.successCalls||[]).flatMap(a=>ae(a,d,n)),...(u.errorCalls||[]).flatMap(a=>ae(a,d,n)),...u.error?ae(u.error,d,n):[],...u.process?ae(u.process,d,n):[],...u.body?ae(u.body,d,n):[],...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function WU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.Operation)throw new Error("Entity must be an operation to be flattened");return[u,...(u.successCalls||[]).flatMap(a=>ae(a,d,n)),...(u.errorCalls||[]).flatMap(a=>ae(a,d,n)),...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.outputs||[]).flatMap(a=>ae(a,d,n)),...u.error?ae(u.error,d,n):[],...u.process?ae(u.process,d,n):[],...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function YU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.OutputMap)throw new Error("Entity must be an output map to be flattened");return[u,...(u.writesValues||[]).flatMap(a=>ae(a,d,n)),...u.declaration?ae(u.declaration,d,n):[],...u.defaultValue?ae(u.defaultValue,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function zU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.PrimitiveEntity)throw new Error("Entity must be a primitive entity to be flattened");return[u,...(u.properties||[]).flatMap(a=>ae(a,d,n)),...(u.methods||[]).flatMap(a=>ae(a,d,n)),...(u.abstractMethods||[]).flatMap(a=>ae(a,d,n))]}function HU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.Project)throw new Error("Entity must be a project to be flattened");return[u,...(u.entities||[]).flatMap(a=>ae(a,d,n)),...(u.functions||[]).flatMap(a=>ae(a,d,n)),...(u.events||[]).flatMap(a=>ae(a,d,n)),...(u.projects||[]).flatMap(a=>ae(a,d,n)),...(u.variableDeclarations||[]).flatMap(a=>ae(a,d,n)),...(u.variableInstances||[]).flatMap(a=>ae(a,d,n)),...(u.operations||[]).flatMap(a=>ae(a,d,n)),...(u.conditions||[]).flatMap(a=>ae(a,d,n)),...(u.functionCalls||[]).flatMap(a=>ae(a,d,n)),...(u.projects||[]).flatMap(a=>ae(a,d,n)),...(u.loops||[]).flatMap(a=>ae(a,d,n)),...(u.searches||[]).flatMap(a=>ae(a,d,n))]}function XU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.Property)throw new Error("Entity must be a property to be flattened");return[u,...u.defaultValue?ae(u.defaultValue,d,n):[],...u.dataType?ae(u.dataType,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function QU(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.ReturnDeclaration)throw new Error("Entity must be a return declaration to be flattened");return[u,...u.readsValue?ae(u.readsValue,d,n):[],...u.defaultValue?ae(u.defaultValue,d,n):[],...u.dataType?ae(u.dataType,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function ej(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.ReturnStatement)throw new Error("Entity must be a return statement to be flattened");return[u,...(u.outputs||[]).flatMap(a=>ae(a,d,n)),...u.throws?ae(u.throws,d,n):[],...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function tj(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.Search)throw new Error("Entity must be a search to be flattened");return[u,...(u.successCalls||[]).flatMap(a=>ae(a,d,n)),...(u.errorCalls||[]).flatMap(a=>ae(a,d,n)),...(u.inputsDeclarations||[]).flatMap(a=>ae(a,d,n)),...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.outputsDeclarations||[]).flatMap(a=>ae(a,d,n)),...(u.outputs||[]).flatMap(a=>ae(a,d,n)),...u.error?ae(u.error,d,n):[],...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.parent?ae(u.parent,d,n):[]]}function rj(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.ValueDescriptor)throw new Error("Entity must be a value descriptor to be flattened");return[u,...u.defaultValue?ae(u.defaultValue,d,n):[],...u.dataType?ae(u.dataType,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function ij(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.VariableDeclaration)throw new Error("Entity must be a variable declaration to be flattened");return[u,...(u.successCalls||[]).flatMap(a=>ae(a,d,n)),...(u.errorCalls||[]).flatMap(a=>ae(a,d,n)),...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.outputs||[]).flatMap(a=>ae(a,d,n)),...(u.internalCalls||[]).flatMap(a=>ae(a,d,n)),...(u.writesValues||[]).flatMap(a=>ae(a,d,n)),...u.readsValue?ae(u.readsValue,d,n):[],...u.defaultValue?ae(u.defaultValue,d,n):[],...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.dataType?ae(u.dataType,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function sj(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(d.has(u.id))return[];if(d.add(u.id),u.type!==f.VariableInstance)throw new Error("Entity must be a variable instance to be flattened");return[u,...(u.successCalls||[]).flatMap(a=>ae(a,d,n)),...(u.errorCalls||[]).flatMap(a=>ae(a,d,n)),...(u.inputs||[]).flatMap(a=>ae(a,d,n)),...(u.outputs||[]).flatMap(a=>ae(a,d,n)),...(u.internalCalls||[]).flatMap(a=>ae(a,d,n)),...(u.writesValues||[]).flatMap(a=>ae(a,d,n)),...u.readsValue?ae(u.readsValue,d,n):[],...u.defaultValue?ae(u.defaultValue,d,n):[],...(is(u)||[]).flatMap(a=>ae(a,d,n)),...u.declaration?ae(u.declaration,d,n):[],...u.parent?ae(u.parent,d,n):[]]}function bs(){const u=new Set,d=sP.flatMap(n=>ae(n,u)).map(n=>n.id);if(!d.includes("http-request-error-return-delaration-id"))throw new Error("Built-in base entities must be included in the list");return d}function ae(u,d=new Set,n={ignoreBuiltInBaseEntities:!1}){if(!u)throw new Error("Entity must be defined to be flattened");if(u.type===f.GenericReference)return[];if(n.ignoreBuiltInBaseEntities&&(Pi.includes(u.type)||bs().includes(u.id)))return[];if(d.has(u.id))return[];switch(u.type){case f.FunctionCall:return FU(u,d,n);case f.Operation:return WU(u,d,n);case f.Condition:return BU(u,d,n);case f.Loop:return JU(u,d,n);case f.Search:return tj(u,d,n);case f.GlobalEvent:return KU(u,d,n);case f.ReturnStatement:return ej(u,d,n);case f.ContinueStatement:return UU(u,d,n);case f.BreakStatement:return LU(u,d,n);case f.VariableDeclaration:return ij(u,d,n);case f.DefinitionEntity:return jU(u,d,n);case f.FunctionDeclaration:return GU(u,d,n);case f.Project:return HU(u,d,n);case f.ActionDescriptor:return VU(u,d,n);case f.ArgumentDeclaration:return NU(u,d,n);case f.ReturnDeclaration:return QU(u,d,n);case f.ValueDescriptor:return rj(u,d,n);case f.InputMap:return kU(u,d,n);case f.OutputMap:return YU(u,d,n);case f.DataType:return xU(u,d,n);case f.InstalledProject:return qU(u,d,n);case f.InternalCall:return SU(u,d,n);case f.LiteralValue:return ZU(u,d,n);case f.Property:return XU(u,d,n);case f.VariableInstance:return sj(u,d,n);case f.BuiltInBaseEntity:return n.ignoreBuiltInBaseEntities?[]:MU(u,d,n);case f.PrimitiveEntity:return n.ignoreBuiltInBaseEntities?[]:zU(u,d,n)}return[]}function _b(u){return u.type===f.FunctionCall||u.type===f.InternalCall||[f.Operation,f.Condition,f.Loop].includes(u.type)?u.declaration.inputs:u.type===f.FunctionDeclaration||cl.includes(u.type)?u.inputs:u.type===f.Search?u.inputsDeclarations:[]}function eye(u,d){return d.type===f.Condition?d.inputs.find(n=>n.declaration.id===u.id):d.type===f.FunctionCall||d.type===f.Operation?d.inputs.find(n=>n.declaration.id===u.id):null}function nj(u){return dr.includes(u.type)?u.inputs:[]}function aj(u){var d;return u.type===f.FunctionCall?((d=u.declaration.returnStatements[0])==null?void 0:d.outputs)||[]:[f.Operation,f.Condition,f.Loop].includes(u.type)?u.declaration.outputs:u.type===f.Search?u.outputsDeclarations:sr.includes(u.type)?u.outputs:[]}function tye(u,d){return d.type===f.Condition?null:d.type===f.FunctionCall||d.type===f.Operation?d.outputs.find(n=>n.declaration.id===u.id):null}function rye(u){return u.type===f.Condition?[]:dr.includes(u.type)?u.outputs:[]}function Ey(u){const d=u.readsValue;return d?Pr(d):null}function oj(u,d){const n=u.readsValue;return n?my(n,d):null}function lj(u){const d=u.internalCalls||[];return w(ei(w(d.flatMap(n=>[...n.successCalls,...n.errorCalls]))))}function od(u){const d=Rb(u),n=[];return d.forEach(a=>{if(lr.includes(a.type))n.push(a);else if(ua.includes(a.type)){const l=a.parent;n.push(l)}}),n}function w(u){const d=new Set;return u.filter(n=>!n||d.has(n.id)?!1:(d.add(n.id),!0))}function Ka(u,d=!1){const n=[];if(u.type===f.Project&&n.push(...(u==null?void 0:u.entities)||[],...(u==null?void 0:u.functions)||[],...(u==null?void 0:u.variableDeclarations)||[],...(u==null?void 0:u.variableInstances)||[],...(u==null?void 0:u.searches)||[],...(u==null?void 0:u.loops)||[],...(u==null?void 0:u.operations)||[],...(u==null?void 0:u.conditions)||[],...(u==null?void 0:u.functionCalls)||[],...(u==null?void 0:u.events)||[],...(u==null?void 0:u.projects)||[]),br.includes(u.type)&&n.push(...(u==null?void 0:u.detachedChildren)||[]),u.type===f.DefinitionEntity){const a=[...u.suggestedMethods,...u.methods].flatMap(l=>l.collapsed&&d?[]:Ka(l));n.push(...a)}if(u.type===f.Condition){const a=u.successCalls.map(p=>Pr(p)),l=u.errorCalls.map(p=>Pr(p));n.push(...a,...l)}if(cl.includes(u.type)){if(u.collapsed&&d)return[];const a=u.inputs.map(p=>od(p)).flat(),l=u.calls.map(p=>Pr(p));n.push(...w(a),...l)}if(dr.includes(u.type)&&u.type!==f.Condition&&u.type!==f.Loop){const a=u==null?void 0:u.outputs.map(t=>od(t)).flat(),l=u.successCalls.map(t=>Pr(t)),p=u.errorCalls.map(t=>Pr(t));n.push(...w(a),...l,...p)}if(lr.includes(u.type)){const a=od(u),l=lj(u);n.push(...a,...l)}if(u.type===f.Loop){const a=u.outputs.map(t=>od(t)).flat();if(u.body){const t=Ka(u.body,d);n.push(...t)}const l=u.errorCalls.map(t=>Pr(t)),p=u.successCalls.map(t=>Pr(t));n.push(...w(a),...p,...l)}if(u.type===f.FunctionDeclaration){if(u.collapsed&&d)return[];const a=u.inputs.map(p=>od(p)).flat(),l=u.calls.map(p=>Pr(p));n.push(...w(a),...l)}return w(n)}function dj(u,d=!1){const n=Ka(u,d),a=[...n,...n.reduce((l,p)=>[...l,...dj(p,d)],[])];return w(a)}function uj(u){const d=Uo(u),n=[...d,...d.reduce((a,l)=>[...a,...uj(l)],[])];return w(n)}function sp(u){return u.implements.reduce((d,n)=>n.type===f.DefinitionEntity?[...d,f.DefinitionEntity,...sp(n),...np(n)]:[...d,n.name],[])}function np(u){return u.extends.reduce((d,n)=>n.type===f.DefinitionEntity?[...d,f.DefinitionEntity,...np(n),...sp(n)]:[...d,n.name],[])}function Db(u){return u.extends.reduce((d,n)=>n.type===f.DefinitionEntity?[...d,n,...Db(n),...gb(n)]:[...d,n],[])}function gb(u){return u.implements.reduce((d,n)=>n.type===f.DefinitionEntity?[...d,n,...gb(n),...Db(n)]:[...d,n],[])}function Ty(u){return[...np(u),...sp(u)].filter((n,a,l)=>l.indexOf(n)===a)}function $b(u){return u.implements.length===0&&u.extends.length===0?null:u.implements.find(a=>a.type===f.BuiltInBaseEntity&&a.name===Oe.PERSISTED_ENTITY)?u:[...u.implements,...u.extends].reduce((a,l)=>{if(l.type===f.DefinitionEntity){const p=$b(l);if(p)return p}return a},null)}function iye(u){const d=u.extends.find(n=>n.type===f.BuiltInBaseEntity);return d&&d.type===f.BuiltInBaseEntity?d:null}function sye(u){const d=u.implements.find(n=>n.type===f.BuiltInBaseEntity);return d&&d.type===f.BuiltInBaseEntity?d:null}function Ob(u){const d=u.extends.find(n=>n.type===f.DefinitionEntity);return d&&d.type===f.DefinitionEntity?d:null}function hi(u){if(u.type===f.BuiltInBaseEntity)return[u];const d=[...u.implements,...u.extends].reduce((n,a)=>a.type===f.BuiltInBaseEntity?[...n,a]:a.type===f.DefinitionEntity?[...n,...hi(a)]:n,[]);return w(d)}function ap(u){return u.type===f.PrimitiveEntity?!0:u.type===f.BuiltInBaseEntity?u.interactive:!hi(u).find(a=>!a.interactive)}function nye(u){return u.parent===u.project&&u.project.variableDeclarations.includes(u)}function Cb(u){return u.parent!==u.project?!1:f.VariableDeclaration===u.type?u.project.variableDeclarations.includes(u):f.VariableInstance===u.type?u.project.variableInstances.includes(u):f.FunctionCall===u.type?u.project.functionCalls.includes(u):f.Condition===u.type?u.project.conditions.includes(u):f.Operation===u.type?u.project.operations.includes(u):f.Loop===u.type?u.project.loops.includes(u):f.Search===u.type?u.project.searches.includes(u):!1}function cj(u){if([...Xt,f.DefinitionEntity,f.InstalledProject,f.Project].includes(u.type)||Cb(u))return!1;const d=Uo(u);return d.length===0?!0:d.some(n=>cj(n))}function Pb(u){return[...Xt,f.DefinitionEntity,f.InstalledProject,f.Project].includes(u.type)||Cb(u)?!1:Uo(u).length===0}function pj(u,d=0){if(Pb(u)){const n=Uo(u);return n.length===0?u:n.map(l=>pj(l,d+1)).reduce((l,p)=>l?p&&p.x<l.x?p:l:p,null)}return null}function fj(u){const d=[];if(Pb(u))d.push(u);else return[];return Uo(u).forEach(a=>{d.push(...fj(a))}),d}function hj(u){return u.type===f.FunctionDeclaration&&u.parent!==u.project&&!![f.DefinitionEntity,f.Loop,f.InstalledProject].includes(u.parent.type)}function aye(u,d){const n=new Map;return u.forEach(a=>{n.set(a.id,a)}),d.forEach(a=>{n.set(a.id,a)}),Array.from(n.values())}function op(u){switch(u){case f.DefinitionEntity:return ia;case f.FunctionDeclaration:return _a;case f.VariableDeclaration:return Va;case f.VariableInstance:return Pa;case f.FunctionCall:return Fa;case f.Operation:return Da;case f.Condition:return Ca;case f.ReturnStatement:return ga;case f.Loop:return Oa;case f.Search:return Na;case f.InputMap:return Es;case f.OutputMap:return Ks;case f.ArgumentDeclaration:return ea;case f.ReturnDeclaration:return wi;case f.Property:return Xn;case f.InstalledProject:return La;case f.Project:return P;case f.DataType:return ji;case f.GlobalEvent:return $a;case f.InternalCall:return Ma;case f.ValueDescriptor:return ks;case f.BuiltInBaseEntity:return En;case f.PrimitiveEntity:return Ri;case f.ActionDescriptor:return Lt;case f.LiteralValue:return Fs;case f.ContinueStatement:return Qr;case f.BreakStatement:return Ba;default:return null}}function yi(u,d,n=null){const a=u!=null&&u.parent?W(u==null?void 0:u.parent):null;let l=a?d.get(a):null,p=n||u;if(u.type===f.ReturnStatement)return Rr(u,d,p);if(u.type===f.FunctionDeclaration&&(l==null?void 0:l.type)===f.Loop)return l;if(Xt.includes(u.type))return u;if(u.type===f.Loop)return p.id===u.id?l:u;if(Pi.includes(u.type))return null;const t=u.parent;if(!t)return null;if(t.type===f.GenericReference){const m=W(t);if(!m)return null;const v=d.get(m);return v?yi(v,d,p):null}else return t===d?d:yi(t,d,p)}function Rr(u,d,n=null){const a=u!=null&&u.parent?W(u==null?void 0:u.parent):null;let l=a?d.get(a):null,p=n||u;if(u.type===f.FunctionDeclaration&&(l==null?void 0:l.type)===f.Loop)return Rr(l.parent,d,p);if(Xt.includes(u.type))return u;if(Pi.includes(u.type))return null;const t=u.parent;if(!t)return null;if(t.type===f.GenericReference){const m=W(t);if(!m)return null;const v=d.get(m);return v?Rr(v,d,p):null}else return t===d?d:Rr(t,d,p)}function Vb(u,d){if(Pi.includes(u.type)||d.getBuiltIn(u.id))return null;const n=ss(u.parent,d);return n?n===d?br.includes(u.type)?u:null:n.type===f.DefinitionEntity?u:Vb(n,d):null}function by(u,d,n){if(u===d||d===n||u===n)return!1;const a=yi(d.parent,n);return a===u?!0:by(a,d,n)}var Ay=(u=>(u.SameBothLocal="same-both-local",u.AInB="a-in-b",u.BInA="b-in-a",u.ParallelInCommonParent="parallel-in-common-parent",u.ParallelInProject="parallel-in-project",u.AIsGlobalBIsNot="a-is-global-b-is-not",u.BIsGlobalAIsNot="b-is-global-a-is-not",u.SameBothGlobal="same-both-global",u))(Ay||{});function lp(u,d,n){const a=yi(u,n),l=yi(d,n);if(!a)throw new Error("Could not find scope owner for the entity: "+u.id);if(!l)throw new Error("Could not find scope owner for the entity: "+d.id);if(a===l&&a.type!==f.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:a};if(a===l&&a.type===f.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:a};if(a.type===f.Project&&l.type!==f.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:a};if(a.type!==f.Project&&l.type===f.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:l};if(by(a,l,n))return{compatible:!0,type:"b-in-a",commonAncestorScope:a};if(by(l,a,n))return{compatible:!0,type:"a-in-b",commonAncestorScope:l};const m=Ib(a,l);return m===n?{compatible:!1,type:"parallel-in-project",commonAncestorScope:m}:m?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:yi(m,n)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:n}}function yj(u,d,n){const a=lp(u,d,n);if(!a.compatible||a.type!=="same-both-local")return null;if(u===d)return u;let l=yi(u.parent,n);if(l){if(l===d)return d;if(l.type===f.Project)return u}else return u;for(;l;){if(l){if(l===d)return d;if(l.type===f.Project)return u}else return u;l=yi(l.parent,n)}let p=yi(d.parent,n);if(p){if(p===u)return u;if(p.type===f.Project)return d}else return d;for(;p;){if(p){if(p===u)return u;if(p.type===f.Project)return d}else return d;p=yi(p.parent,n)}return null}function mj(u){return u.length===0?null:u.length===1?u[0]:u.reduce((n,a)=>{const l=yj(n,a,a.project);return!l||l===a?n:a},u[0])}function ss(u,d){if(!u)return null;let n;return typeof u=="string"?n=u:u.type===f.GenericReference?n=W(u):n=u.id,n===d.id?d:d.get(n)}function ka(u){if(!u)return null;if(Pi.includes(u.type))return u;if(u.type===f.Project)return null;if(u.project.getBuiltIn(u.id))return u;const d=u.parent;return!d||d.type===f.Project?null:ka(d)}function dp(u){const d=[];function n(p,t){return d.some(m=>m.blockedByCaller===p&&m.blockedByCalling===t)}function a(p,t){n(p,t)||d.push({blockedByCaller:p,blockedByCalling:t})}const l=Vb(u,u.project);return u.calledBySuccess.forEach(p=>{[...p.successCalls||[]].forEach(v=>{sr.includes(v.type)&&v!==u&&(at(u).find(I=>I===v)||a(p,v))});let m;if(dr.includes(p.type)&&(m=p),m){const v=dp(m);v.reachable||at(u).find(I=>I===p)||v.blocks.forEach(I=>{a(p,I.blockedByCalling)})}}),u.calledByError.forEach(p=>{[...p.errorCalls||[]].forEach(v=>{sr.includes(v.type)&&v!==u&&(at(u).find(I=>I===v)||a(p,v))});let m;if(dr.includes(p.type)&&(m=p),m){const v=dp(m);v.reachable||at(u).find(I=>I===p)||v.blocks.forEach(I=>{a(p,I.blockedByCalling)})}}),u.calledByEntry.forEach(p=>{if([...p.calls||[]].forEach(v=>{sr.includes(v.type)&&v!==u&&(at(u).find(I=>I===v)||a(p,v))}),p===l)return;let m;if(p.type===f.FunctionDeclaration){const v=Pr(p);if(v.type===f.DefinitionEntity)return;v.type===f.Loop&&(m=v)}if(m){const v=dp(m);v.reachable||v.blocks.forEach(b=>{a(p,b.blockedByCalling)})}}),{reachable:d.length===0,entryPoint:l,blocks:d}}function oye(u){return nf.includes(u.type)?u.type===f.FunctionDeclaration?!hj(u):!0:!1}function lye(u){if(f.ActionDescriptor===u.type){if(u.project.operationDeclarations.find(p=>p.id===u.id))return f.Operation;if(u.project.globalEventActionDescriptors.find(p=>p.id===u.id))return f.GlobalEvent;if(u.project.loopDeclarations.find(p=>p.id===u.id))return f.Loop;if(u.project.conditionDeclarations.find(p=>p.id===u.id))return f.Condition}return u.type}function Iy(u,d){return u.type===f.BuiltInBaseEntity?u.name===d:!!np(u).includes(d)}function dye(u,d){return u.type===f.BuiltInBaseEntity?u.name===d:!!sp(u).includes(d)}function As(u,d){return u.type===f.BuiltInBaseEntity?u.name===d:!!Ty(u).includes(d)}function uye(u){const d=[];return u.entities.forEach(n=>{if(Iy(n,Oe.PERSISTED_ENTITY)){d.push(n);return}}),w(d)}function cye(u){const d=[];return u.entities.forEach(n=>{if(Iy(n,Oe.RELATIONAL_DATABASE)){d.push(n);return}}),w(d)}function pye(u){return u.type!==f.DefinitionEntity||u.abstract||!Iy(u,Oe.PERSISTED_ENTITY)?null:(u==null?void 0:u.properties.find(n=>{var a;return((a=n.implements)==null?void 0:a.id)===fe[f.BuiltInBaseEntity][Oe.PERSISTED_ENTITY].properties.primaryKey.id&&!n.abstract}))||null}function vj(u){var a;const d=$b(u);if(!d)return null;const n=d.properties.find(l=>{var p;return((p=l.implements)==null?void 0:p.id)===fe[f.BuiltInBaseEntity][Oe.PERSISTED_ENTITY].properties.database.id});return n?(a=n.getDefaultValue())==null?void 0:a.valueAsType:null}function ld(u){if(u.type!==f.DefinitionEntity)return[];if(u.abstract)return[];if(!As(u,Oe.PERSISTED_ENTITY))return[];const d=[],n=u.properties.filter(a=>{var l;return((l=a.implements)==null?void 0:l.id)!==fe[f.BuiltInBaseEntity][Oe.PERSISTED_ENTITY].properties.database.id&&!a.abstract});return d.push(...n),d}function fye(u){var n;if(!u||u.type!==f.DefinitionEntity||!As(u,Oe.PERSISTED_ENTITY))return null;const d=u.properties.find(a=>{var l;return((l=a.implements)==null?void 0:l.id)===fe[f.BuiltInBaseEntity][Oe.PERSISTED_ENTITY].properties.database.id});return(n=d==null?void 0:d.getDefaultValue())==null?void 0:n.valueAsTypeSingle}function yr(u,d){var a;if(!i1.includes(d.type)||!u)return d.project||null;let n=d.project;return u.type===f.Project?n=u:((a=d.project)==null?void 0:a.id)!==u.project.id&&(n=u.project),n}function hye(u){switch(u){case f.Project:return P;case f.InstalledProject:return La;case f.DefinitionEntity:return ia;case f.FunctionDeclaration:return _a;case f.GlobalEvent:return $a;case f.VariableInstance:return Pa;case f.VariableDeclaration:return Va;case f.InputMap:return Es;case f.OutputMap:return Ks;case f.Condition:return Ca;case f.Operation:return Da;case f.FunctionCall:return Fa;case f.ReturnDeclaration:return wi;case f.ArgumentDeclaration:return ea;case f.PrimitiveEntity:return Ri;case f.DataType:return ji;case f.Property:return Xn;case f.ActionDescriptor:return Lt;case f.ReturnStatement:return ga;case f.ContinueStatement:return Qr;case f.BreakStatement:return Ba;case f.Loop:return Oa;case f.Search:return Na;case f.ValueDescriptor:return ks;case f.InternalCall:return Ma;case f.LiteralValue:return Fs}return null}function yye(u){const d={added:{},updated:{},removed:{},affected:[],seenEntities:[],self:u==null?void 0:u.self};return u==null||u.added.forEach(n=>{d.added[n.id]=n}),u==null||u.updated.forEach(n=>{d.updated[n.id]=n}),u==null||u.removed.forEach(n=>{d.removed[n.id]=n}),d.affected=Array.from(new Set(u==null?void 0:u.affected.map(n=>n.id))),d}function cr(u,d){const n=op(u.type);return n?!n.MUTABLE_META_PROPERTIES.every(l=>{const p=u[l],t=d[l];return t===void 0||p===t?!0:Array.isArray(p)&&Array.isArray(t)?p.length!==t.length?!1:p.every((m,v)=>m===t[v]):!1}):!1}function wy(u,d={}){if(u.type===f.Project)return[];if(!u.parent)return[];const n=W(u.parent);if(!n)return[];const a=d[n];return a?[a.id,...wy(a,d)]:[]}function mye(u){const d=[],n=new Set;return[...u.listAdded,...u.listUpdated,...u.listAffected].forEach(a=>{const l=Pr(a);!l||n.has(l.id)||(n.add(l.id),d.push(l))}),w(d)}function vye(u){if(u.type===f.Condition)return null;if(u.type===f.Search)return u.project.getBuiltIn(fe["value-descriptor"][pl.SearchErrorOutputDescriptor].id)||null;if(u.type===f.Operation)return u.declaration.error;if(u.type===f.FunctionCall){const n=u.declaration.returnStatements.find(a=>!!a.throws);return(n==null?void 0:n.throws)||null}return null}function Ej(u){const d=u.entities.filter(l=>!!l.implements.find(p=>p.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)),n=d.find(l=>{const p=l.properties.find(v=>v.implements&&v.implements.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),t=p==null?void 0:p.getDefaultValue();return(t==null?void 0:t.value)===!0});return n||d[0]||null}function Nb(u,d){const n=Array.from(new Set([...d.getAllBuiltInIds(),...bs()]));return!!(n.includes(u.id)||!wy(u,{...d.instances,...d.builtInInstances}).every(p=>!n.includes(p)))}function Tj(u){if(!u)return null;if(u.type===f.Project)return u.id;const d=u.parent;return d?Tj(d):u.id}function bj(u){const d=iue(),n=u.toJSON();d.safeParse(n).success;const l=u.implements.flatMap(_=>Eye(u,_)),p=u.extends.flatMap(_=>Tye(u,_)),t=Aye(u),m=bye(u);u.methods.flatMap(_=>_.validate());const v=[...l,...p,...t,...m];return qt(u.errors,v)}function Aj(u,d){const n=d.properties.filter(p=>p.abstract),a=[];let l=[...u.properties];return n.forEach(p=>{const t=l.find(m=>{var v;return((v=m.implements)==null?void 0:v.id)===p.id});t?l=l.filter(m=>m.id!==t.id):a.push(p)}),a}function Ij(u,d){const n=d.abstractMethods,a=[];let l=[...u.methods];return n.forEach(p=>{const t=l.find(m=>{var v;return((v=m.implements)==null?void 0:v.id)===p.id});t?l=l.filter(m=>m.id!==t.id):a.push(p)}),a}function Eye(u,d){const n=[];if(!d.abstract){const _=tt({id:u.id+"--"+me.ImplementingNonAbstractEntity,message:`Entity "${u.name}" with id "${u.id}" is implementing a non-abstract entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.ImplementingNonAbstractEntity,entity:u});return n.push(_.error),n}const a=d.properties.filter(_=>_.abstract),l=[];let p=[...u.properties];a.forEach(_=>{const I=p.find(V=>{var B;return((B=V.implements)==null?void 0:B.id)===_.id});I?p=p.filter(V=>V.id!==I.id):l.push(_)}),l.length&&l.forEach(_=>{const I=tt({id:u.id+"--"+me.MissingPropertyImplementation+"--"+_.id,message:`Property "${_.name}" with id "${_.id}" of entity "${d.name}" with id "${d.id}" is not implemented when entity "${u.name}" with id "${u.id}" implements it`,issue:null,severity:S.Error,code:me.MissingPropertyImplementation,entity:u});n.push(I.error)});const t=[];let m=[...u.methods];d.abstractMethods.forEach(_=>{const I=m.find(V=>{var B;return((B=V.implements)==null?void 0:B.id)===_.id});I?m=m.filter(V=>V.id!==I.id):t.push(_)}),t.length&&t.forEach(_=>{const I=tt({id:u.id+"--"+me.MissingMethodImplementation+"--"+_.id,message:`Method "${_.name}" with id "${_.id}" of entity "${d.name}" with id "${d.id}" is not implemented when entity "${u.name}" with id "${u.id}" implements it`,issue:null,severity:S.Error,code:me.MissingMethodImplementation,entity:u});n.push(I.error)});const v=[];d.properties.forEach(_=>{const I=p.find(V=>V.name===_.name);I&&v.push([I,_])}),v.length&&v.forEach(([_])=>{const I=tt({id:u.id+"--"+le.PropertyOverwritesOtherSiblingWithSameName+"--"+_.id,message:`Property "${_.name}" with id "${_.id}" of entity "${u.name}" with id "${u.id}" overwrites the property with the same name from the base entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:le.PropertyOverwritesOtherSiblingWithSameName,entity:u});n.push(I.error)});const b=[];return d.methods.forEach(_=>{const I=m.find(V=>V.name===_.name);I&&b.push([I,_])}),b.length&&b.forEach(([_])=>{const I=tt({id:u.id+"--"+le.MethodOverwritesOtherSiblingWithSameName+"--"+_.id,message:`Method "${_.name}" with id "${_.id}" of entity "${u.name}" with id "${u.id}" overwrites the method with the same name from the base entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:le.MethodOverwritesOtherSiblingWithSameName,entity:u});n.push(I.error)}),n}function Tye(u,d){const n=[],a=[];if(!u.abstract&&d.abstract){const p=tt({id:u.id+"--"+d.id+"--"+me.NonAbstractExtendingAbstractEntity,message:`Entity "${u.name}" with id "${u.id}" is not-abstract but is extending an abstract entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.NonAbstractExtendingAbstractEntity,entity:u,firstRelationship:d});return n.push(p.error),n}if(u.abstract&&!d.abstract){const p=tt({id:u.id+"--"+d.id+"--"+me.AbstractExtendingNonAbstractEntity,message:`Entity "${u.name}" with id "${u.id}" is abstract but is extending an non-abstract entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.AbstractExtendingNonAbstractEntity,entity:u,firstRelationship:d});return n.push(p.error),n}u.properties.forEach(p=>{var m;const t=d.properties.find(v=>{var b;return v.name===p.name&&((b=p.extends)==null?void 0:b.id)!==v.id});((m=p.implements)==null?void 0:m.id)!==(t==null?void 0:t.id)&&t&&a.push(p)}),a.length&&a.forEach(p=>{const t=tt({id:u.id+"--"+le.PropertyOverwritesOtherSiblingWithSameName,message:`Property "${p.name}" with id "${p.id}" of entity "${u.name}" with id "${u.id}" overwrites the property with the same name from the extended entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:le.PropertyOverwritesOtherSiblingWithSameName,entity:u});n.push(t.error)});const l=[];return u.methods.forEach(p=>{var m;const t=d.methods.find(v=>{var b;return v.name===p.name&&((b=p.extends)==null?void 0:b.id)!==v.id});((m=p.implements)==null?void 0:m.id)!==(t==null?void 0:t.id)&&t&&l.push(p)}),l.length&&l.forEach(p=>{const t=tt({id:u.id+"--"+le.MethodOverwritesOtherSiblingWithSameName,message:`Method "${p.name}" with id "${p.id}" of entity "${u.name}" with id "${u.id}" overwrites the method with the same name from the extended entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:le.MethodOverwritesOtherSiblingWithSameName,entity:u});n.push(t.error)}),n}function bye(u){const d=[];if(!u.properties.length){const n=tt({id:u.id+"--"+me.NoProperties,message:"No properties implemented",issue:null,severity:S.Warning,code:me.NoProperties,entity:u});d.push(n.error)}return u.properties.forEach(n=>{n.validate()}),d}function Aye(u){const d=[];if(u.abstract){if(u.methods.length){const n=tt({id:u.id+"--"+me.AbstractEntityWithNonAbstractMethods,message:`Entity "${u.name}" with id "${u.id}" is marked as abstract but has non-abstract methods`,issue:null,severity:S.Error,code:me.AbstractEntityWithNonAbstractMethods,entity:u});d.push(n.error)}if(u.properties.some(n=>!n.abstract)){const n=tt({id:u.id+"--"+me.AbstractEntityWithNonAbstractProperties,message:`Entity "${u.name}" with id "${u.id}" is marked as abstract but has non-abstract properties`,issue:null,severity:S.Error,code:me.AbstractEntityWithNonAbstractProperties,entity:u});d.push(n.error),u.properties.forEach(a=>{if(!a.abstract){const l=tt({id:u.id+"--"+me.StaticEntityWithNonStaticProperties+"--"+a.id,message:`Property "${a.name}" with id "${a.id}" of entity "${u.name}" with id "${u.id}" is not marked as abstract but the entity is marked as abstract`,issue:null,severity:S.Error,code:me.StaticEntityWithNonStaticProperties,entity:u});d.push(l.error)}})}}else{if(u.abstractMethods.length){const n=tt({id:u.id+"--"+me.AbstractPropertyInNonAbstractEntity,message:`Entity "${u.name}" with id "${u.id}" is not marked as abstract but has abstract methods`,issue:null,severity:S.Error,code:me.AbstractPropertyInNonAbstractEntity,entity:u});d.push(n.error)}u.properties.some(n=>n.abstract)&&u.properties.forEach(n=>{if(n.abstract){const a=tt({id:u.id+"--"+me.AbstractPropertyInNonAbstractEntity+"--"+n.id,message:`Property "${n.name}" with id "${n.id}" of entity "${u.name}" with id "${u.id}" is marked as abstract but the entity is not marked as abstract`,issue:null,severity:S.Error,code:me.AbstractPropertyInNonAbstractEntity,entity:u,firstRelationship:n});d.push(a.error)}})}return u.static&&u.properties.some(n=>!n.static)&&u.properties.forEach(n=>{if(!n.static){const a=tt({id:u.id+"--"+me.NonStaticPropertyInStaticEntity+"--"+n.id,message:`Property "${n.name}" with id "${n.id}" of entity "${u.name}" with id "${u.id}" is not marked as static but the entity is marked as static`,issue:null,severity:S.Error,code:me.NonStaticPropertyInStaticEntity,entity:u,firstRelationship:n});d.push(a.error)}}),d}function Iye(u,d){const n=[],a=hi(d);if(!d.abstract){const t=new xt({id:u.id+"--"+d.id+"--"+me.ImplementingNonAbstractEntity,message:`Entity "${u.name}" with id "${u.id}" is implementing a non-abstract built-in entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.ImplementingNonAbstractEntity,entity:u,firstRelationship:d});n.push(t)}const l=u.implements.filter(t=>t.id!==d.id);if(u.abstract){const t=new xt({id:u.id+"--"+d.id+"--"+me.AbstractEntityImplements,message:`Entity "${u.name}" with id "${u.id}" is marked as abstract and cannot implement built-in entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.AbstractEntityImplements,entity:u,firstRelationship:d});n.push(t)}if(u.static&&!d.static){const t=new xt({id:u.id+"--"+d.id+"--"+me.StaticImplementingNonStaticEntity,message:`Entity "${u.name}" with id "${u.id}" is marked as static and cannot implement non-static built-in entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.StaticImplementingNonStaticEntity,entity:u,firstRelationship:d});n.push(t)}if(!u.static&&d.static){const t=new xt({id:u.id+"--"+d.id+"--"+me.NonStaticImplementingStaticEntity,message:`Entity "${u.name}" with id "${u.id}" is not marked as static and cannot implement static built-in entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.NonStaticImplementingStaticEntity,entity:u,firstRelationship:d});n.push(t)}return l.length&&l.forEach(t=>{if(t.type===f.BuiltInBaseEntity){const m=a.filter(v=>v.id!==t.id);m.length&&m.forEach(v=>{if(v.id!==t.id){const b=new xt({id:u.id+"--"+v.id+"--"+t.id+"--"+me.ImplementsIncompatibleEntities,message:`Entity "${u.name}" with id "${u.id}" is implementing built-in entity "${v.name}" with id "${v.id}" but also implements entity "${t.name}" with id "${t.id}" which is incompatible`,issue:null,severity:S.Error,code:me.ImplementsIncompatibleEntities,entity:u,firstRelationship:v,secondRelationship:t});n.push(b)}})}else{hi(t).forEach(_=>{const I=a.filter(V=>V.id!==_.id);I.length&&I.forEach(V=>{if(V.id!==_.id){const B=new xt({id:u.id+"--"+V.id+"--"+_.id+"--"+me.ImplementsIncompatibleEntities,message:`Entity "${u.name}" with id "${u.id}" is implementing built-in entity "${V.name}" with id "${V.id}" but also implements entity "${_.name}" with id "${_.id}" which is incompatible`,issue:null,severity:S.Error,code:me.ImplementsIncompatibleEntities,entity:u,firstRelationship:V,secondRelationship:_});n.push(B)}})});const v=ra(d.ownDeclaredProperties,t.ownDeclaredProperties,le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation,le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameName);n.push(...v.errors);const b=ra(d.abstractMethods,[...t.abstractMethods,...t.methods],le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation,le.MethodOverwritesOtherImplementedEntitysMethodWithSameName);n.push(...b.errors)}}),w(u.extends.flatMap(t=>hi(t))).forEach(t=>{if(!a.find(m=>m.id===t.id)){const m=new xt({id:u.id+"--"+d.id+"--"+t.id+"--"+me.ExtendsIncompatibleEntities,message:`Entity "${u.name}" with id "${u.id}" is implementing built-in entity "${d.name}" with id "${d.id}" but also extends entity "${t.name}" with id "${t.id}" which is incompatible`,issue:null,severity:S.Error,code:me.ExtendsIncompatibleEntities,entity:u,firstRelationship:d,secondRelationship:t});n.push(m)}}),n}function wye(u,d,n=!1){const a=[],l=hi(d);if(!u.abstract&&d.abstract){const _=tt({id:u.id+"--"+d.id+"--"+me.NonAbstractExtendingAbstractEntity,message:`Entity "${u.name}" with id "${u.id}" is not-abstract but is extending an abstract entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.NonAbstractExtendingAbstractEntity,entity:u,firstRelationship:d});a.push(_.error)}if(u.abstract&&!d.abstract){const _=tt({id:u.id+"--"+d.id+"--"+me.AbstractExtendingNonAbstractEntity,message:`Entity "${u.name}" with id "${u.id}" is abstract but is extending an non-abstract entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.AbstractExtendingNonAbstractEntity,entity:u,firstRelationship:d});a.push(_.error)}if(!u.static&&d.static){const _=tt({id:u.id+"--"+d.id+"--"+me.NonStaticExtendingStaticEntity,message:`Entity "${u.name}" with id "${u.id}" is not static but is extending a static entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.NonStaticExtendingStaticEntity,entity:u,firstRelationship:d});a.push(_.error)}if(u.static&&!d.static){const _=tt({id:u.id+"--"+d.id+"--"+me.StaticExtendingNonStaticEntity,message:`Entity "${u.name}" with id "${u.id}" is static but is extending an non-static entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.StaticExtendingNonStaticEntity,entity:u,firstRelationship:d});a.push(_.error)}if(!ap(d)){const _=tt({id:u.id+"--"+d.id+"--"+me.ExtendingNonInteractiveEntity,message:`Entity "${u.name}" with id "${u.id}" is extending an non-interactive entity "${d.name}" with id "${d.id}"`,issue:null,severity:S.Error,code:me.ExtendingNonInteractiveEntity,entity:u,firstRelationship:d});a.push(_.error)}const t=u.extends.filter(_=>_.id!==d.id);t.length&&t.forEach(_=>{if(_.type===f.BuiltInBaseEntity){const I=l.filter(V=>V.id!==_.id);I.length&&I.forEach(V=>{if(V.id!==_.id){const B=tt({id:u.id+"--"+V.id+"--"+_.id+"--"+me.ExtendsIncompatibleEntities,message:`Entity "${u.name}" with id "${u.id}" is extending built-in entity "${V.name}" with id "${V.id}" but also extends entity "${_.name}" with id "${_.id}" which is incompatible`,issue:null,severity:S.Error,code:me.ExtendsIncompatibleEntities,entity:u,firstRelationship:V,secondRelationship:_});a.push(B.error)}})}else{hi(_).forEach(Q=>{const ue=l.filter(re=>re.id!==Q.id);ue.length&&ue.forEach(re=>{if(re.id!==Q.id){const _e=new xt({id:u.id+"--"+re.id+"--"+Q.id+"--"+me.ImplementsIncompatibleEntities,message:`Entity "${u.name}" with id "${u.id}" is extending built-in entity "${re.name}" with id "${re.id}" but also extends or implements entity "${Q.name}" with id "${Q.id}" which is incompatible`,issue:null,severity:S.Error,code:me.ImplementsIncompatibleEntities,entity:u,firstRelationship:re,secondRelationship:Q});a.push(_e)}})});const V=!!hi(_).find(Q=>Q.id===d.id);let B=[..._.properties];V&&(B=B.filter(Q=>!d.properties.find(ue=>{var re;return ue.id===Q.id||ue.name===Q.name||ue.id===((re=Q.implements)==null?void 0:re.id)})));let K=[..._.methods];V&&(K=K.filter(Q=>!d.methods.find(ue=>{var re;return ue.id===Q.id||ue.name===Q.name||ue.id===((re=Q.implements)==null?void 0:re.id)})));const q=ra(d.ownDeclaredProperties,B,le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation,le.PropertyOverwritesOtherExtendedEntitysPropertyWithSameName);a.push(...q.errors);const Z=ra(d.abstractMethods,K,le.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation,le.MethodOverwritesOtherExtendedEntitysMethodWithSameName);a.push(...Z.errors)}}),n&&console.log("self.implements.length",u.implements.length),u.implements.length&&u.implements.forEach(_=>{if(_.type===f.BuiltInBaseEntity){const I=l.filter(V=>V.id!==_.id);I.length&&I.forEach(V=>{if(V.id!==_.id){const B=new xt({id:u.id+"--"+V.id+"--"+_.id+"--"+me.ImplementsIncompatibleEntities,message:`Entity "${u.name}" with id "${u.id}" is implementing built-in entity "${V.name}" with id "${V.id}" but also implements entity "${_.name}" with id "${_.id}" which is incompatible`,issue:null,severity:S.Error,code:me.ImplementsIncompatibleEntities,entity:u,firstRelationship:V,secondRelationship:_});a.push(B)}})}else{hi(_).forEach(K=>{const q=l.filter(Z=>Z.id!==K.id);q.length&&q.forEach(Z=>{if(Z.id!==K.id){const Q=new xt({id:u.id+"--"+Z.id+"--"+K.id+"--"+me.ImplementsIncompatibleEntities,message:`Entity "${u.name}" with id "${u.id}" is implementing built-in entity "${Z.name}" with id "${Z.id}" but also implements entity "${K.name}" with id "${K.id}" which is incompatible`,issue:null,severity:S.Error,code:me.ImplementsIncompatibleEntities,entity:u,firstRelationship:Z,secondRelationship:K});a.push(Q)}})});const V=ra(d.ownDeclaredProperties,_.ownDeclaredProperties,le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation,le.PropertyOverwritesOtherImplementedEntitysPropertyWithSameName);a.push(...V.errors);const B=ra(d.abstractMethods,[..._.abstractMethods,..._.methods],le.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation,le.MethodOverwritesOtherImplementedEntitysMethodWithSameName);a.push(...B.errors)}});const m=ra(u.ownDeclaredProperties,d.ownDeclaredProperties,le.PropertyOverwritesOtherSiblingWithSameImplementation,le.PropertyOverwritesOtherSiblingWithSameName);a.push(...m.errors);const v=ra(d.methods,d.abstractMethods,le.MethodOverwritesOtherSiblingWithSameImplementation,le.MethodOverwritesOtherSiblingWithSameName);return a.push(...v.errors),w(u.extends.flatMap(_=>hi(_))).forEach(_=>{if(!l.find(I=>I.id===_.id)){const I=new xt({id:u.id+"--"+d.id+"--"+_.id+"--"+me.ImplementsIncompatibleEntities,message:`Entity "${u.name}" with id "${u.id}" is extending built-in entity "${d.name}" with id "${d.id}" but also extends entity "${_.name}" with id "${_.id}" which is incompatible`,issue:null,severity:S.Error,code:me.ImplementsIncompatibleEntities,entity:u,firstRelationship:d,secondRelationship:_});a.push(I)}}),a}function Rye(u){const d=[];return u.implements.forEach(n=>{if(!n.static){const a=new xt({id:u.id+"--"+n.id+"--"+me.StaticImplementingNonStaticEntity,message:`Entity "${u.name}" with id "${u.id}" is static but implements entity "${n.name}" with id "${n.id}" which is non-static`,issue:null,severity:S.Error,code:me.StaticImplementingNonStaticEntity,entity:u,firstRelationship:n});d.push(a)}}),u.extends.forEach(n=>{if(!n.static){const a=new xt({id:u.id+"--"+n.id+"--"+me.StaticExtendingNonStaticEntity,message:`Entity "${u.name}" with id "${u.id}" is static but extends entity "${n.name}" with id "${n.id}" which is non-static`,issue:null,severity:S.Error,code:me.StaticExtendingNonStaticEntity,entity:u,firstRelationship:n});d.push(a)}}),d}function _ye(u){const d=[];if(u.implements.length){const n=new xt({id:u.id+"--"+me.AbstractEntityImplements,message:`Entity "${u.name}" with id "${u.id}" cannot be marked as abstract because it implements other entities`,issue:null,severity:S.Error,code:me.AbstractEntityImplements,entity:u});d.push(n)}return u.extends.forEach(n=>{if(!n.abstract){const a=new xt({id:u.id+"--"+n.id+"--"+me.AbstractExtendingNonAbstractEntity,message:`Entity "${u.name}" with id "${u.id}" is abstract but extends entity "${n.name}" with id "${n.id}" which is non-abstract`,issue:null,severity:S.Error,code:me.AbstractExtendingNonAbstractEntity,entity:u,firstRelationship:n});d.push(a)}}),d}function Dye(u){const d=[];return u.extends.forEach(n=>{if(n.static){const a=new xt({id:u.id+"--"+n.id+"--"+me.NonStaticExtendingStaticEntity,message:`Entity "${u.name}" with id "${u.id}" is non-static but extends entity "${n.name}" with id "${n.id}" which is static`,issue:null,severity:S.Error,code:me.NonStaticExtendingStaticEntity,entity:u,firstRelationship:n});d.push(a)}}),d}function gye(u){const d=[];return u.extends.forEach(n=>{if(n.abstract){const a=new xt({id:u.id+"--"+n.id+"--"+me.NonAbstractExtendingAbstractEntity,message:`Entity "${u.name}" with id "${u.id}" is non-abstract but extends entity "${n.name}" with id "${n.id}" which is abstract`,issue:null,severity:S.Error,code:me.NonAbstractExtendingAbstractEntity,entity:u,firstRelationship:n});d.push(a)}}),d}const $ye=Object.freeze(Object.defineProperty({__proto__:null,getBaseMethodsNotImplemented:Ij,getBasePropertiesNotImplemented:Aj,validate:bj,validateCanBecomeAbstract:_ye,validateCanBecomeNonAbstract:gye,validateCanBecomeNonStatic:Dye,validateCanBecomeStatic:Rye,validateCanExtendEntity:wye,validateCanImplementEntity:Iye},Symbol.toStringTag,{value:"Module"}));function Oye(u,d){const n=[];if(u.parent)if(u.id===u.parent)n.push(new Y({id:`${u.id}--${u.parent}--${k.SelfReference}`,code:k.SelfReference,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.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 a=d.get(u.parent);a?[f.Project,f.DataType].includes(a.type)||n.push(new Y({id:`${u.id}--${u.parent}--${k.InvalidParentReference}`,code:k.InvalidParentReference,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):n.push(new Y({id:`${u.id}--${u.parent}--${k.ReferencedEntityNotFound}`,code:k.ReferencedEntityNotFound,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.id}", is referencing an entity with id "${u.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return u.implements&&Array.isArray(u.implements)?u.implements.forEach(a=>{if(u.id===a){n.push(new Y({id:`${u.id}--${a}--${k.SelfReference}`,code:k.SelfReference,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.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 l=d.get(a);l?[f.DefinitionEntity,f.BuiltInBaseEntity].includes(l.type)?l.abstract||n.push(new Y({id:`${u.id}--${a}--${k.InvalidImplementsReference}`,code:k.InvalidImplementsReference,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):n.push(new Y({id:`${u.id}--${a}--${k.InvalidImplementsReference}`,code:k.InvalidImplementsReference,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.id}", has an 'implements' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):n.push(new Y({id:`${u.id}--${a}--${k.ReferencedEntityNotFound}`,code:k.ReferencedEntityNotFound,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.id}", is referencing an entity with id "${a}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):n.push(new Y({id:`${u.id}--${le.InvalidObjectStructure}`,code:le.InvalidObjectStructure,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.id}", has an 'implements' property that isn't an array.`,issue:null})),u.extends&&Array.isArray(u.extends)&&u.extends.forEach(a=>{const l=d.get(a);l?[f.DefinitionEntity,f.BuiltInBaseEntity].includes(l.type)?l.abstract&&n.push(new Y({id:`${u.id}--${a}--${k.InvalidExtendsReference}`,code:k.InvalidExtendsReference,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.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})):n.push(new Y({id:`${u.id}--${a}--${k.InvalidExtendsReference}`,code:k.InvalidExtendsReference,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.id}", has an 'extends' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):n.push(new Y({id:`${u.id}--${a}--${k.ReferencedEntityNotFound}`,code:k.ReferencedEntityNotFound,severity:S.Error,message:`Entity of type "${u.type}" with id "${u.id}", is referencing an entity with id "${a}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),n}var Ry=(u=>(u.Extends="extends",u.Implements="implements",u))(Ry||{});const _t=class _t extends nr{constructor(n,a){super(n);g(this,"initialData");g(this,"id");g(this,"name");g(this,"description",null);g(this,"x");g(this,"y");g(this,"static");g(this,"abstract");g(this,"type",f.DefinitionEntity);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"implements",[]);g(this,"project");g(this,"errors",[]);g(this,"parent");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);g(this,"suggestedProperties",[]);g(this,"suggestedMethods",[]);this.initialData=n,this.project=a,this.id=n.id,this.name=n.name,this.description=n.description,this.x=n.x,this.y=n.y,this.static=n.static,this.abstract=n.abstract}static new(n=null){return{id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||N().toISOString(),author:(n==null?void 0:n.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DefinitionEntity,name:"",description:"",static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:null}}static fromGenerationTarget(n,a){let l=a;if(n.parent){const b=W(n.parent);l=a.get(b)}const p=[];n.implements&&n.implements.forEach(b=>{p.push(a.get(b)||a.getBuiltIn(b))});const t=[];n.extends&&n.extends.forEach(b=>{t.push(a.get(b)||a.getBuiltIn(b))});const m={id:n.id,version:P.UUID.uuid(),createdAt:N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:n.name,type:f.DefinitionEntity,description:n.description,static:n.static,abstract:n.abstract,properties:[],methods:[],abstractMethods:[],extends:t,implements:p,x:0,y:0,parent:l},v=z(m,a);return v.setParent(l,null),v}static validateGenerationTarget(n,a){let l=JSON.parse(JSON.stringify(n));const p=[],t=Oye(l,a),m=PT(l,a);p.push(...t,...m,...ur(l));const v=l.parent?a.get(l.parent):null;if(v&&v.type===f.DataType){const b=v;b.entity&&p.push(new Y({id:`${n.id}--${k.NewEntityWouldOverriteExisting}`,code:k.NewEntityWouldOverriteExisting,severity:S.Error,message:`The entity of type '${n.type}' with id '${n.id}' can't be added to the 'parent' entity with id '${b.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
401
401
  You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
402
402
  ${vn({describe_entity:b.entity.id})}
403
- Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:p,modifiedData:l}}get interactive(){return this.implements.length?this.implements.every(n=>n.interactive):!0}get allMethods(){return w([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return w([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allMethods,[]),...this.implements.flatMap(n=>n.allMethods,[])])}get allBasePropertiesFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allProperties,[]),...this.implements.flatMap(n=>n.allProperties,[])])}get allBasePropertiesFromExtendedAndImplementedEntities(){return w([...this.extends.reduce((n,a)=>[...[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract),...n],[]),...this.implements.reduce((n,a)=>[...[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract),...n],[])])}get allBaseMethodsFromExtendedAndImplementedEntities(){return w([...this.extends.reduce((n,a)=>a.type!==f.DefinitionEntity?[]:[...[...a.ownDeclaredMethods,...a.allBaseMethodsFromExtendedAndImplementedEntities].filter(p=>p.type!==f.ActionDescriptor),...n],[]),...this.implements.reduce((n,a)=>a.type!==f.DefinitionEntity?a.abstractMethods:[...[...a.ownDeclaredMethods,...a.allBaseMethodsFromExtendedAndImplementedEntities].filter(p=>p.type!==f.ActionDescriptor),...n],[])])}get extendedPropertiesFromOriginalParents(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...n,...l]},[]))}get implementedPropertiesFromOriginalParents(){return w([...this.extends.reduce((n,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(m=>m.name===t.name));return[...l,...p,...n]},[]),...this.implements.reduce((n,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(m=>m.name===t.name));return[...l,...p,...n]},[])].filter(n=>!!n.abstract))}get extendedMethodsFromOriginalParents(){return w(this.extends.reduce((n,a)=>{if(a.type!==f.DefinitionEntity)return[];const l=[...a.ownDeclaredMethods,...a.extendedMethodsFromOriginalParents].filter(p=>p.type!==f.ActionDescriptor);return[...n,...l]},[]))}get implementedMethodsFromOriginalParents(){return w([...this.extends.reduce((n,a)=>{const l=a.type===f.DefinitionEntity?a.methods:[],p=[...a.abstractMethods].filter(t=>!l.find(m=>m.name===t.name));return[...l,...p,...n]},[]),...this.implements.reduce((n,a)=>[...a.abstractMethods,...n],[])].filter(n=>n.type===f.ActionDescriptor))}get extendedProperties(){return this.properties.filter(n=>n.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(n=>!n.isExtendedProperty)}get extendedMethods(){return this.methods.filter(n=>n.isExtendedMethod)}get ownDeclaredMethods(){return this.methods.filter(n=>!n.isExtendedMethod)}validateGeneratedUpdate(n){const a=[];return n.parent&&a.push(new Y({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:S.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:a,modifiedData:n}}subscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(m=>{const v=m.entity.afterAllChildrenInitialized(n);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),n==null||n.attemptAutoclose("sync-dependents",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}onDetachedDependencyRemoved(n,a,l){const p=[],t=[],m=[],v=[];return a==="implements"&&this.removeImplementation(n),a==="extends"&&this.removeExtension(n),{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}onDetachedDependencyRestored(n,a,l){const p=[],t=[],m=[],v=[];return a==="implements"&&this.addImplementation(n),a==="extends"&&this.addExtension(n),{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}unsubscribeFromDependencies(){return this.implements.forEach(n=>{Pi.includes(n.type)||n.unsubscribeDependents([{entity:this,field:"implements"}])}),this}subscribeToDependencies(){return this.implements.forEach(n=>{Pi.includes(n.type)||n.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(n=>{Pi.includes(n.type)||n.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(n){if(n&&!N(n).isValid())throw new Error(`The shared timestamp '${n}' is not a valid ISO 8601 date string.`);return n&&N(n).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=P.UUID.uuid(),this.createdAt=N(n).toISOString()||N().toISOString(),this)}captureVersion(){var a;const n=((a=this.knownVersions)==null?void 0:a.get(this.version))||new _t(this,this.project);return n.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,n):new Map([[this.version,n]]),n.properties=[...this.properties],n.methods=[...this.methods],n.abstractMethods=[...this.abstractMethods],n.extends=[...this.extends],n.implements=[...this.implements],n.parent=this.parent,this}recursiveCaptureUpstreamVersions(n){const a=[],l=[],p=[],t=[];if(this.parent){this.parent.increaseVersion(n);const m=this.parent.recursiveCaptureUpstreamVersions(n);a.push(this.parent,...m.updated),l.push(...m.added),p.push(...m.removed)}return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}async restoreVersion(n){var v;const a=[],l=[],p=[],t=[];if(this.version===n)return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this};if(!this.knownVersions){const b=new Map;for(const[_,I]of this.knownVersions||new Map){if(b.set(_,I),I.activeVersion=!1,I.knownVersions)for(const[V,B]of I.knownVersions)b.set(V,B);I.knownVersions=null}}let m=(v=this.knownVersions)==null?void 0:v.get(n);if(!m){const b=await this.APILoadVersion({},n);if(!b)throw new Error(`Version with id '${n}' for entity with id '${this.id}' not found.`);m=new _t(b,this.project)}return this.metaSync(m.toShallowJSON(),null),this.previousVersion=m.previousVersion,this.version=m.version,this.createdAt=m.createdAt,this.author=m.author,this.deleted=m.deleted,this.properties=m.properties,this.methods=m.methods,this.abstractMethods=m.abstractMethods,this.extends=m.extends,this.implements=m.implements,this.parent=m.parent,{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}updateWithShallowTransfer(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(n,a),this.version=n.version,this.createdAt=n.createdAt,this.author=n.author,this.deleted=n.deleted,this.previousVersion=n.previousVersion,this.unsubscribeFromDependencies(),n.parent){const l=W(n.parent),p=this.project.get(l),t=this.parent;if(t&&t.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return n.extends.forEach(l=>{const p=W(l),t=this.project.get(p);t&&this.addExtension(t)}),n.implements.forEach(l=>{const p=W(l),t=this.project.get(p);t&&this.addImplementation(t)}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const n=[],a=[],l=[],p=[];if(this.initialData.parent){const t=W(this.initialData.parent),m=this.project.get(t);if(m)this.setParent(m,null),n.push(m);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${t}' 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(t=>{const m=W(t),v=this.project.get(m);v&&(this.addExtension(v),v.type!==f.BuiltInBaseEntity&&n.push(v))}),this.initialData.implements.forEach(t=>{const m=W(t),v=this.project.get(m);v&&(this.addImplementation(v),v.type!==f.BuiltInBaseEntity&&n.push(v))}),{updated:w(n),added:w(a),removed:w(l),affected:w(p),self:this}}afterAllChildrenInitialized(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],l=[],p=[],t=[];this.initialized=!0;const{updated:m,added:v,removed:b,affected:_}=this.syncImplementationProperties(n);a.push(...m),l.push(...v),p.push(...b),t.push(..._);const{updated:I,added:V,removed:B,affected:K}=this.addExtendedProperties(n);a.push(...I),l.push(...V),p.push(...B),t.push(...K);const{updated:q,added:Z,removed:Q}=this.removeUnrecognizedProperties(n);a.push(...q),l.push(...Z),p.push(...Q);const{updated:ue,added:re,removed:_e,affected:X}=this.syncImplementationMethods(n);a.push(...ue),l.push(...re),p.push(..._e),t.push(...X);const{updated:Ee,added:se,removed:de,affected:ye}=this.addExtendedMethods(n);a.push(...Ee),l.push(...se),p.push(...de),t.push(...ye);const{updated:H,added:ce,removed:De}=this.removeUnrecognizedMethods(n);return a.push(...H),l.push(...ce),p.push(...De),this.addSuggestions(),this.captureVersion(),n==null||n.attemptAutoclose("after-all-children-initialized",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addSelfToProject(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-self-to-project"))){const a=[this],l=[],p=[],t=[];if(this.parent.type===f.DataType){const m=this.parent;m.entity=this,a.push(m)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),n==null||n.attemptAutoclose("add-self-to-project",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}setParent(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(n==null?void 0:n.id)&&(this.parent=n,a&&(a==null||a.add(this,G.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}addExtension(n){return this.extends.includes(n)||this.extends.push(n),this}removeExtension(n){return this.extends=this.extends.filter(a=>a.id!==n.id),this}addImplementation(n){return this.implements.includes(n)||this.implements.push(n),this}removeImplementation(n){return this.implements=this.implements.filter(a=>a.id!==n.id),this}removeProperty(n){return this.properties=this.properties.filter(a=>a.id!==n.id),this}addMethod(n){return this.methods.includes(n)||(this.methods.push(n),this.suggestedMethods=this.suggestedMethods.filter(a=>a.name!==n.name)),this}removeMethod(n){return this.methods=this.methods.filter(a=>a.id!==n.id),this}addProperty(n){return this.properties.includes(n)||(this.properties.push(n),this.suggestedProperties=this.suggestedProperties.filter(a=>a.name!==n.name)),this}addSuggestedProperty(n){return this.suggestedProperties.includes(n)||this.suggestedProperties.push(n),this}addSuggestedMethod(n){return this.suggestedMethods.includes(n)||this.suggestedMethods.push(n),this}removeSuggestedProperty(n){return this.suggestedProperties=this.suggestedProperties.filter(a=>a.id!==n.id),this}removeSuggestedMethod(n){return this.suggestedMethods=this.suggestedMethods.filter(a=>a.id!==n.id),this}addAbstractMethod(n){return this.abstractMethods.includes(n)||this.abstractMethods.push(n),this}removeAbstractMethod(n){return this.abstractMethods=this.abstractMethods.filter(a=>a.id!==n.id),this}initChildren(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(n),l}),this.methods=this.initialData.methods.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(n),l}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(n),l}),this.extends=this.initialData.extends.map(a=>z(a,this.project)),this.implements=this.initialData.implements.map(a=>z(a,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(n),n==null||n.attemptAutoclose("init-children",this.id),this)}removeUnrecognizedProperties(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-properties"))){const a=[],l=[],p=[],t=[];let m=[...this.properties];m=m.filter(b=>b.parent.id===this.id),m=m.filter(b=>!b.isExtendedProperty);const v=this.implementedPropertiesFromOriginalParents;return m=m.filter(b=>this.interactive&&!b.implements?!1:!v.find(_=>{var I;return _.id===((I=b.implements)==null?void 0:I.id)})),m.forEach(b=>{const _=b.remove({ignoreUpstream:!1},n);p.push(..._.removed),a.push(..._.updated)}),n==null||n.attemptAutoclose("remove-unrecognized-properties",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}removeUnrecognizedMethods(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-methods"))){const a=[],l=[],p=[],t=[];let m=[...this.methods];m=m.filter(b=>b.parent.id===this.id),m=m.filter(b=>!b.isExtendedMethod);const v=this.implementedMethodsFromOriginalParents;return m=m.filter(b=>this.interactive&&!b.implements?!1:!v.find(_=>{var I;return _.id===((I=b.implements)==null?void 0:I.id)})),m.forEach(b=>{const _=b.remove({ignoreUpstream:!1},n);p.push(..._.removed),a.push(..._.updated)}),n==null||n.attemptAutoclose("remove-unrecognized-methods",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}syncImplementationMethods(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-implementation-methods"))){const a=[],l=[],p=[],t=[],m=this.methods,v=this.implementedMethodsFromOriginalParents,b=[...this.allBaseMethodsFromExtendedAndImplementedEntities,...m];return v.filter(I=>!b.find(B=>{var K;return((K=B.implements)==null?void 0:K.id)===I.id})).forEach(I=>{if(this.methods.find(q=>{var Z;return((Z=q.implements)==null?void 0:Z.id)===I.id}))return;const B=this.methods.find(q=>{var _e,X;if(q.name===I.name&&!q.implements)return!0;const Z=As(this,Oe.CRON_JOB),Q=As(this,Oe.HTTP_ENDPOINT),ue=((_e=q.implements)==null?void 0:_e.id)===fe["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id,re=((X=q.implements)==null?void 0:X.id)===fe["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.methods.handler.id;return!!(Z&&!re&&!Q&&ue||Q&&!ue&&!Z&&re)});if(B&&B.type===f.FunctionDeclaration){B.setImplements(I),B.metaSync({name:I.name},n),n==null||n.add(B,G.Updated),n==null||n.add(this,G.Updated);return}const K=I.implementAsFunctionDeclaration(n,this);l.push(K),n==null||n.add(K,G.Added),this.addMethod(K)}),n==null||n.attemptAutoclose("sync-implementation-methods",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}syncImplementationProperties(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-implementation-properties"))){const a=[],l=[],p=[],t=[],m=this.properties,v=this.implementedPropertiesFromOriginalParents,b=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...m];return v.filter(I=>!b.find(B=>{var K;return((K=B.implements)==null?void 0:K.id)===I.id})).forEach(I=>{if(this.properties.find(q=>{var Z;return((Z=q.implements)==null?void 0:Z.id)===I.id}))return;const B=this.properties.find(q=>q.name===I.name&&!!q.abstract&&!q.implements);if(B){B.setImplements(I,n),B.metaSync({abstract:!1},n),B.afterAllChildrenInitialized(n);return}const K=I.implement(this,n,P.UUID.uuid());l.push(K),n==null||n.add(K,G.Added)}),n==null||n.attemptAutoclose("sync-implementation-properties",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addExtendedMethods(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-extended-methods"))){const a=[],l=[],p=[],t=[],m=this.methods,b=this.extendedMethodsFromOriginalParents.filter(I=>I.type===f.FunctionDeclaration),_=new Set(m.filter(I=>{var V;return!!((V=I.extends)!=null&&V.id)}).map(I=>I.extends.id));return b.forEach(I=>{if(_.has(I.id))return;_.add(I.id);const V=I.clone(n,this,P.UUID.uuid());V.setExtends(I,n),V.initChildren(n),l.push(V),n==null||n.add(V,G.Added),this.addMethod(V)}),n==null||n.attemptAutoclose("add-extended-methods",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addExtendedProperties(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-extended-properties"))){const a=[],l=[],p=[],t=[],m=this.properties,v=this.extendedPropertiesFromOriginalParents,b=v.filter(I=>v.find(B=>{var K;return((K=B.implements)==null?void 0:K.id)===I.id})?!1:!I.abstract),_=new Set(m.filter(I=>{var V;return!!((V=I.extends)!=null&&V.id)}).map(I=>I.extends.id));return b.forEach(I=>{if(_.has(I.id))return;_.add(I.id);const V=I.clone(n,this,P.UUID.uuid());V.setExtends(I,n),V.initChildren(n),l.push(V),n==null||n.add(V,G.Added),this.addProperty(V)}),n==null||n.attemptAutoclose("add-extended-properties",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addSuggestions(){return this.implements.forEach(n=>{Aj(this,n).forEach(p=>{const t=p.toJSON();t.id=`_suggestion--parent--${this.id}--${p.id}`;const m=z(t,this.project);m.suggestion=!0,m.setParent(this,null),m.initChildren(null),this.addSuggestedProperty(m)}),Ij(this,n).forEach(p=>{const t=`_suggestion--parent--${this.id}--${p.id}`,m=p.implementAsFunctionDeclaration(null,this,t),v=z(m,this.project);if(v.suggestion=!0,v.setParent(this,null),v.initChildren(null),this.methods=this.methods.filter(b=>b.id!==t),v.inputs.forEach(b=>{b.suggestion=!0}),v.returnStatements.length){const b=v.returnStatements[0];b.suggestion=!0,b.outputs.forEach(_=>{_.suggestion=!0})}this.addSuggestedMethod(v)})}),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=cr(this,n),p=this.toMeta();return this.name=n.name!==void 0?n.name:p.name,this.description=n.description!==void 0?n.description:p.description,this.x=n.x||p.x,this.y=n.y||p.y,this.static=n.static!==void 0?n.static:this.static,this.abstract=n.abstract!==void 0?n.abstract:this.abstract,super.metaSync(n),n.deleted===!0&&!p.deleted?a==null||a.add(this,G.Removed):n.deleted===!1&&p.deleted?a==null||a.add(this,G.Added):l&&(a==null||a.add(this,G.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(n=oe,...a){return await _t.repository.APILoad(this.id,...a),this}async APICreate(n=oe,...a){return await _t.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(n=oe,...a){return await _t.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(n=oe,...a){return await _t.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(n=oe,...a){return await _t.repository.APIClone(this.id,...a),this}async APILoadVersion(n=oe,a,...l){return await _t.repository.APILoadVersion(this.id,a,...l)}removeFromParent(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-from-parent"))){const a=[],l=[],p=[],t=[];if(this.parent.type===f.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===f.DataType&&this.parent.entity&&this.parent.entity.id===this.id){const m=this.parent.setEntity(null,n);a.push(m)}return n==null||n.attemptAutoclose("remove-from-parent",this.id),{added:w(p),updated:w(a),removed:w(l),affected:w(t),self:this}}remove({ignoreUpstream:n}={ignoreUpstream:!1},a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){const l=[],p=[],t=[],m=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:b,removed:_,added:I}=v.entity.onDetachedDependencyRemoved(this,v.field,a);l.push(...b),p.push(..._),t.push(...I)}),this.properties.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),this.methods.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),this.abstractMethods.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),this.suggestedProperties.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),this.suggestedMethods.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),!n){const v=this.removeFromParent(a);t.push(...v.added),l.push(...v.updated),p.push(...v.removed),m.push(...v.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:w(t),updated:w(l),removed:w(p),affected:w(m),self:this}}restore({}={},n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"restore-entity"))){const a=[],l=[],p=[],t=[];return n!=null&&n.hasAdded(this.id)?(n==null||n.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},n),Object.values(this.detachedDependents).forEach(m=>{const{updated:v,removed:b,added:_}=m.entity.onDetachedDependencyRestored(this,m.field,n);l.push(...v),p.push(...b),a.push(..._)}),this.properties.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.methods.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.abstractMethods.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.suggestedProperties.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.suggestedMethods.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),n==null||n.attemptAutoclose("restore-entity",this.id),{added:w(a),updated:w(l),removed:w(p),affected:w(t),self:this})}toFlat(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this,...this.extends.flatMap(l=>l.toFlat(n)),...this.implements.flatMap(l=>l.toFlat(n)),...this.properties.flatMap(l=>l.toFlat(n)),...this.methods.flatMap(l=>l.toFlat(n)),...this.abstractMethods.flatMap(l=>l.toFlat(n)),...this.parent.toFlat(n)])}toFlatIds(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.id,...this.extends.flatMap(l=>l.toFlatIds(n)),...this.implements.flatMap(l=>l.toFlatIds(n)),...this.properties.flatMap(l=>l.toFlatIds(n)),...this.methods.flatMap(l=>l.toFlatIds(n)),...this.abstractMethods.flatMap(l=>l.toFlatIds(n)),...this.parent.toFlatIds(n)])}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(n=new Set){return n.has(this.id)?this.toReference():(n.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(a=>a.toJSON(n)),methods:this.methods.map(a=>a.toJSON(n)),abstractMethods:this.abstractMethods.map(a=>a.toJSON(n)),implements:this.implements.map(a=>a.toJSON(n)),extends:this.extends.map(a=>a.toJSON(n)),parent:this.parent.toReference()})}toJSONClone(n=Ce){var l,p,t,m,v;let a;return(l=n.seenEntityMaps)!=null&&l.has(this.id)?a=n.seenEntityMaps.get(this.id):(a=n.newId||hr(this,this.project,n.uuidStrategy),n.seenEntityMaps&&n.seenEntityMaps.set(this.id,a)),(p=n.seenEntities)!=null&&p.has(a)||(t=n.seenEntities)!=null&&t.has(this.id)?this.toReference({seenEntityMaps:n.seenEntityMaps}):((m=n.seenEntities)==null||m.add(a),(v=n.seenEntities)==null||v.add(this.id),{id:a,version:P.UUID.uuid(),createdAt:n.timestamp||N().toISOString(),author:P.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(b=>b.toJSONClone({...n,newId:null})),methods:this.methods.map(b=>b.toJSONClone({...n,newId:null})),abstractMethods:this.abstractMethods.map(b=>b.toJSONClone({...n,newId:null})),implements:this.implements.map(b=>b.type===f.BuiltInBaseEntity?b.toJSON():b.toJSONClone({...n,newId:null})),extends:this.extends.map(b=>b.type===f.BuiltInBaseEntity?b.toJSON():b.toJSONClone({...n,newId:null})),parent:this.parent.toReference({seenEntityMaps:n.seenEntityMaps})})}toReference(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a,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(p=>p.toReference(n)),methods:this.methods.map(p=>p.toReference(n)),abstractMethods:this.abstractMethods.map(p=>p.toReference(n)),implements:this.implements.map(p=>p.toReference(n)),extends:this.extends.map(p=>p.toReference(n)),parent:this.parent.toReference(n)}}toFlatJSON(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(l=>l.toFlatJSON(n)),...this.methods.flatMap(l=>l.toFlatJSON(n)),...this.abstractMethods.flatMap(l=>l.toFlatJSON(n)),...this.implements.flatMap(l=>l.toFlatJSON(n)),...this.extends.flatMap(l=>l.toFlatJSON(n)),...this.parent.toFlatJSON(n)])}toGenerationTarget(){const n=this.parent.type===f.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(a=>a.id),implements:this.implements.map(a=>a.id),parent:n}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(l=>l.toFlatGenerationTarget(n)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(n)),...this.abstractMethods.flatMap(l=>l.toFlatGenerationTarget(n)),...this.implements.filter(l=>l.type===f.DefinitionEntity).flatMap(l=>l.toFlatGenerationTarget(n)),...this.implements.filter(l=>l.type===f.DefinitionEntity).flatMap(l=>l.toFlatGenerationTarget(n)),...this.parent.toFlatGenerationTarget(n)])}clearErrors(){return this.errors=[],this.properties.forEach(n=>n.clearErrors()),this.methods.forEach(n=>n.clearErrors()),this.abstractMethods.forEach(n=>n.clearErrors()),this}validate(){return this.errors=bj(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(a=>a.getErrors()),...this.methods.flatMap(a=>a.getErrors()),...this.abstractMethods.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}clone(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"clone-entity")),a=null,l=null,p=!0){var q,Z,Q;let t=yr(a,this);const m=this.toJSON(),v=l||P.UUID.uuid();m.properties=[],m.methods=[],m.abstractMethods=[];const b=v.split("-id"),_=b[b.length-1||0]||v;m.id=v,m.version=P.UUID.uuid(),m.createdAt=(n==null?void 0:n.timestamp)||N().toISOString(),m.author=(n==null?void 0:n.author)||"1",m.previousVersion=null,m.deleted=!1;const I=er(m,t);a&&I.setParent(a,null),p&&I.subscribe(),I.initChildren(n),n==null||n.add(I,G.Added);const V=(q=this.properties)==null?void 0:q.map(ue=>ue.clone(n,I,P.UUID.uuid(),p));I.properties=V;const B=(Z=this.methods)==null?void 0:Z.map((ue,re)=>ue.clone(n,I,_+"-method-"+re+"-id",p));I.methods=B;const K=(Q=this.abstractMethods)==null?void 0:Q.map((ue,re)=>ue.clone(n,I,_+"-abstract-method-"+re+"-id",p));return I.abstractMethods=K,n==null||n.attemptAutoclose("clone-entity",this.id),I}getFunctionDeclaration(n){return this.methods.find(a=>a.id===n)}implement(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"implement-definition-entity")),l){const p=hy(this,n,a,l);return a==null||a.attemptAutoclose("implement-definition-entity",this.id),p}getAllInteractiveMethods(){const n=this.implements.filter(l=>l.type===f.DefinitionEntity||l.type===f.BuiltInBaseEntity&&l.interactive);return w([...this.methods,...this.extends.flatMap(l=>l.getAllInteractiveMethods()),...n.flatMap(l=>l.getAllInteractiveMethods())])}inferFromInputs(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const l=[],p=[],t=[],m=[];if(this.parent.type!==f.DataType||!this.parent.inferred)return a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const v=[];n.forEach(I=>{v.find(B=>pe(B,this.project)===pe(I,this.project))||v.push(I)});const b=this.properties.filter(I=>!I.dataType);v.forEach(I=>{var Q,ue;const V=b.find(re=>pe(re,this.project)===pe(I,this.project));if(!V)return;const K=Mo(I.parent).getMasterInputWithValueWritterFromAllInstances(I),q=xs(K,a),Z=q==null?void 0:q.clone(a,V,P.UUID.uuid(),!0);Z&&((Q=V.dataType)==null||Q.merge(Z,a),Z.id!==((ue=V.dataType)==null?void 0:ue.id)&&Z.remove({ignoreUpstream:!1},a),V.dataType&&(V.dataType.metaSync({inferred:!0,like:!0},a),V.setDataType(V.dataType,a),a==null||a.add(V,G.Affected))),I.setDeclaration(V),a==null||a.add(I,G.Updated)});const _=[];return v.forEach(I=>{if(!I.declaration){_.push(I);return}}),_.length===0?(a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(_.forEach(I=>{var re,_e,X,Ee;const V=this.properties.find(se=>pe(se,this.project)===pe(I,this.project));if(V){if(I.setDeclaration(V),!V.getDataType(a)){const de=Mo(I.parent).getMasterInputWithValueWritterFromAllInstances(I),ye=xs(de),H=ye==null?void 0:ye.clone(a,V,P.UUID.uuid(),!0);H&&((re=V.dataType)==null||re.merge(H,a),H.id!==((_e=V.dataType)==null?void 0:_e.id)&&H.remove({ignoreUpstream:!1},a),V.dataType&&(V.dataType.metaSync({inferred:!0,like:!0},a),V.setDataType(V.dataType,a),a==null||a.add(V,G.Affected)))}return}const B={id:P.UUID.uuid(),type:f.Property,version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:pe(I,this.project),description:I.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:I.index,implements:null,extends:null,dataType:null,parent:this.toReference()},K=z(B,this.project);K.setParent(this,a),K.initChildren(a),a==null||a.add(K,G.Added);const Z=Mo(I.parent).getMasterInputWithValueWritterFromAllInstances(I),Q=xs(Z),ue=Q==null?void 0:Q.clone(a,K,P.UUID.uuid(),!0);return ue&&((X=K.dataType)==null||X.merge(ue,a),ue.id!==((Ee=K.dataType)==null?void 0:Ee.id)&&ue.remove({ignoreUpstream:!1},a),K.dataType&&(K.dataType.metaSync({inferred:!0,like:!0},a),K.setDataType(K.dataType,a),a==null||a.add(K,G.Affected))),this.addProperty(K),I.setDeclaration(K),a==null||a.add(I,G.Updated),K}),a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:w(l),updated:w(p),removed:w(t),affected:w(m),self:this})}getRawDefaultValue(){const n={};return this.properties.forEach(a=>{var p;const l=Ra(a.name);n[l]=((p=a.getDefaultValue())==null?void 0:p.value)||null}),n}getActiveRawDefaultValue(){const n={};return this.properties.forEach(a=>{const l=Ra(a.name),p=this.project.requestActiveValue(a);n[l]=(p==null?void 0:p.value)||null}),n}};g(_t,"repository",{APICreate:async(n,...a)=>n,APIUpdate:async(n,...a)=>n,APIDelete:async(n,...a)=>n,APIClone:async(n,...a)=>{},APILoad:async(n,...a)=>null,APILoadVersion:async(n,a,...l)=>null}),g(_t,"type",f.DefinitionEntity),g(_t,"USER_MANAGED_PARENT_TYPES",[f.Project,f.DataType]),g(_t,"PARENT_TYPES",[..._t.USER_MANAGED_PARENT_TYPES]),g(_t,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),g(_t,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(_t,"BASE_PROPERTIES",[..._t.MUTABLE_BASE_PROPERTIES,..._t.INMUTABLE_BASE_PROPERTIES]),g(_t,"MUTABLE_META_PROPERTIES",[..._t.MUTABLE_BASE_PROPERTIES,"x","y"]),g(_t,"INMUTABLE_META_PROPERTIES",[..._t.INMUTABLE_BASE_PROPERTIES]),g(_t,"META_PROPERTIES",[..._t.MUTABLE_META_PROPERTIES,..._t.INMUTABLE_META_PROPERTIES]),g(_t,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),g(_t,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),g(_t,"UPSTREAM_PROPERTIES",[..._t.MUTABLE_UPSTREAM_PROPERTIES,..._t.INMUTABLE_UPSTREAM_PROPERTIES]),g(_t,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),g(_t,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(_t,"DOWNSTREAM_PROPERTIES",[..._t.MUTABLE_DOWNSTREAM_PROPERTIES,..._t.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(_t,"PROPERTIES",[..._t.META_PROPERTIES,..._t.UPSTREAM_PROPERTIES,..._t.DOWNSTREAM_PROPERTIES]);let ia=_t;function Cye(u){const d=Boe(),n=u.toJSON();d.safeParse(n).success;const l=[];return qt(u.errors,l)}const fp=class fp extends nr{constructor(n,a){super(n);g(this,"initialData");g(this,"id");g(this,"version");g(this,"name");g(this,"description",null);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",!1);g(this,"static");g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"interactive",!1);g(this,"errors",[]);g(this,"project");this.initialData=this.initialData||n,this.project=this.project||a,this.id=this.id||n.id,this.version=this.version||n.version,this.name=this.name||n.name,this.static=this.static||n.static,this.interactive=this.interactive||n.interactive,this.abstract=n.abstract,this.properties=this.initialData.properties.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.extends=this.initialData.extends.map(l=>z(l,this.project))}get allMethods(){return w([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return w([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allMethods,[])])}get allBasePropertiesFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allProperties,[])])}get allBasePropertiesFromExtendedAndImplementedEntities(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...n,...l]},[]))}get extendedPropertiesFromOriginalParents(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...n,...l]},[]))}get implementedPropertiesFromOriginalParents(){return w([...this.extends.reduce((n,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(m=>m.name===t.name));return[...l,...p,...n]},[])])}get extendedProperties(){return this.properties.filter(n=>n.isExtendedProperty)}get ownDeclaredMethods(){return this.methods.filter(n=>!n.isExtendedMethod)}get ownDeclaredProperties(){return this.properties.filter(n=>!n.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(n=oe,...a){return await fp.repository.APILoad(this.id,...a),this}toFlat(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this,...this.properties.flatMap(l=>l.toFlat(n)),...this.methods.flatMap(l=>l.toFlat(n)),...this.abstractMethods.flatMap(l=>l.toFlat(n)),...this.extends.flatMap(l=>l.toFlat(n))])}toFlatIds(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.id,...this.properties.flatMap(l=>l.toFlatIds(n)),...this.methods.flatMap(l=>l.toFlatIds(n)),...this.abstractMethods.flatMap(l=>l.toFlatIds(n)),...this.extends.flatMap(l=>l.toFlatIds(n))])}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(n=new Set){return n.has(this.id)?this.toReference():(n.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(a=>a.toJSON(n)),methods:this.methods.map(a=>a.toJSON(n)),abstractMethods:this.abstractMethods.map(a=>a.toJSON(n)),extends:this.extends.map(a=>a.toJSON(n))})}toReference(n=Ce){return{id:this.id+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){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(a=>a.toReference()),methods:this.methods.map(a=>a.toReference()),abstractMethods:this.abstractMethods.map(a=>a.toReference()),extends:this.extends.map(a=>a.toReference())}}toFlatJSON(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(l=>l.toFlatJSON(n)),...this.methods.flatMap(l=>l.toFlatJSON(n)),...this.abstractMethods.flatMap(l=>l.toFlatJSON(n))])}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(n=>n.id)}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(l=>l.toFlatGenerationTarget(n)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(n)),...this.abstractMethods.flatMap(l=>l.toFlatGenerationTarget(n))])}clearErrors(){return this.errors=[],this.properties.forEach(n=>n.clearErrors()),this.methods.forEach(n=>n.clearErrors()),this.abstractMethods.forEach(n=>n.clearErrors()),this}validate(){const n=Cye(this);return this.errors=n,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(a=>a.getErrors()),...this.methods.flatMap(a=>a.getErrors()),...this.abstractMethods.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}implement(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),null,!0,"implement-built-in-base-entity")),l){const p=hy(this,n,a,l);return a==null||a.attemptAutoclose("implement-built-in-base-entity",this.id),p}getAllInteractiveMethods(){const n=[];return this.interactive&&(n.push(...this.methods),this.extends.filter(l=>l.type===f.BuiltInBaseEntity&&l.interactive||l.type===f.PrimitiveEntity).forEach(l=>{l instanceof fp&&n.push(...l.getAllInteractiveMethods())})),w(n)}};g(fp,"repository",{APILoad:async(n,...a)=>null});let En=fp;function Pye(u){const d=goe(),n=u.toJSON();d.safeParse(n).success;const l=[];return qt(u.errors,l)}const $y=class $y extends nr{constructor(n,a){super(n);g(this,"initialData");g(this,"id");g(this,"name");g(this,"description",null);g(this,"type",f.PrimitiveEntity);g(this,"static");g(this,"abstract");g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=n,this.project=a,this.id=n.id,this.name=n.name,this.static=n.static,this.abstract=n.abstract,this.properties=this.initialData.properties.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=z(l,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=z(l,this.project);return p.parent=this,p})}get allMethods(){return w([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return w([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allMethods,[])])}get allBasePropertiesFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allProperties,[])])}get allBasePropertiesFromExtendedAndImplementedEntities(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...n,...l]},[]))}get extendedPropertiesFromOriginalParents(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...n,...l]},[]))}get implementedPropertiesFromOriginalParents(){return w([...this.extends.reduce((n,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(m=>m.name===t.name));return[...l,...p,...n]},[])])}get extendedProperties(){return this.properties.filter(n=>n.isExtendedProperty)}get ownDeclaredMethods(){return this.methods.filter(n=>!n.isExtendedMethod)}get ownDeclaredProperties(){return this.properties.filter(n=>!n.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(n=oe,...a){return await $y.repository.APILoad(this.id,...a),this}toFlat(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this,...this.properties.flatMap(l=>l.toFlat(n)),...this.methods.flatMap(l=>l.toFlat(n)),...this.abstractMethods.flatMap(l=>l.toFlat(n))])}toFlatIds(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.id,...this.properties.flatMap(l=>l.toFlatIds(n)),...this.methods.flatMap(l=>l.toFlatIds(n)),...this.abstractMethods.flatMap(l=>l.toFlatIds(n))])}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(n=new Set){return n.has(this.id)?this.toReference():(n.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(a=>a.toJSON(n)),methods:this.methods.map(a=>a.toJSON(n)),abstractMethods:this.abstractMethods.map(a=>a.toJSON(n)),extends:this.extends.map(a=>a.toJSON(n))})}toReference(n=Ce){return{id:this.id+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){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(a=>a.toReference()),methods:this.methods.map(a=>a.toReference()),abstractMethods:this.abstractMethods.map(a=>a.toReference()),extends:this.extends.map(a=>a.toReference())}}toFlatJSON(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(l=>l.toFlatJSON(n)),...this.methods.flatMap(l=>l.toFlatJSON(n)),...this.abstractMethods.flatMap(l=>l.toFlatJSON(n))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(n=>n.id)}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(l=>l.toFlatGenerationTarget(n)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(n)),...this.abstractMethods.flatMap(l=>l.toFlatGenerationTarget(n))])}clearErrors(){return this.errors=[],this.properties.forEach(n=>n.clearErrors()),this.methods.forEach(n=>n.clearErrors()),this.abstractMethods.forEach(n=>n.clearErrors()),this}validate(){const n=Pye(this);return this.errors=n,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(a=>a.getErrors()),...this.methods.flatMap(a=>a.getErrors()),...this.abstractMethods.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const n=[];return n.push(...this.methods),this.extends.filter(l=>l.type===f.BuiltInBaseEntity&&l.interactive||l.type===f.PrimitiveEntity).forEach(l=>{l instanceof En&&n.push(...l.getAllInteractiveMethods())}),w(n)}};g($y,"repository",{APILoad:async(n,...a)=>null});let Ri=$y;function er(u,d){if(!u)throw new Error("Entity is null");const n=d.get(u.id);switch(u.type){case f.LiteralValue:return n||new Fs(u,d);case f.DefinitionEntity:return n||new ia(u,d);case f.PrimitiveEntity:return n||new Ri(u,d);case f.FunctionDeclaration:return n||new _a(u,d);case f.GlobalEvent:return n||new $a(u,d);case f.DataType:return n||new ji(u,d);case f.Property:return n||new Xn(u,d);case f.FunctionCall:return n||new Fa(u,d);case f.Condition:return n||new Ca(u,d);case f.Operation:return n||new Da(u,d);case f.VariableDeclaration:return n||new Va(u,d);case f.VariableInstance:return n||new Pa(u,d);case f.OutputMap:return n||new Ks(u,d);case f.ReturnDeclaration:return n||new wi(u,d);case f.ArgumentDeclaration:return n||new ea(u,d);case f.InputMap:return n||new Es(u,d);case f.Project:return n||new P(u);case f.InstalledProject:return n||new La(u,d);case f.ActionDescriptor:return n||new Lt(u,d);case f.ReturnStatement:return n||new ga(u,d);case f.Loop:return n||new Oa(u,d);case f.Search:return n||new Na(u,d);case f.ValueDescriptor:return n||new ks(u,d);case f.BuiltInBaseEntity:return n||new En(u,d);case f.InternalCall:return n||new Ma(u,d);case f.ContinueStatement:return n||new Qr(u,d);case f.BreakStatement:return n||new Ba(u,d);case f.GenericReference:return d.get(u.entityId);default:throw new Error("Invalid entity type: "+u.type)}}function z(u,d){if(!u)throw new Error("Entity is null");const n=er(u,d);return n.subscribe(),n}function Vye(u,d){if(!u)throw new Error("Entity is null");switch(u.type){case f.LiteralValue:return Fs.fromGenerationTarget(u,d);case f.DefinitionEntity:return ia.fromGenerationTarget(u,d);case f.FunctionDeclaration:return _a.fromGenerationTarget(u,d);case f.GlobalEvent:return $a.fromGenerationTarget(u,d);case f.DataType:return ji.fromGenerationTarget(u,d);case f.Property:return Xn.fromGenerationTarget(u,d);case f.FunctionCall:return Fa.fromGenerationTarget(u,d);case f.Condition:return Ca.fromGenerationTarget(u,d);case f.Operation:return Da.fromGenerationTarget(u,d);case f.VariableDeclaration:return Va.fromGenerationTarget(u,d);case f.VariableInstance:return Pa.fromGenerationTarget(u,d);case f.OutputMap:return Ks.fromGenerationTarget(u,d);case f.ReturnDeclaration:return wi.fromGenerationTarget(u,d);case f.ArgumentDeclaration:return ea.fromGenerationTarget(u,d);case f.InputMap:return Es.fromGenerationTarget(u,d);case f.InstalledProject:return La.fromGenerationTarget(u,d);case f.ReturnStatement:return ga.fromGenerationTarget(u,d);case f.Loop:return Oa.fromGenerationTarget(u,d);case f.Search:return Na.fromGenerationTarget(u,d);case f.ActionDescriptor:return Lt.fromGenerationTarget(u,d);case f.ValueDescriptor:return ks.fromGenerationTarget(u,d);case f.InternalCall:return Ma.fromGenerationTarget(u,d);case f.ContinueStatement:return Qr.fromGenerationTarget(u,d);case f.BreakStatement:return Ba.fromGenerationTarget(u,d);default:throw new Error("Invalid entity type: "+u.type)}}const Ce={seenEntityMaps:new Map,seenEntities:new Set,timestamp:N().toISOString()};class wj{constructor(){g(this,"initialData")}}const oe={cascade:!1},Rj={APILoad:async(u,...d)=>null},Nye={APICreate:async(u,...d)=>u,APIUpdate:async(u,...d)=>u,APIDelete:async(u,...d)=>u,APIClone:async(u,...d)=>{},APILoadVersion:async(u,d,...n)=>null,...Rj};class Lye{}class Mye extends wj{}class Bye{}class Uye{}class jye{}class Lb{}class xye extends Lb{}class Fye extends Lb{}class Gye{}class up{static initReadsValue(d){if(d.initialData.readsValue&&d.initialData.readsValue.type!==f.GenericReference)d.readsValue=z(d.initialData.readsValue,d.project);else if(d.initialData.readsValue&&d.initialData.readsValue.type===f.GenericReference){const n=ss(d.initialData.readsValue,d.project);n&&(d.readsValue=n)}if(d.readsValue){if(lr.includes(d.readsValue.type)){let n=d.parent;br.includes(n.type)||(n=n.parent);const a=d.type===f.InputMap&&d.parent.type===f.Loop;a&&(n=d.parent.parent),d.readsValue.setParent(n,null),d.readsValue.initChildren(null),n&&n.type!==f.Project&&!a&&n.detachedChildren.includes(d)?n.replaceDetachedChild(d,d.readsValue):n&&n.type!==f.Project&&!a&&n.subscribeDetachedChild(d.readsValue)}d.readsValue.addValueReader(d,null)}return d.readsValue}}class cp{static initWritesValues(d,n){const a=d.initialData.writesValues.reduce((p,t)=>{if(t.type===f.GenericReference||d.writesValues.some(v=>v.id===t.id))return p;const m=z(t,d.project);return m.setValueWriter(d,null),lr.includes(m.type)&&(m.setParent(n,null),m.initChildren(null)),[...p,m]},[]),l=[...d.writesValues];return d.writesValues=w([...l,...a]),d.writesValues}}class Kye{}class kye{constructor(d){g(this,"eventName");g(this,"callbacks",[]);this.eventName=d}on(d){if(typeof d!="function")throw new Error("Event callback must be a function");this.callbacks.includes(d)||this.callbacks.push(d)}off(d){if(typeof d!="function")throw new Error("Event callback must be a function");this.callbacks=this.callbacks.filter(n=>n!==d)}destroy(){this.callbacks=[]}}class Mb{constructor(){g(this,"subscribedEvents",{});g(this,"on",this._on);g(this,"emit",this._emit);g(this,"off",this._off);g(this,"destroy",this._destroy)}getEvent(d){return this.subscribedEvents[d]||(this.subscribedEvents[d]=new kye(d)),this.subscribedEvents[d]}_on(d,n){this.getEvent(d).on(n)}_emit(d,...n){const a=this.getEvent(d);a&&a.callbacks.forEach(l=>{l.apply(null,n)})}_off(d,n){const a=this.getEvent(d);a&&(n?a.off(n):(a.destroy(),delete this.subscribedEvents[d]))}_destroy(){Object.keys(this.subscribedEvents).forEach(d=>{this._off(d)}),this.subscribedEvents={}}}var ar=(u=>(u.PROJECT_INITIALIZED="project-initialized",u.CHANGE_SET_CLOSED="change-set-closed",u.EXPLICIT_DEFINITION_ENTITY_ADDED="explicit-definition-entity-added",u.EXPLICIT_DEFINITION_ENTITY_REMOVED="explicit-definition-entity-removed",u.EXPLICIT_DEFINITION_ENTITY_UPDATED="explicit-definition-entity-updated",u.PERSISTED_DEFINITION_ENTITY_ADDED="persisted-definition-entity-added",u.PERSISTED_DEFINITION_ENTITY_REMOVED="persisted-definition-entity-removed",u.PERSISTED_DEFINITION_ENTITY_UPDATED="persisted-definition-entity-updated",u.RELATIONAL_DATABASE_DEFINITION_ENTITY_ADDED="relational-database-definition-entity-added",u.RELATIONAL_DATABASE_DEFINITION_ENTITY_REMOVED="relational-database-definition-entity-removed",u.RELATIONAL_DATABASE_DEFINITION_ENTITY_UPDATED="relational-database-definition-entity-updated",u))(ar||{});function qye(u,d){d.forEach(n=>{Object.getOwnPropertyNames(n.prototype).forEach(a=>{a!=="constructor"&&Object.defineProperty(u.prototype,a,Object.getOwnPropertyDescriptor(n.prototype,a))})})}class _j extends nr{constructor(...d){super(...d),Object.assign(this,new Mb)}}qye(_j,[Mb]);const Fe=class Fe extends _j{constructor(n){super(n);g(this,"initialData");g(this,"id");g(this,"type",f.Project);g(this,"name",null);g(this,"description",null);g(this,"x");g(this,"y");g(this,"entities",[]);g(this,"projects",[]);g(this,"functions",[]);g(this,"events",[]);g(this,"variableDeclarations",[]);g(this,"variableInstances",[]);g(this,"conditions",[]);g(this,"operations",[]);g(this,"functionCalls",[]);g(this,"loops",[]);g(this,"searches",[]);g(this,"primitives",[]);g(this,"builtInBaseEntities",[]);g(this,"operationDeclarations",[]);g(this,"globalEventActionDescriptors",[]);g(this,"loopDeclarations",[]);g(this,"loopDeclarationsBodies",[]);g(this,"conditionDeclarations",[]);g(this,"valueDescriptors",[]);g(this,"dataTypes",[]);g(this,"project");g(this,"instances",{});g(this,"builtInInstances",{});g(this,"deletedInstances",{});g(this,"errors",[]);g(this,"references",[]);g(this,"history",[]);g(this,"undoableStackValueIndex",-1);g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);g(this,"onCloseChangeSetCallback",null);g(this,"onAddChangeSetCallback",null);g(this,"onDiscardChangeSetCallback",null);g(this,"onRequestActiveValueCallback",null);this.initialData=n,this.id=n.id,this.name=n.name,this.description=n.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!Fe.UUID||Fe.UUID.isBackup)&&(Fe.UUID=eh==null?void 0:eh()),Fe.UUID||(Fe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:a=>a})}catch(a){console.error("Error initializing UUID module",a),Fe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:l=>l}}}static injectUUIDModule(n){Fe.UUID=n}static new(n=null){return{id:Fe.UUID.uuid(),version:Fe.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||N().toISOString(),author:(n==null?void 0:n.author)||Fe.sessionAuthor,previousVersion:null,deleted:!1,type:f.Project,name:"",description:"",entities:[],functions:[],events:[],projects:[],variableDeclarations:[],variableInstances:[],conditions:[],operations:[],functionCalls:[],loops:[],searches:[]}}static validateGenerationTarget(n,a){let l=JSON.parse(JSON.stringify(n));const p=[];return p.push(...ur(l)),{errors:p,modifiedData:l}}async closePendingChangeSets(){const n=this.history.find(a=>a.dirty&&!a.open);n&&await this.closeChangeSet(n)}onRequestActiveValue(n){this.onRequestActiveValueCallback=n}async onCloseChangeSet(n){this.onCloseChangeSetCallback=n,await this.closePendingChangeSets()}onAddChangeSet(n){this.onAddChangeSetCallback=n}onDiscardChangeSet(n){this.onDiscardChangeSetCallback=n}async closeChangeSet(n){const a=this.history.findIndex(t=>t.id===n.id),l=this.history.slice(0,a),p=l[l.length-1];if(!(p!=null&&p.dirty)&&this.onCloseChangeSetCallback){(await this.onCloseChangeSetCallback(n)).success&&(n.dirty=!1,this.emit("change-set-closed",n),this.closePendingChangeSets());return}}toLatestChangeSet(n,a,l,p=!1,t="here-this"){if(!this.history.length)return new F(this,n,a,l,p,t);const m=this.history[this.history.length-1];return m.open?m:this.addChangeSet(new F(this,n,a,l,p,t))}addChangeSet(n){var p,t;if(!this.history.length)return this.undoableStackValueIndex=eM(this.undoableStackValueIndex,this.history,n),(p=this.onAddChangeSetCallback)==null||p.call(this,n,this.undoableStackValueIndex),n;const a=this.history.find(m=>m.id===(n==null?void 0:n.id));if(a)return a;const l=this.history.find(m=>m.open);if(l)throw console.warn("Previous still open: ",l),console.warn("New change set: ",n),new Error(`There is already an open change-set with id '${l.id}'.`);return this.undoableStackValueIndex=eM(this.undoableStackValueIndex,this.history,n),(t=this.onAddChangeSetCallback)==null||t.call(this,n,this.undoableStackValueIndex),n}discardChangeSet(n){var l;const a=this.history.findIndex(p=>p.id===(n==null?void 0:n.id));return a!==-1&&(this.history.splice(a,1),this.undoableStackValueIndex=this.undoableStackValueIndex-1,(l=this.onDiscardChangeSetCallback)==null||l.call(this,n)),this}async inject(...n){return await Promise.all(n.map(a=>new Promise(async l=>{await a.init(this),l(null)}))),this}validateGeneratedUpdate(n){return{errors:[],modifiedData:n}}subscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(n=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(m=>{const v=m.entity.afterAllChildrenInitialized(n);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),n==null||n.attemptAutoclose("sync-dependents",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}onDetachedDependencyRemoved(n,a,l){const p=[],t=[],m=[],v=[];return{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}onDetachedDependencyRestored(n,a,l){const p=[],t=[],m=[],v=[];return{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}unsubscribeFromDependencies(){return this}subscribeToDependencies(){return this}increaseVersion(n){if(n&&!N(n).isValid())throw new Error(`The shared timestamp '${n}' is not a valid ISO 8601 date string.`);return n&&N(n).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=Fe.UUID.uuid(),this.createdAt=N(n).toISOString()||N().toISOString(),this)}captureVersion(){var a;const n=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Fe(this);return n.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,n):new Map([[this.version,n]]),n.entities=[...this.entities],n.projects=[...this.projects],n.functions=[...this.functions],n.events=[...this.events],n.variableDeclarations=[...this.variableDeclarations],n.variableInstances=[...this.variableInstances],n.conditions=[...this.conditions],n.operations=[...this.operations],n.functionCalls=[...this.functionCalls],n.loops=[...this.loops],n.searches=[...this.searches],this}recursiveCaptureUpstreamVersions(n){const a=[],l=[],p=[],t=[];return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}async restoreVersion(n){var v;const a=[],l=[],p=[],t=[];if(this.version===n)return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this};if(!this.knownVersions){const b=new Map;for(const[_,I]of this.knownVersions||new Map){if(b.set(_,I),I.activeVersion=!1,I.knownVersions)for(const[V,B]of I.knownVersions)b.set(V,B);I.knownVersions=null}}let m=(v=this.knownVersions)==null?void 0:v.get(n);if(!m){const b=await this.APILoadVersion({},n);if(!b)throw new Error(`Version with id '${n}' for entity with id '${this.id}' not found.`);m=new Fe(b)}return this.metaSync(m.toShallowJSON(),null),this.previousVersion=m.previousVersion,this.version=m.version,this.createdAt=m.createdAt,this.author=m.author,this.deleted=m.deleted,this.entities=m.entities,this.projects=m.projects,this.functions=m.functions,this.events=m.events,this.variableDeclarations=m.variableDeclarations,this.variableInstances=m.variableInstances,this.conditions=m.conditions,this.operations=m.operations,this.functionCalls=m.functionCalls,this.loops=m.loops,this.searches=m.searches,{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}updateWithShallowTransfer(n,a=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"update-with-shallow-transfer"))){return this.metaSync(n,a),this.version=n.version,this.createdAt=n.createdAt,this.author=n.author,this.deleted=n.deleted,this.previousVersion=n.previousVersion,this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const n=[],a=[],l=[],p=[];return{updated:w(n),added:w(a),removed:w(l),affected:w(p),self:this}}afterAllChildrenInitialized(n=null){const a=[],l=[],p=[],t=[];return this.initialized||(this.initialized=!0,this.emit("project-initialized",this,n)),this.validate(),this.captureVersion(),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addSelfToProject(n){const a=[],l=[],p=[],t=[];return this.subscribe(),this.subscribeToDependencies(),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(n){return this.operationDeclarations.includes(n)}isGlobalEventActionDescriptor(n){return this.globalEventActionDescriptors.includes(n)}isLoopDeclaration(n){return this.loopDeclarations.includes(n)}isConditionDeclaration(n){return this.conditionDeclarations.includes(n)}initChildren(n=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.projects=this.initialData.projects.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.variableDeclarations=this.initialData.variableDeclarations.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.variableInstances=this.initialData.variableInstances.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.conditions=this.initialData.conditions.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.operations=this.initialData.operations.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.functions=this.initialData.functions.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.events=this.initialData.events.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.functionCalls=this.initialData.functionCalls.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.loops=this.initialData.loops.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.searches=this.initialData.searches.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(n),n==null||n.attemptAutoclose("init-children",this.id),this)}subscribeInstance(n){return(!this.instances[n.id]||this.instances[n.id]!==n)&&(this.instances[n.id]=n),this}subscribeDeletedInstance(n){return(!this.deletedInstances[n.id]||this.deletedInstances[n.id]!==n)&&(this.deletedInstances[n.id]=n),this}subscribeBuiltInInstance(n){return(!this.builtInInstances[n.id]||this.builtInInstances[n.id]!==n)&&(this.builtInInstances[n.id]=n),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(n){return delete this.instances[n.id],this}unsubscribeDeletedInstance(n){return delete this.deletedInstances[n.id],this}findSubscribedBuiltInInstance(n){return this.builtInInstances[n.id]||null}get(n){return this.instances[n]||this.builtInInstances[n]||null}getDeleted(n){return this.deletedInstances[n]||null}getManaged(n){return this.getBuiltIn(n)?null:this.instances[n]||null}getBuiltIn(n){return this.builtInInstances[n]||null}findSubscribedInstanceFromReference(n){return this.instances[n.entityId]||null}findSubscribedBuiltInInstanceFromReference(n){return this.builtInInstances[n.entityId]||null}metaSync(n,a=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=cr(this,n),p=this.toMeta();return this.name=n.name!==void 0?n.name:p.name,this.description=n.description!==void 0?n.description:p.description,this.x=n.x||p.x,this.y=n.y||p.y,super.metaSync(n),n.deleted===!0&&!p.deleted?a==null||a.add(this,G.Removed):n.deleted===!1&&p.deleted?a==null||a.add(this,G.Added):l&&(a==null||a.add(this,G.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(n=oe,...a){return await Fe.repository.APILoad(this.id,...a),this}async APICreate(n=oe,...a){return await Fe.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(n=oe,...a){return await Fe.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(n=oe,...a){return await Fe.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(n=oe,...a){return await Fe.repository.APIClone(this.id,...a),this}async APILoadVersion(n=oe,a,...l){return await Fe.repository.APILoadVersion(this.id,a,...l)}remove({ignoreUpstream:n}={ignoreUpstream:!1},a=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},n=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}getAllBuiltInIds(){const n=new Set;return[...this.primitives.flatMap(a=>a.toFlatIds(n)),...this.builtInBaseEntities.flatMap(a=>a.toFlatIds(n)),...this.operationDeclarations.flatMap(a=>a.toFlatIds(n)),...this.globalEventActionDescriptors.flatMap(a=>a.toFlatIds(n)),...this.loopDeclarations.flatMap(a=>a.toFlatIds(n)),...this.conditionDeclarations.flatMap(a=>a.toFlatIds(n)),...this.valueDescriptors.flatMap(a=>a.toFlatIds(n)),...this.dataTypes.flatMap(a=>a.toFlatIds(n))]}getAllBuiltIn(){const n=new Set;return[...this.primitives.flatMap(a=>a.toFlat(n)),...this.builtInBaseEntities.flatMap(a=>a.toFlat(n)),...this.operationDeclarations.flatMap(a=>a.toFlat(n)),...this.globalEventActionDescriptors.flatMap(a=>a.toFlat(n)),...this.loopDeclarations.flatMap(a=>a.toFlat(n)),...this.conditionDeclarations.flatMap(a=>a.toFlat(n)),...this.valueDescriptors.flatMap(a=>a.toFlat(n)),...this.dataTypes.flatMap(a=>a.toFlat(n))]}toFlat(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this,...this.entities.flatMap(l=>l.toFlat(n)),...this.functions.flatMap(l=>l.toFlat(n)),...this.events.flatMap(l=>l.toFlat(n)),...this.projects.flatMap(l=>l.toFlat(n)),...this.variableDeclarations.flatMap(l=>l.toFlat(n)),...this.variableInstances.flatMap(l=>l.toFlat(n)),...this.conditions.flatMap(l=>l.toFlat(n)),...this.operations.flatMap(l=>l.toFlat(n)),...this.functionCalls.flatMap(l=>l.toFlat(n)),...this.loops.flatMap(l=>l.toFlat(n)),...this.searches.flatMap(l=>l.toFlat(n))])}toFlatIds(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.id,...this.entities.flatMap(l=>l.toFlatIds(n)),...this.functions.flatMap(l=>l.toFlatIds(n)),...this.events.flatMap(l=>l.toFlatIds(n)),...this.projects.flatMap(l=>l.toFlatIds(n)),...this.variableDeclarations.flatMap(l=>l.toFlatIds(n)),...this.variableInstances.flatMap(l=>l.toFlatIds(n)),...this.conditions.flatMap(l=>l.toFlatIds(n)),...this.operations.flatMap(l=>l.toFlatIds(n)),...this.functionCalls.flatMap(l=>l.toFlatIds(n)),...this.loops.flatMap(l=>l.toFlatIds(n)),...this.searches.flatMap(l=>l.toFlatIds(n))])}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(n=new Set){return n.has(this.id)?this.toReference():(n.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(a=>a.toJSON(n)),variableDeclarations:this.variableDeclarations.map(a=>a.toJSON(n)),variableInstances:this.variableInstances.map(a=>a.toJSON(n)),conditions:this.conditions.map(a=>a.toJSON(n)),operations:this.operations.map(a=>a.toJSON(n)),loops:this.loops.map(a=>a.toJSON(n)),searches:this.searches.map(a=>a.toJSON(n)),functions:this.functions.map(a=>a.toJSON(n)),events:this.events.map(a=>a.toJSON(n)),projects:this.projects.map(a=>a.toJSON(n)),functionCalls:this.functionCalls.map(a=>a.toJSON(n))})}toJSONClone(n={uuidStrategy:"uuid"}){const a=new Map,l=new Set,p=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(t=>{if(p.includes(t)){a.set(t,t);return}a.set(t,Fe.UUID.uuid())}),l.add(this.id),{id:a.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(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),projects:this.projects.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),variableDeclarations:this.variableDeclarations.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),variableInstances:this.variableInstances.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),conditions:this.conditions.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),operations:this.operations.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),functions:this.functions.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),events:this.events.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),functionCalls:this.functionCalls.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),loops:this.loops.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),searches:this.searches.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null}))}}toReference(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a+"--"+Fe.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a,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(p=>p.toReference(n)),functions:this.functions.map(p=>p.toReference(n)),events:this.events.map(p=>p.toReference(n)),projects:this.projects.map(p=>p.toReference(n)),variableDeclarations:this.variableDeclarations.map(p=>p.toReference(n)),variableInstances:this.variableInstances.map(p=>p.toReference(n)),conditions:this.conditions.map(p=>p.toReference(n)),operations:this.operations.map(p=>p.toReference(n)),functionCalls:this.functionCalls.map(p=>p.toReference(n)),loops:this.loops.map(p=>p.toReference(n)),searches:this.searches.map(p=>p.toReference(n))}}toFlatJSON(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(l=>l.toFlatJSON(n)),...this.functions.flatMap(l=>l.toFlatJSON(n)),...this.events.flatMap(l=>l.toFlatJSON(n)),...this.projects.flatMap(l=>l.toFlatJSON(n)),...this.variableDeclarations.flatMap(l=>l.toFlatJSON(n)),...this.variableInstances.flatMap(l=>l.toFlatJSON(n)),...this.conditions.flatMap(l=>l.toFlatJSON(n)),...this.operations.flatMap(l=>l.toFlatJSON(n)),...this.functionCalls.flatMap(l=>l.toFlatJSON(n)),...this.loops.flatMap(l=>l.toFlatJSON(n)),...this.searches.flatMap(l=>l.toFlatJSON(n))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[...this.entities.flatMap(l=>l.toFlatGenerationTarget(n)),...this.functions.flatMap(l=>l.toFlatGenerationTarget(n)),...this.events.flatMap(l=>l.toFlatGenerationTarget(n)),...this.projects.flatMap(l=>l.toFlatGenerationTarget(n)),...this.variableDeclarations.flatMap(l=>l.toFlatGenerationTarget(n)),...this.variableInstances.flatMap(l=>l.toFlatGenerationTarget(n)),...this.conditions.flatMap(l=>l.toFlatGenerationTarget(n)),...this.operations.flatMap(l=>l.toFlatGenerationTarget(n)),...this.functionCalls.flatMap(l=>l.toFlatGenerationTarget(n)),...this.loops.flatMap(l=>l.toFlatGenerationTarget(n)),...this.searches.flatMap(l=>l.toFlatGenerationTarget(n))])}clearErrors(){return this.errors=[],this.entities.forEach(n=>n.clearErrors()),this.projects.forEach(n=>n.clearErrors()),this.functions.forEach(n=>n.clearErrors()),this.events.forEach(n=>n.clearErrors()),this.variableDeclarations.forEach(n=>n.clearErrors()),this.variableInstances.forEach(n=>n.clearErrors()),this.conditions.forEach(n=>n.clearErrors()),this.operations.forEach(n=>n.clearErrors()),this.functionCalls.forEach(n=>n.clearErrors()),this.loops.forEach(n=>n.clearErrors()),this.searches.forEach(n=>n.clearErrors()),this}validate(){const n=Xde(),a=this.toJSON();return n.safeParse(a),this.validateChildren(),{success:!0,error:null,data:a}}validateChildren(){this.entities.forEach(n=>n.validate()),this.projects.forEach(n=>n.validate()),this.functions.forEach(n=>n.validate()),this.events.forEach(n=>n.validate()),this.variableDeclarations.forEach(n=>n.validate()),this.variableInstances.forEach(n=>n.validate()),this.conditions.forEach(n=>n.validate()),this.operations.forEach(n=>n.validate()),this.functionCalls.forEach(n=>n.validate()),this.loops.forEach(n=>n.validate()),this.searches.forEach(n=>n.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(a=>a.getErrors()),...this.projects.flatMap(a=>a.getErrors()),...this.functions.flatMap(a=>a.getErrors()),...this.events.flatMap(a=>a.getErrors()),...this.variableDeclarations.flatMap(a=>a.getErrors()),...this.variableInstances.flatMap(a=>a.getErrors()),...this.conditions.flatMap(a=>a.getErrors()),...this.operations.flatMap(a=>a.getErrors()),...this.functionCalls.flatMap(a=>a.getErrors()),...this.loops.flatMap(a=>a.getErrors()),...this.searches.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(n){return this.entities.find(a=>a.id===n)||null}addDefinitionEntity(n){return this.entities.includes(n)||this.entities.push(n),n}addFunctionDeclaration(n){return this.functions.includes(n)||this.functions.push(n),n}addFunctionCall(n){return this.functionCalls.includes(n)||this.functionCalls.push(n),n}addVariableDeclaration(n){return this.variableDeclarations.includes(n)||this.variableDeclarations.push(n),n}addVariableInstance(n){return this.variableInstances.includes(n)||this.variableInstances.push(n),n}addInstalledProject(n){return this.projects.includes(n)||this.projects.push(n),this}addGlobalEvent(n){return this.events.includes(n)||this.events.push(n),this}addCondition(n){return this.conditions.includes(n)||this.conditions.push(n),this}addOperation(n){return this.operations.includes(n)||this.operations.push(n),this}addLoop(n){return this.loops.includes(n)||this.loops.push(n),this}addSearch(n){return this.searches.includes(n)||this.searches.push(n),this}removeDefinitionEntity(n){const a=this.entities.findIndex(l=>l.id===n.id);if(a>-1){const l=this.entities[a];return this.entities.splice(a,1),l}return null}removeCondition(n){const a=this.conditions.findIndex(l=>l.id===n.id);if(a>-1){const l=this.conditions[a];return this.conditions.splice(a,1),l}return null}removeOperation(n){const a=this.operations.findIndex(l=>l.id===n.id);if(a>-1){const l=this.operations[a];return this.operations.splice(a,1),l}return null}removeLoop(n){const a=this.loops.findIndex(l=>l.id===n.id);if(a>-1){const l=this.loops[a];return this.loops.splice(a,1),l}return null}removeSearch(n){const a=this.searches.findIndex(l=>l.id===n.id);if(a>-1){const l=this.searches[a];return this.searches.splice(a,1),l}return null}removeFunctionCall(n){const a=this.functionCalls.findIndex(l=>l.id===n.id);if(a>-1){const l=this.functionCalls[a];return this.functionCalls.splice(a,1),l}return null}removeVariableInstance(n){const a=this.variableInstances.findIndex(l=>l.id===n.id);if(a>-1){const l=this.variableInstances[a];return this.variableInstances.splice(a,1),l}return null}removeVariableDeclaration(n){const a=this.variableDeclarations.findIndex(l=>l.id===n.id);if(a>-1){const l=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),l}return null}removeFunctionDeclaration(n){const a=this.functions.findIndex(l=>l.id===n.id);if(a>-1){const l=this.functions[a];return this.functions.splice(a,1),l}return null}removeInstalledProject(n){const a=this.projects.findIndex(l=>l.id===n.id);if(a>-1){const l=this.projects[a];return this.projects.splice(a,1),l}return null}removeGlobalEvent(n){const a=this.events.findIndex(l=>l.id===n.id);if(a>-1){const l=this.events[a];return this.events.splice(a,1),l}return null}removeTopLevelVariableDeclaration(n){if(n.type!==f.VariableDeclaration)return null;const a=this.variableDeclarations.findIndex(l=>l.id===n.id);if(a>-1){const l=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),l}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(a=>a.methods)]}getTerminationStatements(){return[...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.ReturnStatement||t.type===f.ContinueStatement||t.type===f.BreakStatement)]},[])]}getFunctionDeclaration(n){return this.functions.find(a=>a.id===n)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.functionCalls.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.operations.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.loops.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.searches.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.functionCalls.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.conditions.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.loops.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.searches.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.conditions.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.operations.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.loops.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.searches.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.functionCalls.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.conditions.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.operations.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.loops.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.searches.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.functionCalls.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.conditions.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.operations.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.loops.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.searches.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[])]}getVariableDeclarations(){return w([...this.variableDeclarations,...this.getEntryPoints().reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.functionCalls.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.conditions.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.operations.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.loops.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.searches.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[])])}getLoops(){return[...this.loops,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.functionCalls.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.conditions.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.operations.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.searches.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[])]}getSearches(){return[...this.searches,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.functionCalls.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.conditions.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.operations.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.loops.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[])]}attachOrphanReferences(){const n=this.getVariableInstances(),a=this.getVariableDeclarations();return n.forEach(l=>{if(!l.declaration){const p=l.initialData,t=p.declaration.entityId||p.declaration.id,m=a.find(v=>v.id===t);m&&l.setDeclaration(m)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(n=>n.name===Oe.PERSISTED_ENTITY)||null}requestActiveValue(n){var l;const a=(l=this.onRequestActiveValueCallback)==null?void 0:l.call(this,n);return a?a||null:n.getDefaultValue()}undo(){console.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex-1,console.log("To: ",this.undoableStackValueIndex);const n=this.history[this.undoableStackValueIndex+1],a=this.history[this.undoableStackValueIndex];return console.log("Current change set: ",n),console.log("Change set to restore: ",a),XL(n||"initial",a||"initial",this)}redo(){console.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex+1,console.log("To: ",this.undoableStackValueIndex);const n=this.history[this.undoableStackValueIndex-1],a=this.history[this.undoableStackValueIndex];return console.log("Current change set: ",n),console.log("Change set to restore: ",a),XL(n||"initial",a||"initial",this)}applyExternalChangeSet(n){const a=n.payload,l=this.addChangeSet(new F(this,n.author,n.timestamp,this)),p=a.updated[this.id];if(!p)throw new Error("Project root not found in change set transfer. Cannot apply changes.");const t={...a.added,...a.updated,...a.removed},m=a.seenEntities.filter(b=>!a.affected.includes(b));m.forEach(b=>{var _;if(!t[b]){console.warn(`Entity '${b}' not found in change set transfer. Cannot apply changes.`);const I=(_=this.get(b))==null?void 0:_.toShallowJSON();throw I?console.warn("Entity in project: ",I):console.warn("Entity not in project"),new Error(`Entity '${b}' not found in change set transfer. Cannot apply changes.`)}});const v=new Ga(p);return v.flatRecord=t,v.order=m,v.orderEntities(),console.log("All entities: ",v.order.map((b,_)=>`${_+1}: ${t[b].type} - ${b}`).join(`,
404
- `)),console.log("Persisting new additions"),v.visit(async(b,_)=>{if(a.added[b.id]){console.log("Adding: ",b.id);try{const I=z(b,this);if(I.hydrateAncestors(),I.addSelfToProject(l),l.add(I,G.Added),!this.get(b.id))throw new Error(`Entity ${b.id} was not added to the project`)}catch(I){console.error("Error: ",I),console.error("Errored entity: ",b)}}}),console.log("Persisting updates"),v.visit(async(b,_)=>{if(a.updated[b.id]){console.log("Updating: ",b.id);try{const I=this.get(b.id);I&&(I.updateWithShallowTransfer(b,l),l.add(I,G.Updated))}catch(I){console.error("Error: ",I),console.error("Errored entity: ",b)}}}),console.log("Persisting removals"),v.visit(async(b,_)=>{if(a.removed[b.id]){console.log("Removing: ",b.id);try{const I=this.get(b.id);I&&I.remove({ignoreUpstream:!1},l)}catch(I){console.error("Error: ",I),console.error("Errored entity: ",b)}}}),l}toFullProjectTransfer(){const n=new Ga(this),a={};return n.visit(l=>{const p=l.toShallowJSON();a[l.id]=p}),{order:n.order,size:n.order.length,record:a}}};g(Fe,"sessionAuthor","1"),g(Fe,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:n=>n}),g(Fe,"repository",{APICreate:async(n,...a)=>n,APIUpdate:async(n,...a)=>n,APIDelete:async(n,...a)=>n,APIClone:async(n,...a)=>{},APILoad:async(n,...a)=>null,APILoadVersion:async(n,a,...l)=>null}),g(Fe,"type",f.Project),g(Fe,"USER_MANAGED_PARENT_TYPES",[]),g(Fe,"PARENT_TYPES",[...Fe.USER_MANAGED_PARENT_TYPES]),g(Fe,"MUTABLE_BASE_PROPERTIES",["name","description"]),g(Fe,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(Fe,"BASE_PROPERTIES",[...Fe.MUTABLE_BASE_PROPERTIES,...Fe.INMUTABLE_BASE_PROPERTIES]),g(Fe,"MUTABLE_META_PROPERTIES",[...Fe.MUTABLE_BASE_PROPERTIES,"x","y"]),g(Fe,"INMUTABLE_META_PROPERTIES",[...Fe.INMUTABLE_BASE_PROPERTIES]),g(Fe,"META_PROPERTIES",[...Fe.MUTABLE_META_PROPERTIES,...Fe.INMUTABLE_META_PROPERTIES]),g(Fe,"MUTABLE_UPSTREAM_PROPERTIES",[]),g(Fe,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),g(Fe,"UPSTREAM_PROPERTIES",[...Fe.MUTABLE_UPSTREAM_PROPERTIES,...Fe.INMUTABLE_UPSTREAM_PROPERTIES]),g(Fe,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),g(Fe,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Fe,"DOWNSTREAM_PROPERTIES",[...Fe.MUTABLE_DOWNSTREAM_PROPERTIES,...Fe.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Fe,"PROPERTIES",[...Fe.META_PROPERTIES,...Fe.UPSTREAM_PROPERTIES,...Fe.DOWNSTREAM_PROPERTIES]);let P=Fe;var Dj=(u=>(u.PersistChangeSet="persist-change-set",u.CreateSingle="create-single",u.CreateBulk="create-bulk",u.CreateSingleNested="create-single-nested",u.CreateBulkNested="create-bulk-nested",u.Update="update",u.Clone="clone",u.Delete="delete",u.Load="load",u.LoadNested="load-nested",u.LoadVersion="load-version",u))(Dj||{});class gj extends Lt{constructor(n){super(Vs,n);g(this,"id",Jt.Parallel);g(this,"name",Jt.Parallel);g(this,"description","Programmatically execute a list of actions one after the other");g(this,"version","1");g(this,"autoexecutable",!0);g(this,"initialData",Vs);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=n,this.inputs=Vs.inputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Vs.outputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Vs.error?z(Vs.error,this.project):null}}class $j extends Lt{constructor(n){super(mi,n);g(this,"id",mi.id);g(this,"name",mi.name);g(this,"description",mi.description);g(this,"version",mi.version);g(this,"autoexecutable",!1);g(this,"initialData",mi);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=n,this.inputs=mi.inputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=mi.outputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=mi.error?z(mi.error,this.project):null}}class Oj extends Lt{constructor(n){super(Fn,n);g(this,"id",Jt.Sequential);g(this,"name",Jt.Sequential);g(this,"description","Programmatically execute a list of actions one after the other");g(this,"version","1");g(this,"autoexecutable",!0);g(this,"initialData",Fn);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=n,this.inputs=Fn.inputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Fn.outputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Fn.error?z(Fn.error,this.project):null}}class Sye extends Lt{constructor(d){super(tu,d)}}class Zye extends Lt{constructor(d){super(lo,d)}}class Jye extends Lt{constructor(n){super(uo,n);g(this,"autoexecutable",!0)}getEntityToMatchInputMap(n){return n.inputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===fe.operation[Wt.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(n){return n.inputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===fe.operation[Wt.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(n){return n.outputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===fe.operation[Wt.Validate].outputs.outputEntity.id})||null}getEntityToMatch(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"get-entity-to-match-validate-data"))){const l=this.project.requestActiveValue(n),p=l==null?void 0:l.valueAsTypeSingle;return a==null||a.attemptAutoclose("get-entity-to-match-validate-data",this.id),p}syncOperationInstance(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const l=[],p=[],t=[],m=[],v=this.getEntityToMatchInputMap(n);if(v){const{added:I,updated:V,removed:B,affected:K}=this.syncEntityToMatchInputMapDataType(v,a);l.push(...V),p.push(...I),t.push(...B),m.push(...K)}const b=this.getDataToValidateInputMap(n);if(b){const{added:I,updated:V,removed:B,affected:K}=this.syncDataToValidateInputMapDataType(b,a);l.push(...V),p.push(...I),t.push(...B),m.push(...K)}const _=this.getOutputDataOutputMap(n);if(_){const{added:I,updated:V,removed:B,affected:K}=this.syncOutputDataOutputMapDataType(_,a);l.push(...V),p.push(...I),t.push(...B),m.push(...K)}return a==null||a.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:w(l),added:w(p),removed:w(t),affected:w(m),self:n}}syncEntityToMatchInputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var _,I,V,B,K,q,Z,Q,ue,re,_e,X,Ee,se,de;const l=[],p=[],t=[],m=[];if(((_=n.declaration)==null?void 0:_.id)!==fe.operation[Wt.Validate].inputs.entityToMatch.id)return a==null||a.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.project.requestActiveValue(n),b=v==null?void 0:v.valueAsTypeSingle;if(!n.dataType){const ye={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:((I=n.declaration.dataType)==null?void 0:I.options)||null,implementationChooseOne:((V=n.declaration.dataType)==null?void 0:V.implementationChooseOne)||!1,staticEntities:((B=n.declaration.dataType)==null?void 0:B.staticEntities)??null,interactiveEntities:((K=n.declaration.dataType)==null?void 0:K.interactiveEntities)??null,actionEntities:((q=n.declaration.dataType)==null?void 0:q.actionEntities)??null,isList:((Z=n.declaration.dataType)==null?void 0:Z.isList)||!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:(b==null?void 0:b.toJSON())||null,like:!0,inferred:!0,parent:n.toReference()},H=z(ye,n.project);H.hydrateAncestors(),H.setParent(n,a),H.initChildren(a),H.setEntity(b,a),a==null||a.add(H,G.Added),l.push(H),n.setDataType(H,a)}return(se=n.dataType)==null||se.metaSync({inferred:!0,like:!1,asType:!0,options:((Q=n.declaration.dataType)==null?void 0:Q.options)||null,implementationChooseOne:((ue=n.declaration.dataType)==null?void 0:ue.implementationChooseOne)||!1,staticEntities:((re=n.declaration.dataType)==null?void 0:re.staticEntities)??null,interactiveEntities:((_e=n.declaration.dataType)==null?void 0:_e.interactiveEntities)??null,actionEntities:((X=n.declaration.dataType)==null?void 0:X.actionEntities)??null,isList:((Ee=n.declaration.dataType)==null?void 0:Ee.isList)||!1},a),(de=n.dataType)==null||de.setEntity(b,a),n.dataType&&p.push(n.dataType),a==null||a.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:w(p),added:w(l),removed:w(t),affected:w(m),self:n.dataType}}syncDataToValidateInputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var I,V,B;const l=[],p=[],t=[],m=[];if(((I=n.declaration)==null?void 0:I.id)!==fe.operation[Wt.Validate].inputs.dataToValidate.id)return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.getEntityToMatchInputMap(n.parent);if(!v)return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(v,a))return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!n.dataType){const K={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,staticEntities:null,interactiveEntities:null,actionEntities:null,asType:!1,entity:null,like:!0,inferred:!0,parent:n.toReference()},q=z(K,n.project);q.setParent(n,a),q.initChildren(a),a==null||a.add(q,G.Added),l.push(q),n.setDataType(q,a)}(V=n.dataType)==null||V.metaSync({inferred:!0,like:!0,asType:!1},a);const _=this.getEntityToMatch(v,a);return(B=n.dataType)==null||B.setEntity(_,a),n.dataType&&p.push(n.dataType),a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:w(p),added:w(l),removed:w(t),affected:w(m),self:n.dataType}}syncOutputDataOutputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var V,B,K;const l=[],p=[],t=[],m=[];if(((V=n.declaration)==null?void 0:V.id)!==fe.operation[Wt.Validate].outputs.outputEntity.id)return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.getEntityToMatchInputMap(n.parent);if(!v)return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(v,a))return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const _=this.project.requestActiveValue(v),I=(_==null?void 0:_.valueAsTypeSingle)||null;if(!n.dataType){const q={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:(I==null?void 0:I.toJSON())||null,like:!0,inferred:!0,parent:n.toReference()},Z=z(q,n.project);Z.hydrateAncestors(),Z.setParent(n,a),Z.initChildren(a),Z.setEntity(I,a),a==null||a.add(Z,G.Added),l.push(Z),n.setDataType(Z,a)}return(B=n.dataType)==null||B.metaSync({inferred:!0,like:!0,asType:!1},a),(K=n.dataType)==null||K.setEntity(I,a),n.dataType&&p.push(n.dataType),a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:w(p),added:w(l),removed:w(t),affected:w(m),self:n.dataType}}inferInputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var p,t,m;if(((p=n.declaration)==null?void 0:p.id)===fe.operation[Wt.Validate].inputs.entityToMatch.id){const{added:v,updated:b,removed:_,affected:I}=this.syncEntityToMatchInputMapDataType(n,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:w(b),added:w(v),removed:w(_),affected:w(I),self:n.dataType}}if(((t=n.declaration)==null?void 0:t.id)===fe.operation[Wt.Validate].inputs.dataToValidate.id){const{added:v,updated:b,removed:_,affected:I}=this.syncDataToValidateInputMapDataType(n,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:w(b),added:w(v),removed:w(_),affected:w(I),self:n.dataType}}const l=(m=n.declaration)==null?void 0:m.getDataType(a);if(l&&l.isResolved)return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:l};if(n.readsValue){const v=xs(n.readsValue,a);return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:v}}return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var l;if(((l=n.declaration)==null?void 0:l.id)===fe.operation[Wt.Validate].outputs.outputEntity.id){const{added:p,updated:t,removed:m,affected:v}=this.syncOutputDataOutputMapDataType(n,a);return a==null||a.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:w(t),added:w(p),removed:w(m),affected:w(v),self:n.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class Wye extends Lt{constructor(d){super($m,d)}}class Yye extends Lt{constructor(d){super(Cm,d)}}class zye extends Lt{constructor(d){super(Pm,d)}}class Hye extends Lt{constructor(d){super(df,d)}}class Xye extends Lt{constructor(d){super(af,d)}}class Qye extends Lt{constructor(d){super(eu,d)}}function e0e(u){const d=[new Oj(u),new gj(u),new $j(u),new Sye(u),new Zye(u),new Jye(u),new Hye(u),new Wye(u),new zye(u),new Yye(u),new Xye(u),new Qye(u),new Lt(gm,u),new Lt(Dm,u)];return d.forEach(n=>{n.initChildren(null),u.subscribeBuiltInInstance(n)}),u.operationDeclarations=d,d}class Cj extends En{constructor(n){super(Jr,n);g(this,"initialData");g(this,"id",Oe.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Oe.PERSISTED_ENTITY);g(this,"description",Jr.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",Jr.abstract);g(this,"static",Jr.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=Jr,this.project=n,this.id=Jr.id,this.version=Jr.version,this.name=Jr.name,this.static=Jr.static,this.abstract=Jr.abstract,this.properties=this.initialData.properties.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.methods=this.initialData.methods.map(a=>{const l=z(a,this.project);return l.parent=this,l}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const l=z(a,this.project);return l.parent=this,l}),this.extends=this.initialData.extends.map(a=>z(a,this.project))}}var Pj=(u=>(u.StatusCodeMustBeNumber="status-code-must-be-number",u.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",u))(Pj||{});function Vj(u,d){const n=[];if(typeof d!="number"){const a=new xt({id:u.id+"--status-code-must-be-number",message:`Entity of type ${u.type} with id "${u.id}" has an invalid value "${d}". The value must be a number.`,issue:null,severity:S.Error,code:"status-code-must-be-number",entity:u});return n.push(a),{errors:n,override:d}}if(d<100){const a=new xt({id:u.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${u.type} with id "${u.id}" has an invalid value "${d}". The value must be a number between 100 and 599.`,issue:null,severity:S.Error,code:"status-code-must-be-between-100-and-599",entity:u});n.push(a)}if(d>599){const a=new xt({id:u.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${u.type} with id "${u.id}" has an invalid value "${d}". The value must be a number between 100 and 599.`,issue:null,severity:S.Error,code:"status-code-must-be-between-100-and-599",entity:u});n.push(a)}return{errors:n,override:d}}class Nj extends En{constructor(n){super(Vi,n);g(this,"initialData");g(this,"id",Oe.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Oe.PERSISTED_ENTITY);g(this,"description",Vi.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",Vi.abstract);g(this,"static",Vi.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=Vi,this.project=n,this.id=Vi.id,this.version=Vi.version,this.name=Vi.name,this.static=Vi.static,this.abstract=Vi.abstract,this.properties=this.initialData.properties.map(t=>{const m=z(t,this.project);return m.setParent(this,null),m.initChildren(null),m}),this.methods=this.initialData.methods.map(t=>{const m=z(t,this.project);return m.parent=this,m}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const m=z(t,this.project);return m.parent=this,m}),this.extends=this.initialData.extends.map(t=>z(t,this.project));const a=this.properties.find(t=>t.id===fe["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!a)throw new Error("Path property not found in endpoint entity");a._codeNativeValueValidation=(t,m)=>hU(t,m);const l=this.abstractMethods.find(t=>t.id===fe["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!l)throw new Error("Handler method not found in endpoint entity");const p=l.outputs.find(t=>t.id===fe["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.outputs.statusCode.id);if(!p)throw new Error("Status code output not found in handler method");p.codeNativeValueValidation=(t,m)=>Vj(t,m)}}const t0e="test_primitive_entities_export";class r0e extends En{constructor(n){super(Gr,n);g(this,"initialData");g(this,"id",Oe.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Oe.PERSISTED_ENTITY);g(this,"description",Gr.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",Gr.abstract);g(this,"static",Gr.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=Gr,this.project=n,this.id=Gr.id,this.version=Gr.version,this.name=Gr.name,this.static=Gr.static,this.abstract=Gr.abstract,this.properties=this.initialData.properties.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=z(l,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=z(l,this.project);return p.parent=this,p}),this.extends=this.initialData.extends.map(l=>z(l,this.project));const a=this.properties.find(l=>l.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!a)throw new Error("Path property not found in endpoint entity");a._codeNativeValueValidation=(l,p)=>yU(l,p)}}function i0e(u){const d=[new Cj(u),new Nj(u),new r0e(u),new En(Df,u)];return d.forEach(n=>{u.subscribeBuiltInInstance(n)}),u.builtInBaseEntities=d,d}function s0e(u){const d=[new Ri(ke,u),new Ri(Bn,u),new Ri(nt,u),new Ri(bm,u),new Ri(Fr,u),new Ri(Un,u),new Ri(sn,u),new Ri(jn,u),new Ri(fl,u)];return d.forEach(n=>{u.subscribeBuiltInInstance(n)}),u.primitives=d,d}function n0e(u){const d=[new Lt($f,u)];return d.forEach(n=>{n.initChildren(null),u.subscribeBuiltInInstance(n)}),u.globalEventActionDescriptors=d,d}function a0e(u){const d=[new Lt(nu,u),new Lt(ca,u),new Lt(iu,u),new Lt(ml,u),new Lt(vl,u),new Lt(vf,u)];d.forEach(a=>{a.initChildren(null),u.subscribeBuiltInInstance(a)}),u.loopDeclarations=d;const n=[new Lt(Af,u),new Lt(su,u),new Lt(Tf,u),new Lt(qm,u),new Lt(Zm,u),new Lt(Ef,u)];return n.forEach(a=>{a.initChildren(null),u.subscribeBuiltInInstance(a)}),u.loopDeclarationsBodies=n,d}function o0e(u){const d=[new ks(Of,u),new ks(pv,u)];return d.forEach(n=>{n.initChildren(null),u.subscribeBuiltInInstance(n)}),u.valueDescriptors=d,d}function l0e(u){const d=[new Lt(yo,u),new Lt(Il,u)];return d.forEach(n=>{n.initChildren(null),u.subscribeBuiltInInstance(n)}),u.conditionDeclarations=d,d}const jo={},_y={},pp={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function Lj(u,d={enrich:!0,shallowErrors:!1}){const n={enrich:!0,shallowErrors:!1,...d},{enrich:a,shallowErrors:l}=n,p=u.project,t=u.record,m=new Ga(p),v=new Set;t[p.id]=p,v.add(p.id);const b=N().toISOString();Object.values(t).forEach(V=>{!V||m.allBuiltInEntityIds.includes(V.id)||v.add(V.id)}),m.order=Array.from(v),m.flatRecord=t,m.orderEntities();const _=Dy(u.project);_.instances[p.id]=_;const I=a?_.addChangeSet(new F(_,P.sessionAuthor,b,_,!0,"project-init-from-fetch-result")):null;return m.visit(V=>{if(V.id===_.id)return;const B=z(V,_);try{B.hydrateAncestors(),B.addSelfToProject(null)}catch(K){if(l)console.error("Error hydrating ancestors: ",K);else throw K}}),a?(m.visit(V=>{if(V.id===_.id)return;const B=_.get(V.id);B&&B.afterAllChildrenInitialized(I)}),_.afterAllChildrenInitialized(I)):gy(_,b).forEach(B=>{B.remove({ignoreUpstream:!0},null)}),_.instancesList.forEach(V=>{V.previousVersion=null}),I==null||I.attemptAutoclose("project-init-from-fetch-result",_.id),_}async function d0e(u,d=pp){const n={...pp,...d};if(n.empty)return{data:{project:{id:u.id,type:f.Project,version:P.UUID.uuid(),createdAt:N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(n.mock){const l={...bE};return l.id=u.id,{data:{project:l,record:{}}}}return console.log("Fetching project from external API"),new Promise(async l=>{try{if(n.onFetch){const p=await n.onFetch(u.id);if(p){l({data:p});return}}else l({data:null})}catch(p){console.error("Error fetching project: ",p),l({data:null})}})}function Dy(u){const d=new P(u);return s0e(d),i0e(d),e0e(d),n0e(d),a0e(d),o0e(d),l0e(d),Array.from(new Set([...d.getAllBuiltInIds(),...bs()])).forEach(a=>{if(!d.builtInInstances[a]&&d.instances[a])d.builtInInstances[a]=d.instances[a],delete d.instances[a];else if(!d.builtInInstances[a])throw new Error(`Built in entity was not properly initialized: ${a}`)}),d.instances[d.id]=d,d}function gy(u,d){return u.instancesList.filter(a=>N(a.createdAt).isAfter(N(d)||!!a.previousVersion))}function u0e(u,{enrich:d}={enrich:!0}){const n=new Map,a=new Map,l=Array.from(new Set([...u.getAllBuiltInIds(),...bs()]));Object.keys(u.instances).forEach(_=>{if(l.includes(_)){n.set(_,_),a.set(_,_);return}const I=u.get(_);if(!wy(I,{...u.instances,...u.builtInInstances}).every(q=>!l.includes(q))){n.set(_,_),a.set(_,_);return}const K=P.UUID.uuid();n.set(_,K),a.set(K,_)});const p=N().toISOString(),t=u.toShallowJSON({seenEntityMaps:n});t.previousVersion=null,t.createdAt=p,t.version=P.UUID.uuid();const m=Dy(t);m.instances[m.id]=m;const v=d?m.addChangeSet(new F(m,P.sessionAuthor,p,m,!0,"project-clone")):null,b=new Ga(u);return b.visit(_=>{const I=_.toShallowJSON({seenEntityMaps:n});I.previousVersion=null,I.createdAt=p,I.version=P.UUID.uuid();const V=ip(I,PU(b.flatRecord,n));if(Object.keys(V.upstream).length){let K=!1;if(Object.keys(V.upstream).forEach(q=>{if(!K&&(!m.get(q)||m.getDeleted(q))){K=!0;return}}),K)return}const B=z(I,m);B.hydrateAncestors(),B.addSelfToProject(v),v==null||v.add(B,G.Added)}),d?(b.visit(_=>{if(_.id===m.id)return;const I=m.get(n.get(_.id));I&&I.afterAllChildrenInitialized(v)}),m.afterAllChildrenInitialized(v)):gy(m,p).forEach(I=>{I.remove({ignoreUpstream:!0},null)}),m.instancesList.forEach(_=>{_.previousVersion=null}),v==null||v.attemptAutoclose("project-clone",m.id),m}function Mj(u,{enrich:d}={enrich:!0}){const n=Dy(u),a=N().toISOString(),l=d?n.addChangeSet(new F(n,P.sessionAuthor,a,n,!0,"project-init")):null;l&&(l.type=jT.Automatic);const p=new Ga(u);return p.visit(t=>{const m=z(t,n);m.hydrateAncestors(),m.addSelfToProject(l)}),d?(p.visit(t=>{if(t.id===n.id)return;const m=n.get(t.id);m&&m.afterAllChildrenInitialized(l)}),n.afterAllChildrenInitialized(l)):(gy(n,a).forEach(v=>{v.remove({ignoreUpstream:!0},null)}),new Ga(n).visit(v=>{v.initialized=!0,v.captureVersion()})),n.initialized=!0,l==null||l.attemptAutoclose("project-init",n.id),n}async function c0e(u,d=pp){const n={...pp,...d};if(u.id&&jo[u.id]&&!n.ignoreCache)return jo[u.id];if(u.id&&_y[u.id]&&!n.ignoreCache)return await _y[u.id],jo[u.id];const a=d0e(u,n);u.id&&(_y[u.id]=a);const l=await a;if(l.data){let p;return n.mock?p=Mj(bE,{enrich:!!n.enrich}):l.data instanceof P?p=l.data:p=Lj(l.data,{enrich:!!n.enrich}),jo[u.id]=p,u.id&&delete _y[u.id],p}return null}function p0e(u){return jo[u.id]&&delete jo[u.id],null}C.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=hb,C.ALL_BUILT_IN_BASE_ENTITIES=BC,C.ALL_BUILT_IN_CONDITION_ENTITIES=zC,C.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=XC,C.ALL_BUILT_IN_LOOP_BODY_ENTITIES=uO,C.ALL_BUILT_IN_LOOP_ENTITIES=dO,C.ALL_BUILT_IN_OPERATION_ENTITIES=Ag,C.ALL_BUILT_IN_PRIMITIVE_ENTITIES=d1,C.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=sP,C.ALL_BUILT_IN_VALUE_DESCRIPTORS=iP,C.ActionDescriptorState=Lt,C.ActionInputMapState=The,C.ActionOutputMapState=Ihe,C.AppendToListOperationInputIds=v_,C.AppendToListOperationOutputIds=E_,C.ArgumentDeclarationDependencyField=S3,C.ArgumentDeclarationState=ea,C.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=ub,C.BUILT_IN_BASE_ENTITY_IDS=fe,C.BUILT_IN_ENTITY_TYPES=Pi,C.BaseCanvasDraggableState=Bye,C.BaseEntityNames=Oe,C.BaseState=Mye,C.BaseValueDescriptorIds=pl,C.BreakStatementDependencyField=J3,C.BreakStatementState=Ba,C.BuiltInBaseEntityState=En,C.CACHED_PROJECTS_BY_ID=jo,C.CALLABLE_ENTITIES_EXPLANATION=Ohe,C.CALLABLE_TYPES=tn,C.CALLER_ENTITIES_EXPLANATION=X3,C.CALLER_TYPES=rn,C.CALLS_UPDATE_EXPLANATION=ja,C.CHILDREN_TYPES=o7,C.COMPARISON_CONDITIONS=WC,C.CONDITIONS=YC,C.CUSTOM_ENTITY_OPERATIONS=xD,C.CallableEntityClass=jye,C.CallerEntityClass=Lb,C.ChangeSet=F,C.ChangeSetChangeCaptureType=jT,C.ChangeSetEntityChangeType=G,C.ChildEntityBaseClass=Uye,C.CommonStringValidationErrorCodes=fU,C.ComparisonOperatorTypes=fr,C.ConditionDependencyField=bM,C.ConditionState=Ca,C.ContinueStatementDependencyField=hM,C.ContinueStatementState=Qr,C.CreateNewInputIds=fD,C.CreateNewOutputIds=hD,C.DRAGGABLE_CALLABLE_TYPES=Tm,C.DRAGGABLE_CALLER_TYPES=t1,C.DRAGGABLE_ELEMENT_TYPES=nf,C.DRAGGABLE_EXECUTABLE_TYPES=n7,C.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=sf,C.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=Em,C.DataTypeCompatibilityTypes=ms,C.DataTypeDependencyField=xT,C.DataTypeParentChildRelation=xr,C.DataTypeState=ji,C.DefinitionEntityDependencyField=Ry,C.DefinitionEntityState=ia,C.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=Nye,C.ENTITIES_WITH_VALLUES_EXPLANATION=dy,C.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=oe,C.ENTITY_RECUSION_OPTIONS_DEFAULTS=Ce,C.ENTITY_TYPES=a7,C.ENTITY_WITH_DECLARATION_TYPES=i7,C.ENTITY_WITH_LOGIC_SCOPE_TYPES=br,C.ENTITY_WITH_NAMES_TYPES=r1,C.ENTITY_WITH_PARENT_TYPES=t7,C.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Qw,C.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=r7,C.ENTITY_WITH_VALUE_TYPES=vm,C.ENTRY_POINT_ENTITIES_EXPLANATION=Qc,C.ENTRY_POINT_TYPES=Xt,C.EVENT_TYPES=cl,C.EXECUTABLE_TYPES=s7,C.EXECUTION_OPERATIONS=pD,C.EndpointEntity=Nj,C.EntityAction=Dj,C.EntityError=xt,C.EntityErrorSeverity=S,C.EntityGenerationError=Y,C.EntityGenerationErrorCode=k,C.EntityInstanceErrorCode=me,C.EntityOperations=Wt,C.EntityType=f,C.EntityWithLogicScopeClass=Kye,C.EntityWithValueClass=Gye,C.EntryPointEntityClass=xye,C.Events=Mb,C.ExecutionOperations=Jt,C.ExecutionTerminationType=vM,C.FunctionCallDependencyField=dU,C.FunctionCallState=Fa,C.FunctionDeclarationDependencyField=aM,C.FunctionDeclarationState=_a,C.GET_PROJECT_OPTIONS_DEFAULTS=pp,C.GLOBAL_EVENT_DECLARATIONS=HC,C.GetLastInListOperationInputIds=n_,C.GetLastInListOperationOutputIds=a_,C.GlobalEventNames=Mn,C.GlobalEventState=$a,C.HTTPOperations=Hr,C.HTTPStatucCodeValidationErrorCodes=Pj,C.HTTP_OPERATIONS=Tg,C.InputMapDependencyField=G3,C.InputMapState=Es,C.InstalledProjectState=La,C.InternalCallDependencyField=x3,C.InternalCallState=Ma,C.JoinListOperationInputIds=_R,C.JoinListOperationOutputIds=DR,C.LIST_OPERATIONS=P_,C.ListOperations=it,C.LiteralValueDependencyField=rM,C.LiteralValueState=Fs,C.LoopDependencyField=EM,C.LoopState=Oa,C.LoopTypes=Be,C.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=xa,C.NUMBER_OPERATIONS=x1,C.NumberOperations=Ht,C.OPERATION_DECLARATIONS=bg,C.OperationDependencyField=dM,C.OperationState=Da,C.OutputMapDependencyField=k3,C.OutputMapParentChildRelation=ul,C.OutputMapState=Ks,C.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=uy,C.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=Ua,C.PASS_THROUGH_CALLABLE_TYPES=dr,C.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=e1,C.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=fb,C.ParallelExecutionOperation=gj,C.PassThroughCallableEntityClass=Fye,C.PersistedEntity=Cj,C.PersistedEntityMethods=Wi,C.PrimitiveEntityState=Ri,C.PrimitiveTypes=ee,C.ProjectState=P,C.ProjectStateEvents=ar,C.PropertyDependencyField=sM,C.PropertyState=Xn,C.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=Rj,C.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Che,C.ReturnDeclarationDependencyField=cM,C.ReturnDeclarationState=wi,C.ReturnStatementDependencyField=FT,C.ReturnStatementState=ga,C.SQLAST=che,C.STANDALONE_CONDITIONS=xC,C.STRING_OPERATIONS=RR,C.ScopeCompatibilityType=Ay,C.SearchDependencyField=M3,C.SearchState=Na,C.SequentialExecutionOperation=Oj,C.SequentialExecutionOperationInputIds=Q_,C.SequentialExecutionOperationOutputIds=eD,C.SharedEntityErrorCode=le,C.SharedStateFunctionality=wj,C.SplitListOperationInputIds=GR,C.SplitListOperationOutputIds=KR,C.StandaloneOperatorTypes=ps,C.StringOperations=ut,C.TERMINATION_TYPES=sr,C.Traverser=Ga,C.USER_MANAGED_ENTITY_TYPES=i1,C.UserManagedEntityStateTemplate=Lye,C.VALUE_READING_ENTITIES_EXPLANATION=pb,C.VALUE_READING_TYPES=ua,C.VALUE_WRITING_ENTITIES_EXPLANATION=Q3,C.VALUE_WRITING_TYPES=Tr,C.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=cb,C.VARIABLE_TYPES=lr,C.ValueAutogenerationType=Er,C.ValueDescriptorDependencyField=Y3,C.ValueDescriptorParentChildRelation=ie,C.ValueDescriptorState=ks,C.ValueReadingEntityClass=up,C.ValueWritingEntityClass=cp,C.VariableDeclarationDependencyField=wM,C.VariableDeclarationState=Va,C.VariableInputMapState=Ehe,C.VariableInstanceDependencyField=KT,C.VariableInstanceState=Pa,C.VariableOutputMapState=Ahe,C.WaitOperation=$j,C.WaitOperationInputIds=Z_,C.WaitOperationOutputIds=J_,C.actionDescriptorValidation=bpe,C.appendToListOperation=df,C.appendToListOperationElementToAppendArgument=Nm,C.appendToListOperationElementToAppendArgumentParentRef=D_,C.appendToListOperationElementToAppendArgumentRef=A_,C.appendToListOperationError=C_,C.appendToListOperationErrorParentRef=O_,C.appendToListOperationListArgument=Vm,C.appendToListOperationListArgumentParentRef=__,C.appendToListOperationListArgumentRef=T_,C.appendToListOperationListDataType=b_,C.appendToListOperationResultListDataType=R_,C.appendToListOperationResultListReturn=$_,C.appendToListOperationResultListReturnParentRef=g_,C.appendToListOperationResultListReturnRef=w_,C.appendToListOperationSecondListDataType=I_,C.applyNewScope=Me,C.argumentDeclarationValidation=whe,C.asGenerationActionExample=vn,C.booleanPrototype=Bn,C.breakStatementValidation=Rhe,C.calculateNewParentBasedOnCallers=Ab,C.capitalizeFirstLetter=kr,C.changeSetJSONRecordToUniqueIds=spe,C.checkAreDataTypesCompatible=vs,C.checkAreDefinitionEntitiesCompatibleAsDataType=BL,C.checkArePropertiesCompatibleAsDataType=ML,C.checkExtendsBaseEntity=Iy,C.checkHasBaseEntity=As,C.checkHasMetadataChanged=cr,C.checkImplementationsOverlap=ra,C.checkImplementsBaseEntity=dye,C.checkIsBranchDependentButNotDirectlyOnBranch=tp,C.checkIsBranchDependentOnBranch=khe,C.checkIsBuiltIn=Nb,C.checkIsCallableEntityReachable=dp,C.checkIsCanvasEntity=oye,C.checkIsDefEntityInlineDeclaredForSearchOutputType=nb,C.checkIsDetachedBranch=cj,C.checkIsDetachedBranchShallow=Pb,C.checkIsGlobalVariable=nye,C.checkIsGloballyDeclared=Cb,C.checkIsMethod=hj,C.checkIsNestedScope=by,C.checkScopeCompatibility=lp,C.cloneProject=u0e,C.conditionValidation=Ape,C.continueStatementValidation=mpe,C.convertToAbstract=xhe,C.convertToNonAbstract=Fhe,C.convertToNonStatic=Khe,C.convertToStatic=Ghe,C.countedLoopActionDescriptor=nu,C.countedLoopActionDescriptorDynamicReturnDeclaration=tO,C.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=eO,C.countedLoopActionDescriptorStringArgumentDeclaration=Q$,C.countedLoopActionDescriptorStringArgumentDeclarationDataType=H$,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=Y$,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=W$,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=z$,C.countedLoopActionDescriptorStringArgumentDeclarationParentRef=X$,C.countedLoopBodyActionDescriptor=Af,C.countedLoopBodyActionDescriptorAnyDynamicArgument=aO,C.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=nO,C.countedLoopBodyActionDescriptorAnyDynamicReturn=lO,C.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=oO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Wm,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=iO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=rO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=sO,C.createDefinitionEntityFromJSONObject=yy,C.createEntityError=tt,C.createNestedDataTypeForEntity=pU,C.createNewInstanceOperation=lo,C.createNewInstanceOperationEntityToInstanciateArgument=ID,C.createNewInstanceOperationEntityToInstanciateArgumentRef=TD,C.createNewInstanceOperationEntityToInstanciateDataType=bD,C.createNewInstanceOperationError=DD,C.createNewInstanceOperationErrorParentRef=_D,C.createNewInstanceOperationNewEntityDataArgument=ED,C.createNewInstanceOperationNewEntityDataArgumentDataType=vD,C.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=mD,C.createNewInstanceOperationNewEntityDataArgumentParentRef=yD,C.createNewInstanceOperationOutputEntityDeclaration=RD,C.createNewInstanceOperationOutputEntityDeclarationParentRef=wD,C.createNewInstanceOperationRef=AD,C.createSemanticId=WL,C.createStateFromGenerationTargetType=Vye,C.createStateFromType=er,C.createStateFromTypeAndSubscribe=z,C.cronJobBuiltInBaseEntity=Df,C.cronJobBuiltInBaseEntityExpressionProperty=LC,C.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=y7,C.cronJobBuiltInBaseEntityExpressionPropertyRef=VC,C.cronJobBuiltInBaseEntityRef=NC,C.cronJobTriggeredFunctionDeclarationBlueprint=lv,C.cronJobTriggeredFunctionDeclarationBlueprintParentRef=CC,C.dataTypeCompatibilityToErrorExplanation=oU,C.dataTypeValidation=upe,C.datePrototype=sn,C.dateValueAutogenerationSchema=_E,C.definitionEntityToZodSchema=bP,C.definitionEntityValidation=$ye,C.deletePersistedEntityMethod=ov,C.deletePersistedEntityMethodParentRef=yC,C.deleteRootProject=p0e,C.endpointBuiltInBaseEntity=Vi,C.endpointBuiltInBaseEntityRef=hO,C.endpointBuiltInBaseEntityRefFour=zO,C.endpointBuiltInBaseEntityRefThree=wO,C.endpointBuiltInBaseEntityRefTwo=TO,C.endpointBuiltInCorsProperty=yO,C.endpointBuiltInCorsPropertyDataType=fO,C.endpointBuiltInCorsPropertyDataTypeRef=cO,C.endpointBuiltInCorsPropertyRef=pO,C.endpointBuiltInMethodProperty=zm,C.endpointBuiltInMethodPropertyDataType=IO,C.endpointBuiltInMethodPropertyDataTypeRef=bO,C.endpointBuiltInMethodPropertyRef=AO,C.endpointBuiltInPathProperty=Ym,C.endpointBuiltInPathPropertyDataType=EO,C.endpointBuiltInPathPropertyDataTypeRef=mO,C.endpointBuiltInPathPropertyRef=vO,C.endpointPathParamsArgumentDeclaration=Xm,C.endpointPathParamsArgumentDeclarationRef=NO,C.endpointPathParamsVariableDataType=LO,C.endpointPathParamsVariableDataTypeRef=VO,C.endpointReachedTriggerActionDescriptor=sv,C.endpointReachedTriggerActionDescriptorRef=MO,C.endpointReachedTriggerActionDescriptorRefFour=jO,C.endpointReachedTriggerActionDescriptorRefThree=UO,C.endpointReachedTriggerActionDescriptorRefTwo=BO,C.endpointRequestBodyArgumentDeclaration=ev,C.endpointRequestBodyArgumentDeclarationRef=gO,C.endpointRequestBodyVariableDataType=$O,C.endpointRequestHeadersArgumentDeclaration=Hm,C.endpointRequestHeadersArgumentDeclarationRef=_O,C.endpointRequestHeadersVariableDataType=DO,C.endpointRequestHeadersVariableDataTypeRef=RO,C.endpointRequestQueryParamsArgumentDeclaration=Qm,C.endpointRequestQueryParamsArgumentDeclarationRef=CO,C.endpointRequestQueryParamsVariableDataType=PO,C.endpointRequestQueryParamsVariableDataTypeRef=OO,C.endpointResponseBodyDataType=WO,C.endpointResponseBodyReturnDeclaration=iv,C.endpointResponseBodyReturnDeclarationRef=JO,C.endpointResponseCodeDataType=FO,C.endpointResponseCodeReturnDeclaration=tv,C.endpointResponseCodeReturnDeclarationDefaultValueParentRef=KO,C.endpointResponseCodeReturnDeclarationRef=xO,C.endpointResponseHeadersDataType=SO,C.endpointResponseHeadersDataTypeRef=kO,C.endpointResponseHeadersReturnDeclaration=rv,C.endpointResponseHeadersReturnDeclarationRef=qO,C.endpointReturnStatementRef=GO,C.endpointReturnStatementRefThree=YO,C.endpointReturnStatementRefTwo=ZO,C.enrichFromKnownEntities=rp,C.enumOptionsProperty=l1,C.enumOptionsPropertyDataType=a1,C.enumOptionsPropertyDataTypeRef=s1,C.enumOptionsPropertyRef=n1,C.enumPrototype=Un,C.enumPrototypeRef=o1,C.executionBuiltInBaseEntity=gf,C.executionBuiltInEntityAbortMethod=dv,C.executionBuiltInEntityAbortMethodParentRef=MC,C.filterOutDuplicateEntities=w,C.filterOutDuplicateErrors=Eoe,C.findEntityFromKeys=Eb,C.findReferenceToSelfInList=CU,C.findReferencesToSelfInProject=Xhe,C.flattenActionDescriptor=VU,C.flattenArgumentDeclaration=NU,C.flattenBreakStatement=LU,C.flattenBuiltInBaseEntity=MU,C.flattenCalls=Ts,C.flattenCanvasAncestorsUntil=ad,C.flattenCondition=BU,C.flattenContinueStatement=UU,C.flattenDataType=xU,C.flattenDefinitionEntity=jU,C.flattenDefinitionEntityExtensionAndImplementationTypes=Ty,C.flattenDefinitionEntityExtensionTypes=np,C.flattenDefinitionEntityExtensions=Db,C.flattenDefinitionEntityImplementations=gb,C.flattenDefinitionEntityImplementionTypes=sp,C.flattenDerivedCanvasEntities=Fi,C.flattenDetachedBranch=fj,C.flattenElementCalls=at,C.flattenElementCallsOnTheSameScope=Hhe,C.flattenEntity=ae,C.flattenFunctionCall=FU,C.flattenFunctionDeclaration=GU,C.flattenGlobalEvent=KU,C.flattenInputMap=kU,C.flattenInstalledProject=qU,C.flattenInternalCall=SU,C.flattenLiteralValue=ZU,C.flattenLoop=JU,C.flattenOperation=WU,C.flattenOutputMap=YU,C.flattenPrimitiveEntity=zU,C.flattenProject=HU,C.flattenProjectElements=OU,C.flattenProperty=XU,C.flattenRelatedCanvasElementsOnTheLeft=uj,C.flattenRelatedCanvasElementsOnTheRight=dj,C.flattenReturnDeclaration=QU,C.flattenReturnStatement=ej,C.flattenSearch=tj,C.flattenValueDescriptor=rj,C.flattenVariableDeclaration=ij,C.flattenVariableInstance=sj,C.flattenVariableReads=$U,C.flattenVariableWrites=gU,C.flattenVariables=kt,C.fromChangeSetToRecordChangeSet=yye,C.fromLiteralValueTypeToPrimitiveType=ib,C.fromZodParseToEntityGenerationErrors=ob,C.functionCallValidation=jhe,C.functionDeclarationValidation=dpe,C.generate=E9,C.generateActionExample=Phe,C.generateExecutionDataType=Yce,C.generateIdFromStrategy=hr,C.generateMutablePropertiesExplanation=ay,C.generateRandomBoolean=ZP,C.generateRandomDate=RP,C.generateRandomDateAfter=AP,C.generateRandomDateBefore=IP,C.generateRandomDateBetweenRange=wP,C.generateRandomNumber=GP,C.generateRandomNumberAfter=jP,C.generateRandomNumberBefore=xP,C.generateRandomNumberBetweenRange=FP,C.generateRandomText=SP,C.generateRandomTextAfter=KP,C.generateRandomTextBefore=kP,C.generateRandomTextBetweenRange=qP,C.generateUniqueUUID=UP,C.getAllActionDescriptorsForConditions=fy,C.getAllActionDescriptorsForGlobalEvents=cy,C.getAllActionDescriptorsForLoops=py,C.getAllActionDescriptorsForOperations=Mhe,C.getAllBuiltInEntityIds=bs,C.getAllGloballyDeclaredFunctionDeclarationsExplanation=sU,C.getBaseBuiltInEntities=hi,C.getBaseSchemaBasedOnType=z3,C.getBuiltInEntityOwner=ka,C.getCallableEntityReferenceSchema=Kr,C.getCallableEntityTypeSchema=wN,C.getCalledBy=is,C.getCallerEntityReferenceSchema=Ide,C.getCallerEntityTypeSchema=Ade,C.getCalls=wb,C.getCanvasEntitiesDerivedFromInternalCalls=lj,C.getCanvasEntitiesDerivedFromWrites=od,C.getCanvasEntityDerivedFromValueReadingEntity=Ey,C.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=oj,C.getCanvasEntityReferenceSchema=xde,C.getCanvasEntityTypeSchema=jde,C.getChildrenEntityWithValues=She,C.getColumnProperties=ld,C.getCommonAncestor=Ib,C.getCommonChildren=mU,C.getDatabaseEntities=cye,C.getDatabaseEntity=fye,C.getDeclaration=Mo,C.getDeclarationOutputedError=vye,C.getDeepestScope=mj,C.getDefaultRelationalDatabaseEntityOrFirst=Ej,C.getDraggableCallableEntityReferenceSchema=_N,C.getDraggableCallableEntityTypeSchema=RN,C.getDraggableCallerEntityReferenceSchema=Rde,C.getDraggableCallerEntityTypeSchema=wde,C.getDraggableExecutableEntityReferenceSchema=$de,C.getDraggableExecutableEntityTypeSchema=gde,C.getDraggablePassThroughCallableEntityReferenceSchema=Bh,C.getDraggablePassThroughCallableEntityTypeSchema=Mh,C.getDraggablePlayableEntityReferenceSchema=Nde,C.getDraggablePlayableEntityTypeSchema=Vde,C.getEntitiesCreatedSinceInitialization=gy,C.getEntityArgumentDeclarations=_b,C.getEntityInputMaps=nj,C.getEntityOutputMaps=rye,C.getEntityReferenceSchema=Ude,C.getEntityReturnDeclarations=aj,C.getEntityTypeSchema=Bde,C.getEntityWithLogicScopeReferenceSchema=Yn,C.getEntityWithLogicScopeTypeSchema=Ode,C.getEntityWithValueReferenceSchema=IN,C.getEntityWithValueTypeSchema=bde,C.getEntryPointEntityReferenceSchema=Br,C.getEntryPointEntityTypeSchema=Ia,C.getEventEntityReferenceSchema=Nh,C.getEventEntityTypeSchema=Vh,C.getExecutableEntityReferenceSchema=Dde,C.getExecutableEntityTypeSchema=_de,C.getExtendedBuiltInEntity=iye,C.getExtendedDefinitionEntity=Ob,C.getFirstNonLoopScopeOwner=Rr,C.getGenerationTargetSchemaBasedOnType=H3,C.getHeadIfPartOfDetachedBranch=pj,C.getHighestScope=yj,C.getImplementedBuiltInEntity=sye,C.getIsInteractive=ap,C.getLastInListOperation=Pm,C.getLastInListOperationError=m_,C.getLastInListOperationErrorParentRef=y_,C.getLastInListOperationInputListArgument=p_,C.getLastInListOperationInputListArgumentParentRef=c_,C.getLastInListOperationInputListArgumentRef=o_,C.getLastInListOperationInputListDataType=l_,C.getLastInListOperationOutputElementDataType=u_,C.getLastInListOperationOutputElementReturn=h_,C.getLastInListOperationOutputElementReturnParentRef=f_,C.getLastInListOperationOutputElementReturnRef=d_,C.getLinkedEntitiesFromArgumentDeclaration=zhe,C.getLowestPersistedEntityImplementation=$b,C.getParentCallableEntity=vU,C.getParentCallerEntity=TU,C.getParentCanvasEntities=ei,C.getParentCanvasEntity=Pr,C.getParentCanvasEntityFromTransfer=my,C.getParentEntryPoint=qhe,C.getParentPassthroughCallableEntity=EU,C.getPassThroughCallableEntityReferenceSchema=Qt,C.getPassThroughCallableEntityTypeSchema=Lh,C.getPeristedEntities=uye,C.getPlayableEntityReferenceSchema=Pde,C.getPlayableEntityTypeSchema=Cde,C.getProject=c0e,C.getPrototypeByType=op,C.getRecusriveParentsIds=wy,C.getReferenceEntityId=W,C.getReferencedEntitiesStateOrErrors=ly,C.getReferencedEntityStateOrErrors=lb,C.getReferencedIds=ip,C.getRelatedCanvasElementsOnTheLeft=Uo,C.getRelatedCanvasElementsOnTheLeftFromTransfer=Qhe,C.getRelatedCanvasElementsOnTheRight=Ka,C.getRootEntryPointScopeOwner=Vb,C.getScopeOwner=yi,C.getStateClassFromType=hye,C.getTerminationReferenceSchema=Mde,C.getTerminationTypeSchema=Lde,C.getTopLevelParentEntityId=Tj,C.getTouchedCanvasEntitiesFromChangeSet=mye,C.getUsedArgFromDeclaration=eye,C.getUsedReturnFromDeclaration=tye,C.getValueReadingEntityReferenceSchema=AN,C.getValueReadingEntityTypeSchema=Wn,C.getValueWritingEntityReferenceSchema=Tde,C.getValueWritingEntityTypeSchema=ku,C.getVariableFromInputMapping=AU,C.getVariableFromReturnVariablePointer=RU,C.getVariableReferenceSchema=Aa,C.getVariableTypeSchema=Oo,C.getVariablesFromArgumentDeclarations=vy,C.getVariablesFromInputMaps=IU,C.getVariablesFromOutputMapping=_U,C.getVariablesFromOutputMaps=DU,C.getVariablesFromReturnDeclarations=wU,C.getVariablesInSameOrHigherScope=CT,C.getWrites=Rb,C.globalEventValidation=vpe,C.groupCallsBasedOnParallelizableExecution=Jhe,C.handleAfterEntityImplementationSideEffects=cU,C.handleBeforeEntityImplementationSideEffects=uU,C.httpRequestBodyArgument=ff,C.httpRequestBodyArgumentRef=XD,C.httpRequestBodyDataType=QD,C.httpRequestHeadersArgument=pf,C.httpRequestHeadersArgumentRef=zD,C.httpRequestHeadersDataType=HD,C.httpRequestMethodArgument=uf,C.httpRequestMethodArgumentRef=WD,C.httpRequestMethodDataType=YD,C.httpRequestMethodDataTypeRef=ZD,C.httpRequestOperation=tu,C.httpRequestOperationErrorValueDescriptor=xm,C.httpRequestOperationErrorValueDescriptorDatatype=Eg,C.httpRequestOperationErrorValueDescriptorRef=vg,C.httpRequestOperationRef=fg,C.httpRequestOperationRefEight=yg,C.httpRequestOperationRefFive=cg,C.httpRequestOperationRefFour=ug,C.httpRequestOperationRefNine=mg,C.httpRequestOperationRefSeven=hg,C.httpRequestOperationRefSix=pg,C.httpRequestOperationRefThree=dg,C.httpRequestOperationRefTwo=lg,C.httpRequestQueryParamsArgument=jm,C.httpRequestQueryParamsArgumentRef=qD,C.httpRequestQueryParamsDataType=SD,C.httpRequestVariableURLArgument=cf,C.httpRequestVariableURLArgumentRef=KD,C.httpRequestVariableURLDataType=kD,C.httpRequestVariableURLDataTypeRef=FD,C.httpResponseBodyReturnDataType=og,C.httpResponseBodyReturnDataTypeRef=ng,C.httpResponseBodyReturnReturn=mf,C.httpResponseBodyReturnReturnRef=ag,C.httpResponseCodeDataType=tg,C.httpResponseCodeReturn=hf,C.httpResponseCodeReturnRef=eg,C.httpResponseHeadersDataType=sg,C.httpResponseHeadersDataTypeRef=rg,C.httpResponseHeadersReturn=yf,C.httpResponseHeadersReturnRef=ig,C.httpStatusCodeValueValidation=Vj,C.implement=hy,C.inferArgumentDeclarationDataType=UL,C.inferDataType=xs,C.inferInputMapDataType=gT,C.inferOutputMapDataType=OT,C.inferPropertyDataType=FL,C.inferReturnDeclarationDataType=$T,C.inferValueDescriptorDataType=GL,C.inferVariableDeclarationDataType=xL,C.inferVariableInstanceDataType=jL,C.initBaseProjectEntity=Dy,C.initProject=Mj,C.initProjectFromFetchResult=Lj,C.inputMapValidation=vhe,C.installedProjectValidation=yhe,C.internalCallValidation=mhe,C.isPromise=vb,C.isUUID=YL,C.iterateOverListActionDescriptorListArgumentDeclaration=Xg,C.iterateOverListActionDescriptorListArgumentDeclarationDataType=zg,C.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=Yg,C.iterateOverListActionDescriptorListArgumentDeclarationParentRef=Hg,C.iterateOverListLoopActionDescriptor=ca,C.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=e$,C.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=Qg,C.iterateOverListLoopBodyActionDescriptor=su,C.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=d$,C.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=l$,C.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=c$,C.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=u$,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=bf,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=r$,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=t$,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=i$,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=o$,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=n$,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=s$,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=a$,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=m$,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=h$,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=f$,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=y$,C.iterateOverObjectKeysLoopActionDescriptor=ml,C.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=E$,C.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=v$,C.iterateOverObjectKeysLoopBodyActionDescriptor=qm,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=g$,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=D$,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=O$,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=$$,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=km,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=b$,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=T$,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=A$,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=_$,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=w$,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=I$,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=R$,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=L$,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=V$,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=P$,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=N$,C.iterateOverObjectValuesLoopActionDescriptor=vl,C.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=B$,C.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=M$,C.iterateOverObjectValuesLoopBodyActionDescriptor=Zm,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=S$,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=q$,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=J$,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Z$,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Sm,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=j$,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=U$,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=x$,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=k$,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=G$,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=F$,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=K$,C.iterateOverStringActionDescriptorDynamicReturnDeclaration=Ug,C.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=Bg,C.iterateOverStringActionDescriptorStringArgumentDeclaration=Mg,C.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=Ng,C.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=Vg,C.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=Lg,C.iterateOverStringLoopActionDescriptor=iu,C.iterateOverStringLoopBodyActionDescriptor=Tf,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=Sg,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=qg,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=Jg,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=Zg,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Gm,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=xg,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=jg,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Fg,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Km,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Kg,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Gg,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=kg,C.joinListOperation=$m,C.joinListOperationError=FR,C.joinListOperationErrorParentRef=xR,C.joinListOperationFirstListArgument=LR,C.joinListOperationFirstListArgumentParentRef=NR,C.joinListOperationFirstListArgumentRef=gR,C.joinListOperationFirstListDataType=$R,C.joinListOperationResultListDataType=VR,C.joinListOperationResultListReturn=jR,C.joinListOperationResultListReturnParentRef=UR,C.joinListOperationResultListReturnRef=PR,C.joinListOperationSecondListArgument=BR,C.joinListOperationSecondListArgumentParentRef=MR,C.joinListOperationSecondListArgumentRef=OR,C.joinListOperationSecondListDataType=CR,C.joinListWithLastSeparator=Ke,C.joinStringsOperation=eu,C.joinStringsOperationDynamicStringArgument=aR,C.joinStringsOperationDynamicStringArgumentParentRef=nR,C.joinStringsOperationDynamicStringArgumentRef=iR,C.joinStringsOperationDynamicStringDataType=sR,C.joinStringsOperationError=rR,C.joinStringsOperationErrorParentRef=tR,C.joinStringsOperationFirstStringArgument=of,C.joinStringsOperationFirstStringArgumentParentRef=Z1,C.joinStringsOperationFirstStringArgumentRef=F1,C.joinStringsOperationFirstStringDataType=G1,C.joinStringsOperationResultStringDataType=S1,C.joinStringsOperationResultStringReturn=Qd,C.joinStringsOperationResultStringReturnParentRef=eR,C.joinStringsOperationResultStringReturnRef=q1,C.joinStringsOperationSecondStringArgument=lf,C.joinStringsOperationSecondStringArgumentParentRef=Q1,C.joinStringsOperationSecondStringArgumentRef=K1,C.joinStringsOperationSecondStringDataType=k1,C.joinStringsOperationSeparatorStringArgument=X1,C.joinStringsOperationSeparatorStringArgumentParentRef=H1,C.joinStringsOperationSeparatorStringArgumentRef=J1,C.joinStringsOperationSeparatorStringDataType=z1,C.joinStringsOperationSeparatorStringDataTypeDefaultValue=Y1,C.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=W1,C.keyValuePrototype=fl,C.literalValueValidation=npe,C.loopValidation=Tpe,C.lowercaseFirstLetter=Qu,C.manualFlowActionDescriptorDeclarationArgumentDeclaration=Fm,C.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=_g,C.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=Rg,C.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=Dg,C.manualFlowLoopActionDescriptor=vf,C.manualFlowLoopActionDescriptorDynamicReturnDeclaration=wg,C.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=Ig,C.manualFlowLoopBodyActionDescriptor=Ef,C.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=$g,C.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=gg,C.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=Cg,C.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=Og,C.mapActionDescriptorToTypeItRepresents=lye,C.mapRecord=PU,C.mergeEntityErrorsList=Toe,C.mergeListOfEntities=aye,C.methodDefaultValue=JD,C.mockClientProject=bE,C.moreThanOrEqualCondition=Il,C.moreThanOrEqualConditionLeftHandArgument=kC,C.moreThanOrEqualConditionLeftHandArgumentDataType=GC,C.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=FC,C.moreThanOrEqualConditionLeftHandArgumentParentRef=KC,C.moreThanOrEqualConditionRightHandArgument=JC,C.moreThanOrEqualConditionRightHandArgumentDataType=SC,C.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=qC,C.moreThanOrEqualConditionRightHandArgumentParentRef=ZC,C.noSpacesOrDashesValueValidation=yU,C.noSpacesValueValidation=hU,C.notEmptyCondition=yo,C.notEmptyConditionArgument=jC,C.notEmptyConditionRef=UC,C.nullPrototype=bm,C.numberAdditionOperation=af,C.numberAdditionOperationDynamicSummandArgument=I1,C.numberAdditionOperationDynamicSummandArgumentType=A1,C.numberAdditionOperationDynamicSummandArgumentTypeParentRef=b1,C.numberAdditionOperationError=T1,C.numberAdditionOperationErrorParentRef=E1,C.numberAdditionOperationFirstNumberArgument=Am,C.numberAdditionOperationFirstNumberArgumentRef=u1,C.numberAdditionOperationFirstNumberDataType=c1,C.numberAdditionOperationRef=m1,C.numberAdditionOperationRefThree=wm,C.numberAdditionOperationRefTwo=v1,C.numberAdditionOperationResultNumberDataType=y1,C.numberAdditionOperationResultNumberReturn=Rm,C.numberAdditionOperationResultNumberReturnRef=h1,C.numberAdditionOperationSecondNumberArgument=Im,C.numberAdditionOperationSecondNumberArgumentRef=p1,C.numberAdditionOperationSecondNumberDataType=f1,C.numberPrototype=nt,C.numberSubtractionOperation=Dm,C.numberSubtractionOperationDynamicSubtrahendArgument=j1,C.numberSubtractionOperationDynamicSubtrahendArgumentType=U1,C.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=B1,C.numberSubtractionOperationError=M1,C.numberSubtractionOperationErrorParentRef=L1,C.numberSubtractionOperationFirstNumberArgument=O1,C.numberSubtractionOperationFirstNumberArgumentRef=w1,C.numberSubtractionOperationFirstNumberDataType=R1,C.numberSubtractionOperationRef=_m,C.numberSubtractionOperationRefThree=V1,C.numberSubtractionOperationRefTwo=C1,C.numberSubtractionOperationResultNumberDataType=$1,C.numberSubtractionOperationResultNumberReturn=N1,C.numberSubtractionOperationResultNumberReturnRef=g1,C.numberSubtractionOperationSecondNumberArgument=P1,C.numberSubtractionOperationSecondNumberArgumentRef=_1,C.numberSubtractionOperationSecondNumberDataType=D1,C.numberValueAutogenerationSchema=RE,C.operationValidation=fpe,C.outputMapValidation=bhe,C.parallelExecutionOperation=Vs,C.parallelExecutionOperationError=S_,C.parallelExecutionOperationErrorParentRef=q_,C.parallelExecutionOperationListOfExecutionResultsDataType=G_,C.parallelExecutionOperationListOfExecutionResultsReturn=Mm,C.parallelExecutionOperationListOfExecutionResultsReturnRef=F_,C.parallelExecutionOperationListOfFunctionsArgument=Lm,C.parallelExecutionOperationListOfFunctionsArgumentDatatype=x_,C.parallelExecutionOperationListOfFunctionsArgumentRef=j_,C.parallelExecutionOperationListOfFunctionsBlueprint=U_,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=M_,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=L_,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=N_,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=V_,C.parallelExecutionOperationListOfFunctionsBlueprintParentRef=B_,C.parallelExecutionOperationRef=K_,C.parallelExecutionOperationRefThree=k_,C.persistedBuiltInBaseEntity=Jr,C.persistedBuiltInBaseEntityDatabaseProperty=Tl,C.persistedBuiltInBaseEntityDatabasePropertyDataType=EC,C.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=p7,C.persistedBuiltInBaseEntityDatabasePropertyParentRef=TC,C.persistedBuiltInBaseEntityDatabasePropertyRef=vC,C.persistedBuiltInBaseEntityPrimaryKeyProperty=bl,C.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=gC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=AC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=bC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=$C,C.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=DC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=wC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=IC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=_C,C.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=RC,C.printEntity=bb,C.processOutputGlobalValueDescriptorDataType=eP,C.processOutputGlobalValueDescriptorReturn=Of,C.processOutputGlobalValueDescriptorReturnRef=QC,C.projectPublicationCompletedGlobalEvent=$f,C.propertyToZodSchema=TP,C.propertyValidation=tpe,C.relationalDatabaseBuiltInBaseEntity=Gr,C.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=av,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=fC,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=pC,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=hC,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=cC,C.relationalDatabaseBuiltInBaseEntityDefaultProperty=nv,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=uC,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=lC,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=dC,C.relationalDatabaseBuiltInBaseEntityIdentifierProperty=If,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=QO,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=HO,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=XO,C.relationalDatabaseBuiltInBaseEntityMinSizeProperty=_f,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=oC,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=nC,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=aC,C.relationalDatabaseBuiltInBaseEntityPasswordProperty=Rf,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=iC,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=c7,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDefaultValueParentRef=sC,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=rC,C.relationalDatabaseBuiltInBaseEntityRef=El,C.relationalDatabaseBuiltInBaseEntityUsernameProperty=wf,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=tC,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=u7,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=eC,C.resolveActionDescriptorName=JL,C.resolveBaseEntityName=kL,C.resolveBuiltInBaseEntityDataTypeLabel=qL,C.resolveClonedEntityProject=yr,C.resolveConditionOperatorLabel=Zh,C.resolveDataType=qh,C.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Tb,C.resolveDataTypeLabel=Xl,C.resolveDefinitionEntityDataTypeLabel=Xce,C.resolveEntityDataTypeLabel=Hce,C.resolveEntityName=pe,C.resolveFirstCallsSecond=Whe,C.resolveFirstWritesSecond=Yhe,C.resolvePersistedDefinitionEntityDatabaseEntity=vj,C.resolvePrimaryKeyProperty=pye,C.resolvePrimitiveEntityForSearchLiteralValueType=sb,C.resolvePrimitiveEntityName=ZL,C.resolveSearchName=SL,C.resolveVariableScope=zce,C.returnDeclarationValidation=hpe,C.returnStatementValidation=ype,C.searchStatementErrorGlobalValueDescriptor=pv,C.searchStatementErrorGlobalValueDescriptorDataType=rP,C.searchStatementErrorGlobalValueDescriptorRef=tP,C.searchStatementState=phe,C.searchStatementUtils=hhe,C.searchValidation=Rpe,C.sequentialExecutionOperation=Fn,C.sequentialExecutionOperationError=cD,C.sequentialExecutionOperationErrorParentRef=uD,C.sequentialExecutionOperationListOfExecutionResultsDataType=oD,C.sequentialExecutionOperationListOfExecutionResultsReturn=Um,C.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=dD,C.sequentialExecutionOperationListOfExecutionResultsReturnRef=aD,C.sequentialExecutionOperationListOfFunctionsArgument=Bm,C.sequentialExecutionOperationListOfFunctionsArgumentDatatype=nD,C.sequentialExecutionOperationListOfFunctionsArgumentParentRef=lD,C.sequentialExecutionOperationListOfFunctionsArgumentRef=sD,C.sequentialExecutionOperationListOfFunctionsBlueprint=iD,C.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=rD,C.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=tD,C.softDeletePersistedEntityMethod=f7,C.softDeletePersistedEntityMethodParentRef=OC,C.sortCallsBasedOnExecutionDependencies=bU,C.sortChildrenEntitiesBasedOnExecutionDependencies=Zhe,C.splitListOperation=Cm,C.splitListOperationError=s_,C.splitListOperationErrorParentRef=i_,C.splitListOperationFirstOutputListDataType=JR,C.splitListOperationFirstOutputListReturn=QR,C.splitListOperationFirstOutputListReturnParentRef=XR,C.splitListOperationFirstOutputListReturnRef=Om,C.splitListOperationInputListArgument=YR,C.splitListOperationInputListArgumentParentRef=WR,C.splitListOperationInputListArgumentRef=kR,C.splitListOperationInputListDataType=qR,C.splitListOperationSecondOutputListDataType=e_,C.splitListOperationSecondOutputListReturn=r_,C.splitListOperationSecondOutputListReturnParentRef=t_,C.splitListOperationSplitIndexArgument=HR,C.splitListOperationSplitIndexArgumentParentRef=zR,C.splitListOperationSplitIndexArgumentRef=SR,C.splitListOperationSplitIndexDataType=ZR,C.splitStringOperation=gm,C.splitStringOperationError=wR,C.splitStringOperationErrorParentRef=IR,C.splitStringOperationFirstPartResultStringDataType=pR,C.splitStringOperationFirstPartResultStringReturn=AR,C.splitStringOperationFirstPartResultStringReturnParentRef=bR,C.splitStringOperationFirstPartResultStringReturnRef=cR,C.splitStringOperationIndexArgument=ER,C.splitStringOperationIndexArgumentParentRef=vR,C.splitStringOperationIndexArgumentRef=dR,C.splitStringOperationIndexDataType=uR,C.splitStringOperationSecondPartResultStringDataType=hR,C.splitStringOperationSecondPartResultStringReturn=l7,C.splitStringOperationSecondPartResultStringReturnParentRef=TR,C.splitStringOperationSecondPartResultStringReturnRef=fR,C.splitStringOperationStringArgument=mR,C.splitStringOperationStringArgumentParentRef=yR,C.splitStringOperationStringArgumentRef=oR,C.splitStringOperationStringDataType=lR,C.stringPrototype=ke,C.stringValueAutogenerationSchema=wE,C.suggestNewIdForEntity=UT,C.syncSearchEntityOutput=ab,C.test_primitive_entities_export=t0e,C.toCamelCase=Ra,C.toEntityState=ss,C.toKebabCase=KL,C.toLowerCaseKebabCase=Sh,C.toPascalCase=Hl,C.untypedDataPrototype=Fr,C.updateErrorsList=qt,C.urlDefaultValue=GD,C.uuidPrototype=jn,C.validateArgumentDeclarationName=MT,C.validateCalledByErrorIdInAction=Nhe,C.validateCalledByIdInAction=Vhe,C.validateCallers=iU,C.validateConditionEntityDeclaration=Bhe,C.validateDataOperation=uo,C.validateDataOperationDataToValidateArgument=CD,C.validateDataOperationDataToValidateArgumentParentRef=OD,C.validateDataOperationDataToValidateArgumentRef=gD,C.validateDataOperationDataToValidateDataType=$D,C.validateDataOperationEntityToMatchTypeArgument=LD,C.validateDataOperationEntityToMatchTypeArgumentParentRef=ND,C.validateDataOperationEntityToMatchTypeArgumentRef=PD,C.validateDataOperationEntityToMatchTypeDataType=VD,C.validateDataOperationError=jD,C.validateDataOperationErrorParentRef=UD,C.validateDataOperationOutputEntityDeclaration=BD,C.validateDataOperationOutputEntityDeclarationParentRef=MD,C.validateDefinitionEntityName=PT,C.validateEntryCaller=rU,C.validateErrorCaller=tU,C.validateFunctionCallDeclaration=nU,C.validateFunctionDeclarationName=VT,C.validateGeneratedEntityParentIsNotBuiltInEntity=$he,C.validateGeneration=Dhe,C.validateGenerationTarget=ur,C.validateGenerationUpdate=ghe,C.validateLoopEntityDeclaration=Uhe,C.validateName=Qce,C.validateOperationEntityDeclaration=aU,C.validatePropertyName=LT,C.validateReachability=ta,C.validateReadsValueInActionPayload=Lhe,C.validateReferenceObject=oy,C.validateReferenceToOne=db,C.validateReferences=Cr,C.validateReturnDeclarationName=BT,C.validateSuccessCaller=eU,C.validateValueReaderGenerationUpdate=ep,C.validateValueWritter=yb,C.validateVariableDeclarationName=NT,C.validateVariableInternalCallUse=mb,C.valueAutogenerationCurrentDateAndTimeSchema=eN,C.valueAutogenerationGenericSchema=vh,C.valueAutogenerationOptions=DE,C.valueAutogenerationOptionsSchema=Q4,C.valueAutogenerationRandomBooleanSchema=IE,C.valueAutogenerationRandomDateBetweenSchema=dN,C.valueAutogenerationRandomDateFromSchema=oN,C.valueAutogenerationRandomDateSchema=bh,C.valueAutogenerationRandomDateUntilSchema=lN,C.valueAutogenerationRandomNumberBetweenSchema=iN,C.valueAutogenerationRandomNumberFromSchema=tN,C.valueAutogenerationRandomNumberSchema=Eh,C.valueAutogenerationRandomNumberUntilSchema=rN,C.valueAutogenerationRandomSchema=Bu,C.valueAutogenerationRandomTextBetweenSchema=aN,C.valueAutogenerationRandomTextFromSchema=sN,C.valueAutogenerationRandomTextSchema=Th,C.valueAutogenerationRandomTextUntilSchema=nN,C.valueAutogenerationRangeValueTypesSchema=Mu,C.valueAutogenerationUniqueSchema=AE,C.valueDescriptorValidation=_he,C.variableDeclarationValidation=Ipe,C.variableInstanceValidation=wpe,C.waitOperation=mi,C.waitOperationMillisecondsNumberArgument=oo,C.waitOperationMillisecondsNumberArgumentRef=W_,C.waitOperationMillisecondsNumberDataType=Y_,C.waitOperationOperationError=X_,C.waitOperationOperationErrorParentRef=H_,C.waitOperationRef=z_,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
403
+ Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:p,modifiedData:l}}get interactive(){return this.implements.length?this.implements.every(n=>n.interactive):!0}get allMethods(){return w([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return w([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allMethods,[]),...this.implements.flatMap(n=>n.allMethods,[])])}get allBasePropertiesFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allProperties,[]),...this.implements.flatMap(n=>n.allProperties,[])])}get allBasePropertiesFromExtendedAndImplementedEntities(){return w([...this.extends.reduce((n,a)=>[...[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract),...n],[]),...this.implements.reduce((n,a)=>[...[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract),...n],[])])}get allBaseMethodsFromExtendedAndImplementedEntities(){return w([...this.extends.reduce((n,a)=>a.type!==f.DefinitionEntity?[]:[...[...a.ownDeclaredMethods,...a.allBaseMethodsFromExtendedAndImplementedEntities].filter(p=>p.type!==f.ActionDescriptor),...n],[]),...this.implements.reduce((n,a)=>a.type!==f.DefinitionEntity?a.abstractMethods:[...[...a.ownDeclaredMethods,...a.allBaseMethodsFromExtendedAndImplementedEntities].filter(p=>p.type!==f.ActionDescriptor),...n],[])])}get extendedPropertiesFromOriginalParents(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...n,...l]},[]))}get implementedPropertiesFromOriginalParents(){return w([...this.extends.reduce((n,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(m=>m.name===t.name));return[...l,...p,...n]},[]),...this.implements.reduce((n,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(m=>m.name===t.name));return[...l,...p,...n]},[])].filter(n=>!!n.abstract))}get extendedMethodsFromOriginalParents(){return w(this.extends.reduce((n,a)=>{if(a.type!==f.DefinitionEntity)return[];const l=[...a.ownDeclaredMethods,...a.extendedMethodsFromOriginalParents].filter(p=>p.type!==f.ActionDescriptor);return[...n,...l]},[]))}get implementedMethodsFromOriginalParents(){return w([...this.extends.reduce((n,a)=>{const l=a.type===f.DefinitionEntity?a.methods:[],p=[...a.abstractMethods].filter(t=>!l.find(m=>m.name===t.name));return[...l,...p,...n]},[]),...this.implements.reduce((n,a)=>[...a.abstractMethods,...n],[])].filter(n=>n.type===f.ActionDescriptor))}get extendedProperties(){return this.properties.filter(n=>n.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(n=>!n.isExtendedProperty)}get extendedMethods(){return this.methods.filter(n=>n.isExtendedMethod)}get ownDeclaredMethods(){return this.methods.filter(n=>!n.isExtendedMethod)}validateGeneratedUpdate(n){const a=[];return n.parent&&a.push(new Y({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:S.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:a,modifiedData:n}}subscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(m=>{const v=m.entity.afterAllChildrenInitialized(n);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),n==null||n.attemptAutoclose("sync-dependents",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}onDetachedDependencyRemoved(n,a,l){const p=[],t=[],m=[],v=[];return a==="implements"&&this.removeImplementation(n),a==="extends"&&this.removeExtension(n),{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}onDetachedDependencyRestored(n,a,l){const p=[],t=[],m=[],v=[];return a==="implements"&&this.addImplementation(n),a==="extends"&&this.addExtension(n),{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}unsubscribeFromDependencies(){return this.implements.forEach(n=>{Pi.includes(n.type)||n.unsubscribeDependents([{entity:this,field:"implements"}])}),this}subscribeToDependencies(){return this.implements.forEach(n=>{Pi.includes(n.type)||n.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(n=>{Pi.includes(n.type)||n.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(n){if(n&&!N(n).isValid())throw new Error(`The shared timestamp '${n}' is not a valid ISO 8601 date string.`);return n&&N(n).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=P.UUID.uuid(),this.createdAt=N(n).toISOString()||N().toISOString(),this)}captureVersion(){var a;const n=((a=this.knownVersions)==null?void 0:a.get(this.version))||new _t(this,this.project);return n.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,n):new Map([[this.version,n]]),n.properties=[...this.properties],n.methods=[...this.methods],n.abstractMethods=[...this.abstractMethods],n.extends=[...this.extends],n.implements=[...this.implements],n.parent=this.parent,this}recursiveCaptureUpstreamVersions(n){const a=[],l=[],p=[],t=[];if(this.parent){this.parent.increaseVersion(n);const m=this.parent.recursiveCaptureUpstreamVersions(n);a.push(this.parent,...m.updated),l.push(...m.added),p.push(...m.removed)}return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}async restoreVersion(n){var v;const a=[],l=[],p=[],t=[];if(this.version===n)return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this};if(!this.knownVersions){const b=new Map;for(const[_,I]of this.knownVersions||new Map){if(b.set(_,I),I.activeVersion=!1,I.knownVersions)for(const[V,B]of I.knownVersions)b.set(V,B);I.knownVersions=null}}let m=(v=this.knownVersions)==null?void 0:v.get(n);if(!m){const b=await this.APILoadVersion({},n);if(!b)throw new Error(`Version with id '${n}' for entity with id '${this.id}' not found.`);m=new _t(b,this.project)}return this.metaSync(m.toShallowJSON(),null),this.previousVersion=m.previousVersion,this.version=m.version,this.createdAt=m.createdAt,this.author=m.author,this.deleted=m.deleted,this.properties=m.properties,this.methods=m.methods,this.abstractMethods=m.abstractMethods,this.extends=m.extends,this.implements=m.implements,this.parent=m.parent,{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}updateWithShallowTransfer(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(n,a),this.version=n.version,this.createdAt=n.createdAt,this.author=n.author,this.deleted=n.deleted,this.previousVersion=n.previousVersion,this.unsubscribeFromDependencies(),n.parent){const l=W(n.parent),p=this.project.get(l),t=this.parent;if(t&&t.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return n.extends.forEach(l=>{const p=W(l),t=this.project.get(p);t&&this.addExtension(t)}),n.implements.forEach(l=>{const p=W(l),t=this.project.get(p);t&&this.addImplementation(t)}),this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const n=[],a=[],l=[],p=[];if(this.initialData.parent){const t=W(this.initialData.parent),m=this.project.get(t);if(m)this.setParent(m,null),n.push(m);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${t}' 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(t=>{const m=W(t),v=this.project.get(m);v&&(this.addExtension(v),v.type!==f.BuiltInBaseEntity&&n.push(v))}),this.initialData.implements.forEach(t=>{const m=W(t),v=this.project.get(m);v&&(this.addImplementation(v),v.type!==f.BuiltInBaseEntity&&n.push(v))}),{updated:w(n),added:w(a),removed:w(l),affected:w(p),self:this}}afterAllChildrenInitialized(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],l=[],p=[],t=[];this.initialized=!0;const{updated:m,added:v,removed:b,affected:_}=this.syncImplementationProperties(n);a.push(...m),l.push(...v),p.push(...b),t.push(..._);const{updated:I,added:V,removed:B,affected:K}=this.addExtendedProperties(n);a.push(...I),l.push(...V),p.push(...B),t.push(...K);const{updated:q,added:Z,removed:Q}=this.removeUnrecognizedProperties(n);a.push(...q),l.push(...Z),p.push(...Q);const{updated:ue,added:re,removed:_e,affected:X}=this.syncImplementationMethods(n);a.push(...ue),l.push(...re),p.push(..._e),t.push(...X);const{updated:Ee,added:se,removed:de,affected:ye}=this.addExtendedMethods(n);a.push(...Ee),l.push(...se),p.push(...de),t.push(...ye);const{updated:H,added:ce,removed:De}=this.removeUnrecognizedMethods(n);return a.push(...H),l.push(...ce),p.push(...De),this.addSuggestions(),this.captureVersion(),n==null||n.attemptAutoclose("after-all-children-initialized",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addSelfToProject(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-self-to-project"))){const a=[this],l=[],p=[],t=[];if(this.parent.type===f.DataType){const m=this.parent;m.entity=this,a.push(m)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),n==null||n.attemptAutoclose("add-self-to-project",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}setParent(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(n==null?void 0:n.id)&&(this.parent=n,a&&(a==null||a.add(this,G.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}addExtension(n){return this.extends.includes(n)||this.extends.push(n),this}removeExtension(n){return this.extends=this.extends.filter(a=>a.id!==n.id),this}addImplementation(n){return this.implements.includes(n)||this.implements.push(n),this}removeImplementation(n){return this.implements=this.implements.filter(a=>a.id!==n.id),this}removeProperty(n){return this.properties=this.properties.filter(a=>a.id!==n.id),this}addMethod(n){return this.methods.includes(n)||(this.methods.push(n),this.suggestedMethods=this.suggestedMethods.filter(a=>a.name!==n.name)),this}removeMethod(n){return this.methods=this.methods.filter(a=>a.id!==n.id),this}addProperty(n){return this.properties.includes(n)||(this.properties.push(n),this.suggestedProperties=this.suggestedProperties.filter(a=>a.name!==n.name)),this}addSuggestedProperty(n){return this.suggestedProperties.includes(n)||this.suggestedProperties.push(n),this}addSuggestedMethod(n){return this.suggestedMethods.includes(n)||this.suggestedMethods.push(n),this}removeSuggestedProperty(n){return this.suggestedProperties=this.suggestedProperties.filter(a=>a.id!==n.id),this}removeSuggestedMethod(n){return this.suggestedMethods=this.suggestedMethods.filter(a=>a.id!==n.id),this}addAbstractMethod(n){return this.abstractMethods.includes(n)||this.abstractMethods.push(n),this}removeAbstractMethod(n){return this.abstractMethods=this.abstractMethods.filter(a=>a.id!==n.id),this}initChildren(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(n),l}),this.methods=this.initialData.methods.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(n),l}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(n),l}),this.extends=this.initialData.extends.map(a=>z(a,this.project)),this.implements=this.initialData.implements.map(a=>z(a,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(n),n==null||n.attemptAutoclose("init-children",this.id),this)}removeUnrecognizedProperties(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-properties"))){const a=[],l=[],p=[],t=[];let m=[...this.properties];m=m.filter(b=>b.parent.id===this.id),m=m.filter(b=>!b.isExtendedProperty);const v=this.implementedPropertiesFromOriginalParents;return m=m.filter(b=>this.interactive&&!b.implements?!1:!v.find(_=>{var I;return _.id===((I=b.implements)==null?void 0:I.id)})),m.forEach(b=>{const _=b.remove({ignoreUpstream:!1},n);p.push(..._.removed),a.push(..._.updated)}),n==null||n.attemptAutoclose("remove-unrecognized-properties",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}removeUnrecognizedMethods(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-unrecognized-methods"))){const a=[],l=[],p=[],t=[];let m=[...this.methods];m=m.filter(b=>b.parent.id===this.id),m=m.filter(b=>!b.isExtendedMethod);const v=this.implementedMethodsFromOriginalParents;return m=m.filter(b=>this.interactive&&!b.implements?!1:!v.find(_=>{var I;return _.id===((I=b.implements)==null?void 0:I.id)})),m.forEach(b=>{const _=b.remove({ignoreUpstream:!1},n);p.push(..._.removed),a.push(..._.updated)}),n==null||n.attemptAutoclose("remove-unrecognized-methods",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}syncImplementationMethods(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-implementation-methods"))){const a=[],l=[],p=[],t=[],m=this.methods,v=this.implementedMethodsFromOriginalParents,b=[...this.allBaseMethodsFromExtendedAndImplementedEntities,...m];return v.filter(I=>!b.find(B=>{var K;return((K=B.implements)==null?void 0:K.id)===I.id})).forEach(I=>{if(this.methods.find(q=>{var Z;return((Z=q.implements)==null?void 0:Z.id)===I.id}))return;const B=this.methods.find(q=>{var _e,X;if(q.name===I.name&&!q.implements)return!0;const Z=As(this,Oe.CRON_JOB),Q=As(this,Oe.HTTP_ENDPOINT),ue=((_e=q.implements)==null?void 0:_e.id)===fe["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id,re=((X=q.implements)==null?void 0:X.id)===fe["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.methods.handler.id;return!!(Z&&!re&&!Q&&ue||Q&&!ue&&!Z&&re)});if(B&&B.type===f.FunctionDeclaration){B.setImplements(I),B.metaSync({name:I.name},n),n==null||n.add(B,G.Updated),n==null||n.add(this,G.Updated);return}const K=I.implementAsFunctionDeclaration(n,this);l.push(K),n==null||n.add(K,G.Added),this.addMethod(K)}),n==null||n.attemptAutoclose("sync-implementation-methods",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}syncImplementationProperties(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-implementation-properties"))){const a=[],l=[],p=[],t=[],m=this.properties,v=this.implementedPropertiesFromOriginalParents,b=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...m];return v.filter(I=>!b.find(B=>{var K;return((K=B.implements)==null?void 0:K.id)===I.id})).forEach(I=>{if(this.properties.find(q=>{var Z;return((Z=q.implements)==null?void 0:Z.id)===I.id}))return;const B=this.properties.find(q=>q.name===I.name&&!!q.abstract&&!q.implements);if(B){B.setImplements(I,n),B.metaSync({abstract:!1},n),B.afterAllChildrenInitialized(n);return}const K=I.implement(this,n,P.UUID.uuid());l.push(K),n==null||n.add(K,G.Added)}),n==null||n.attemptAutoclose("sync-implementation-properties",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addExtendedMethods(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-extended-methods"))){const a=[],l=[],p=[],t=[],m=this.methods,b=this.extendedMethodsFromOriginalParents.filter(I=>I.type===f.FunctionDeclaration),_=new Set(m.filter(I=>{var V;return!!((V=I.extends)!=null&&V.id)}).map(I=>I.extends.id));return b.forEach(I=>{if(_.has(I.id))return;_.add(I.id);const V=I.clone(n,this,P.UUID.uuid());V.setExtends(I,n),V.initChildren(n),l.push(V),n==null||n.add(V,G.Added),this.addMethod(V)}),n==null||n.attemptAutoclose("add-extended-methods",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addExtendedProperties(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-extended-properties"))){const a=[],l=[],p=[],t=[],m=this.properties,v=this.extendedPropertiesFromOriginalParents,b=v.filter(I=>v.find(B=>{var K;return((K=B.implements)==null?void 0:K.id)===I.id})?!1:!I.abstract),_=new Set(m.filter(I=>{var V;return!!((V=I.extends)!=null&&V.id)}).map(I=>I.extends.id));return b.forEach(I=>{if(_.has(I.id))return;_.add(I.id);const V=I.clone(n,this,P.UUID.uuid());V.setExtends(I,n),V.initChildren(n),l.push(V),n==null||n.add(V,G.Added),this.addProperty(V)}),n==null||n.attemptAutoclose("add-extended-properties",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addSuggestions(){return this.implements.forEach(n=>{Aj(this,n).forEach(p=>{const t=p.toJSON();t.id=`_suggestion--parent--${this.id}--${p.id}`;const m=z(t,this.project);m.suggestion=!0,m.setParent(this,null),m.initChildren(null),this.addSuggestedProperty(m)}),Ij(this,n).forEach(p=>{const t=`_suggestion--parent--${this.id}--${p.id}`,m=p.implementAsFunctionDeclaration(null,this,t),v=z(m,this.project);if(v.suggestion=!0,v.setParent(this,null),v.initChildren(null),this.methods=this.methods.filter(b=>b.id!==t),v.inputs.forEach(b=>{b.suggestion=!0}),v.returnStatements.length){const b=v.returnStatements[0];b.suggestion=!0,b.outputs.forEach(_=>{_.suggestion=!0})}this.addSuggestedMethod(v)})}),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=cr(this,n),p=this.toMeta();return this.name=n.name!==void 0?n.name:p.name,this.description=n.description!==void 0?n.description:p.description,this.x=n.x||p.x,this.y=n.y||p.y,this.static=n.static!==void 0?n.static:this.static,this.abstract=n.abstract!==void 0?n.abstract:this.abstract,super.metaSync(n),n.deleted===!0&&!p.deleted?a==null||a.add(this,G.Removed):n.deleted===!1&&p.deleted?a==null||a.add(this,G.Added):l&&(a==null||a.add(this,G.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(n=oe,...a){return await _t.repository.APILoad(this.id,...a),this}async APICreate(n=oe,...a){return await _t.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(n=oe,...a){return await _t.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(n=oe,...a){return await _t.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(n=oe,...a){return await _t.repository.APIClone(this.id,...a),this}async APILoadVersion(n=oe,a,...l){return await _t.repository.APILoadVersion(this.id,a,...l)}removeFromParent(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-from-parent"))){const a=[],l=[],p=[],t=[];if(this.parent.type===f.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===f.DataType&&this.parent.entity&&this.parent.entity.id===this.id){const m=this.parent.setEntity(null,n);a.push(m)}return n==null||n.attemptAutoclose("remove-from-parent",this.id),{added:w(p),updated:w(a),removed:w(l),affected:w(t),self:this}}remove({ignoreUpstream:n}={ignoreUpstream:!1},a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){const l=[],p=[],t=[],m=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:b,removed:_,added:I}=v.entity.onDetachedDependencyRemoved(this,v.field,a);l.push(...b),p.push(..._),t.push(...I)}),this.properties.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),this.methods.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),this.abstractMethods.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),this.suggestedProperties.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),this.suggestedMethods.forEach(v=>{const{updated:b,removed:_}=v.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}),!n){const v=this.removeFromParent(a);t.push(...v.added),l.push(...v.updated),p.push(...v.removed),m.push(...v.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:w(t),updated:w(l),removed:w(p),affected:w(m),self:this}}restore({}={},n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"restore-entity"))){const a=[],l=[],p=[],t=[];return n!=null&&n.hasAdded(this.id)?(n==null||n.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},n),Object.values(this.detachedDependents).forEach(m=>{const{updated:v,removed:b,added:_}=m.entity.onDetachedDependencyRestored(this,m.field,n);l.push(...v),p.push(...b),a.push(..._)}),this.properties.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.methods.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.abstractMethods.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.suggestedProperties.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),this.suggestedMethods.forEach(m=>{const{updated:v}=m.restore({},n);l.push(...v)}),n==null||n.attemptAutoclose("restore-entity",this.id),{added:w(a),updated:w(l),removed:w(p),affected:w(t),self:this})}toFlat(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this,...this.extends.flatMap(l=>l.toFlat(n)),...this.implements.flatMap(l=>l.toFlat(n)),...this.properties.flatMap(l=>l.toFlat(n)),...this.methods.flatMap(l=>l.toFlat(n)),...this.abstractMethods.flatMap(l=>l.toFlat(n)),...this.parent.toFlat(n)])}toFlatIds(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.id,...this.extends.flatMap(l=>l.toFlatIds(n)),...this.implements.flatMap(l=>l.toFlatIds(n)),...this.properties.flatMap(l=>l.toFlatIds(n)),...this.methods.flatMap(l=>l.toFlatIds(n)),...this.abstractMethods.flatMap(l=>l.toFlatIds(n)),...this.parent.toFlatIds(n)])}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(n=new Set){return n.has(this.id)?this.toReference():(n.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(a=>a.toJSON(n)),methods:this.methods.map(a=>a.toJSON(n)),abstractMethods:this.abstractMethods.map(a=>a.toJSON(n)),implements:this.implements.map(a=>a.toJSON(n)),extends:this.extends.map(a=>a.toJSON(n)),parent:this.parent.toReference()})}toJSONClone(n=Ce){var l,p,t,m,v;let a;return(l=n.seenEntityMaps)!=null&&l.has(this.id)?a=n.seenEntityMaps.get(this.id):(a=n.newId||hr(this,this.project,n.uuidStrategy),n.seenEntityMaps&&n.seenEntityMaps.set(this.id,a)),(p=n.seenEntities)!=null&&p.has(a)||(t=n.seenEntities)!=null&&t.has(this.id)?this.toReference({seenEntityMaps:n.seenEntityMaps}):((m=n.seenEntities)==null||m.add(a),(v=n.seenEntities)==null||v.add(this.id),{id:a,version:P.UUID.uuid(),createdAt:n.timestamp||N().toISOString(),author:P.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(b=>b.toJSONClone({...n,newId:null})),methods:this.methods.map(b=>b.toJSONClone({...n,newId:null})),abstractMethods:this.abstractMethods.map(b=>b.toJSONClone({...n,newId:null})),implements:this.implements.map(b=>b.type===f.BuiltInBaseEntity?b.toJSON():b.toJSONClone({...n,newId:null})),extends:this.extends.map(b=>b.type===f.BuiltInBaseEntity?b.toJSON():b.toJSONClone({...n,newId:null})),parent:this.parent.toReference({seenEntityMaps:n.seenEntityMaps})})}toReference(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a,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(p=>p.toReference(n)),methods:this.methods.map(p=>p.toReference(n)),abstractMethods:this.abstractMethods.map(p=>p.toReference(n)),implements:this.implements.map(p=>p.toReference(n)),extends:this.extends.map(p=>p.toReference(n)),parent:this.parent.toReference(n)}}toFlatJSON(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(l=>l.toFlatJSON(n)),...this.methods.flatMap(l=>l.toFlatJSON(n)),...this.abstractMethods.flatMap(l=>l.toFlatJSON(n)),...this.implements.flatMap(l=>l.toFlatJSON(n)),...this.extends.flatMap(l=>l.toFlatJSON(n)),...this.parent.toFlatJSON(n)])}toGenerationTarget(){const n=this.parent.type===f.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(a=>a.id),implements:this.implements.map(a=>a.id),parent:n}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(l=>l.toFlatGenerationTarget(n)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(n)),...this.abstractMethods.flatMap(l=>l.toFlatGenerationTarget(n)),...this.implements.filter(l=>l.type===f.DefinitionEntity).flatMap(l=>l.toFlatGenerationTarget(n)),...this.implements.filter(l=>l.type===f.DefinitionEntity).flatMap(l=>l.toFlatGenerationTarget(n)),...this.parent.toFlatGenerationTarget(n)])}clearErrors(){return this.errors=[],this.properties.forEach(n=>n.clearErrors()),this.methods.forEach(n=>n.clearErrors()),this.abstractMethods.forEach(n=>n.clearErrors()),this}validate(){return this.errors=bj(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(a=>a.getErrors()),...this.methods.flatMap(a=>a.getErrors()),...this.abstractMethods.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}clone(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"clone-entity")),a=null,l=null,p=!0){var q,Z,Q;let t=yr(a,this);const m=this.toJSON(),v=l||P.UUID.uuid();m.properties=[],m.methods=[],m.abstractMethods=[];const b=v.split("-id"),_=b[b.length-1||0]||v;m.id=v,m.version=P.UUID.uuid(),m.createdAt=(n==null?void 0:n.timestamp)||N().toISOString(),m.author=(n==null?void 0:n.author)||"1",m.previousVersion=null,m.deleted=!1;const I=er(m,t);a&&I.setParent(a,null),p&&I.subscribe(),I.initChildren(n),n==null||n.add(I,G.Added);const V=(q=this.properties)==null?void 0:q.map(ue=>ue.clone(n,I,P.UUID.uuid(),p));I.properties=V;const B=(Z=this.methods)==null?void 0:Z.map((ue,re)=>ue.clone(n,I,_+"-method-"+re+"-id",p));I.methods=B;const K=(Q=this.abstractMethods)==null?void 0:Q.map((ue,re)=>ue.clone(n,I,_+"-abstract-method-"+re+"-id",p));return I.abstractMethods=K,n==null||n.attemptAutoclose("clone-entity",this.id),I}getFunctionDeclaration(n){return this.methods.find(a=>a.id===n)}implement(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"implement-definition-entity")),l){const p=hy(this,n,a,l);return a==null||a.attemptAutoclose("implement-definition-entity",this.id),p}getAllInteractiveMethods(){const n=this.implements.filter(l=>l.type===f.DefinitionEntity||l.type===f.BuiltInBaseEntity&&l.interactive);return w([...this.methods,...this.extends.flatMap(l=>l.getAllInteractiveMethods()),...n.flatMap(l=>l.getAllInteractiveMethods())])}inferFromInputs(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const l=[],p=[],t=[],m=[];if(this.parent.type!==f.DataType||!this.parent.inferred)return a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const v=[];n.forEach(I=>{v.find(B=>pe(B,this.project)===pe(I,this.project))||v.push(I)});const b=this.properties.filter(I=>!I.dataType);v.forEach(I=>{var Q,ue;const V=b.find(re=>pe(re,this.project)===pe(I,this.project));if(!V)return;const K=Mo(I.parent).getMasterInputWithValueWritterFromAllInstances(I),q=xs(K,a),Z=q==null?void 0:q.clone(a,V,P.UUID.uuid(),!0);Z&&((Q=V.dataType)==null||Q.merge(Z,a),Z.id!==((ue=V.dataType)==null?void 0:ue.id)&&Z.remove({ignoreUpstream:!1},a),V.dataType&&(V.dataType.metaSync({inferred:!0,like:!0},a),V.setDataType(V.dataType,a),a==null||a.add(V,G.Affected))),I.setDeclaration(V),a==null||a.add(I,G.Updated)});const _=[];return v.forEach(I=>{if(!I.declaration){_.push(I);return}}),_.length===0?(a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(_.forEach(I=>{var re,_e,X,Ee;const V=this.properties.find(se=>pe(se,this.project)===pe(I,this.project));if(V){if(I.setDeclaration(V),!V.getDataType(a)){const de=Mo(I.parent).getMasterInputWithValueWritterFromAllInstances(I),ye=xs(de),H=ye==null?void 0:ye.clone(a,V,P.UUID.uuid(),!0);H&&((re=V.dataType)==null||re.merge(H,a),H.id!==((_e=V.dataType)==null?void 0:_e.id)&&H.remove({ignoreUpstream:!1},a),V.dataType&&(V.dataType.metaSync({inferred:!0,like:!0},a),V.setDataType(V.dataType,a),a==null||a.add(V,G.Affected)))}return}const B={id:P.UUID.uuid(),type:f.Property,version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:pe(I,this.project),description:I.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:I.index,implements:null,extends:null,dataType:null,parent:this.toReference()},K=z(B,this.project);K.setParent(this,a),K.initChildren(a),a==null||a.add(K,G.Added);const Z=Mo(I.parent).getMasterInputWithValueWritterFromAllInstances(I),Q=xs(Z),ue=Q==null?void 0:Q.clone(a,K,P.UUID.uuid(),!0);return ue&&((X=K.dataType)==null||X.merge(ue,a),ue.id!==((Ee=K.dataType)==null?void 0:Ee.id)&&ue.remove({ignoreUpstream:!1},a),K.dataType&&(K.dataType.metaSync({inferred:!0,like:!0},a),K.setDataType(K.dataType,a),a==null||a.add(K,G.Affected))),this.addProperty(K),I.setDeclaration(K),a==null||a.add(I,G.Updated),K}),a==null||a.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:w(l),updated:w(p),removed:w(t),affected:w(m),self:this})}getRawDefaultValue(){const n={};return this.properties.forEach(a=>{var p;const l=Ra(a.name);n[l]=((p=a.getDefaultValue())==null?void 0:p.value)||null}),n}getActiveRawDefaultValue(){const n={};return this.properties.forEach(a=>{const l=Ra(a.name),p=this.project.requestActiveValue(a);n[l]=(p==null?void 0:p.value)||null}),n}};g(_t,"repository",{APICreate:async(n,...a)=>n,APIUpdate:async(n,...a)=>n,APIDelete:async(n,...a)=>n,APIClone:async(n,...a)=>{},APILoad:async(n,...a)=>null,APILoadVersion:async(n,a,...l)=>null}),g(_t,"type",f.DefinitionEntity),g(_t,"USER_MANAGED_PARENT_TYPES",[f.Project,f.DataType]),g(_t,"PARENT_TYPES",[..._t.USER_MANAGED_PARENT_TYPES]),g(_t,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),g(_t,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(_t,"BASE_PROPERTIES",[..._t.MUTABLE_BASE_PROPERTIES,..._t.INMUTABLE_BASE_PROPERTIES]),g(_t,"MUTABLE_META_PROPERTIES",[..._t.MUTABLE_BASE_PROPERTIES,"x","y"]),g(_t,"INMUTABLE_META_PROPERTIES",[..._t.INMUTABLE_BASE_PROPERTIES]),g(_t,"META_PROPERTIES",[..._t.MUTABLE_META_PROPERTIES,..._t.INMUTABLE_META_PROPERTIES]),g(_t,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),g(_t,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),g(_t,"UPSTREAM_PROPERTIES",[..._t.MUTABLE_UPSTREAM_PROPERTIES,..._t.INMUTABLE_UPSTREAM_PROPERTIES]),g(_t,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),g(_t,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(_t,"DOWNSTREAM_PROPERTIES",[..._t.MUTABLE_DOWNSTREAM_PROPERTIES,..._t.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(_t,"PROPERTIES",[..._t.META_PROPERTIES,..._t.UPSTREAM_PROPERTIES,..._t.DOWNSTREAM_PROPERTIES]);let ia=_t;function Cye(u){const d=Boe(),n=u.toJSON();d.safeParse(n).success;const l=[];return qt(u.errors,l)}const fp=class fp extends nr{constructor(n,a){super(n);g(this,"initialData");g(this,"id");g(this,"version");g(this,"name");g(this,"description",null);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",!1);g(this,"static");g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"interactive",!1);g(this,"errors",[]);g(this,"project");this.initialData=this.initialData||n,this.project=this.project||a,this.id=this.id||n.id,this.version=this.version||n.version,this.name=this.name||n.name,this.static=this.static||n.static,this.interactive=this.interactive||n.interactive,this.abstract=n.abstract,this.properties=this.initialData.properties.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.extends=this.initialData.extends.map(l=>z(l,this.project))}get allMethods(){return w([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return w([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allMethods,[])])}get allBasePropertiesFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allProperties,[])])}get allBasePropertiesFromExtendedAndImplementedEntities(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...n,...l]},[]))}get extendedPropertiesFromOriginalParents(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...n,...l]},[]))}get implementedPropertiesFromOriginalParents(){return w([...this.extends.reduce((n,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(m=>m.name===t.name));return[...l,...p,...n]},[])])}get extendedProperties(){return this.properties.filter(n=>n.isExtendedProperty)}get ownDeclaredMethods(){return this.methods.filter(n=>!n.isExtendedMethod)}get ownDeclaredProperties(){return this.properties.filter(n=>!n.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(n=oe,...a){return await fp.repository.APILoad(this.id,...a),this}toFlat(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this,...this.properties.flatMap(l=>l.toFlat(n)),...this.methods.flatMap(l=>l.toFlat(n)),...this.abstractMethods.flatMap(l=>l.toFlat(n)),...this.extends.flatMap(l=>l.toFlat(n))])}toFlatIds(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.id,...this.properties.flatMap(l=>l.toFlatIds(n)),...this.methods.flatMap(l=>l.toFlatIds(n)),...this.abstractMethods.flatMap(l=>l.toFlatIds(n)),...this.extends.flatMap(l=>l.toFlatIds(n))])}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(n=new Set){return n.has(this.id)?this.toReference():(n.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(a=>a.toJSON(n)),methods:this.methods.map(a=>a.toJSON(n)),abstractMethods:this.abstractMethods.map(a=>a.toJSON(n)),extends:this.extends.map(a=>a.toJSON(n))})}toReference(n=Ce){return{id:this.id+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){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(a=>a.toReference()),methods:this.methods.map(a=>a.toReference()),abstractMethods:this.abstractMethods.map(a=>a.toReference()),extends:this.extends.map(a=>a.toReference())}}toFlatJSON(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(l=>l.toFlatJSON(n)),...this.methods.flatMap(l=>l.toFlatJSON(n)),...this.abstractMethods.flatMap(l=>l.toFlatJSON(n))])}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(n=>n.id)}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(l=>l.toFlatGenerationTarget(n)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(n)),...this.abstractMethods.flatMap(l=>l.toFlatGenerationTarget(n))])}clearErrors(){return this.errors=[],this.properties.forEach(n=>n.clearErrors()),this.methods.forEach(n=>n.clearErrors()),this.abstractMethods.forEach(n=>n.clearErrors()),this}validate(){const n=Cye(this);return this.errors=n,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(a=>a.getErrors()),...this.methods.flatMap(a=>a.getErrors()),...this.abstractMethods.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}implement(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),null,!0,"implement-built-in-base-entity")),l){const p=hy(this,n,a,l);return a==null||a.attemptAutoclose("implement-built-in-base-entity",this.id),p}getAllInteractiveMethods(){const n=[];return this.interactive&&(n.push(...this.methods),this.extends.filter(l=>l.type===f.BuiltInBaseEntity&&l.interactive||l.type===f.PrimitiveEntity).forEach(l=>{l instanceof fp&&n.push(...l.getAllInteractiveMethods())})),w(n)}};g(fp,"repository",{APILoad:async(n,...a)=>null});let En=fp;function Pye(u){const d=goe(),n=u.toJSON();d.safeParse(n).success;const l=[];return qt(u.errors,l)}const $y=class $y extends nr{constructor(n,a){super(n);g(this,"initialData");g(this,"id");g(this,"name");g(this,"description",null);g(this,"type",f.PrimitiveEntity);g(this,"static");g(this,"abstract");g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=n,this.project=a,this.id=n.id,this.name=n.name,this.static=n.static,this.abstract=n.abstract,this.properties=this.initialData.properties.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=z(l,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=z(l,this.project);return p.parent=this,p})}get allMethods(){return w([...this.ownDeclaredMethods,...this.allBaseMethodsFromOriginalParents])}get allProperties(){return w([...this.ownDeclaredProperties,...this.allBasePropertiesFromOriginalParents])}get allBaseMethodsFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allMethods,[])])}get allBasePropertiesFromOriginalParents(){return w([...this.extends.flatMap(n=>n.allProperties,[])])}get allBasePropertiesFromExtendedAndImplementedEntities(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.allBasePropertiesFromExtendedAndImplementedEntities].filter(p=>!p.abstract);return[...n,...l]},[]))}get extendedPropertiesFromOriginalParents(){return w(this.extends.reduce((n,a)=>{const l=[...a.ownDeclaredProperties,...a.extendedPropertiesFromOriginalParents].filter(p=>!p.abstract);return[...n,...l]},[]))}get implementedPropertiesFromOriginalParents(){return w([...this.extends.reduce((n,a)=>{const l=a.implementedPropertiesFromOriginalParents,p=[...a.ownDeclaredProperties].filter(t=>!!t.abstract&&!l.find(m=>m.name===t.name));return[...l,...p,...n]},[])])}get extendedProperties(){return this.properties.filter(n=>n.isExtendedProperty)}get ownDeclaredMethods(){return this.methods.filter(n=>!n.isExtendedMethod)}get ownDeclaredProperties(){return this.properties.filter(n=>!n.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(n=oe,...a){return await $y.repository.APILoad(this.id,...a),this}toFlat(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this,...this.properties.flatMap(l=>l.toFlat(n)),...this.methods.flatMap(l=>l.toFlat(n)),...this.abstractMethods.flatMap(l=>l.toFlat(n))])}toFlatIds(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.id,...this.properties.flatMap(l=>l.toFlatIds(n)),...this.methods.flatMap(l=>l.toFlatIds(n)),...this.abstractMethods.flatMap(l=>l.toFlatIds(n))])}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(n=new Set){return n.has(this.id)?this.toReference():(n.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(a=>a.toJSON(n)),methods:this.methods.map(a=>a.toJSON(n)),abstractMethods:this.abstractMethods.map(a=>a.toJSON(n)),extends:this.extends.map(a=>a.toJSON(n))})}toReference(n=Ce){return{id:this.id+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){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(a=>a.toReference()),methods:this.methods.map(a=>a.toReference()),abstractMethods:this.abstractMethods.map(a=>a.toReference()),extends:this.extends.map(a=>a.toReference())}}toFlatJSON(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(l=>l.toFlatJSON(n)),...this.methods.flatMap(l=>l.toFlatJSON(n)),...this.abstractMethods.flatMap(l=>l.toFlatJSON(n))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(n=>n.id)}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(l=>l.toFlatGenerationTarget(n)),...this.methods.flatMap(l=>l.toFlatGenerationTarget(n)),...this.abstractMethods.flatMap(l=>l.toFlatGenerationTarget(n))])}clearErrors(){return this.errors=[],this.properties.forEach(n=>n.clearErrors()),this.methods.forEach(n=>n.clearErrors()),this.abstractMethods.forEach(n=>n.clearErrors()),this}validate(){const n=Pye(this);return this.errors=n,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(a=>a.getErrors()),...this.methods.flatMap(a=>a.getErrors()),...this.abstractMethods.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const n=[];return n.push(...this.methods),this.extends.filter(l=>l.type===f.BuiltInBaseEntity&&l.interactive||l.type===f.PrimitiveEntity).forEach(l=>{l instanceof En&&n.push(...l.getAllInteractiveMethods())}),w(n)}};g($y,"repository",{APILoad:async(n,...a)=>null});let Ri=$y;function er(u,d){if(!u)throw new Error("Entity is null");const n=d.get(u.id);switch(u.type){case f.LiteralValue:return n||new Fs(u,d);case f.DefinitionEntity:return n||new ia(u,d);case f.PrimitiveEntity:return n||new Ri(u,d);case f.FunctionDeclaration:return n||new _a(u,d);case f.GlobalEvent:return n||new $a(u,d);case f.DataType:return n||new ji(u,d);case f.Property:return n||new Xn(u,d);case f.FunctionCall:return n||new Fa(u,d);case f.Condition:return n||new Ca(u,d);case f.Operation:return n||new Da(u,d);case f.VariableDeclaration:return n||new Va(u,d);case f.VariableInstance:return n||new Pa(u,d);case f.OutputMap:return n||new Ks(u,d);case f.ReturnDeclaration:return n||new wi(u,d);case f.ArgumentDeclaration:return n||new ea(u,d);case f.InputMap:return n||new Es(u,d);case f.Project:return n||new P(u);case f.InstalledProject:return n||new La(u,d);case f.ActionDescriptor:return n||new Lt(u,d);case f.ReturnStatement:return n||new ga(u,d);case f.Loop:return n||new Oa(u,d);case f.Search:return n||new Na(u,d);case f.ValueDescriptor:return n||new ks(u,d);case f.BuiltInBaseEntity:return n||new En(u,d);case f.InternalCall:return n||new Ma(u,d);case f.ContinueStatement:return n||new Qr(u,d);case f.BreakStatement:return n||new Ba(u,d);case f.GenericReference:return d.get(u.entityId);default:throw new Error("Invalid entity type: "+u.type)}}function z(u,d){if(!u)throw new Error("Entity is null");const n=er(u,d);return n.subscribe(),n}function Vye(u,d){if(!u)throw new Error("Entity is null");switch(u.type){case f.LiteralValue:return Fs.fromGenerationTarget(u,d);case f.DefinitionEntity:return ia.fromGenerationTarget(u,d);case f.FunctionDeclaration:return _a.fromGenerationTarget(u,d);case f.GlobalEvent:return $a.fromGenerationTarget(u,d);case f.DataType:return ji.fromGenerationTarget(u,d);case f.Property:return Xn.fromGenerationTarget(u,d);case f.FunctionCall:return Fa.fromGenerationTarget(u,d);case f.Condition:return Ca.fromGenerationTarget(u,d);case f.Operation:return Da.fromGenerationTarget(u,d);case f.VariableDeclaration:return Va.fromGenerationTarget(u,d);case f.VariableInstance:return Pa.fromGenerationTarget(u,d);case f.OutputMap:return Ks.fromGenerationTarget(u,d);case f.ReturnDeclaration:return wi.fromGenerationTarget(u,d);case f.ArgumentDeclaration:return ea.fromGenerationTarget(u,d);case f.InputMap:return Es.fromGenerationTarget(u,d);case f.InstalledProject:return La.fromGenerationTarget(u,d);case f.ReturnStatement:return ga.fromGenerationTarget(u,d);case f.Loop:return Oa.fromGenerationTarget(u,d);case f.Search:return Na.fromGenerationTarget(u,d);case f.ActionDescriptor:return Lt.fromGenerationTarget(u,d);case f.ValueDescriptor:return ks.fromGenerationTarget(u,d);case f.InternalCall:return Ma.fromGenerationTarget(u,d);case f.ContinueStatement:return Qr.fromGenerationTarget(u,d);case f.BreakStatement:return Ba.fromGenerationTarget(u,d);default:throw new Error("Invalid entity type: "+u.type)}}const Ce={seenEntityMaps:new Map,seenEntities:new Set,timestamp:N().toISOString()};class wj{constructor(){g(this,"initialData")}}const oe={cascade:!1},Rj={APILoad:async(u,...d)=>null},Nye={APICreate:async(u,...d)=>u,APIUpdate:async(u,...d)=>u,APIDelete:async(u,...d)=>u,APIClone:async(u,...d)=>{},APILoadVersion:async(u,d,...n)=>null,...Rj};class Lye{}class Mye extends wj{}class Bye{}class Uye{}class jye{}class Lb{}class xye extends Lb{}class Fye extends Lb{}class Gye{}class up{static initReadsValue(d){if(d.initialData.readsValue&&d.initialData.readsValue.type!==f.GenericReference)d.readsValue=z(d.initialData.readsValue,d.project);else if(d.initialData.readsValue&&d.initialData.readsValue.type===f.GenericReference){const n=ss(d.initialData.readsValue,d.project);n&&(d.readsValue=n)}if(d.readsValue){if(lr.includes(d.readsValue.type)){let n=d.parent;br.includes(n.type)||(n=n.parent);const a=d.type===f.InputMap&&d.parent.type===f.Loop;a&&(n=d.parent.parent),d.readsValue.setParent(n,null),d.readsValue.initChildren(null),n&&n.type!==f.Project&&!a&&n.detachedChildren.includes(d)?n.replaceDetachedChild(d,d.readsValue):n&&n.type!==f.Project&&!a&&n.subscribeDetachedChild(d.readsValue)}d.readsValue.addValueReader(d,null)}return d.readsValue}}class cp{static initWritesValues(d,n){const a=d.initialData.writesValues.reduce((p,t)=>{if(t.type===f.GenericReference||d.writesValues.some(v=>v.id===t.id))return p;const m=z(t,d.project);return m.setValueWriter(d,null),lr.includes(m.type)&&(m.setParent(n,null),m.initChildren(null)),[...p,m]},[]),l=[...d.writesValues];return d.writesValues=w([...l,...a]),d.writesValues}}class Kye{}class kye{constructor(d){g(this,"eventName");g(this,"callbacks",[]);this.eventName=d}on(d){if(typeof d!="function")throw new Error("Event callback must be a function");this.callbacks.includes(d)||this.callbacks.push(d)}off(d){if(typeof d!="function")throw new Error("Event callback must be a function");this.callbacks=this.callbacks.filter(n=>n!==d)}destroy(){this.callbacks=[]}}class Mb{constructor(){g(this,"subscribedEvents",{});g(this,"on",this._on);g(this,"emit",this._emit);g(this,"off",this._off);g(this,"destroy",this._destroy)}getEvent(d){return this.subscribedEvents[d]||(this.subscribedEvents[d]=new kye(d)),this.subscribedEvents[d]}_on(d,n){this.getEvent(d).on(n)}_emit(d,...n){const a=this.getEvent(d);a&&a.callbacks.forEach(l=>{l.apply(null,n)})}_off(d,n){const a=this.getEvent(d);a&&(n?a.off(n):(a.destroy(),delete this.subscribedEvents[d]))}_destroy(){Object.keys(this.subscribedEvents).forEach(d=>{this._off(d)}),this.subscribedEvents={}}}var ar=(u=>(u.PROJECT_INITIALIZED="project-initialized",u.CHANGE_SET_CLOSED="change-set-closed",u.EXPLICIT_DEFINITION_ENTITY_ADDED="explicit-definition-entity-added",u.EXPLICIT_DEFINITION_ENTITY_REMOVED="explicit-definition-entity-removed",u.EXPLICIT_DEFINITION_ENTITY_UPDATED="explicit-definition-entity-updated",u.PERSISTED_DEFINITION_ENTITY_ADDED="persisted-definition-entity-added",u.PERSISTED_DEFINITION_ENTITY_REMOVED="persisted-definition-entity-removed",u.PERSISTED_DEFINITION_ENTITY_UPDATED="persisted-definition-entity-updated",u.RELATIONAL_DATABASE_DEFINITION_ENTITY_ADDED="relational-database-definition-entity-added",u.RELATIONAL_DATABASE_DEFINITION_ENTITY_REMOVED="relational-database-definition-entity-removed",u.RELATIONAL_DATABASE_DEFINITION_ENTITY_UPDATED="relational-database-definition-entity-updated",u))(ar||{});function qye(u,d){d.forEach(n=>{Object.getOwnPropertyNames(n.prototype).forEach(a=>{a!=="constructor"&&Object.defineProperty(u.prototype,a,Object.getOwnPropertyDescriptor(n.prototype,a))})})}class _j extends nr{constructor(...d){super(...d),Object.assign(this,new Mb)}}qye(_j,[Mb]);const Fe=class Fe extends _j{constructor(n){super(n);g(this,"initialData");g(this,"id");g(this,"type",f.Project);g(this,"name",null);g(this,"description",null);g(this,"x");g(this,"y");g(this,"entities",[]);g(this,"projects",[]);g(this,"functions",[]);g(this,"events",[]);g(this,"variableDeclarations",[]);g(this,"variableInstances",[]);g(this,"conditions",[]);g(this,"operations",[]);g(this,"functionCalls",[]);g(this,"loops",[]);g(this,"searches",[]);g(this,"primitives",[]);g(this,"builtInBaseEntities",[]);g(this,"operationDeclarations",[]);g(this,"globalEventActionDescriptors",[]);g(this,"loopDeclarations",[]);g(this,"loopDeclarationsBodies",[]);g(this,"conditionDeclarations",[]);g(this,"valueDescriptors",[]);g(this,"dataTypes",[]);g(this,"project");g(this,"instances",{});g(this,"builtInInstances",{});g(this,"deletedInstances",{});g(this,"errors",[]);g(this,"references",[]);g(this,"history",[]);g(this,"undoableStackValueIndex",-1);g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);g(this,"onCloseChangeSetCallback",null);g(this,"onAddChangeSetCallback",null);g(this,"onDiscardChangeSetCallback",null);g(this,"onRequestActiveValueCallback",null);this.initialData=n,this.id=n.id,this.name=n.name,this.description=n.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!Fe.UUID||Fe.UUID.isBackup)&&(Fe.UUID=eh==null?void 0:eh()),Fe.UUID||(Fe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:a=>a})}catch(a){console.error("Error initializing UUID module",a),Fe.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:l=>l}}}static injectUUIDModule(n){Fe.UUID=n}static new(n=null){return{id:Fe.UUID.uuid(),version:Fe.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||N().toISOString(),author:(n==null?void 0:n.author)||Fe.sessionAuthor,previousVersion:null,deleted:!1,type:f.Project,name:"",description:"",entities:[],functions:[],events:[],projects:[],variableDeclarations:[],variableInstances:[],conditions:[],operations:[],functionCalls:[],loops:[],searches:[]}}static validateGenerationTarget(n,a){let l=JSON.parse(JSON.stringify(n));const p=[];return p.push(...ur(l)),{errors:p,modifiedData:l}}async closePendingChangeSets(){const n=this.history.find(a=>a.dirty&&!a.open);n&&await this.closeChangeSet(n)}onRequestActiveValue(n){this.onRequestActiveValueCallback=n}async onCloseChangeSet(n){this.onCloseChangeSetCallback=n,await this.closePendingChangeSets()}onAddChangeSet(n){this.onAddChangeSetCallback=n}onDiscardChangeSet(n){this.onDiscardChangeSetCallback=n}async closeChangeSet(n){const a=this.history.findIndex(t=>t.id===n.id),l=this.history.slice(0,a),p=l[l.length-1];if(!(p!=null&&p.dirty)&&this.onCloseChangeSetCallback){(await this.onCloseChangeSetCallback(n)).success&&(n.dirty=!1,this.emit("change-set-closed",n),this.closePendingChangeSets());return}}toLatestChangeSet(n,a,l,p=!1,t="here-this"){if(!this.history.length)return new F(this,n,a,l,p,t);const m=this.history[this.history.length-1];return m.open?m:this.addChangeSet(new F(this,n,a,l,p,t))}addChangeSet(n){var p,t;if(!this.history.length)return this.undoableStackValueIndex=eM(this.undoableStackValueIndex,this.history,n),(p=this.onAddChangeSetCallback)==null||p.call(this,n,this.undoableStackValueIndex),n;const a=this.history.find(m=>m.id===(n==null?void 0:n.id));if(a)return a;const l=this.history.find(m=>m.open);if(l)throw console.warn("Previous still open: ",l),console.warn("New change set: ",n),new Error(`There is already an open change-set with id '${l.id}'.`);return this.undoableStackValueIndex=eM(this.undoableStackValueIndex,this.history,n),(t=this.onAddChangeSetCallback)==null||t.call(this,n,this.undoableStackValueIndex),n}discardChangeSet(n){var l;const a=this.history.findIndex(p=>p.id===(n==null?void 0:n.id));return a!==-1&&(this.history.splice(a,1),this.undoableStackValueIndex=this.undoableStackValueIndex-1,(l=this.onDiscardChangeSetCallback)==null||l.call(this,n)),this}async inject(...n){return await Promise.all(n.map(a=>new Promise(async l=>{await a.init(this),l(null)}))),this}validateGeneratedUpdate(n){return{errors:[],modifiedData:n}}subscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(n=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(m=>{const v=m.entity.afterAllChildrenInitialized(n);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),n==null||n.attemptAutoclose("sync-dependents",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}onDetachedDependencyRemoved(n,a,l){const p=[],t=[],m=[],v=[];return{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}onDetachedDependencyRestored(n,a,l){const p=[],t=[],m=[],v=[];return{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}unsubscribeFromDependencies(){return this}subscribeToDependencies(){return this}increaseVersion(n){if(n&&!N(n).isValid())throw new Error(`The shared timestamp '${n}' is not a valid ISO 8601 date string.`);return n&&N(n).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=Fe.UUID.uuid(),this.createdAt=N(n).toISOString()||N().toISOString(),this)}captureVersion(){var a;const n=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Fe(this);return n.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,n):new Map([[this.version,n]]),n.entities=[...this.entities],n.projects=[...this.projects],n.functions=[...this.functions],n.events=[...this.events],n.variableDeclarations=[...this.variableDeclarations],n.variableInstances=[...this.variableInstances],n.conditions=[...this.conditions],n.operations=[...this.operations],n.functionCalls=[...this.functionCalls],n.loops=[...this.loops],n.searches=[...this.searches],this}recursiveCaptureUpstreamVersions(n){const a=[],l=[],p=[],t=[];return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}async restoreVersion(n){var v;const a=[],l=[],p=[],t=[];if(this.version===n)return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this};if(!this.knownVersions){const b=new Map;for(const[_,I]of this.knownVersions||new Map){if(b.set(_,I),I.activeVersion=!1,I.knownVersions)for(const[V,B]of I.knownVersions)b.set(V,B);I.knownVersions=null}}let m=(v=this.knownVersions)==null?void 0:v.get(n);if(!m){const b=await this.APILoadVersion({},n);if(!b)throw new Error(`Version with id '${n}' for entity with id '${this.id}' not found.`);m=new Fe(b)}return this.metaSync(m.toShallowJSON(),null),this.previousVersion=m.previousVersion,this.version=m.version,this.createdAt=m.createdAt,this.author=m.author,this.deleted=m.deleted,this.entities=m.entities,this.projects=m.projects,this.functions=m.functions,this.events=m.events,this.variableDeclarations=m.variableDeclarations,this.variableInstances=m.variableInstances,this.conditions=m.conditions,this.operations=m.operations,this.functionCalls=m.functionCalls,this.loops=m.loops,this.searches=m.searches,{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}updateWithShallowTransfer(n,a=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"update-with-shallow-transfer"))){return this.metaSync(n,a),this.version=n.version,this.createdAt=n.createdAt,this.author=n.author,this.deleted=n.deleted,this.previousVersion=n.previousVersion,this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const n=[],a=[],l=[],p=[];return{updated:w(n),added:w(a),removed:w(l),affected:w(p),self:this}}afterAllChildrenInitialized(n=null){const a=[],l=[],p=[],t=[];return this.initialized||(this.initialized=!0,this.emit("project-initialized",this,n)),this.validate(),this.captureVersion(),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addSelfToProject(n){const a=[],l=[],p=[],t=[];return this.subscribe(),this.subscribeToDependencies(),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(n){return this.operationDeclarations.includes(n)}isGlobalEventActionDescriptor(n){return this.globalEventActionDescriptors.includes(n)}isLoopDeclaration(n){return this.loopDeclarations.includes(n)}isConditionDeclaration(n){return this.conditionDeclarations.includes(n)}initChildren(n=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.projects=this.initialData.projects.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.variableDeclarations=this.initialData.variableDeclarations.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.variableInstances=this.initialData.variableInstances.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.conditions=this.initialData.conditions.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.operations=this.initialData.operations.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.functions=this.initialData.functions.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.events=this.initialData.events.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.functionCalls=this.initialData.functionCalls.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.loops=this.initialData.loops.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.searches=this.initialData.searches.map(a=>{const l=z(a,this);return l.setParent(this,null),l.initChildren(n),l}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(n),n==null||n.attemptAutoclose("init-children",this.id),this)}subscribeInstance(n){return(!this.instances[n.id]||this.instances[n.id]!==n)&&(this.instances[n.id]=n),this}subscribeDeletedInstance(n){return(!this.deletedInstances[n.id]||this.deletedInstances[n.id]!==n)&&(this.deletedInstances[n.id]=n),this}subscribeBuiltInInstance(n){return(!this.builtInInstances[n.id]||this.builtInInstances[n.id]!==n)&&(this.builtInInstances[n.id]=n),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(n){return delete this.instances[n.id],this}unsubscribeDeletedInstance(n){return delete this.deletedInstances[n.id],this}findSubscribedBuiltInInstance(n){return this.builtInInstances[n.id]||null}get(n){return this.instances[n]||this.builtInInstances[n]||null}getDeleted(n){return this.deletedInstances[n]||null}getManaged(n){return this.getBuiltIn(n)?null:this.instances[n]||null}getBuiltIn(n){return this.builtInInstances[n]||null}findSubscribedInstanceFromReference(n){return this.instances[n.entityId]||null}findSubscribedBuiltInInstanceFromReference(n){return this.builtInInstances[n.entityId]||null}metaSync(n,a=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=cr(this,n),p=this.toMeta();return this.name=n.name!==void 0?n.name:p.name,this.description=n.description!==void 0?n.description:p.description,this.x=n.x||p.x,this.y=n.y||p.y,super.metaSync(n),n.deleted===!0&&!p.deleted?a==null||a.add(this,G.Removed):n.deleted===!1&&p.deleted?a==null||a.add(this,G.Added):l&&(a==null||a.add(this,G.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(n=oe,...a){return await Fe.repository.APILoad(this.id,...a),this}async APICreate(n=oe,...a){return await Fe.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(n=oe,...a){return await Fe.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(n=oe,...a){return await Fe.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(n=oe,...a){return await Fe.repository.APIClone(this.id,...a),this}async APILoadVersion(n=oe,a,...l){return await Fe.repository.APILoadVersion(this.id,a,...l)}remove({ignoreUpstream:n}={ignoreUpstream:!1},a=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},n=this.project.addChangeSet(new F(this.project,Fe.sessionAuthor,N().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}getAllBuiltInIds(){const n=new Set;return[...this.primitives.flatMap(a=>a.toFlatIds(n)),...this.builtInBaseEntities.flatMap(a=>a.toFlatIds(n)),...this.operationDeclarations.flatMap(a=>a.toFlatIds(n)),...this.globalEventActionDescriptors.flatMap(a=>a.toFlatIds(n)),...this.loopDeclarations.flatMap(a=>a.toFlatIds(n)),...this.conditionDeclarations.flatMap(a=>a.toFlatIds(n)),...this.valueDescriptors.flatMap(a=>a.toFlatIds(n)),...this.dataTypes.flatMap(a=>a.toFlatIds(n))]}getAllBuiltIn(){const n=new Set;return[...this.primitives.flatMap(a=>a.toFlat(n)),...this.builtInBaseEntities.flatMap(a=>a.toFlat(n)),...this.operationDeclarations.flatMap(a=>a.toFlat(n)),...this.globalEventActionDescriptors.flatMap(a=>a.toFlat(n)),...this.loopDeclarations.flatMap(a=>a.toFlat(n)),...this.conditionDeclarations.flatMap(a=>a.toFlat(n)),...this.valueDescriptors.flatMap(a=>a.toFlat(n)),...this.dataTypes.flatMap(a=>a.toFlat(n))]}toFlat(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this,...this.entities.flatMap(l=>l.toFlat(n)),...this.functions.flatMap(l=>l.toFlat(n)),...this.events.flatMap(l=>l.toFlat(n)),...this.projects.flatMap(l=>l.toFlat(n)),...this.variableDeclarations.flatMap(l=>l.toFlat(n)),...this.variableInstances.flatMap(l=>l.toFlat(n)),...this.conditions.flatMap(l=>l.toFlat(n)),...this.operations.flatMap(l=>l.toFlat(n)),...this.functionCalls.flatMap(l=>l.toFlat(n)),...this.loops.flatMap(l=>l.toFlat(n)),...this.searches.flatMap(l=>l.toFlat(n))])}toFlatIds(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.id,...this.entities.flatMap(l=>l.toFlatIds(n)),...this.functions.flatMap(l=>l.toFlatIds(n)),...this.events.flatMap(l=>l.toFlatIds(n)),...this.projects.flatMap(l=>l.toFlatIds(n)),...this.variableDeclarations.flatMap(l=>l.toFlatIds(n)),...this.variableInstances.flatMap(l=>l.toFlatIds(n)),...this.conditions.flatMap(l=>l.toFlatIds(n)),...this.operations.flatMap(l=>l.toFlatIds(n)),...this.functionCalls.flatMap(l=>l.toFlatIds(n)),...this.loops.flatMap(l=>l.toFlatIds(n)),...this.searches.flatMap(l=>l.toFlatIds(n))])}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(n=new Set){return n.has(this.id)?this.toReference():(n.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(a=>a.toJSON(n)),variableDeclarations:this.variableDeclarations.map(a=>a.toJSON(n)),variableInstances:this.variableInstances.map(a=>a.toJSON(n)),conditions:this.conditions.map(a=>a.toJSON(n)),operations:this.operations.map(a=>a.toJSON(n)),loops:this.loops.map(a=>a.toJSON(n)),searches:this.searches.map(a=>a.toJSON(n)),functions:this.functions.map(a=>a.toJSON(n)),events:this.events.map(a=>a.toJSON(n)),projects:this.projects.map(a=>a.toJSON(n)),functionCalls:this.functionCalls.map(a=>a.toJSON(n))})}toJSONClone(n={uuidStrategy:"uuid"}){const a=new Map,l=new Set,p=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(t=>{if(p.includes(t)){a.set(t,t);return}a.set(t,Fe.UUID.uuid())}),l.add(this.id),{id:a.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(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),projects:this.projects.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),variableDeclarations:this.variableDeclarations.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),variableInstances:this.variableInstances.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),conditions:this.conditions.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),operations:this.operations.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),functions:this.functions.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),events:this.events.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),functionCalls:this.functionCalls.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),loops:this.loops.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null})),searches:this.searches.map(t=>t.toJSONClone({...n,seenEntityMaps:a,seenEntities:l,newId:null}))}}toReference(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a+"--"+Fe.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a,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(p=>p.toReference(n)),functions:this.functions.map(p=>p.toReference(n)),events:this.events.map(p=>p.toReference(n)),projects:this.projects.map(p=>p.toReference(n)),variableDeclarations:this.variableDeclarations.map(p=>p.toReference(n)),variableInstances:this.variableInstances.map(p=>p.toReference(n)),conditions:this.conditions.map(p=>p.toReference(n)),operations:this.operations.map(p=>p.toReference(n)),functionCalls:this.functionCalls.map(p=>p.toReference(n)),loops:this.loops.map(p=>p.toReference(n)),searches:this.searches.map(p=>p.toReference(n))}}toFlatJSON(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(l=>l.toFlatJSON(n)),...this.functions.flatMap(l=>l.toFlatJSON(n)),...this.events.flatMap(l=>l.toFlatJSON(n)),...this.projects.flatMap(l=>l.toFlatJSON(n)),...this.variableDeclarations.flatMap(l=>l.toFlatJSON(n)),...this.variableInstances.flatMap(l=>l.toFlatJSON(n)),...this.conditions.flatMap(l=>l.toFlatJSON(n)),...this.operations.flatMap(l=>l.toFlatJSON(n)),...this.functionCalls.flatMap(l=>l.toFlatJSON(n)),...this.loops.flatMap(l=>l.toFlatJSON(n)),...this.searches.flatMap(l=>l.toFlatJSON(n))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[...this.entities.flatMap(l=>l.toFlatGenerationTarget(n)),...this.functions.flatMap(l=>l.toFlatGenerationTarget(n)),...this.events.flatMap(l=>l.toFlatGenerationTarget(n)),...this.projects.flatMap(l=>l.toFlatGenerationTarget(n)),...this.variableDeclarations.flatMap(l=>l.toFlatGenerationTarget(n)),...this.variableInstances.flatMap(l=>l.toFlatGenerationTarget(n)),...this.conditions.flatMap(l=>l.toFlatGenerationTarget(n)),...this.operations.flatMap(l=>l.toFlatGenerationTarget(n)),...this.functionCalls.flatMap(l=>l.toFlatGenerationTarget(n)),...this.loops.flatMap(l=>l.toFlatGenerationTarget(n)),...this.searches.flatMap(l=>l.toFlatGenerationTarget(n))])}clearErrors(){return this.errors=[],this.entities.forEach(n=>n.clearErrors()),this.projects.forEach(n=>n.clearErrors()),this.functions.forEach(n=>n.clearErrors()),this.events.forEach(n=>n.clearErrors()),this.variableDeclarations.forEach(n=>n.clearErrors()),this.variableInstances.forEach(n=>n.clearErrors()),this.conditions.forEach(n=>n.clearErrors()),this.operations.forEach(n=>n.clearErrors()),this.functionCalls.forEach(n=>n.clearErrors()),this.loops.forEach(n=>n.clearErrors()),this.searches.forEach(n=>n.clearErrors()),this}validate(){const n=Xde(),a=this.toJSON();return n.safeParse(a),this.validateChildren(),{success:!0,error:null,data:a}}validateChildren(){this.entities.forEach(n=>n.validate()),this.projects.forEach(n=>n.validate()),this.functions.forEach(n=>n.validate()),this.events.forEach(n=>n.validate()),this.variableDeclarations.forEach(n=>n.validate()),this.variableInstances.forEach(n=>n.validate()),this.conditions.forEach(n=>n.validate()),this.operations.forEach(n=>n.validate()),this.functionCalls.forEach(n=>n.validate()),this.loops.forEach(n=>n.validate()),this.searches.forEach(n=>n.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(a=>a.getErrors()),...this.projects.flatMap(a=>a.getErrors()),...this.functions.flatMap(a=>a.getErrors()),...this.events.flatMap(a=>a.getErrors()),...this.variableDeclarations.flatMap(a=>a.getErrors()),...this.variableInstances.flatMap(a=>a.getErrors()),...this.conditions.flatMap(a=>a.getErrors()),...this.operations.flatMap(a=>a.getErrors()),...this.functionCalls.flatMap(a=>a.getErrors()),...this.loops.flatMap(a=>a.getErrors()),...this.searches.flatMap(a=>a.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(n){return this.entities.find(a=>a.id===n)||null}addDefinitionEntity(n){return this.entities.includes(n)||this.entities.push(n),n}addFunctionDeclaration(n){return this.functions.includes(n)||this.functions.push(n),n}addFunctionCall(n){return this.functionCalls.includes(n)||this.functionCalls.push(n),n}addVariableDeclaration(n){return this.variableDeclarations.includes(n)||this.variableDeclarations.push(n),n}addVariableInstance(n){return this.variableInstances.includes(n)||this.variableInstances.push(n),n}addInstalledProject(n){return this.projects.includes(n)||this.projects.push(n),this}addGlobalEvent(n){return this.events.includes(n)||this.events.push(n),this}addCondition(n){return this.conditions.includes(n)||this.conditions.push(n),this}addOperation(n){return this.operations.includes(n)||this.operations.push(n),this}addLoop(n){return this.loops.includes(n)||this.loops.push(n),this}addSearch(n){return this.searches.includes(n)||this.searches.push(n),this}removeDefinitionEntity(n){const a=this.entities.findIndex(l=>l.id===n.id);if(a>-1){const l=this.entities[a];return this.entities.splice(a,1),l}return null}removeCondition(n){const a=this.conditions.findIndex(l=>l.id===n.id);if(a>-1){const l=this.conditions[a];return this.conditions.splice(a,1),l}return null}removeOperation(n){const a=this.operations.findIndex(l=>l.id===n.id);if(a>-1){const l=this.operations[a];return this.operations.splice(a,1),l}return null}removeLoop(n){const a=this.loops.findIndex(l=>l.id===n.id);if(a>-1){const l=this.loops[a];return this.loops.splice(a,1),l}return null}removeSearch(n){const a=this.searches.findIndex(l=>l.id===n.id);if(a>-1){const l=this.searches[a];return this.searches.splice(a,1),l}return null}removeFunctionCall(n){const a=this.functionCalls.findIndex(l=>l.id===n.id);if(a>-1){const l=this.functionCalls[a];return this.functionCalls.splice(a,1),l}return null}removeVariableInstance(n){const a=this.variableInstances.findIndex(l=>l.id===n.id);if(a>-1){const l=this.variableInstances[a];return this.variableInstances.splice(a,1),l}return null}removeVariableDeclaration(n){const a=this.variableDeclarations.findIndex(l=>l.id===n.id);if(a>-1){const l=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),l}return null}removeFunctionDeclaration(n){const a=this.functions.findIndex(l=>l.id===n.id);if(a>-1){const l=this.functions[a];return this.functions.splice(a,1),l}return null}removeInstalledProject(n){const a=this.projects.findIndex(l=>l.id===n.id);if(a>-1){const l=this.projects[a];return this.projects.splice(a,1),l}return null}removeGlobalEvent(n){const a=this.events.findIndex(l=>l.id===n.id);if(a>-1){const l=this.events[a];return this.events.splice(a,1),l}return null}removeTopLevelVariableDeclaration(n){if(n.type!==f.VariableDeclaration)return null;const a=this.variableDeclarations.findIndex(l=>l.id===n.id);if(a>-1){const l=this.variableDeclarations[a];return this.variableDeclarations.splice(a,1),l}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(a=>a.methods)]}getTerminationStatements(){return[...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.ReturnStatement||t.type===f.ContinueStatement||t.type===f.BreakStatement)]},[])]}getFunctionDeclaration(n){return this.functions.find(a=>a.id===n)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.functionCalls.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.operations.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.loops.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[]),...this.searches.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.functionCalls.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.conditions.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.loops.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[]),...this.searches.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.conditions.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.operations.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.loops.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[]),...this.searches.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.functionCalls.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.conditions.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.operations.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.loops.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[]),...this.searches.reduce((a,l)=>{const p=kt(l);return[...a,...p]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.functionCalls.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.conditions.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.operations.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.loops.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[]),...this.searches.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableInstance);return[...a,...t]},[])]}getVariableDeclarations(){return w([...this.variableDeclarations,...this.getEntryPoints().reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.functionCalls.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.conditions.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.operations.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.loops.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[]),...this.searches.reduce((a,l)=>{const t=kt(l).filter(m=>m.type===f.VariableDeclaration);return[...a,...t]},[])])}getLoops(){return[...this.loops,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.functionCalls.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.conditions.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.operations.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[]),...this.searches.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Loop)]},[])]}getSearches(){return[...this.searches,...this.getEntryPoints().reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.functionCalls.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.conditions.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.operations.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[]),...this.loops.reduce((a,l)=>{const p=at(l);return[...a,...p.filter(t=>t.type===f.Search)]},[])]}attachOrphanReferences(){const n=this.getVariableInstances(),a=this.getVariableDeclarations();return n.forEach(l=>{if(!l.declaration){const p=l.initialData,t=p.declaration.entityId||p.declaration.id,m=a.find(v=>v.id===t);m&&l.setDeclaration(m)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(n=>n.name===Oe.PERSISTED_ENTITY)||null}requestActiveValue(n){var l;const a=(l=this.onRequestActiveValueCallback)==null?void 0:l.call(this,n);return a?a||null:n.getDefaultValue()}undo(){console.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex-1,console.log("To: ",this.undoableStackValueIndex);const n=this.history[this.undoableStackValueIndex+1],a=this.history[this.undoableStackValueIndex];return console.log("Current change set: ",n),console.log("Change set to restore: ",a),XL(n||"initial",a||"initial",this)}redo(){console.log("Undoing, from: ",this.undoableStackValueIndex),this.undoableStackValueIndex=this.undoableStackValueIndex+1,console.log("To: ",this.undoableStackValueIndex);const n=this.history[this.undoableStackValueIndex-1],a=this.history[this.undoableStackValueIndex];return console.log("Current change set: ",n),console.log("Change set to restore: ",a),XL(n||"initial",a||"initial",this)}applyExternalChangeSet(n){const a=n.payload,l=this.addChangeSet(new F(this,n.author,n.timestamp,this)),p=a.updated[this.id];if(!p)throw new Error("Project root not found in change set transfer. Cannot apply changes.");const t={...a.added,...a.updated,...a.removed},m=[...Object.keys(a.added),...Object.keys(a.updated),...Object.keys(a.removed)];m.forEach(b=>{var _;if(!t[b]){console.warn(`Entity '${b}' not found in change set transfer. Cannot apply changes.`);const I=(_=this.get(b))==null?void 0:_.toShallowJSON();throw I?console.warn("Entity in project: ",I):console.warn("Entity not in project"),new Error(`Entity '${b}' not found in change set transfer. Cannot apply changes.`)}});const v=new Ga(p);return v.flatRecord=t,v.order=m,v.orderEntities(),console.log("All entities: ",v.order.map((b,_)=>`${_+1}: ${t[b].type} - ${b}`).join(`,
404
+ `)),console.log("Persisting new additions"),v.visit(async(b,_)=>{if(a.added[b.id]){console.log("Adding: ",b.id);try{const I=z(b,this);if(I.hydrateAncestors(),I.addSelfToProject(l),l.add(I,G.Added),!this.get(b.id))throw new Error(`Entity ${b.id} was not added to the project`)}catch(I){console.error("Error: ",I),console.error("Errored entity: ",b)}}}),console.log("Persisting updates"),v.visit(async(b,_)=>{if(a.updated[b.id]){console.log("Updating: ",b.id);try{const I=this.get(b.id);I?(console.log("Applying changes to: ",I==null?void 0:I.id),I.updateWithShallowTransfer(b,l),l.add(I,G.Updated)):console.warn(`Active version of ${b.id} not found`)}catch(I){console.error("Error: ",I),console.error("Errored entity: ",b)}}}),console.log("Persisting removals"),v.visit(async(b,_)=>{if(a.removed[b.id]){console.log("Removing: ",b.id);try{const I=this.get(b.id);I&&I.remove({ignoreUpstream:!1},l)}catch(I){console.error("Error: ",I),console.error("Errored entity: ",b)}}}),l}toFullProjectTransfer(){const n=new Ga(this),a={};return n.visit(l=>{const p=l.toShallowJSON();a[l.id]=p}),{order:n.order,size:n.order.length,record:a}}};g(Fe,"sessionAuthor","1"),g(Fe,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:n=>n}),g(Fe,"repository",{APICreate:async(n,...a)=>n,APIUpdate:async(n,...a)=>n,APIDelete:async(n,...a)=>n,APIClone:async(n,...a)=>{},APILoad:async(n,...a)=>null,APILoadVersion:async(n,a,...l)=>null}),g(Fe,"type",f.Project),g(Fe,"USER_MANAGED_PARENT_TYPES",[]),g(Fe,"PARENT_TYPES",[...Fe.USER_MANAGED_PARENT_TYPES]),g(Fe,"MUTABLE_BASE_PROPERTIES",["name","description"]),g(Fe,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(Fe,"BASE_PROPERTIES",[...Fe.MUTABLE_BASE_PROPERTIES,...Fe.INMUTABLE_BASE_PROPERTIES]),g(Fe,"MUTABLE_META_PROPERTIES",[...Fe.MUTABLE_BASE_PROPERTIES,"x","y"]),g(Fe,"INMUTABLE_META_PROPERTIES",[...Fe.INMUTABLE_BASE_PROPERTIES]),g(Fe,"META_PROPERTIES",[...Fe.MUTABLE_META_PROPERTIES,...Fe.INMUTABLE_META_PROPERTIES]),g(Fe,"MUTABLE_UPSTREAM_PROPERTIES",[]),g(Fe,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),g(Fe,"UPSTREAM_PROPERTIES",[...Fe.MUTABLE_UPSTREAM_PROPERTIES,...Fe.INMUTABLE_UPSTREAM_PROPERTIES]),g(Fe,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),g(Fe,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Fe,"DOWNSTREAM_PROPERTIES",[...Fe.MUTABLE_DOWNSTREAM_PROPERTIES,...Fe.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Fe,"PROPERTIES",[...Fe.META_PROPERTIES,...Fe.UPSTREAM_PROPERTIES,...Fe.DOWNSTREAM_PROPERTIES]);let P=Fe;var Dj=(u=>(u.PersistChangeSet="persist-change-set",u.CreateSingle="create-single",u.CreateBulk="create-bulk",u.CreateSingleNested="create-single-nested",u.CreateBulkNested="create-bulk-nested",u.Update="update",u.Clone="clone",u.Delete="delete",u.Load="load",u.LoadNested="load-nested",u.LoadVersion="load-version",u))(Dj||{});class gj extends Lt{constructor(n){super(Vs,n);g(this,"id",Jt.Parallel);g(this,"name",Jt.Parallel);g(this,"description","Programmatically execute a list of actions one after the other");g(this,"version","1");g(this,"autoexecutable",!0);g(this,"initialData",Vs);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=n,this.inputs=Vs.inputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Vs.outputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Vs.error?z(Vs.error,this.project):null}}class $j extends Lt{constructor(n){super(mi,n);g(this,"id",mi.id);g(this,"name",mi.name);g(this,"description",mi.description);g(this,"version",mi.version);g(this,"autoexecutable",!1);g(this,"initialData",mi);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=n,this.inputs=mi.inputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=mi.outputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=mi.error?z(mi.error,this.project):null}}class Oj extends Lt{constructor(n){super(Fn,n);g(this,"id",Jt.Sequential);g(this,"name",Jt.Sequential);g(this,"description","Programmatically execute a list of actions one after the other");g(this,"version","1");g(this,"autoexecutable",!0);g(this,"initialData",Fn);g(this,"type",f.ActionDescriptor);g(this,"inputs",[]);g(this,"outputs",[]);g(this,"error",null);g(this,"project");this.project=n,this.inputs=Fn.inputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.outputs=Fn.outputs.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.error=Fn.error?z(Fn.error,this.project):null}}class Sye extends Lt{constructor(d){super(tu,d)}}class Zye extends Lt{constructor(d){super(lo,d)}}class Jye extends Lt{constructor(n){super(uo,n);g(this,"autoexecutable",!0)}getEntityToMatchInputMap(n){return n.inputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===fe.operation[Wt.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(n){return n.inputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===fe.operation[Wt.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(n){return n.outputs.find(a=>{var l;return((l=a.declaration)==null?void 0:l.id)===fe.operation[Wt.Validate].outputs.outputEntity.id})||null}getEntityToMatch(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"get-entity-to-match-validate-data"))){const l=this.project.requestActiveValue(n),p=l==null?void 0:l.valueAsTypeSingle;return a==null||a.attemptAutoclose("get-entity-to-match-validate-data",this.id),p}syncOperationInstance(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const l=[],p=[],t=[],m=[],v=this.getEntityToMatchInputMap(n);if(v){const{added:I,updated:V,removed:B,affected:K}=this.syncEntityToMatchInputMapDataType(v,a);l.push(...V),p.push(...I),t.push(...B),m.push(...K)}const b=this.getDataToValidateInputMap(n);if(b){const{added:I,updated:V,removed:B,affected:K}=this.syncDataToValidateInputMapDataType(b,a);l.push(...V),p.push(...I),t.push(...B),m.push(...K)}const _=this.getOutputDataOutputMap(n);if(_){const{added:I,updated:V,removed:B,affected:K}=this.syncOutputDataOutputMapDataType(_,a);l.push(...V),p.push(...I),t.push(...B),m.push(...K)}return a==null||a.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:w(l),added:w(p),removed:w(t),affected:w(m),self:n}}syncEntityToMatchInputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var _,I,V,B,K,q,Z,Q,ue,re,_e,X,Ee,se,de;const l=[],p=[],t=[],m=[];if(((_=n.declaration)==null?void 0:_.id)!==fe.operation[Wt.Validate].inputs.entityToMatch.id)return a==null||a.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.project.requestActiveValue(n),b=v==null?void 0:v.valueAsTypeSingle;if(!n.dataType){const ye={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:((I=n.declaration.dataType)==null?void 0:I.options)||null,implementationChooseOne:((V=n.declaration.dataType)==null?void 0:V.implementationChooseOne)||!1,staticEntities:((B=n.declaration.dataType)==null?void 0:B.staticEntities)??null,interactiveEntities:((K=n.declaration.dataType)==null?void 0:K.interactiveEntities)??null,actionEntities:((q=n.declaration.dataType)==null?void 0:q.actionEntities)??null,isList:((Z=n.declaration.dataType)==null?void 0:Z.isList)||!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:(b==null?void 0:b.toJSON())||null,like:!0,inferred:!0,parent:n.toReference()},H=z(ye,n.project);H.hydrateAncestors(),H.setParent(n,a),H.initChildren(a),H.setEntity(b,a),a==null||a.add(H,G.Added),l.push(H),n.setDataType(H,a)}return(se=n.dataType)==null||se.metaSync({inferred:!0,like:!1,asType:!0,options:((Q=n.declaration.dataType)==null?void 0:Q.options)||null,implementationChooseOne:((ue=n.declaration.dataType)==null?void 0:ue.implementationChooseOne)||!1,staticEntities:((re=n.declaration.dataType)==null?void 0:re.staticEntities)??null,interactiveEntities:((_e=n.declaration.dataType)==null?void 0:_e.interactiveEntities)??null,actionEntities:((X=n.declaration.dataType)==null?void 0:X.actionEntities)??null,isList:((Ee=n.declaration.dataType)==null?void 0:Ee.isList)||!1},a),(de=n.dataType)==null||de.setEntity(b,a),n.dataType&&p.push(n.dataType),a==null||a.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:w(p),added:w(l),removed:w(t),affected:w(m),self:n.dataType}}syncDataToValidateInputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var I,V,B;const l=[],p=[],t=[],m=[];if(((I=n.declaration)==null?void 0:I.id)!==fe.operation[Wt.Validate].inputs.dataToValidate.id)return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.getEntityToMatchInputMap(n.parent);if(!v)return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(v,a))return a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!n.dataType){const K={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,isList:!1,andChildrenGroup:null,orChildrenGroup:null,staticEntities:null,interactiveEntities:null,actionEntities:null,asType:!1,entity:null,like:!0,inferred:!0,parent:n.toReference()},q=z(K,n.project);q.setParent(n,a),q.initChildren(a),a==null||a.add(q,G.Added),l.push(q),n.setDataType(q,a)}(V=n.dataType)==null||V.metaSync({inferred:!0,like:!0,asType:!1},a);const _=this.getEntityToMatch(v,a);return(B=n.dataType)==null||B.setEntity(_,a),n.dataType&&p.push(n.dataType),a==null||a.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:w(p),added:w(l),removed:w(t),affected:w(m),self:n.dataType}}syncOutputDataOutputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var V,B,K;const l=[],p=[],t=[],m=[];if(((V=n.declaration)==null?void 0:V.id)!==fe.operation[Wt.Validate].outputs.outputEntity.id)return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const v=this.getEntityToMatchInputMap(n.parent);if(!v)return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(v,a))return a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const _=this.project.requestActiveValue(v),I=(_==null?void 0:_.valueAsTypeSingle)||null;if(!n.dataType){const q={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:(a==null?void 0:a.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:f.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:(I==null?void 0:I.toJSON())||null,like:!0,inferred:!0,parent:n.toReference()},Z=z(q,n.project);Z.hydrateAncestors(),Z.setParent(n,a),Z.initChildren(a),Z.setEntity(I,a),a==null||a.add(Z,G.Added),l.push(Z),n.setDataType(Z,a)}return(B=n.dataType)==null||B.metaSync({inferred:!0,like:!0,asType:!1},a),(K=n.dataType)==null||K.setEntity(I,a),n.dataType&&p.push(n.dataType),a==null||a.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:w(p),added:w(l),removed:w(t),affected:w(m),self:n.dataType}}inferInputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var p,t,m;if(((p=n.declaration)==null?void 0:p.id)===fe.operation[Wt.Validate].inputs.entityToMatch.id){const{added:v,updated:b,removed:_,affected:I}=this.syncEntityToMatchInputMapDataType(n,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:w(b),added:w(v),removed:w(_),affected:w(I),self:n.dataType}}if(((t=n.declaration)==null?void 0:t.id)===fe.operation[Wt.Validate].inputs.dataToValidate.id){const{added:v,updated:b,removed:_,affected:I}=this.syncDataToValidateInputMapDataType(n,a);return a==null||a.attemptAutoclose("infer-input-map-data-type",this.id),{updated:w(b),added:w(v),removed:w(_),affected:w(I),self:n.dataType}}const l=(m=n.declaration)==null?void 0:m.getDataType(a);if(l&&l.isResolved)return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:l};if(n.readsValue){const v=xs(n.readsValue,a);return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:v}}return a==null||a.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var l;if(((l=n.declaration)==null?void 0:l.id)===fe.operation[Wt.Validate].outputs.outputEntity.id){const{added:p,updated:t,removed:m,affected:v}=this.syncOutputDataOutputMapDataType(n,a);return a==null||a.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:w(t),added:w(p),removed:w(m),affected:w(v),self:n.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class Wye extends Lt{constructor(d){super($m,d)}}class Yye extends Lt{constructor(d){super(Cm,d)}}class zye extends Lt{constructor(d){super(Pm,d)}}class Hye extends Lt{constructor(d){super(df,d)}}class Xye extends Lt{constructor(d){super(af,d)}}class Qye extends Lt{constructor(d){super(eu,d)}}function e0e(u){const d=[new Oj(u),new gj(u),new $j(u),new Sye(u),new Zye(u),new Jye(u),new Hye(u),new Wye(u),new zye(u),new Yye(u),new Xye(u),new Qye(u),new Lt(gm,u),new Lt(Dm,u)];return d.forEach(n=>{n.initChildren(null),u.subscribeBuiltInInstance(n)}),u.operationDeclarations=d,d}class Cj extends En{constructor(n){super(Jr,n);g(this,"initialData");g(this,"id",Oe.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Oe.PERSISTED_ENTITY);g(this,"description",Jr.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",Jr.abstract);g(this,"static",Jr.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=Jr,this.project=n,this.id=Jr.id,this.version=Jr.version,this.name=Jr.name,this.static=Jr.static,this.abstract=Jr.abstract,this.properties=this.initialData.properties.map(a=>{const l=z(a,this.project);return l.setParent(this,null),l.initChildren(null),l}),this.methods=this.initialData.methods.map(a=>{const l=z(a,this.project);return l.parent=this,l}),this.abstractMethods=this.initialData.abstractMethods.map(a=>{const l=z(a,this.project);return l.parent=this,l}),this.extends=this.initialData.extends.map(a=>z(a,this.project))}}var Pj=(u=>(u.StatusCodeMustBeNumber="status-code-must-be-number",u.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",u))(Pj||{});function Vj(u,d){const n=[];if(typeof d!="number"){const a=new xt({id:u.id+"--status-code-must-be-number",message:`Entity of type ${u.type} with id "${u.id}" has an invalid value "${d}". The value must be a number.`,issue:null,severity:S.Error,code:"status-code-must-be-number",entity:u});return n.push(a),{errors:n,override:d}}if(d<100){const a=new xt({id:u.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${u.type} with id "${u.id}" has an invalid value "${d}". The value must be a number between 100 and 599.`,issue:null,severity:S.Error,code:"status-code-must-be-between-100-and-599",entity:u});n.push(a)}if(d>599){const a=new xt({id:u.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${u.type} with id "${u.id}" has an invalid value "${d}". The value must be a number between 100 and 599.`,issue:null,severity:S.Error,code:"status-code-must-be-between-100-and-599",entity:u});n.push(a)}return{errors:n,override:d}}class Nj extends En{constructor(n){super(Vi,n);g(this,"initialData");g(this,"id",Oe.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Oe.PERSISTED_ENTITY);g(this,"description",Vi.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",Vi.abstract);g(this,"static",Vi.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=Vi,this.project=n,this.id=Vi.id,this.version=Vi.version,this.name=Vi.name,this.static=Vi.static,this.abstract=Vi.abstract,this.properties=this.initialData.properties.map(t=>{const m=z(t,this.project);return m.setParent(this,null),m.initChildren(null),m}),this.methods=this.initialData.methods.map(t=>{const m=z(t,this.project);return m.parent=this,m}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const m=z(t,this.project);return m.parent=this,m}),this.extends=this.initialData.extends.map(t=>z(t,this.project));const a=this.properties.find(t=>t.id===fe["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!a)throw new Error("Path property not found in endpoint entity");a._codeNativeValueValidation=(t,m)=>hU(t,m);const l=this.abstractMethods.find(t=>t.id===fe["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!l)throw new Error("Handler method not found in endpoint entity");const p=l.outputs.find(t=>t.id===fe["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.outputs.statusCode.id);if(!p)throw new Error("Status code output not found in handler method");p.codeNativeValueValidation=(t,m)=>Vj(t,m)}}const t0e="test_primitive_entities_export";class r0e extends En{constructor(n){super(Gr,n);g(this,"initialData");g(this,"id",Oe.PERSISTED_ENTITY);g(this,"version","1");g(this,"name",Oe.PERSISTED_ENTITY);g(this,"description",Gr.description);g(this,"type",f.BuiltInBaseEntity);g(this,"abstract",Gr.abstract);g(this,"static",Gr.static);g(this,"properties",[]);g(this,"methods",[]);g(this,"abstractMethods",[]);g(this,"extends",[]);g(this,"errors",[]);g(this,"project");this.initialData=Gr,this.project=n,this.id=Gr.id,this.version=Gr.version,this.name=Gr.name,this.static=Gr.static,this.abstract=Gr.abstract,this.properties=this.initialData.properties.map(l=>{const p=z(l,this.project);return p.setParent(this,null),p.initChildren(null),p}),this.methods=this.initialData.methods.map(l=>{const p=z(l,this.project);return p.parent=this,p}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const p=z(l,this.project);return p.parent=this,p}),this.extends=this.initialData.extends.map(l=>z(l,this.project));const a=this.properties.find(l=>l.id===fe["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!a)throw new Error("Path property not found in endpoint entity");a._codeNativeValueValidation=(l,p)=>yU(l,p)}}function i0e(u){const d=[new Cj(u),new Nj(u),new r0e(u),new En(Df,u)];return d.forEach(n=>{u.subscribeBuiltInInstance(n)}),u.builtInBaseEntities=d,d}function s0e(u){const d=[new Ri(ke,u),new Ri(Bn,u),new Ri(nt,u),new Ri(bm,u),new Ri(Fr,u),new Ri(Un,u),new Ri(sn,u),new Ri(jn,u),new Ri(fl,u)];return d.forEach(n=>{u.subscribeBuiltInInstance(n)}),u.primitives=d,d}function n0e(u){const d=[new Lt($f,u)];return d.forEach(n=>{n.initChildren(null),u.subscribeBuiltInInstance(n)}),u.globalEventActionDescriptors=d,d}function a0e(u){const d=[new Lt(nu,u),new Lt(ca,u),new Lt(iu,u),new Lt(ml,u),new Lt(vl,u),new Lt(vf,u)];d.forEach(a=>{a.initChildren(null),u.subscribeBuiltInInstance(a)}),u.loopDeclarations=d;const n=[new Lt(Af,u),new Lt(su,u),new Lt(Tf,u),new Lt(qm,u),new Lt(Zm,u),new Lt(Ef,u)];return n.forEach(a=>{a.initChildren(null),u.subscribeBuiltInInstance(a)}),u.loopDeclarationsBodies=n,d}function o0e(u){const d=[new ks(Of,u),new ks(pv,u)];return d.forEach(n=>{n.initChildren(null),u.subscribeBuiltInInstance(n)}),u.valueDescriptors=d,d}function l0e(u){const d=[new Lt(yo,u),new Lt(Il,u)];return d.forEach(n=>{n.initChildren(null),u.subscribeBuiltInInstance(n)}),u.conditionDeclarations=d,d}const jo={},_y={},pp={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function Lj(u,d={enrich:!0,shallowErrors:!1}){const n={enrich:!0,shallowErrors:!1,...d},{enrich:a,shallowErrors:l}=n,p=u.project,t=u.record,m=new Ga(p),v=new Set;t[p.id]=p,v.add(p.id);const b=N().toISOString();Object.values(t).forEach(V=>{!V||m.allBuiltInEntityIds.includes(V.id)||v.add(V.id)}),m.order=Array.from(v),m.flatRecord=t,m.orderEntities();const _=Dy(u.project);_.instances[p.id]=_;const I=a?_.addChangeSet(new F(_,P.sessionAuthor,b,_,!0,"project-init-from-fetch-result")):null;return m.visit(V=>{if(V.id===_.id)return;const B=z(V,_);try{B.hydrateAncestors(),B.addSelfToProject(null)}catch(K){if(l)console.error("Error hydrating ancestors: ",K);else throw K}}),a?(m.visit(V=>{if(V.id===_.id)return;const B=_.get(V.id);B&&B.afterAllChildrenInitialized(I)}),_.afterAllChildrenInitialized(I)):gy(_,b).forEach(B=>{B.remove({ignoreUpstream:!0},null)}),_.instancesList.forEach(V=>{V.previousVersion=null}),I==null||I.attemptAutoclose("project-init-from-fetch-result",_.id),_}async function d0e(u,d=pp){const n={...pp,...d};if(n.empty)return{data:{project:{id:u.id,type:f.Project,version:P.UUID.uuid(),createdAt:N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(n.mock){const l={...bE};return l.id=u.id,{data:{project:l,record:{}}}}return console.log("Fetching project from external API"),new Promise(async l=>{try{if(n.onFetch){const p=await n.onFetch(u.id);if(p){l({data:p});return}}else l({data:null})}catch(p){console.error("Error fetching project: ",p),l({data:null})}})}function Dy(u){const d=new P(u);return s0e(d),i0e(d),e0e(d),n0e(d),a0e(d),o0e(d),l0e(d),Array.from(new Set([...d.getAllBuiltInIds(),...bs()])).forEach(a=>{if(!d.builtInInstances[a]&&d.instances[a])d.builtInInstances[a]=d.instances[a],delete d.instances[a];else if(!d.builtInInstances[a])throw new Error(`Built in entity was not properly initialized: ${a}`)}),d.instances[d.id]=d,d}function gy(u,d){return u.instancesList.filter(a=>N(a.createdAt).isAfter(N(d)||!!a.previousVersion))}function u0e(u,{enrich:d}={enrich:!0}){const n=new Map,a=new Map,l=Array.from(new Set([...u.getAllBuiltInIds(),...bs()]));Object.keys(u.instances).forEach(_=>{if(l.includes(_)){n.set(_,_),a.set(_,_);return}const I=u.get(_);if(!wy(I,{...u.instances,...u.builtInInstances}).every(q=>!l.includes(q))){n.set(_,_),a.set(_,_);return}const K=P.UUID.uuid();n.set(_,K),a.set(K,_)});const p=N().toISOString(),t=u.toShallowJSON({seenEntityMaps:n});t.previousVersion=null,t.createdAt=p,t.version=P.UUID.uuid();const m=Dy(t);m.instances[m.id]=m;const v=d?m.addChangeSet(new F(m,P.sessionAuthor,p,m,!0,"project-clone")):null,b=new Ga(u);return b.visit(_=>{const I=_.toShallowJSON({seenEntityMaps:n});I.previousVersion=null,I.createdAt=p,I.version=P.UUID.uuid();const V=ip(I,PU(b.flatRecord,n));if(Object.keys(V.upstream).length){let K=!1;if(Object.keys(V.upstream).forEach(q=>{if(!K&&(!m.get(q)||m.getDeleted(q))){K=!0;return}}),K)return}const B=z(I,m);B.hydrateAncestors(),B.addSelfToProject(v),v==null||v.add(B,G.Added)}),d?(b.visit(_=>{if(_.id===m.id)return;const I=m.get(n.get(_.id));I&&I.afterAllChildrenInitialized(v)}),m.afterAllChildrenInitialized(v)):gy(m,p).forEach(I=>{I.remove({ignoreUpstream:!0},null)}),m.instancesList.forEach(_=>{_.previousVersion=null}),v==null||v.attemptAutoclose("project-clone",m.id),m}function Mj(u,{enrich:d}={enrich:!0}){const n=Dy(u),a=N().toISOString(),l=d?n.addChangeSet(new F(n,P.sessionAuthor,a,n,!0,"project-init")):null;l&&(l.type=jT.Automatic);const p=new Ga(u);return p.visit(t=>{const m=z(t,n);m.hydrateAncestors(),m.addSelfToProject(l)}),d?(p.visit(t=>{if(t.id===n.id)return;const m=n.get(t.id);m&&m.afterAllChildrenInitialized(l)}),n.afterAllChildrenInitialized(l)):(gy(n,a).forEach(v=>{v.remove({ignoreUpstream:!0},null)}),new Ga(n).visit(v=>{v.initialized=!0,v.captureVersion()})),n.initialized=!0,l==null||l.attemptAutoclose("project-init",n.id),n}async function c0e(u,d=pp){const n={...pp,...d};if(u.id&&jo[u.id]&&!n.ignoreCache)return jo[u.id];if(u.id&&_y[u.id]&&!n.ignoreCache)return await _y[u.id],jo[u.id];const a=d0e(u,n);u.id&&(_y[u.id]=a);const l=await a;if(l.data){let p;return n.mock?p=Mj(bE,{enrich:!!n.enrich}):l.data instanceof P?p=l.data:p=Lj(l.data,{enrich:!!n.enrich}),jo[u.id]=p,u.id&&delete _y[u.id],p}return null}function p0e(u){return jo[u.id]&&delete jo[u.id],null}C.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=hb,C.ALL_BUILT_IN_BASE_ENTITIES=BC,C.ALL_BUILT_IN_CONDITION_ENTITIES=zC,C.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=XC,C.ALL_BUILT_IN_LOOP_BODY_ENTITIES=uO,C.ALL_BUILT_IN_LOOP_ENTITIES=dO,C.ALL_BUILT_IN_OPERATION_ENTITIES=Ag,C.ALL_BUILT_IN_PRIMITIVE_ENTITIES=d1,C.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=sP,C.ALL_BUILT_IN_VALUE_DESCRIPTORS=iP,C.ActionDescriptorState=Lt,C.ActionInputMapState=The,C.ActionOutputMapState=Ihe,C.AppendToListOperationInputIds=v_,C.AppendToListOperationOutputIds=E_,C.ArgumentDeclarationDependencyField=S3,C.ArgumentDeclarationState=ea,C.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=ub,C.BUILT_IN_BASE_ENTITY_IDS=fe,C.BUILT_IN_ENTITY_TYPES=Pi,C.BaseCanvasDraggableState=Bye,C.BaseEntityNames=Oe,C.BaseState=Mye,C.BaseValueDescriptorIds=pl,C.BreakStatementDependencyField=J3,C.BreakStatementState=Ba,C.BuiltInBaseEntityState=En,C.CACHED_PROJECTS_BY_ID=jo,C.CALLABLE_ENTITIES_EXPLANATION=Ohe,C.CALLABLE_TYPES=tn,C.CALLER_ENTITIES_EXPLANATION=X3,C.CALLER_TYPES=rn,C.CALLS_UPDATE_EXPLANATION=ja,C.CHILDREN_TYPES=o7,C.COMPARISON_CONDITIONS=WC,C.CONDITIONS=YC,C.CUSTOM_ENTITY_OPERATIONS=xD,C.CallableEntityClass=jye,C.CallerEntityClass=Lb,C.ChangeSet=F,C.ChangeSetChangeCaptureType=jT,C.ChangeSetEntityChangeType=G,C.ChildEntityBaseClass=Uye,C.CommonStringValidationErrorCodes=fU,C.ComparisonOperatorTypes=fr,C.ConditionDependencyField=bM,C.ConditionState=Ca,C.ContinueStatementDependencyField=hM,C.ContinueStatementState=Qr,C.CreateNewInputIds=fD,C.CreateNewOutputIds=hD,C.DRAGGABLE_CALLABLE_TYPES=Tm,C.DRAGGABLE_CALLER_TYPES=t1,C.DRAGGABLE_ELEMENT_TYPES=nf,C.DRAGGABLE_EXECUTABLE_TYPES=n7,C.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=sf,C.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=Em,C.DataTypeCompatibilityTypes=ms,C.DataTypeDependencyField=xT,C.DataTypeParentChildRelation=xr,C.DataTypeState=ji,C.DefinitionEntityDependencyField=Ry,C.DefinitionEntityState=ia,C.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=Nye,C.ENTITIES_WITH_VALLUES_EXPLANATION=dy,C.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=oe,C.ENTITY_RECUSION_OPTIONS_DEFAULTS=Ce,C.ENTITY_TYPES=a7,C.ENTITY_WITH_DECLARATION_TYPES=i7,C.ENTITY_WITH_LOGIC_SCOPE_TYPES=br,C.ENTITY_WITH_NAMES_TYPES=r1,C.ENTITY_WITH_PARENT_TYPES=t7,C.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=Qw,C.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=r7,C.ENTITY_WITH_VALUE_TYPES=vm,C.ENTRY_POINT_ENTITIES_EXPLANATION=Qc,C.ENTRY_POINT_TYPES=Xt,C.EVENT_TYPES=cl,C.EXECUTABLE_TYPES=s7,C.EXECUTION_OPERATIONS=pD,C.EndpointEntity=Nj,C.EntityAction=Dj,C.EntityError=xt,C.EntityErrorSeverity=S,C.EntityGenerationError=Y,C.EntityGenerationErrorCode=k,C.EntityInstanceErrorCode=me,C.EntityOperations=Wt,C.EntityType=f,C.EntityWithLogicScopeClass=Kye,C.EntityWithValueClass=Gye,C.EntryPointEntityClass=xye,C.Events=Mb,C.ExecutionOperations=Jt,C.ExecutionTerminationType=vM,C.FunctionCallDependencyField=dU,C.FunctionCallState=Fa,C.FunctionDeclarationDependencyField=aM,C.FunctionDeclarationState=_a,C.GET_PROJECT_OPTIONS_DEFAULTS=pp,C.GLOBAL_EVENT_DECLARATIONS=HC,C.GetLastInListOperationInputIds=n_,C.GetLastInListOperationOutputIds=a_,C.GlobalEventNames=Mn,C.GlobalEventState=$a,C.HTTPOperations=Hr,C.HTTPStatucCodeValidationErrorCodes=Pj,C.HTTP_OPERATIONS=Tg,C.InputMapDependencyField=G3,C.InputMapState=Es,C.InstalledProjectState=La,C.InternalCallDependencyField=x3,C.InternalCallState=Ma,C.JoinListOperationInputIds=_R,C.JoinListOperationOutputIds=DR,C.LIST_OPERATIONS=P_,C.ListOperations=it,C.LiteralValueDependencyField=rM,C.LiteralValueState=Fs,C.LoopDependencyField=EM,C.LoopState=Oa,C.LoopTypes=Be,C.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=xa,C.NUMBER_OPERATIONS=x1,C.NumberOperations=Ht,C.OPERATION_DECLARATIONS=bg,C.OperationDependencyField=dM,C.OperationState=Da,C.OutputMapDependencyField=k3,C.OutputMapParentChildRelation=ul,C.OutputMapState=Ks,C.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=uy,C.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=Ua,C.PASS_THROUGH_CALLABLE_TYPES=dr,C.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=e1,C.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=fb,C.ParallelExecutionOperation=gj,C.PassThroughCallableEntityClass=Fye,C.PersistedEntity=Cj,C.PersistedEntityMethods=Wi,C.PrimitiveEntityState=Ri,C.PrimitiveTypes=ee,C.ProjectState=P,C.ProjectStateEvents=ar,C.PropertyDependencyField=sM,C.PropertyState=Xn,C.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=Rj,C.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=Che,C.ReturnDeclarationDependencyField=cM,C.ReturnDeclarationState=wi,C.ReturnStatementDependencyField=FT,C.ReturnStatementState=ga,C.SQLAST=che,C.STANDALONE_CONDITIONS=xC,C.STRING_OPERATIONS=RR,C.ScopeCompatibilityType=Ay,C.SearchDependencyField=M3,C.SearchState=Na,C.SequentialExecutionOperation=Oj,C.SequentialExecutionOperationInputIds=Q_,C.SequentialExecutionOperationOutputIds=eD,C.SharedEntityErrorCode=le,C.SharedStateFunctionality=wj,C.SplitListOperationInputIds=GR,C.SplitListOperationOutputIds=KR,C.StandaloneOperatorTypes=ps,C.StringOperations=ut,C.TERMINATION_TYPES=sr,C.Traverser=Ga,C.USER_MANAGED_ENTITY_TYPES=i1,C.UserManagedEntityStateTemplate=Lye,C.VALUE_READING_ENTITIES_EXPLANATION=pb,C.VALUE_READING_TYPES=ua,C.VALUE_WRITING_ENTITIES_EXPLANATION=Q3,C.VALUE_WRITING_TYPES=Tr,C.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=cb,C.VARIABLE_TYPES=lr,C.ValueAutogenerationType=Er,C.ValueDescriptorDependencyField=Y3,C.ValueDescriptorParentChildRelation=ie,C.ValueDescriptorState=ks,C.ValueReadingEntityClass=up,C.ValueWritingEntityClass=cp,C.VariableDeclarationDependencyField=wM,C.VariableDeclarationState=Va,C.VariableInputMapState=Ehe,C.VariableInstanceDependencyField=KT,C.VariableInstanceState=Pa,C.VariableOutputMapState=Ahe,C.WaitOperation=$j,C.WaitOperationInputIds=Z_,C.WaitOperationOutputIds=J_,C.actionDescriptorValidation=bpe,C.appendToListOperation=df,C.appendToListOperationElementToAppendArgument=Nm,C.appendToListOperationElementToAppendArgumentParentRef=D_,C.appendToListOperationElementToAppendArgumentRef=A_,C.appendToListOperationError=C_,C.appendToListOperationErrorParentRef=O_,C.appendToListOperationListArgument=Vm,C.appendToListOperationListArgumentParentRef=__,C.appendToListOperationListArgumentRef=T_,C.appendToListOperationListDataType=b_,C.appendToListOperationResultListDataType=R_,C.appendToListOperationResultListReturn=$_,C.appendToListOperationResultListReturnParentRef=g_,C.appendToListOperationResultListReturnRef=w_,C.appendToListOperationSecondListDataType=I_,C.applyNewScope=Me,C.argumentDeclarationValidation=whe,C.asGenerationActionExample=vn,C.booleanPrototype=Bn,C.breakStatementValidation=Rhe,C.calculateNewParentBasedOnCallers=Ab,C.capitalizeFirstLetter=kr,C.changeSetJSONRecordToUniqueIds=spe,C.checkAreDataTypesCompatible=vs,C.checkAreDefinitionEntitiesCompatibleAsDataType=BL,C.checkArePropertiesCompatibleAsDataType=ML,C.checkExtendsBaseEntity=Iy,C.checkHasBaseEntity=As,C.checkHasMetadataChanged=cr,C.checkImplementationsOverlap=ra,C.checkImplementsBaseEntity=dye,C.checkIsBranchDependentButNotDirectlyOnBranch=tp,C.checkIsBranchDependentOnBranch=khe,C.checkIsBuiltIn=Nb,C.checkIsCallableEntityReachable=dp,C.checkIsCanvasEntity=oye,C.checkIsDefEntityInlineDeclaredForSearchOutputType=nb,C.checkIsDetachedBranch=cj,C.checkIsDetachedBranchShallow=Pb,C.checkIsGlobalVariable=nye,C.checkIsGloballyDeclared=Cb,C.checkIsMethod=hj,C.checkIsNestedScope=by,C.checkScopeCompatibility=lp,C.cloneProject=u0e,C.conditionValidation=Ape,C.continueStatementValidation=mpe,C.convertToAbstract=xhe,C.convertToNonAbstract=Fhe,C.convertToNonStatic=Khe,C.convertToStatic=Ghe,C.countedLoopActionDescriptor=nu,C.countedLoopActionDescriptorDynamicReturnDeclaration=tO,C.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=eO,C.countedLoopActionDescriptorStringArgumentDeclaration=Q$,C.countedLoopActionDescriptorStringArgumentDeclarationDataType=H$,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=Y$,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=W$,C.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=z$,C.countedLoopActionDescriptorStringArgumentDeclarationParentRef=X$,C.countedLoopBodyActionDescriptor=Af,C.countedLoopBodyActionDescriptorAnyDynamicArgument=aO,C.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=nO,C.countedLoopBodyActionDescriptorAnyDynamicReturn=lO,C.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=oO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Wm,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=iO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=rO,C.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=sO,C.createDefinitionEntityFromJSONObject=yy,C.createEntityError=tt,C.createNestedDataTypeForEntity=pU,C.createNewInstanceOperation=lo,C.createNewInstanceOperationEntityToInstanciateArgument=ID,C.createNewInstanceOperationEntityToInstanciateArgumentRef=TD,C.createNewInstanceOperationEntityToInstanciateDataType=bD,C.createNewInstanceOperationError=DD,C.createNewInstanceOperationErrorParentRef=_D,C.createNewInstanceOperationNewEntityDataArgument=ED,C.createNewInstanceOperationNewEntityDataArgumentDataType=vD,C.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=mD,C.createNewInstanceOperationNewEntityDataArgumentParentRef=yD,C.createNewInstanceOperationOutputEntityDeclaration=RD,C.createNewInstanceOperationOutputEntityDeclarationParentRef=wD,C.createNewInstanceOperationRef=AD,C.createSemanticId=WL,C.createStateFromGenerationTargetType=Vye,C.createStateFromType=er,C.createStateFromTypeAndSubscribe=z,C.cronJobBuiltInBaseEntity=Df,C.cronJobBuiltInBaseEntityExpressionProperty=LC,C.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=y7,C.cronJobBuiltInBaseEntityExpressionPropertyRef=VC,C.cronJobBuiltInBaseEntityRef=NC,C.cronJobTriggeredFunctionDeclarationBlueprint=lv,C.cronJobTriggeredFunctionDeclarationBlueprintParentRef=CC,C.dataTypeCompatibilityToErrorExplanation=oU,C.dataTypeValidation=upe,C.datePrototype=sn,C.dateValueAutogenerationSchema=_E,C.definitionEntityToZodSchema=bP,C.definitionEntityValidation=$ye,C.deletePersistedEntityMethod=ov,C.deletePersistedEntityMethodParentRef=yC,C.deleteRootProject=p0e,C.endpointBuiltInBaseEntity=Vi,C.endpointBuiltInBaseEntityRef=hO,C.endpointBuiltInBaseEntityRefFour=zO,C.endpointBuiltInBaseEntityRefThree=wO,C.endpointBuiltInBaseEntityRefTwo=TO,C.endpointBuiltInCorsProperty=yO,C.endpointBuiltInCorsPropertyDataType=fO,C.endpointBuiltInCorsPropertyDataTypeRef=cO,C.endpointBuiltInCorsPropertyRef=pO,C.endpointBuiltInMethodProperty=zm,C.endpointBuiltInMethodPropertyDataType=IO,C.endpointBuiltInMethodPropertyDataTypeRef=bO,C.endpointBuiltInMethodPropertyRef=AO,C.endpointBuiltInPathProperty=Ym,C.endpointBuiltInPathPropertyDataType=EO,C.endpointBuiltInPathPropertyDataTypeRef=mO,C.endpointBuiltInPathPropertyRef=vO,C.endpointPathParamsArgumentDeclaration=Xm,C.endpointPathParamsArgumentDeclarationRef=NO,C.endpointPathParamsVariableDataType=LO,C.endpointPathParamsVariableDataTypeRef=VO,C.endpointReachedTriggerActionDescriptor=sv,C.endpointReachedTriggerActionDescriptorRef=MO,C.endpointReachedTriggerActionDescriptorRefFour=jO,C.endpointReachedTriggerActionDescriptorRefThree=UO,C.endpointReachedTriggerActionDescriptorRefTwo=BO,C.endpointRequestBodyArgumentDeclaration=ev,C.endpointRequestBodyArgumentDeclarationRef=gO,C.endpointRequestBodyVariableDataType=$O,C.endpointRequestHeadersArgumentDeclaration=Hm,C.endpointRequestHeadersArgumentDeclarationRef=_O,C.endpointRequestHeadersVariableDataType=DO,C.endpointRequestHeadersVariableDataTypeRef=RO,C.endpointRequestQueryParamsArgumentDeclaration=Qm,C.endpointRequestQueryParamsArgumentDeclarationRef=CO,C.endpointRequestQueryParamsVariableDataType=PO,C.endpointRequestQueryParamsVariableDataTypeRef=OO,C.endpointResponseBodyDataType=WO,C.endpointResponseBodyReturnDeclaration=iv,C.endpointResponseBodyReturnDeclarationRef=JO,C.endpointResponseCodeDataType=FO,C.endpointResponseCodeReturnDeclaration=tv,C.endpointResponseCodeReturnDeclarationDefaultValueParentRef=KO,C.endpointResponseCodeReturnDeclarationRef=xO,C.endpointResponseHeadersDataType=SO,C.endpointResponseHeadersDataTypeRef=kO,C.endpointResponseHeadersReturnDeclaration=rv,C.endpointResponseHeadersReturnDeclarationRef=qO,C.endpointReturnStatementRef=GO,C.endpointReturnStatementRefThree=YO,C.endpointReturnStatementRefTwo=ZO,C.enrichFromKnownEntities=rp,C.enumOptionsProperty=l1,C.enumOptionsPropertyDataType=a1,C.enumOptionsPropertyDataTypeRef=s1,C.enumOptionsPropertyRef=n1,C.enumPrototype=Un,C.enumPrototypeRef=o1,C.executionBuiltInBaseEntity=gf,C.executionBuiltInEntityAbortMethod=dv,C.executionBuiltInEntityAbortMethodParentRef=MC,C.filterOutDuplicateEntities=w,C.filterOutDuplicateErrors=Eoe,C.findEntityFromKeys=Eb,C.findReferenceToSelfInList=CU,C.findReferencesToSelfInProject=Xhe,C.flattenActionDescriptor=VU,C.flattenArgumentDeclaration=NU,C.flattenBreakStatement=LU,C.flattenBuiltInBaseEntity=MU,C.flattenCalls=Ts,C.flattenCanvasAncestorsUntil=ad,C.flattenCondition=BU,C.flattenContinueStatement=UU,C.flattenDataType=xU,C.flattenDefinitionEntity=jU,C.flattenDefinitionEntityExtensionAndImplementationTypes=Ty,C.flattenDefinitionEntityExtensionTypes=np,C.flattenDefinitionEntityExtensions=Db,C.flattenDefinitionEntityImplementations=gb,C.flattenDefinitionEntityImplementionTypes=sp,C.flattenDerivedCanvasEntities=Fi,C.flattenDetachedBranch=fj,C.flattenElementCalls=at,C.flattenElementCallsOnTheSameScope=Hhe,C.flattenEntity=ae,C.flattenFunctionCall=FU,C.flattenFunctionDeclaration=GU,C.flattenGlobalEvent=KU,C.flattenInputMap=kU,C.flattenInstalledProject=qU,C.flattenInternalCall=SU,C.flattenLiteralValue=ZU,C.flattenLoop=JU,C.flattenOperation=WU,C.flattenOutputMap=YU,C.flattenPrimitiveEntity=zU,C.flattenProject=HU,C.flattenProjectElements=OU,C.flattenProperty=XU,C.flattenRelatedCanvasElementsOnTheLeft=uj,C.flattenRelatedCanvasElementsOnTheRight=dj,C.flattenReturnDeclaration=QU,C.flattenReturnStatement=ej,C.flattenSearch=tj,C.flattenValueDescriptor=rj,C.flattenVariableDeclaration=ij,C.flattenVariableInstance=sj,C.flattenVariableReads=$U,C.flattenVariableWrites=gU,C.flattenVariables=kt,C.fromChangeSetToRecordChangeSet=yye,C.fromLiteralValueTypeToPrimitiveType=ib,C.fromZodParseToEntityGenerationErrors=ob,C.functionCallValidation=jhe,C.functionDeclarationValidation=dpe,C.generate=E9,C.generateActionExample=Phe,C.generateExecutionDataType=Yce,C.generateIdFromStrategy=hr,C.generateMutablePropertiesExplanation=ay,C.generateRandomBoolean=ZP,C.generateRandomDate=RP,C.generateRandomDateAfter=AP,C.generateRandomDateBefore=IP,C.generateRandomDateBetweenRange=wP,C.generateRandomNumber=GP,C.generateRandomNumberAfter=jP,C.generateRandomNumberBefore=xP,C.generateRandomNumberBetweenRange=FP,C.generateRandomText=SP,C.generateRandomTextAfter=KP,C.generateRandomTextBefore=kP,C.generateRandomTextBetweenRange=qP,C.generateUniqueUUID=UP,C.getAllActionDescriptorsForConditions=fy,C.getAllActionDescriptorsForGlobalEvents=cy,C.getAllActionDescriptorsForLoops=py,C.getAllActionDescriptorsForOperations=Mhe,C.getAllBuiltInEntityIds=bs,C.getAllGloballyDeclaredFunctionDeclarationsExplanation=sU,C.getBaseBuiltInEntities=hi,C.getBaseSchemaBasedOnType=z3,C.getBuiltInEntityOwner=ka,C.getCallableEntityReferenceSchema=Kr,C.getCallableEntityTypeSchema=wN,C.getCalledBy=is,C.getCallerEntityReferenceSchema=Ide,C.getCallerEntityTypeSchema=Ade,C.getCalls=wb,C.getCanvasEntitiesDerivedFromInternalCalls=lj,C.getCanvasEntitiesDerivedFromWrites=od,C.getCanvasEntityDerivedFromValueReadingEntity=Ey,C.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=oj,C.getCanvasEntityReferenceSchema=xde,C.getCanvasEntityTypeSchema=jde,C.getChildrenEntityWithValues=She,C.getColumnProperties=ld,C.getCommonAncestor=Ib,C.getCommonChildren=mU,C.getDatabaseEntities=cye,C.getDatabaseEntity=fye,C.getDeclaration=Mo,C.getDeclarationOutputedError=vye,C.getDeepestScope=mj,C.getDefaultRelationalDatabaseEntityOrFirst=Ej,C.getDraggableCallableEntityReferenceSchema=_N,C.getDraggableCallableEntityTypeSchema=RN,C.getDraggableCallerEntityReferenceSchema=Rde,C.getDraggableCallerEntityTypeSchema=wde,C.getDraggableExecutableEntityReferenceSchema=$de,C.getDraggableExecutableEntityTypeSchema=gde,C.getDraggablePassThroughCallableEntityReferenceSchema=Bh,C.getDraggablePassThroughCallableEntityTypeSchema=Mh,C.getDraggablePlayableEntityReferenceSchema=Nde,C.getDraggablePlayableEntityTypeSchema=Vde,C.getEntitiesCreatedSinceInitialization=gy,C.getEntityArgumentDeclarations=_b,C.getEntityInputMaps=nj,C.getEntityOutputMaps=rye,C.getEntityReferenceSchema=Ude,C.getEntityReturnDeclarations=aj,C.getEntityTypeSchema=Bde,C.getEntityWithLogicScopeReferenceSchema=Yn,C.getEntityWithLogicScopeTypeSchema=Ode,C.getEntityWithValueReferenceSchema=IN,C.getEntityWithValueTypeSchema=bde,C.getEntryPointEntityReferenceSchema=Br,C.getEntryPointEntityTypeSchema=Ia,C.getEventEntityReferenceSchema=Nh,C.getEventEntityTypeSchema=Vh,C.getExecutableEntityReferenceSchema=Dde,C.getExecutableEntityTypeSchema=_de,C.getExtendedBuiltInEntity=iye,C.getExtendedDefinitionEntity=Ob,C.getFirstNonLoopScopeOwner=Rr,C.getGenerationTargetSchemaBasedOnType=H3,C.getHeadIfPartOfDetachedBranch=pj,C.getHighestScope=yj,C.getImplementedBuiltInEntity=sye,C.getIsInteractive=ap,C.getLastInListOperation=Pm,C.getLastInListOperationError=m_,C.getLastInListOperationErrorParentRef=y_,C.getLastInListOperationInputListArgument=p_,C.getLastInListOperationInputListArgumentParentRef=c_,C.getLastInListOperationInputListArgumentRef=o_,C.getLastInListOperationInputListDataType=l_,C.getLastInListOperationOutputElementDataType=u_,C.getLastInListOperationOutputElementReturn=h_,C.getLastInListOperationOutputElementReturnParentRef=f_,C.getLastInListOperationOutputElementReturnRef=d_,C.getLinkedEntitiesFromArgumentDeclaration=zhe,C.getLowestPersistedEntityImplementation=$b,C.getParentCallableEntity=vU,C.getParentCallerEntity=TU,C.getParentCanvasEntities=ei,C.getParentCanvasEntity=Pr,C.getParentCanvasEntityFromTransfer=my,C.getParentEntryPoint=qhe,C.getParentPassthroughCallableEntity=EU,C.getPassThroughCallableEntityReferenceSchema=Qt,C.getPassThroughCallableEntityTypeSchema=Lh,C.getPeristedEntities=uye,C.getPlayableEntityReferenceSchema=Pde,C.getPlayableEntityTypeSchema=Cde,C.getProject=c0e,C.getPrototypeByType=op,C.getRecusriveParentsIds=wy,C.getReferenceEntityId=W,C.getReferencedEntitiesStateOrErrors=ly,C.getReferencedEntityStateOrErrors=lb,C.getReferencedIds=ip,C.getRelatedCanvasElementsOnTheLeft=Uo,C.getRelatedCanvasElementsOnTheLeftFromTransfer=Qhe,C.getRelatedCanvasElementsOnTheRight=Ka,C.getRootEntryPointScopeOwner=Vb,C.getScopeOwner=yi,C.getStateClassFromType=hye,C.getTerminationReferenceSchema=Mde,C.getTerminationTypeSchema=Lde,C.getTopLevelParentEntityId=Tj,C.getTouchedCanvasEntitiesFromChangeSet=mye,C.getUsedArgFromDeclaration=eye,C.getUsedReturnFromDeclaration=tye,C.getValueReadingEntityReferenceSchema=AN,C.getValueReadingEntityTypeSchema=Wn,C.getValueWritingEntityReferenceSchema=Tde,C.getValueWritingEntityTypeSchema=ku,C.getVariableFromInputMapping=AU,C.getVariableFromReturnVariablePointer=RU,C.getVariableReferenceSchema=Aa,C.getVariableTypeSchema=Oo,C.getVariablesFromArgumentDeclarations=vy,C.getVariablesFromInputMaps=IU,C.getVariablesFromOutputMapping=_U,C.getVariablesFromOutputMaps=DU,C.getVariablesFromReturnDeclarations=wU,C.getVariablesInSameOrHigherScope=CT,C.getWrites=Rb,C.globalEventValidation=vpe,C.groupCallsBasedOnParallelizableExecution=Jhe,C.handleAfterEntityImplementationSideEffects=cU,C.handleBeforeEntityImplementationSideEffects=uU,C.httpRequestBodyArgument=ff,C.httpRequestBodyArgumentRef=XD,C.httpRequestBodyDataType=QD,C.httpRequestHeadersArgument=pf,C.httpRequestHeadersArgumentRef=zD,C.httpRequestHeadersDataType=HD,C.httpRequestMethodArgument=uf,C.httpRequestMethodArgumentRef=WD,C.httpRequestMethodDataType=YD,C.httpRequestMethodDataTypeRef=ZD,C.httpRequestOperation=tu,C.httpRequestOperationErrorValueDescriptor=xm,C.httpRequestOperationErrorValueDescriptorDatatype=Eg,C.httpRequestOperationErrorValueDescriptorRef=vg,C.httpRequestOperationRef=fg,C.httpRequestOperationRefEight=yg,C.httpRequestOperationRefFive=cg,C.httpRequestOperationRefFour=ug,C.httpRequestOperationRefNine=mg,C.httpRequestOperationRefSeven=hg,C.httpRequestOperationRefSix=pg,C.httpRequestOperationRefThree=dg,C.httpRequestOperationRefTwo=lg,C.httpRequestQueryParamsArgument=jm,C.httpRequestQueryParamsArgumentRef=qD,C.httpRequestQueryParamsDataType=SD,C.httpRequestVariableURLArgument=cf,C.httpRequestVariableURLArgumentRef=KD,C.httpRequestVariableURLDataType=kD,C.httpRequestVariableURLDataTypeRef=FD,C.httpResponseBodyReturnDataType=og,C.httpResponseBodyReturnDataTypeRef=ng,C.httpResponseBodyReturnReturn=mf,C.httpResponseBodyReturnReturnRef=ag,C.httpResponseCodeDataType=tg,C.httpResponseCodeReturn=hf,C.httpResponseCodeReturnRef=eg,C.httpResponseHeadersDataType=sg,C.httpResponseHeadersDataTypeRef=rg,C.httpResponseHeadersReturn=yf,C.httpResponseHeadersReturnRef=ig,C.httpStatusCodeValueValidation=Vj,C.implement=hy,C.inferArgumentDeclarationDataType=UL,C.inferDataType=xs,C.inferInputMapDataType=gT,C.inferOutputMapDataType=OT,C.inferPropertyDataType=FL,C.inferReturnDeclarationDataType=$T,C.inferValueDescriptorDataType=GL,C.inferVariableDeclarationDataType=xL,C.inferVariableInstanceDataType=jL,C.initBaseProjectEntity=Dy,C.initProject=Mj,C.initProjectFromFetchResult=Lj,C.inputMapValidation=vhe,C.installedProjectValidation=yhe,C.internalCallValidation=mhe,C.isPromise=vb,C.isUUID=YL,C.iterateOverListActionDescriptorListArgumentDeclaration=Xg,C.iterateOverListActionDescriptorListArgumentDeclarationDataType=zg,C.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=Yg,C.iterateOverListActionDescriptorListArgumentDeclarationParentRef=Hg,C.iterateOverListLoopActionDescriptor=ca,C.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=e$,C.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=Qg,C.iterateOverListLoopBodyActionDescriptor=su,C.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=d$,C.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=l$,C.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=c$,C.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=u$,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=bf,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=r$,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=t$,C.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=i$,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=o$,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=n$,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=s$,C.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=a$,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=m$,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=h$,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=f$,C.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=y$,C.iterateOverObjectKeysLoopActionDescriptor=ml,C.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=E$,C.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=v$,C.iterateOverObjectKeysLoopBodyActionDescriptor=qm,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=g$,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=D$,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=O$,C.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=$$,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=km,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=b$,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=T$,C.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=A$,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=_$,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=w$,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=I$,C.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=R$,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=L$,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=V$,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=P$,C.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=N$,C.iterateOverObjectValuesLoopActionDescriptor=vl,C.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=B$,C.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=M$,C.iterateOverObjectValuesLoopBodyActionDescriptor=Zm,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=S$,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=q$,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=J$,C.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=Z$,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Sm,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=j$,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=U$,C.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=x$,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=k$,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=G$,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=F$,C.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=K$,C.iterateOverStringActionDescriptorDynamicReturnDeclaration=Ug,C.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=Bg,C.iterateOverStringActionDescriptorStringArgumentDeclaration=Mg,C.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=Ng,C.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=Vg,C.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=Lg,C.iterateOverStringLoopActionDescriptor=iu,C.iterateOverStringLoopBodyActionDescriptor=Tf,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=Sg,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=qg,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=Jg,C.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=Zg,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Gm,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=xg,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=jg,C.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Fg,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Km,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Kg,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Gg,C.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=kg,C.joinListOperation=$m,C.joinListOperationError=FR,C.joinListOperationErrorParentRef=xR,C.joinListOperationFirstListArgument=LR,C.joinListOperationFirstListArgumentParentRef=NR,C.joinListOperationFirstListArgumentRef=gR,C.joinListOperationFirstListDataType=$R,C.joinListOperationResultListDataType=VR,C.joinListOperationResultListReturn=jR,C.joinListOperationResultListReturnParentRef=UR,C.joinListOperationResultListReturnRef=PR,C.joinListOperationSecondListArgument=BR,C.joinListOperationSecondListArgumentParentRef=MR,C.joinListOperationSecondListArgumentRef=OR,C.joinListOperationSecondListDataType=CR,C.joinListWithLastSeparator=Ke,C.joinStringsOperation=eu,C.joinStringsOperationDynamicStringArgument=aR,C.joinStringsOperationDynamicStringArgumentParentRef=nR,C.joinStringsOperationDynamicStringArgumentRef=iR,C.joinStringsOperationDynamicStringDataType=sR,C.joinStringsOperationError=rR,C.joinStringsOperationErrorParentRef=tR,C.joinStringsOperationFirstStringArgument=of,C.joinStringsOperationFirstStringArgumentParentRef=Z1,C.joinStringsOperationFirstStringArgumentRef=F1,C.joinStringsOperationFirstStringDataType=G1,C.joinStringsOperationResultStringDataType=S1,C.joinStringsOperationResultStringReturn=Qd,C.joinStringsOperationResultStringReturnParentRef=eR,C.joinStringsOperationResultStringReturnRef=q1,C.joinStringsOperationSecondStringArgument=lf,C.joinStringsOperationSecondStringArgumentParentRef=Q1,C.joinStringsOperationSecondStringArgumentRef=K1,C.joinStringsOperationSecondStringDataType=k1,C.joinStringsOperationSeparatorStringArgument=X1,C.joinStringsOperationSeparatorStringArgumentParentRef=H1,C.joinStringsOperationSeparatorStringArgumentRef=J1,C.joinStringsOperationSeparatorStringDataType=z1,C.joinStringsOperationSeparatorStringDataTypeDefaultValue=Y1,C.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=W1,C.keyValuePrototype=fl,C.literalValueValidation=npe,C.loopValidation=Tpe,C.lowercaseFirstLetter=Qu,C.manualFlowActionDescriptorDeclarationArgumentDeclaration=Fm,C.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=_g,C.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=Rg,C.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=Dg,C.manualFlowLoopActionDescriptor=vf,C.manualFlowLoopActionDescriptorDynamicReturnDeclaration=wg,C.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=Ig,C.manualFlowLoopBodyActionDescriptor=Ef,C.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=$g,C.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=gg,C.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=Cg,C.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=Og,C.mapActionDescriptorToTypeItRepresents=lye,C.mapRecord=PU,C.mergeEntityErrorsList=Toe,C.mergeListOfEntities=aye,C.methodDefaultValue=JD,C.mockClientProject=bE,C.moreThanOrEqualCondition=Il,C.moreThanOrEqualConditionLeftHandArgument=kC,C.moreThanOrEqualConditionLeftHandArgumentDataType=GC,C.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=FC,C.moreThanOrEqualConditionLeftHandArgumentParentRef=KC,C.moreThanOrEqualConditionRightHandArgument=JC,C.moreThanOrEqualConditionRightHandArgumentDataType=SC,C.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=qC,C.moreThanOrEqualConditionRightHandArgumentParentRef=ZC,C.noSpacesOrDashesValueValidation=yU,C.noSpacesValueValidation=hU,C.notEmptyCondition=yo,C.notEmptyConditionArgument=jC,C.notEmptyConditionRef=UC,C.nullPrototype=bm,C.numberAdditionOperation=af,C.numberAdditionOperationDynamicSummandArgument=I1,C.numberAdditionOperationDynamicSummandArgumentType=A1,C.numberAdditionOperationDynamicSummandArgumentTypeParentRef=b1,C.numberAdditionOperationError=T1,C.numberAdditionOperationErrorParentRef=E1,C.numberAdditionOperationFirstNumberArgument=Am,C.numberAdditionOperationFirstNumberArgumentRef=u1,C.numberAdditionOperationFirstNumberDataType=c1,C.numberAdditionOperationRef=m1,C.numberAdditionOperationRefThree=wm,C.numberAdditionOperationRefTwo=v1,C.numberAdditionOperationResultNumberDataType=y1,C.numberAdditionOperationResultNumberReturn=Rm,C.numberAdditionOperationResultNumberReturnRef=h1,C.numberAdditionOperationSecondNumberArgument=Im,C.numberAdditionOperationSecondNumberArgumentRef=p1,C.numberAdditionOperationSecondNumberDataType=f1,C.numberPrototype=nt,C.numberSubtractionOperation=Dm,C.numberSubtractionOperationDynamicSubtrahendArgument=j1,C.numberSubtractionOperationDynamicSubtrahendArgumentType=U1,C.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=B1,C.numberSubtractionOperationError=M1,C.numberSubtractionOperationErrorParentRef=L1,C.numberSubtractionOperationFirstNumberArgument=O1,C.numberSubtractionOperationFirstNumberArgumentRef=w1,C.numberSubtractionOperationFirstNumberDataType=R1,C.numberSubtractionOperationRef=_m,C.numberSubtractionOperationRefThree=V1,C.numberSubtractionOperationRefTwo=C1,C.numberSubtractionOperationResultNumberDataType=$1,C.numberSubtractionOperationResultNumberReturn=N1,C.numberSubtractionOperationResultNumberReturnRef=g1,C.numberSubtractionOperationSecondNumberArgument=P1,C.numberSubtractionOperationSecondNumberArgumentRef=_1,C.numberSubtractionOperationSecondNumberDataType=D1,C.numberValueAutogenerationSchema=RE,C.operationValidation=fpe,C.outputMapValidation=bhe,C.parallelExecutionOperation=Vs,C.parallelExecutionOperationError=S_,C.parallelExecutionOperationErrorParentRef=q_,C.parallelExecutionOperationListOfExecutionResultsDataType=G_,C.parallelExecutionOperationListOfExecutionResultsReturn=Mm,C.parallelExecutionOperationListOfExecutionResultsReturnRef=F_,C.parallelExecutionOperationListOfFunctionsArgument=Lm,C.parallelExecutionOperationListOfFunctionsArgumentDatatype=x_,C.parallelExecutionOperationListOfFunctionsArgumentRef=j_,C.parallelExecutionOperationListOfFunctionsBlueprint=U_,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=M_,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=L_,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=N_,C.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=V_,C.parallelExecutionOperationListOfFunctionsBlueprintParentRef=B_,C.parallelExecutionOperationRef=K_,C.parallelExecutionOperationRefThree=k_,C.persistedBuiltInBaseEntity=Jr,C.persistedBuiltInBaseEntityDatabaseProperty=Tl,C.persistedBuiltInBaseEntityDatabasePropertyDataType=EC,C.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=p7,C.persistedBuiltInBaseEntityDatabasePropertyParentRef=TC,C.persistedBuiltInBaseEntityDatabasePropertyRef=vC,C.persistedBuiltInBaseEntityPrimaryKeyProperty=bl,C.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=gC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=AC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=bC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=$C,C.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=DC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=wC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=IC,C.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=_C,C.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=RC,C.printEntity=bb,C.processOutputGlobalValueDescriptorDataType=eP,C.processOutputGlobalValueDescriptorReturn=Of,C.processOutputGlobalValueDescriptorReturnRef=QC,C.projectPublicationCompletedGlobalEvent=$f,C.propertyToZodSchema=TP,C.propertyValidation=tpe,C.relationalDatabaseBuiltInBaseEntity=Gr,C.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=av,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=fC,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=pC,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=hC,C.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=cC,C.relationalDatabaseBuiltInBaseEntityDefaultProperty=nv,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=uC,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=lC,C.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=dC,C.relationalDatabaseBuiltInBaseEntityIdentifierProperty=If,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=QO,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=HO,C.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=XO,C.relationalDatabaseBuiltInBaseEntityMinSizeProperty=_f,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=oC,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=nC,C.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=aC,C.relationalDatabaseBuiltInBaseEntityPasswordProperty=Rf,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=iC,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=c7,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyDefaultValueParentRef=sC,C.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=rC,C.relationalDatabaseBuiltInBaseEntityRef=El,C.relationalDatabaseBuiltInBaseEntityUsernameProperty=wf,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=tC,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=u7,C.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=eC,C.resolveActionDescriptorName=JL,C.resolveBaseEntityName=kL,C.resolveBuiltInBaseEntityDataTypeLabel=qL,C.resolveClonedEntityProject=yr,C.resolveConditionOperatorLabel=Zh,C.resolveDataType=qh,C.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Tb,C.resolveDataTypeLabel=Xl,C.resolveDefinitionEntityDataTypeLabel=Xce,C.resolveEntityDataTypeLabel=Hce,C.resolveEntityName=pe,C.resolveFirstCallsSecond=Whe,C.resolveFirstWritesSecond=Yhe,C.resolvePersistedDefinitionEntityDatabaseEntity=vj,C.resolvePrimaryKeyProperty=pye,C.resolvePrimitiveEntityForSearchLiteralValueType=sb,C.resolvePrimitiveEntityName=ZL,C.resolveSearchName=SL,C.resolveVariableScope=zce,C.returnDeclarationValidation=hpe,C.returnStatementValidation=ype,C.searchStatementErrorGlobalValueDescriptor=pv,C.searchStatementErrorGlobalValueDescriptorDataType=rP,C.searchStatementErrorGlobalValueDescriptorRef=tP,C.searchStatementState=phe,C.searchStatementUtils=hhe,C.searchValidation=Rpe,C.sequentialExecutionOperation=Fn,C.sequentialExecutionOperationError=cD,C.sequentialExecutionOperationErrorParentRef=uD,C.sequentialExecutionOperationListOfExecutionResultsDataType=oD,C.sequentialExecutionOperationListOfExecutionResultsReturn=Um,C.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=dD,C.sequentialExecutionOperationListOfExecutionResultsReturnRef=aD,C.sequentialExecutionOperationListOfFunctionsArgument=Bm,C.sequentialExecutionOperationListOfFunctionsArgumentDatatype=nD,C.sequentialExecutionOperationListOfFunctionsArgumentParentRef=lD,C.sequentialExecutionOperationListOfFunctionsArgumentRef=sD,C.sequentialExecutionOperationListOfFunctionsBlueprint=iD,C.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=rD,C.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=tD,C.softDeletePersistedEntityMethod=f7,C.softDeletePersistedEntityMethodParentRef=OC,C.sortCallsBasedOnExecutionDependencies=bU,C.sortChildrenEntitiesBasedOnExecutionDependencies=Zhe,C.splitListOperation=Cm,C.splitListOperationError=s_,C.splitListOperationErrorParentRef=i_,C.splitListOperationFirstOutputListDataType=JR,C.splitListOperationFirstOutputListReturn=QR,C.splitListOperationFirstOutputListReturnParentRef=XR,C.splitListOperationFirstOutputListReturnRef=Om,C.splitListOperationInputListArgument=YR,C.splitListOperationInputListArgumentParentRef=WR,C.splitListOperationInputListArgumentRef=kR,C.splitListOperationInputListDataType=qR,C.splitListOperationSecondOutputListDataType=e_,C.splitListOperationSecondOutputListReturn=r_,C.splitListOperationSecondOutputListReturnParentRef=t_,C.splitListOperationSplitIndexArgument=HR,C.splitListOperationSplitIndexArgumentParentRef=zR,C.splitListOperationSplitIndexArgumentRef=SR,C.splitListOperationSplitIndexDataType=ZR,C.splitStringOperation=gm,C.splitStringOperationError=wR,C.splitStringOperationErrorParentRef=IR,C.splitStringOperationFirstPartResultStringDataType=pR,C.splitStringOperationFirstPartResultStringReturn=AR,C.splitStringOperationFirstPartResultStringReturnParentRef=bR,C.splitStringOperationFirstPartResultStringReturnRef=cR,C.splitStringOperationIndexArgument=ER,C.splitStringOperationIndexArgumentParentRef=vR,C.splitStringOperationIndexArgumentRef=dR,C.splitStringOperationIndexDataType=uR,C.splitStringOperationSecondPartResultStringDataType=hR,C.splitStringOperationSecondPartResultStringReturn=l7,C.splitStringOperationSecondPartResultStringReturnParentRef=TR,C.splitStringOperationSecondPartResultStringReturnRef=fR,C.splitStringOperationStringArgument=mR,C.splitStringOperationStringArgumentParentRef=yR,C.splitStringOperationStringArgumentRef=oR,C.splitStringOperationStringDataType=lR,C.stringPrototype=ke,C.stringValueAutogenerationSchema=wE,C.suggestNewIdForEntity=UT,C.syncSearchEntityOutput=ab,C.test_primitive_entities_export=t0e,C.toCamelCase=Ra,C.toEntityState=ss,C.toKebabCase=KL,C.toLowerCaseKebabCase=Sh,C.toPascalCase=Hl,C.untypedDataPrototype=Fr,C.updateErrorsList=qt,C.urlDefaultValue=GD,C.uuidPrototype=jn,C.validateArgumentDeclarationName=MT,C.validateCalledByErrorIdInAction=Nhe,C.validateCalledByIdInAction=Vhe,C.validateCallers=iU,C.validateConditionEntityDeclaration=Bhe,C.validateDataOperation=uo,C.validateDataOperationDataToValidateArgument=CD,C.validateDataOperationDataToValidateArgumentParentRef=OD,C.validateDataOperationDataToValidateArgumentRef=gD,C.validateDataOperationDataToValidateDataType=$D,C.validateDataOperationEntityToMatchTypeArgument=LD,C.validateDataOperationEntityToMatchTypeArgumentParentRef=ND,C.validateDataOperationEntityToMatchTypeArgumentRef=PD,C.validateDataOperationEntityToMatchTypeDataType=VD,C.validateDataOperationError=jD,C.validateDataOperationErrorParentRef=UD,C.validateDataOperationOutputEntityDeclaration=BD,C.validateDataOperationOutputEntityDeclarationParentRef=MD,C.validateDefinitionEntityName=PT,C.validateEntryCaller=rU,C.validateErrorCaller=tU,C.validateFunctionCallDeclaration=nU,C.validateFunctionDeclarationName=VT,C.validateGeneratedEntityParentIsNotBuiltInEntity=$he,C.validateGeneration=Dhe,C.validateGenerationTarget=ur,C.validateGenerationUpdate=ghe,C.validateLoopEntityDeclaration=Uhe,C.validateName=Qce,C.validateOperationEntityDeclaration=aU,C.validatePropertyName=LT,C.validateReachability=ta,C.validateReadsValueInActionPayload=Lhe,C.validateReferenceObject=oy,C.validateReferenceToOne=db,C.validateReferences=Cr,C.validateReturnDeclarationName=BT,C.validateSuccessCaller=eU,C.validateValueReaderGenerationUpdate=ep,C.validateValueWritter=yb,C.validateVariableDeclarationName=NT,C.validateVariableInternalCallUse=mb,C.valueAutogenerationCurrentDateAndTimeSchema=eN,C.valueAutogenerationGenericSchema=vh,C.valueAutogenerationOptions=DE,C.valueAutogenerationOptionsSchema=Q4,C.valueAutogenerationRandomBooleanSchema=IE,C.valueAutogenerationRandomDateBetweenSchema=dN,C.valueAutogenerationRandomDateFromSchema=oN,C.valueAutogenerationRandomDateSchema=bh,C.valueAutogenerationRandomDateUntilSchema=lN,C.valueAutogenerationRandomNumberBetweenSchema=iN,C.valueAutogenerationRandomNumberFromSchema=tN,C.valueAutogenerationRandomNumberSchema=Eh,C.valueAutogenerationRandomNumberUntilSchema=rN,C.valueAutogenerationRandomSchema=Bu,C.valueAutogenerationRandomTextBetweenSchema=aN,C.valueAutogenerationRandomTextFromSchema=sN,C.valueAutogenerationRandomTextSchema=Th,C.valueAutogenerationRandomTextUntilSchema=nN,C.valueAutogenerationRangeValueTypesSchema=Mu,C.valueAutogenerationUniqueSchema=AE,C.valueDescriptorValidation=_he,C.variableDeclarationValidation=Ipe,C.variableInstanceValidation=wpe,C.waitOperation=mi,C.waitOperationMillisecondsNumberArgument=oo,C.waitOperationMillisecondsNumberArgumentRef=W_,C.waitOperationMillisecondsNumberDataType=Y_,C.waitOperationOperationError=X_,C.waitOperationOperationErrorParentRef=H_,C.waitOperationRef=z_,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6336",
3
+ "version": "0.0.6337",
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",