@elyx-code/project-logic-tree 0.0.6277 → 0.0.6278
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
|
@@ -71087,6 +71087,7 @@ const ie = class ie extends kv {
|
|
|
71087
71087
|
h(this, "initialized", !1);
|
|
71088
71088
|
h(this, "startedInitialization", !1);
|
|
71089
71089
|
h(this, "onCloseChangeSetCallback", null);
|
|
71090
|
+
h(this, "onAddChangeSetCallback", null);
|
|
71090
71091
|
h(this, "onRequestActiveValueCallback", null);
|
|
71091
71092
|
this.initialData = e, this.id = e.id, this.name = e.name, this.description = e.description, this.x = 0, this.y = 0, this.instances[this.id] = this;
|
|
71092
71093
|
try {
|
|
@@ -71156,6 +71157,9 @@ const ie = class ie extends kv {
|
|
|
71156
71157
|
async onCloseChangeSet(e) {
|
|
71157
71158
|
this.onCloseChangeSetCallback = e, await this.closePendingChangeSets();
|
|
71158
71159
|
}
|
|
71160
|
+
onAddChangeSet(e) {
|
|
71161
|
+
this.onAddChangeSetCallback = e;
|
|
71162
|
+
}
|
|
71159
71163
|
async closeChangeSet(e) {
|
|
71160
71164
|
const t = this.history.findIndex((l) => l.id === e.id), i = this.history.slice(0, t), s = i[i.length - 1];
|
|
71161
71165
|
if (!(s != null && s.dirty) && this.onCloseChangeSetCallback) {
|
|
@@ -71191,18 +71195,19 @@ const ie = class ie extends kv {
|
|
|
71191
71195
|
// Adds it in cronological order based on the change-set "timestamp"
|
|
71192
71196
|
// If there is a currently open change-set, it throws an error
|
|
71193
71197
|
addChangeSet(e) {
|
|
71198
|
+
var s, l;
|
|
71194
71199
|
if (!this.history.length)
|
|
71195
71200
|
return this.undoableStackValueIndex = qp(
|
|
71196
71201
|
this.undoableStackValueIndex,
|
|
71197
71202
|
this.history,
|
|
71198
71203
|
e
|
|
71199
|
-
), e;
|
|
71204
|
+
), (s = this.onAddChangeSetCallback) == null || s.call(this, e, this.undoableStackValueIndex), e;
|
|
71200
71205
|
const t = this.history.find(
|
|
71201
|
-
(
|
|
71206
|
+
(o) => o.id === (e == null ? void 0 : e.id)
|
|
71202
71207
|
);
|
|
71203
71208
|
if (t)
|
|
71204
71209
|
return t;
|
|
71205
|
-
const i = this.history.find((
|
|
71210
|
+
const i = this.history.find((o) => o.open);
|
|
71206
71211
|
if (i)
|
|
71207
71212
|
throw console.warn("Previous still open: ", i), console.warn("New change set: ", e), new Error(
|
|
71208
71213
|
`There is already an open change-set with id '${i.id}'.`
|
|
@@ -71211,7 +71216,7 @@ const ie = class ie extends kv {
|
|
|
71211
71216
|
this.undoableStackValueIndex,
|
|
71212
71217
|
this.history,
|
|
71213
71218
|
e
|
|
71214
|
-
), e;
|
|
71219
|
+
), (l = this.onAddChangeSetCallback) == null || l.call(this, e, this.undoableStackValueIndex), e;
|
|
71215
71220
|
}
|
|
71216
71221
|
// Sometimes change-sets get initialized by default but end up not having any changes.
|
|
71217
71222
|
// So we remove them from the state
|
package/dist/index.umd.cjs
CHANGED
|
@@ -406,4 +406,4 @@ If an entity is called by another, they must be in the same scope, which means t
|
|
|
406
406
|
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}unsubscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]&&delete this.detachedDependents[t.entity.id]}),this}syncDependents(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-dependents"))){const t=[],i=[],s=[],l=[];return Object.values(this.detachedDependents).forEach(o=>{const d=o.entity.afterAllChildrenInitialized(e);t.push(...d.updated),i.push(...d.added),s.push(...d.removed),l.push(...d.affected)}),e==null||e.attemptAutoclose("sync-dependents",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];if(t==="declaration"){const{updated:u,added:f,removed:c}=this.remove({ignoreUpstream:!1},i);s.push(...u),l.push(...f),o.push(...c)}if(t==="parent"){const{updated:u,added:f,removed:c}=this.remove({ignoreUpstream:!1},i);s.push(...u),l.push(...f),o.push(...c)}return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];if(t==="declaration"){const{updated:u,added:f,removed:c}=this.restore({},i);s.push(...u),l.push(...f),o.push(...c)}if(t==="parent"){const{updated:u,added:f,removed:c}=this.restore({},i);s.push(...u),l.push(...f),o.push(...c)}return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}unsubscribeFromDependencies(){var e;return(e=this.parent)==null||e.unsubscribeDependents([{entity:this,field:"parent"}]),this.declaration.unsubscribeDependents([{entity:this,field:"declaration"}]),this}subscribeToDependencies(){var e;return(e=this.parent)==null||e.subscribeDependents([{entity:this,field:"parent"}]),this.declaration.subscribeDependents([{entity:this,field:"declaration"}]),this}increaseVersion(e){if(e&&!E(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&E(e).isSame(E(this.createdAt))?this:(this.previousVersion=this.version,this.version=m.UUID.uuid(),this.createdAt=E(e).toISOString()||E().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Je(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[this.version,e]]),e.inputs=[...this.inputs],e.outputs=[...this.outputs],e.error=this.error,e.successCalls=[...this.successCalls],e.errorCalls=[...this.errorCalls],e.process=this.process,e.declaration=this.declaration,e.calledBySuccess=[...this.calledBySuccess],e.calledByError=[...this.calledByError],e.calledByEntry=[...this.calledByEntry],e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],i=[],s=[],l=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[f,c]of this.knownVersions||new Map){if(u.set(f,c),c.activeVersion=!1,c.knownVersions)for(const[T,I]of c.knownVersions)u.set(T,I);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Je(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.previousVersion=o.previousVersion,this.version=o.version,this.createdAt=o.createdAt,this.author=o.author,this.deleted=o.deleted,this.inputs=o.inputs,this.outputs=o.outputs,this.error=o.error,this.successCalls=o.successCalls,this.errorCalls=o.errorCalls,this.process=o.process,this.declaration=o.declaration,this.calledBySuccess=o.calledBySuccess,this.calledByError=o.calledByError,this.calledByEntry=o.calledByEntry,this.parent=o.parent,{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent){const l=B(this.initialData.parent),o=this.project.get(l);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.declaration){const l=B(this.initialData.declaration),o=this.project.get(l);o&&(this.setDeclaration(o),e.push(o))}return this.initialData.calledByEntry.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addEntryCaller(d,null),d.addCall(this,null),e.push(d))}),this.initialData.calledBySuccess.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addSuccessCaller(d,null),d.addSuccessCall(this,null),e.push(d))}),this.initialData.calledByError.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addErrorCaller(d,null),d.addErrorCall(this,null),e.push(d))}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],l=[];this.initialized=!0;const{updated:o,added:d,removed:u}=this.syncMissingFixedInputs(e),{updated:f,added:c,removed:T}=this.syncMissingFixedOutputs(e);return t.push(...o,...f),i.push(...d,...c),s.push(...u,...T),this.captureVersion(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-self-to-project"))){var o;const t=[this],i=[],s=[],l=[];return this.parent===this.project&&this.project.addFunctionCall(this),(o=this.process)==null||o.writesValues.forEach(d=>{d.setValueWriter(this.process,e),t.push(d)}),this.successCalls.forEach(d=>{d.addSuccessCaller(this,e),t.push(d)}),this.errorCalls.forEach(d=>{d.addErrorCaller(this,e),t.push(d)}),this.calledBySuccess.forEach(d=>{d.addSuccessCall(this,e),t.push(d)}),this.calledByError.forEach(d=>{d.addErrorCall(this,e),t.push(d)}),this.calledByEntry.forEach(d=>{d.addCall(this,e),t.push(d)}),this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-input"))){const i=this.inputs.findIndex(s=>s.id===e.id);return i>-1&&(this.inputs.splice(i,1),t&&(t==null||t.add(this,A.Affected))),t==null||t.attemptAutoclose("remove-input",this.id),this}addInput(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-input"))){return this.inputs.includes(e)?(t==null||t.attemptAutoclose("add-input",this.id),this):(this.inputs.push(e),t==null||t.add(this,A.Affected),t==null||t.attemptAutoclose("add-input",this.id),this)}addOutput(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-output"))){return this.outputs.includes(e)?(t==null||t.attemptAutoclose("add-output",this.id),this):(this.outputs.push(e),t==null||t.add(this,A.Affected),t==null||t.attemptAutoclose("add-output",this.id),this)}removeOutput(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-output"))){const i=this.outputs.findIndex(s=>s.id===e.id);return i>-1&&(this.outputs.splice(i,1),t&&(t==null||t.add(this,A.Affected))),t==null||t.attemptAutoclose("remove-output",this.id),this}addValueReader(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-value-reader"))){var i;return this.process&&!this.process.writesValues.includes(e)&&((i=this.process)==null||i.addValueReader(e,t),t==null||t.add(this,A.Affected)),t==null||t.attemptAutoclose("add-value-reader",this.id),this}removeValueReader(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-value-reader"))){var i;return this.process&&this.process.writesValues.includes(e)&&((i=this.process)==null||i.removeValueReader(e,t),t==null||t.add(this,A.Affected)),t==null||t.attemptAutoclose("remove-value-reader",this.id),this}addSuccessCaller(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-success-caller")),i=!1){return this.calledBySuccess.find(s=>s.id===e.id)||(this.calledBySuccess.push(e),t==null||t.add(this,A.Updated),i&&Q(this,t)),t==null||t.attemptAutoclose("add-success-caller",this.id),this}addErrorCaller(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-error-caller")),i=!1){return this.calledByError.find(s=>s.id===e.id)||(this.calledByError.push(e),t==null||t.add(this,A.Updated),i&&Q(this,t)),t==null||t.attemptAutoclose("add-error-caller",this.id),this}addEntryCaller(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-entry-caller")),i=!1){return this.calledByEntry.find(s=>s.id===e.id)||(this.calledByEntry.push(e),t==null||t.add(this,A.Updated),i&&Q(this,t)),t==null||t.attemptAutoclose("add-entry-caller",this.id),this}addErrorCall(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-error-call")),i=!1){return this.errorCalls.find(s=>s.id===e.id)||(this.errorCalls.push(e),i&&Q(this,t),t==null||t.add(this,A.Affected)),t==null||t.attemptAutoclose("add-error-call",this.id),this}addSuccessCall(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-success-call")),i=!1){return this.successCalls.find(s=>s.id===e.id)||(this.successCalls.push(e),i&&Q(this,t),t==null||t.add(this,A.Affected)),t==null||t.attemptAutoclose("add-success-call",this.id),this}removeCall(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-call")),i=!1){const s=this.successCalls.findIndex(o=>o.id===e.id);s>-1&&(this.successCalls.splice(s,1),t==null||t.add(this,A.Affected));const l=this.errorCalls.findIndex(o=>o.id===e.id);return l>-1&&(this.errorCalls.splice(l,1),t==null||t.add(this,A.Affected)),i&&Q(this,t),t==null||t.attemptAutoclose("remove-call",this.id),this}removeCaller(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-caller")),i=!1){return this.calledBySuccess=this.calledBySuccess.filter(s=>s.id!==e.id?!0:(t==null||t.add(this,A.Updated),t==null||t.add(s,A.Affected),!1)),this.calledByError=this.calledByError.filter(s=>s.id!==e.id?!0:(t==null||t.add(this,A.Updated),t==null||t.add(s,A.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(s=>s.id!==e.id?!0:(t==null||t.add(this,A.Updated),t==null||t.add(s,A.Affected),!1)),i&&Q(this,t),t==null||t.attemptAutoclose("remove-caller",this.id),this}setParent(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,A.Updated))),t==null||t.attemptAutoclose("set-parent",this.id),this}setDeclaration(e){return this.declaration=e,this}initChildren(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.declaration.type===n.FunctionDeclaration){const t=C(this.initialData.declaration,this.project);this.declaration=t}else{const t=B(this.initialData.declaration),i=this.project.get(t);this.declaration=i}return this.successCalls=this.initialData.successCalls.map(t=>{const i=C(t,this.project);if(i.addSuccessCaller(this),[n.BreakStatement,n.ContinueStatement].includes(i.type))i.setParent(this.parent.parent,null),i.initChildren(e);else if(i.type===n.ReturnStatement){const s=It(this,this.project);i.setParent(s,null),i.initChildren(e)}else i.type!==n.InternalCall&&(i.setParent(this.parent,null),i.initChildren(e));return i}),this.errorCalls=this.initialData.errorCalls.map(t=>{const i=C(t,this.project);if(i.addErrorCaller(this),[n.BreakStatement,n.ContinueStatement].includes(i.type))i.setParent(this.parent.parent,null),i.initChildren(e);else if(i.type===n.ReturnStatement){const s=It(this,this.project);i.setParent(s,null),i.initChildren(e)}else i.type!==n.InternalCall&&(i.setParent(this.parent,null),i.initChildren(e));return i}),this.inputs=this.initialData.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.initialData.process&&(this.process=C(this.initialData.process,this.project),this.process.setParent(this,null),this.process.initChildren(e)),this.initialData.error&&(this.error=C(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(e)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"meta-sync"))){const i=pt(this,e),s=this.toMeta();return this.x=e.x||s.x,this.y=e.y||s.y,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await Je.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await Je.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await Je.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await Je.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await Je.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await Je.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-entity"))){var d;const i=[],s=[],l=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(s.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(u=>{const{updated:f,removed:c,added:T}=u.entity.onDetachedDependencyRemoved(this,u.field,t);i.push(...f),s.push(...c),l.push(...T)}),this.process){const{updated:u,removed:f}=(d=this.process)==null?void 0:d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}if(this.inputs.forEach(u=>{const{updated:f,removed:c}=u.remove({ignoreUpstream:!0},t);i.push(...f),s.push(...c)}),this.outputs.forEach(u=>{const{updated:f,removed:c}=u.remove({ignoreUpstream:!0},t);i.push(...f),s.push(...c)}),this.error){const{updated:u,removed:f}=this.error.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}return this.successCalls.forEach(u=>{i.push(u),u.removeCaller(this,t)}),this.errorCalls.forEach(u=>{i.push(u),u.removeCaller(this,t)}),e||this.calledBy.forEach(u=>{i.push(u),u.removeCall(this,t)}),t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(l),updated:p(i),removed:p(s),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],l=[];if(e!=null&&e.hasAdded(this.id))return e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),Object.values(this.detachedDependents).forEach(o=>{const{updated:d,removed:u,added:f}=o.entity.onDetachedDependencyRestored(this,o.field,e);i.push(...d),s.push(...u),t.push(...f)}),this.process){const{updated:o}=this.process.restore({},e);i.push(...o)}return this.inputs.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.outputs.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.successCalls.forEach(o=>{i.push(o),o.addSuccessCaller(this,e)}),this.errorCalls.forEach(o=>{i.push(o),o.addErrorCaller(this,e)}),this.calledBySuccess.forEach(o=>{i.push(o),o.addSuccessCall(this,e)}),this.calledByError.forEach(o=>{i.push(o),o.addErrorCall(this,e)}),this.calledByEntry.forEach(o=>{i.push(o),o.addCall(this,e)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(l),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.successCalls.flatMap(i=>i.toFlat(e)),...this.errorCalls.flatMap(i=>i.toFlat(e)),...this.inputs.flatMap(i=>i.toFlat(e)),...this.outputs.flatMap(i=>i.toFlat(e)),...this.process?this.process.toFlat(e):[],...this.error?this.error.toFlat(e):[],...this.calledBy.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.successCalls.flatMap(i=>i.toFlatIds(e)),...this.errorCalls.flatMap(i=>i.toFlatIds(e)),...this.inputs.flatMap(i=>i.toFlatIds(e)),...this.outputs.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type}}toJSON(e=new Set){var t,i;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(s=>s.toJSON(e)),errorCalls:this.errorCalls.map(s=>s.toJSON(e)),calledBySuccess:this.calledBySuccess.map(s=>s.toReference()),calledByError:this.calledByError.map(s=>s.toReference()),calledByEntry:this.calledByEntry.map(s=>s.toReference()),process:(t=this.process)==null?void 0:t.toJSON(e),declaration:this.declaration.toJSON(e),inputs:this.inputs.map(s=>s.toJSON(e)),outputs:this.outputs.map(s=>s.toJSON(e)),parent:this.parent.toReference(),error:(i=this.error)==null?void 0:i.toJSON(e)})}toJSONClone(e=W){var i,s,l,o,d,u,f;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||yt(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(l=e.seenEntities)!=null&&l.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(d=e.seenEntities)==null||d.add(this.id),{id:t,version:m.UUID.uuid(),createdAt:e.timestamp||E().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(c=>c.toJSONClone({...e,newId:null})),errorCalls:this.errorCalls.map(c=>c.toJSONClone({...e,newId:null})),calledBySuccess:this.calledBySuccess.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),calledByError:this.calledByError.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),calledByEntry:this.calledByEntry.map(c=>c.toReference({seenEntityMaps:e.seenEntityMaps})),process:(u=this.process)==null?void 0:u.toJSONClone({...e,newId:null}),declaration:this.declaration.toJSONClone({...e,newId:null}),inputs:this.inputs.map(c=>c.toJSONClone({...e,newId:null})),outputs:this.outputs.map(c=>c.toJSONClone({...e,newId:null})),error:(f=this.error)==null?void 0:f.toJSONClone({...e,newId:null}),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,x:this.x,y:this.y,process:this.process?this.process.toReference(e):null,inputs:this.inputs.map(s=>s.toReference(e)),outputs:this.outputs.map(s=>s.toReference(e)),declaration:this.declaration.toReference(e),successCalls:this.successCalls.map(s=>s.toReference(e)),errorCalls:this.errorCalls.map(s=>s.toReference(e)),calledBySuccess:this.calledBySuccess.map(s=>s.toReference(e)),calledByError:this.calledByError.map(s=>s.toReference(e)),calledByEntry:this.calledByEntry.map(s=>s.toReference(e)),error:this.error?this.error.toReference(e):null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.successCalls.flatMap(i=>i.toFlatJSON(e)),...this.errorCalls.flatMap(i=>i.toFlatJSON(e)),...this.inputs.flatMap(i=>i.toFlatJSON(e)),...this.outputs.flatMap(i=>i.toFlatJSON(e)),...this.process?this.process.toFlatJSON(e):[],...this.error?this.error.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),declaration:this.declaration.id,parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.successCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.inputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.outputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.process?this.process.toFlatGenerationTarget(e):[],...this.error?this.error.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(i=>i.clearErrors()),this.outputs.forEach(i=>i.clearErrors()),this.successCalls.forEach(i=>i.clearErrors()),this.errorCalls.forEach(i=>i.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=ow(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors()),...this.outputs.flatMap(t=>t.getErrors()),...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){var D,O;let l=mt(t,this);const o=this.toJSON(),d=i||m.UUID.uuid();o.inputs=[];const u=d.split("-id"),f=u[u.length-1||0]||d;o.id=d,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||E().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=st(o,l);t?c.setParent(t,null):c.setParent(this.parent,null),s&&c.subscribe(),c.initChildren(e),e==null||e.add(c,A.Added);const T=(D=this.inputs)==null?void 0:D.map((V,M)=>V.clone(e,c,f+"-input-map-"+M+"-id",s));c.inputs=T;const I=(O=this.outputs)==null?void 0:O.map((V,M)=>V.clone(e,c,f+"-output-map-"+M+"-id",s));return c.outputs=I,this.error&&(c.error=this.error.clone(e,c,f+"-error-map-id",s)),this.process&&(c.process=this.process.clone(e,c,f+"-process-id",s)),e==null||e.attemptAutoclose("clone-entity",this.id),c}removeUnrecognizedInputs(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-unrecognized-inputs"))){const t=[],i=[],s=[],l=[];return this.inputs.forEach(o=>{if(!this.declaration.inputs.find(u=>{var f;return u.id===((f=o.declaration)==null?void 0:f.id)})){const u=o.remove({ignoreUpstream:!1},e);s.push(...u.removed),t.push(...u.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-inputs",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}removeUnrecognizedOutputs(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-unrecognized-outputs"))){const t=[],i=[],s=[],l=[];return this.outputs.forEach(o=>{if(!this.declaration.getUniqueReturnDeclarations().find(u=>{var f;return u.id===((f=o.declaration)==null?void 0:f.id)})){const u=o.remove({ignoreUpstream:!1},e);s.push(...u.removed),t.push(...u.updated)}}),e==null||e.attemptAutoclose("remove-unrecognized-outputs",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}syncMissingFixedInputs(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-missing-fixed-inputs"))){const t=[],i=[],s=[],l=[],o=this.declaration.inputs.filter(c=>!this.inputs.find(T=>T.declaration.id===c.id));this.inputs.sort((c,T)=>c.index-T.index),o.forEach(c=>{this.inputs.forEach(D=>{D.index>=c.index&&D.metaSync({index:D.index+1},e)});const T={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||E().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.InputMap,declaration:c.toJSON(),readsValue:null,defaultValue:null,index:c.index,name:null,description:null,parent:this.toReference()},I=C(T,this.project);I.setParent(this,e),I.initChildren(e),e==null||e.add(I,A.Added),I.addSelfToProject(e),i.push(I)}),this.inputs.sort((c,T)=>c.index-T.index);const{updated:d,added:u,removed:f}=this.removeUnrecognizedInputs(e);return t.push(...d),i.push(...u),s.push(...f),e==null||e.attemptAutoclose("sync-missing-fixed-inputs",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}syncMissingFixedOutputs(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-missing-fixed-outputs"))){const t=[],i=[],s=[],l=[],o=[];this.outputs=this.initialData.outputs.map(T=>{const I=C(T,this.project);return o.push(I.index),I.setParent(this,null),I.initChildren(e),I});const d=this.declaration.getUniqueReturnDeclarations().filter(T=>!this.outputs.find(I=>I.declaration.id===T.id));this.outputs.sort((T,I)=>T.index-I.index),d.forEach((T,I)=>{this.outputs.forEach(M=>{M.index>=T.index&&M.index++});const D=o.includes(T.index)?this.outputs.length-1+I:T.index,O={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||E().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.OutputMap,declaration:T.toJSON(),defaultValue:null,writesValues:[],index:D,parent:this.toReference()},V=C(O,this.project);V.setParent(this,e),V.initChildren(e),e==null||e.add(V,A.Added),V.addSelfToProject(e)}),this.outputs.sort((T,I)=>T.index-I.index);const{updated:u,added:f,removed:c}=this.removeUnrecognizedOutputs(e);return t.push(...u),i.push(...f),s.push(...c),e==null||e.attemptAutoclose("sync-missing-fixed-outputs",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}};h(Je,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...i)=>null}),h(Je,"type",n.FunctionCall),h(Je,"USER_MANAGED_PARENT_TYPES",[...ht,n.Project]),h(Je,"PARENT_TYPES",[...Je.USER_MANAGED_PARENT_TYPES]),h(Je,"MUTABLE_BASE_PROPERTIES",[]),h(Je,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),h(Je,"BASE_PROPERTIES",[...Je.MUTABLE_BASE_PROPERTIES,...Je.INMUTABLE_BASE_PROPERTIES]),h(Je,"MUTABLE_META_PROPERTIES",["x","y"]),h(Je,"INMUTABLE_META_PROPERTIES",[...Je.INMUTABLE_BASE_PROPERTIES]),h(Je,"META_PROPERTIES",[...Je.MUTABLE_META_PROPERTIES,...Je.INMUTABLE_META_PROPERTIES]),h(Je,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),h(Je,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),h(Je,"UPSTREAM_PROPERTIES",[...Je.MUTABLE_UPSTREAM_PROPERTIES,...Je.INMUTABLE_UPSTREAM_PROPERTIES]),h(Je,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),h(Je,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),h(Je,"DOWNSTREAM_PROPERTIES",[...Je.MUTABLE_DOWNSTREAM_PROPERTIES,...Je.INMUTABLE_DOWNSTREAM_PROPERTIES]),h(Je,"PROPERTIES",[...Je.META_PROPERTIES,...Je.UPSTREAM_PROPERTIES,...Je.DOWNSTREAM_PROPERTIES]);let an=Je;function Jc(r){return r&&typeof r.then=="function"}class Ua{constructor(a){h(this,"order",[]);h(this,"flatRecord",{});h(this,"allBuiltInEntityIds",Gi());h(this,"onGoingVisits",{});this.flatten(a),this.orderEntities()}flatten(a){const e=new Set(Gi()),t=p(j(a,e,{ignoreBuiltInBaseEntities:!0})),i=new Set;for(const s of t)this.flatRecord[s.id]=s,i.add(s.id);this.order=Array.from(i)}moveEntityAfterDependencies(a){const{upstream:e}=Ql(a,this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds});for(const t of Object.keys(e)){const i=this.order.indexOf(t),s=this.order.indexOf(a.id);if(i>s)return this.order.splice(s,1),this.order.splice(i,0,a.id),!0}return!1}orderEntities(){let a=!1;for(let e=0;e<this.order.length;e++){const t=this.order[e],i=this.flatRecord[t];if(this.moveEntityAfterDependencies(i)){a=!0;break}}a&&this.orderEntities()}getUpstreamOngoingDependenciesVisits(a,e){const{upstream:t}=Ql(this.flatRecord[a],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}),i={};return Object.entries(this.onGoingVisits[e]||{}).forEach(([s,l])=>{Object.keys(t).includes(s)&&(i[s]=l)}),i}getDownstreamOngoingDependenciesVisits(a,e){const t=Object.keys(this.onGoingVisits[e]||{}),i=new Set(t.flatMap(l=>Object.keys(Ql(this.flatRecord[l],this.flatRecord,{ignoreBuiltInBaseEntities:!0,allBuiltInEntityIds:this.allBuiltInEntityIds}).downstream))),s={};return Array.from(i).forEach(l=>{l===a&&(s[l]=this.onGoingVisits[e][l])}),s}async settlePromises(a,e){const t=Object.values(a);t.length&&await Promise.all(t),Object.keys(a).forEach(i=>{delete this.onGoingVisits[e][i]})}visit(a){const e=this.order;for(const t of e)a(this.flatRecord[t],this.flatRecord);return this}reverseVisit(a){const e=this.order.slice().reverse();for(const t of e)a(this.flatRecord[t],this.flatRecord);return this}async visitAsync(a){const e=this.order,t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const i of e){const s=this.getUpstreamOngoingDependenciesVisits(i,t);Object.keys(s).length&&await this.settlePromises(s,t);const l=a(this.flatRecord[i],this.flatRecord);Jc(l)&&(this.onGoingVisits[t][i]=l)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}async reverseVisitAsync(a){const e=this.order.slice().reverse(),t=Math.random().toString(36).substring(7);this.onGoingVisits[t]={};for(const i of e){const s=this.getDownstreamOngoingDependenciesVisits(i,t);Object.keys(s).length&&await this.settlePromises(s,t);const l=a(this.flatRecord[i],this.flatRecord);Jc(l)&&(this.onGoingVisits[t][i]=l)}return await this.settlePromises(this.onGoingVisits[t],t),this.onGoingVisits[t]={},this}}function dw(r,a){switch(r.id){case k["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const e=r.project.entities.filter(d=>!!d.implements.find(u=>u.id===k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));if(e.find(d=>!!d.properties.find(u=>{var f;return u.implements&&u.implements.id===k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((f=u.getDefaultValue())==null?void 0:f.value)===!0}))){const u=e[0].properties.find(c=>c.implements&&c.implements.id===k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),f=u==null?void 0:u.defaultValue;if(f)f.value=!0;else if(u!=null&&u.dataType){const c={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:N.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:u==null?void 0:u.dataType.toReference()},T=C(c,r.project);return T.setParent(u==null?void 0:u.dataType,a),T.initChildren(a),a==null||a.add(T,A.Added),T.addSelfToProject(a),{newEntities:[T]}}return{newEntities:[]}}const i=r.project.get(k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),s=Yl(i,"Main database",a);if(s.errors.length>0)return{newEntities:[]};const l=s.properties.find(d=>d.implements&&d.implements.id===k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),o=l==null?void 0:l.defaultValue;if(o)o.value=!0;else if(l!=null&&l.dataType){const d={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:N.EntityTemplate,autogeneration:null,value:!0,valueAsTypeSingle:null,valueAsTypeList:null,parent:l==null?void 0:l.dataType.toReference()},u=C(d,r.project);u.setParent(l==null?void 0:l.dataType,a),u.initChildren(a),a==null||a.add(u,A.Added),u.addSelfToProject(a)}return{newEntities:[s]}}}return{newEntities:[]}}function uw(r,a){const e=[],t=[],i=[],s=[];return r.implements.filter(o=>o.type===n.BuiltInBaseEntity).forEach(o=>{var d;switch(o.id){case k["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{let f=r.project.entities.filter(I=>I.implements.find(D=>D.id===k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)).find(I=>!!I.properties.find(D=>{var O;return D.implements&&D.implements.id===k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((O=D.getDefaultValue())==null?void 0:O.value)===!0}));if(!f){f=r.project.getBuiltIn(k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id).implement("Relational database",a);const D=f.properties.find(O=>{var V;return((V=O.implements)==null?void 0:V.id)===k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id});(d=D==null?void 0:D.defaultValue)==null||d.metaSync({value:!0},a),t.push(f)}const c=r.properties.find(I=>I.implements&&I.implements.id===k["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),T=c==null?void 0:c.defaultValue;if(c&&!T){const I={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(a==null?void 0:a.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:N.EntityTemplate,autogeneration:null,value:null,valueAsTypeSingle:f,valueAsTypeList:null,parent:c==null?void 0:c.toReference()},D=C(I,r.project);D.hydrateAncestors(),D.setParent(c,a),D.addSelfToProject(a),D.initChildren(a),a==null||a.add(D,A.Added),t.push(D);return}else T&&T.setValueAsTypeSingle(f,a);return}}}),{self:r,updated:p(e),added:p(t),removed:p(i),affected:p(s)}}function Yl(r,a,e,t){const i=t||m.UUID.uuid(),s=m.UUID.uuid(),l={id:i,version:s,createdAt:(e==null?void 0:e.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:a,type:n.DefinitionEntity,description:null,static:r.static,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[r.toJSON()],x:0,y:0,parent:r.project.toReference()};dw(r,e);const o=C(l,r.project);return o.hydrateAncestors(),e==null||e.add(o,A.Added),o.addSelfToProject(e),o.addImplementation(r),o.setParent(r.project,e),o.initChildren(e),uw(o,e),o}function Wc(r,a){return a.entities.find(i=>{const s=i.properties,l=s.map(c=>c.name),o=r.every(c=>l.includes(c)),d=l.filter(c=>!r.includes(c)),u=s.every(c=>!d.includes(c.name)||!c.required);return o&&u})||null}function pw(r,a,e,t=Pt.OrDataTypeGroup){const i=[],s=[],l=[],o=[],u={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,options:null,implementationChooseOne:!1,entity:r.toJSON(),isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:null,interactiveEntities:null,actionEntities:null,like:!0,inferred:!1,parentRelationType:t,parent:a.toReference()},f=C(u,r.project);return s.push(f),f.setParent(a,e),f.initChildren(e),e==null||e.add(f,A.Added),f.setEntity(r),f.addSelfToProject(e),{updated:p(i),added:p(s),removed:p(l),affected:p(o),self:f}}function Sc(r,a,e,t,i){var u,f,c,T,I,D,O,V;const s=[],l=[],o=[],d=[];switch(typeof r){case"string":let M=!1;const G=new Date(r);if(G instanceof Date&&!isNaN(G.valueOf())&&(M=!0),M){const _=a.project.getBuiltIn(k[n.PrimitiveEntity][N.Date].id);a.setEntity(_);break}else{const _=a.project.getBuiltIn(k[n.PrimitiveEntity][N.String].id);a.setEntity(_);break}case"number":a.setEntity(a.project.getBuiltIn(k[n.PrimitiveEntity][N.Number].id));break;case"boolean":a.setEntity(a.project.getBuiltIn(k[n.PrimitiveEntity][N.Boolean].id));break;case"object":if(r===null){a.setEntity(a.project.getBuiltIn(k[n.PrimitiveEntity][N.Null].id));break}else if(Array.isArray(r))if(a.metaSync({isList:!0},t),r.length>0){const _=r.slice(0,5).filter(q=>q!==void 0);if(_.every(q=>typeof q==typeof _[0])&&(typeof _[0]!="object"||_[0]===null))switch(typeof _[0]){case"string":a.setEntity(a.project.getBuiltIn(k[n.PrimitiveEntity][N.String].id));break;case"number":a.setEntity(a.project.getBuiltIn(k[n.PrimitiveEntity][N.Number].id));break;case"boolean":a.setEntity(a.project.getBuiltIn(k[n.PrimitiveEntity][N.Boolean].id));break;case"object":a.setEntity(a.project.getBuiltIn(k[n.PrimitiveEntity][N.Null].id));break}else{const q=[];let S=!1;_.forEach(de=>{var me,z,oe,Ft;if(Array.isArray(de)&&(S=!0),typeof de=="object"&&!Array.isArray(de)&&de!==null){const nr=Hl(de,a.project,{...e,id:m.UUID.uuid()},t,i);nr.hasCreated&&q.push((me=nr.changeSet)==null?void 0:me.self),s.push(...(z=nr.changeSet)==null?void 0:z.updated),l.push(...(oe=nr.changeSet)==null?void 0:oe.added),o.push(...(Ft=nr.changeSet)==null?void 0:Ft.removed)}});const K=p(q);if(!K.length&&!S){_.forEach(de=>{const me={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,options:null,implementationChooseOne:!1,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:!1,interactiveEntities:!0,actionEntities:!1,like:!0,inferred:!1,parentRelationType:Pt.OrDataTypeGroup,parent:a.toReference()},z=C(me,a.project);switch(z.setParent(a,t),z.initChildren(t),t==null||t.add(z,A.Added),z.addSelfToProject(t),typeof de){case"string":z.setEntity(z.project.getBuiltIn(k[n.PrimitiveEntity][N.String].id));break;case"number":z.setEntity(z.project.getBuiltIn(k[n.PrimitiveEntity][N.Number].id));break;case"boolean":z.setEntity(z.project.getBuiltIn(k[n.PrimitiveEntity][N.Boolean].id));break;case"object":z.setEntity(z.project.getBuiltIn(k[n.PrimitiveEntity][N.Null].id));break}});break}else K.length===1&&!S?a.setEntity(K[0]):_.forEach(de=>{if(typeof de=="object"&&!Array.isArray(de)&&de!==null){const me=Wc(Object.keys(de),a.project);if(me){const z=pw(me||K[0],a,t,Pt.OrDataTypeGroup);s.push(...z.updated),l.push(...z.added),o.push(...z.removed)}}else{const me={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,options:null,implementationChooseOne:!1,entity:null,isList:Array.isArray(de),asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:!1,interactiveEntities:!0,actionEntities:!1,like:!0,inferred:!1,parentRelationType:Pt.OrDataTypeGroup,parent:a.toReference()},z=C(me,a.project);z.setParent(a,t),z.initChildren(t),t==null||t.add(z,A.Added),z.addSelfToProject(t);const oe=Sc(de,z,{...e,id:m.UUID.uuid()},t,i);s.push(...oe.updated),l.push(...oe.added),o.push(...oe.removed)}})}}else{const _=Hl(r[0],a.project,{...e},t,i);a.setEntity((u=_.changeSet)==null?void 0:u.self),s.push(...(f=_.changeSet)==null?void 0:f.updated),l.push(...(c=_.changeSet)==null?void 0:c.added),o.push(...(T=_.changeSet)==null?void 0:T.removed);break}else{const _=Hl(r,a.project,{...e},t,i);a.setEntity((I=_.changeSet)==null?void 0:I.self),s.push(...(D=_.changeSet)==null?void 0:D.updated),l.push(...(O=_.changeSet)==null?void 0:O.added),o.push(...(V=_.changeSet)==null?void 0:V.removed);break}}return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:a}}function Hl(r,a,e,t,i){const s=[],l=[],o=[],d=[],u=Object.keys(r),f=Wc(u,a);if(f)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],affected:[],self:f}};const c=i?e.name+" of "+i.name:e.name,I={id:e.id||m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:c,type:n.DefinitionEntity,description:e.description||null,static:e.static||!1,abstract:e.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:a.toReference()},D=C(I,a);return D.setParent(a,t),D.initChildren(t),t==null||t.add(D,A.Added),D.addSelfToProject(t),l.push(D),u.forEach((O,V)=>{const G={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:O,type:n.Property,description:null,static:!1,abstract:!1,defaultValue:null,constant:!1,dataType:null,implements:null,extends:null,index:V,hidden:!1,private:!1,required:!0,parent:D.toReference()},_=C(G,a);_.setParent(D,t),_.initChildren(t),t==null||t.add(_,A.Added),_.addSelfToProject(t),l.push(_);const g=r[O],S={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,entity:null,isList:!1,asType:null,andChildrenGroup:null,orChildrenGroup:null,staticEntities:!1,interactiveEntities:!0,actionEntities:!1,like:!0,inferred:!1,parent:_.toReference()},K=C(S,a);K.setParent(_,t),K.initChildren(t),t==null||t.add(K,A.Added),K.addSelfToProject(t),l.push(K);const de=Sc(g,K,{...e,name:O,id:m.UUID.uuid()},t,i||D);s.push(...de.updated),l.push(...de.added),o.push(...de.removed)}),{hasCreated:!0,changeSet:{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:D}}}function Dr(r,a,e,t){const i=[];return!r.length||!a.length?{errors:i,overlap:!1}:(r.length>a.length?r.forEach(s=>{const l=a.find(d=>d.name===s.name),o=a.find(d=>{var u,f;return!!s.implements&&((u=d.implements)==null?void 0:u.id)===((f=s.implements)==null?void 0:f.id)});if(l){const d=new Ye({id:s.id+"--"+l.id+"--"+t,message:`Entity of type ${s.type} named "${s.name}" with id "${s.id}" overrides a base ${l.type} ${l.name} with id "${l.id}" that has the same name`,issue:null,severity:w.Error,code:t,entity:s,firstRelationship:l});i.push(d)}if(o){const d=new Ye({id:s.id+"--"+o.id+"--"+e,message:`Entity of type ${s.type} named "${s.name}" with id "${s.id}" overrides a base ${o.type} ${o.name} with id "${o.id}" that implements the same base descriptor`,issue:null,severity:w.Error,code:e,entity:s,firstRelationship:o});i.push(d)}}):a.forEach(s=>{var d;const l=r.find(u=>u.name===s.name),o=r.find(u=>{var f,c;return!!u.implements&&((f=u.implements)==null?void 0:f.id)===((c=s.implements)==null?void 0:c.id)});if(l){const u=new Ye({id:l.id+"--"+s.id+"--"+t,message:`Entity of type ${l.type} named "${l.name}" with id "${l.id}" overrides a base entity ${s.name} with id "${s.id}" that has the same name`,issue:null,severity:w.Error,code:t,entity:l,firstRelationship:s});i.push(u)}if(o){const u=new Ye({id:o.id+"--"+s.id+"--"+e,message:`Entity of type ${o.type} named "${o.name}" with id "${o.id}" overrides a base entity ${s.name} with id "${s.id}" that implements the same base ${(d=o==null?void 0:o.implements)==null?void 0:d.type}`,issue:null,severity:w.Error,code:e,entity:o,firstRelationship:s});i.push(u)}}),{errors:i,overlap:!!i.length})}function CW(r,a){return r.abstract||(r.properties.forEach(t=>{t.abstract||t.metaSync({abstract:!0},a)}),Object.values(r.detachedDependents).forEach(t=>{t.field===Bc.Entity&&t.entity.remove({ignoreUpstream:!1},a)}),r.metaSync({abstract:!0},a)),r}function _W(r,a){return r.abstract&&(r.properties.forEach(t=>{t.abstract&&t.metaSync({abstract:!1},a)}),Object.values(r.detachedDependents).forEach(t=>{(t.field===sd.Implements||t.field===sd.Extends)&&t.entity.onDetachedDependencyRemoved(r,t.field,a)}),r.metaSync({abstract:!1},a)),r}function BW(r,a){return r.static||(r.properties.forEach(t=>{t.static||t.metaSync({static:!0},a)}),r.metaSync({static:!0},a)),r}function MW(r,a){return r.static&&r.metaSync({static:!1},a),r}var cw=(r=>(r.StringValueMustNotHaveSpaces="string-value-must-not-have-spaces",r.StringValueMustNotHaveDashes="string-value-must-not-have-dashes",r))(cw||{});function fw(r,a){const e=[],t=a;if(!t)return{errors:e,override:a};if(typeof t!="string")return{errors:[],override:a};if(t.includes(" ")){const i=new Ye({id:r.id+"--string-value-must-not-have-spaces",message:`Entity of type ${r.type} with id "${r.id}" has an invalid value "${a}". The value cannot contain spaces.`,issue:null,severity:w.Error,code:"string-value-must-not-have-spaces",entity:r});e.push(i)}return{errors:e,override:t.replace(/\s/g,"-")}}function hw(r,a){const e=[],t=a;if(!t)return{errors:e,override:a};if(typeof t!="string")return{errors:[],override:a};if(t.includes(" ")){const i=new Ye({id:r.id+"--string-value-must-not-have-spaces",message:`Entity of type ${r.type} with id "${r.id}" has an invalid value "${a}". The value cannot contain spaces or dashes.`,issue:null,severity:w.Error,code:"string-value-must-not-have-spaces",entity:r});e.push(i)}if(t.includes("-")){const i=new Ye({id:r.id+"--string-value-must-not-have-dashes",message:`Entity of type ${r.type} with id "${r.id}" has an invalid value "${a}". The value cannot contain spaces or dashes.`,issue:null,severity:w.Error,code:"string-value-must-not-have-dashes",entity:r});e.push(i)}return{errors:e,override:t.replace(/\s|-/g,"_")}}function _s(r,a){const e=gn(r);if(e.length===0)return{list:[],last:null};let t=null;return{list:e.flatMap(s=>{if(s===a)return t=s,[s];const l=_s(s,a);return l.last&&(t=l.last),[s,...l.list]}),last:t}}function zc(r){const a=r.calledBy;if(a.length===0)return r.project;const e=a.reduce((t,i)=>{const s=zt(i,r.project);return!s||s.type===n.Project?t:t.type===n.Project||_s(s,t).last?s:(_s(t,s).last,t)},r.project);return e.type===n.FunctionDeclaration&&e.parent.type===n.Loop?e.parent:e}function Q(r,a){var i,s;let e=zc(r);if(r.type===n.InternalCall)(i=r.parent)==null||i.setParent(e,a),(s=r.parent)==null||s.addSelfToProject(a);else if((r.type===n.ContinueStatement||r.type===n.BreakStatement)&&e.type!==n.Loop){r.remove({ignoreUpstream:!1},a);return}else if(r.type===n.ReturnStatement&&!ht.includes(e.type)){r.remove({ignoreUpstream:!1},a);return}else r.setParent(e,a),r.addSelfToProject(a);if(ot.includes(r.type))return;Te(r).forEach(l=>{var d,u;const o=zc(l);if(l.type===n.InternalCall)(d=l.parent)==null||d.setParent(o,a),(u=l.parent)==null||u.addSelfToProject(a);else if((l.type===n.ContinueStatement||l.type===n.BreakStatement)&&o.type!==n.Loop){l.remove({ignoreUpstream:!1},a);return}else if(l.type===n.ReturnStatement&&!ht.includes(o.type)){l.remove({ignoreUpstream:!1},a);return}else l.setParent(o,a),l.addSelfToProject(a)})}function yw(r,a,e=new Set){const t=on(r),i=on(a),s=t.filter(d=>!i.includes(d)),l=t.filter(d=>i.includes(d)),o=s.reduce((d,u)=>e.has(u.id)?d:(e.add(u.id),p([...d,...yw(u,a,e)])),[]);return p([...l,...o])}function $a(r,a){const e=_s(r,a);return e.last===a&&e.list.length>0&&e.list[0]!==a}function NW(r,a){return!!_s(r,a).last}function LW(r){if(rt.includes(r.type))return r;if([...xi,n.VariableDeclaration].includes(r.type)){const a=r.parent;return rt.includes(a.type)?a:null}return null}function Yc(r,a){if(!r||!a)throw new Error("Both entities must be defined to find a common ancestor");if(r===a)return r;const e=r.parent;if(e){if(e===a)return a;if(e.type===n.Project)return null}else return null;const t=a.parent;if(t){if(t===r)return r;if(t.type===n.Project)return null}else return null;return Yc(e,t)}function Rt(r){if(Ka.includes(r.type)){if(r.type===n.FunctionDeclaration){const a=r.parent;if(a.type===n.DefinitionEntity)return Rt(a);if(a.type===n.Loop)return a}return r.type===n.DefinitionEntity&&r.parent.type===n.DataType?Rt(r.parent):r}else{const a=r.parent;return a?Rt(a):null}}function Kl(r,a){const e=Ga(r,a);if(!e)return null;if(Ka.includes(e.type)){if(e.type===n.FunctionDeclaration){const t=Ga(e.parent,a);if(t){if(t.type===n.DefinitionEntity)return t;if(t.type===n.Loop)return t}}return e}else{const t=e.parent?Ga(e.parent,a):null;return t?Kl(t,a):null}}function mw(r){if(!r)return null;if(xi.includes(r.type))return r;const a=r.parent;return a?mw(a):null}function vw(r){if(!r)return null;if(dt.includes(r.type))return r;const a=r.parent;return a?vw(a):null}function Ew(r){if(!r)return null;if(ki.includes(r.type))return r;const a=r.parent;return a?Ew(a):null}function jW(r){return r.type===n.VariableDeclaration?[r]:dt.includes(r.type)?[...r.inputs,...r.outputs||[]]:ot.includes(r.type)?r.outputs:qn.includes(r.type)||r.type===n.FunctionDeclaration?r.inputs:[]}function UW(r){const a=on(r),e=[],t=[];pf.includes(r.type)&&e.push(...Hc(r));const i=a.filter(s=>{const l=e.includes(s);return l?!1:xi.includes(s.type)&&!l?(t.push(s),!1):!0});return e.sort((s,l)=>$a(l,s)?-1:0),t.sort((s,l)=>$a(l,s)?-1:0),[...e,...t,...i]}function Tw(r){return[...r].sort((a,e)=>$a(e,a)?-1:0)}function $W(r){const a=Tw(r),e=[];return a.forEach(t=>{const i=e[e.length-1];if(i){const s=i[i.length-1];$a(t,s)?e.push([t]):i.push(t)}else e.push([t])}),e}function gt(r){const a=r.map(e=>Rt(e));return p(a)}function Hc(r){return dt.includes(r.type)?[...gt(r.successCalls),...gt(r.errorCalls)]:rt.includes(r.type)?gt(r.calls):[]}function GW(r,a){return Hc(r).includes(a)}function Kc(r){return r.writesValues||[]}function gW(r,a){return Kc(r).includes(a)}function Iw(r){var a;return it.includes((a=r==null?void 0:r.readsValue)==null?void 0:a.type)?r.readsValue:null}function FW(r){return r.writesValues}function Aw(r=[]){return r.map(Iw).filter(a=>!!a)}function Xl(r=[]){return r.map(a=>a.writesValues).flat().filter(a=>it.includes(a.type))}function bw(r=[]){return r.map(a=>a.readsValue).filter(a=>!!a&&it.includes(a.type))}function Rw(r){return it.includes(r.type)?r:null}function Dw(r){return r.writesValues.map(Rw).filter(a=>!!a)}function Ow(r=[]){return r.reduce((a,e)=>e.type===n.OutputMap?[...a,...Dw(e)]:a,[])}function Te(r){return r.type===n.Loop?p([...Ci(gt(r.successCalls)),...Ci(gt(r.errorCalls)),...r.body?Te(r.body):[]]):dt.includes(r.type)?p([...Ci(gt(r.successCalls)),...Ci(gt(r.errorCalls))]):rt.includes(r.type)?p(Ci(gt(r.calls))):[]}function xW(r){return dt.includes(r.type)?[...Ci(gt(r.successCalls)),...Ci(gt(r.errorCalls))]:rt.includes(r.type)?Ci(gt(r.calls)):[]}function ww(r,a=new Set){return r.writesValues.filter(t=>it.includes(t.type)&&!a.has(t.id)).reduce((t,i)=>a.has(i.id)?t:[...t,...He(i,a)],[])}function Pw(r,a=new Set){var t;return(((t=r.readsValue)==null?void 0:t.writesValues)||[]).filter(i=>it.includes(i.type)&&!a.has(i.id)).reduce((i,s)=>a.has(s.id)?i:[...i,...He(s,a)],[])}function He(r,a=new Set){if(a.has(r.id))return[];if(r.type===n.ReturnStatement)return bw(r.outputs).reduce((t,i)=>[...t,...He(i,a)],[]);if(r.type===n.FunctionCall||r.type===n.Operation||r.type===n.Condition)return[...Te(r).reduce((s,l)=>{const o=Rt(l);return[...s,...He(o||l,a)]},[]),...Aw(r.inputs),...Ow(r.outputs)].reduce((s,l)=>[...s,...He(l,a)],[]);if(qn.includes(r.type)){const e=Xl(r.inputs),i=Te(r).reduce((s,l)=>{const o=Rt(l);return[...s,...He(o||l,a)]},[]);return e.push(...i),e.reduce((s,l)=>[...s,...He(l,a)],[])}if(r.type===n.FunctionDeclaration){const e=[...Xl(r.inputs)],i=Te(r).reduce((s,l)=>{const o=Rt(l);return[...s,...He(o||l,a)]},[]);return e.push(...i),e.reduce((s,l)=>[...s,...He(l)],[])}if(it.includes(r.type)){a.add(r.id);const t=Te(r).reduce((i,s)=>{const l=Rt(s);return[...i,...He(l||s,a)]},[]);return[r,...t,...Pw(r,a),...ww(r,a)]}return[]}function ci(r,a=new Set){return a.has(r.id)?[]:(a.add(r.id),[...on(r).reduce((i,s)=>[...i,s,...ci(s,a)],[])])}function Ci(r){return r.reduce((a,e)=>e.type===n.ReturnStatement||e.type===n.ContinueStatement||e.type===n.BreakStatement?[...a,e]:[...a,e,...Te(e)],[])}function Vw(r){const a=r.entities||[],e=[...a,...r.functions||[],...r.events||[],...r.projects||[]],t=a.reduce((d,u)=>[...d,...u.properties],[]),i=a.reduce((d,u)=>[...d,...u.methods],[]),s=i.reduce((d,u)=>[...d,...Xl(u.inputs),...Ci(gt(u.calls)),...u.returnStatements],[]),l=r.functions.reduce((d,u)=>[...d,...Ci(gt(u.calls)),...u.returnStatements],[]),o=r.events.reduce((d,u)=>[...d,...Ci(gt(u.calls)),...u.returnStatements],[]);return[...e,...t,...i,...s,...l,...o]}function Cw(r,a){return a.filter(t=>{if(!t)return!1;switch(t.type){case n.FunctionCall:return t.inputs.find(i=>i.id===r.id)!==void 0||t.outputs.find(i=>i.id===r.id)!==void 0;case n.Condition:return t.successCalls.find(i=>i.id===r.id)!==void 0||t.errorCalls.find(i=>i.id===r.id)!==void 0||t.inputs.find(i=>i.id===r.id)!==void 0;case n.Operation:return t.outputs.find(i=>i.id===r.id)!==void 0;case n.VariableDeclaration:return dt.includes(r.type)?rP(r).find(s=>{var l;return((l=s.readsValue)==null?void 0:l.id)===t.id})!==void 0:!1;case n.DefinitionEntity:return t.properties.find(i=>i.id===r.id)!==void 0||t.methods.find(i=>i.id===r.id)!==void 0;case n.FunctionDeclaration:return t.inputs.find(i=>i.id===r.id)!==void 0||(t.returnStatements.map(i=>i.outputs).flat()||[]).find(i=>i.id===r.id)!==void 0;default:return!1}})}function kW(r){const a=Vw(r.project);return Cw(r,a)}function Ga(r,a){return r?typeof r=="string"?a[r]:r.type===n.GenericReference?a[r.entityId]:a[r.id]?a[r.id]:null:null}function Ql(r,a={},e={ignoreBuiltInBaseEntities:!1,allBuiltInEntityIds:[]}){if(e.ignoreBuiltInBaseEntities&&(si.includes(r.type)||(e.allBuiltInEntityIds||[]).includes(r.id)))return{upstream:{},downstream:{}};const t=r,i=r,s=r,l=r,o=r,d=r,u=r,f=r,c=r,T=r,I=r,D=r,O=r,V=[...O.readsValue?[O.readsValue]:[],...O.declaration?[O.declaration]:[],...(D.calledByEntry||[]).flatMap(g=>g),...(D.calledBySuccess||[]).flatMap(g=>g),...(D.calledByError||[]).flatMap(g=>g),...T.parent?[T.parent]:[]];Array.isArray(s.implements)?V.push(...s.implements.flatMap(g=>g)):c.implements&&V.push(c.implements),Array.isArray(s.extends)?V.push(...s.extends.flatMap(g=>g)):c.extends&&V.push(c.extends),o.valueAsTypeList&&Array.isArray(o.valueAsTypeList)&&V.push(...o.valueAsTypeList.flatMap(g=>g)),o.valueAsTypeSingle&&V.push(o.valueAsTypeSingle);const M=[...(t.inputs||[]).flatMap(g=>g),...(I.inputsDeclarations||[]).flatMap(g=>g),...(t.outputs||[]).flatMap(g=>g),...(I.outputsDeclarations||[]).flatMap(g=>g),...(O.internalCalls||[]).flatMap(g=>g),...O.writesValues||[],...D.dataType?[D.dataType]:[],...d.body?[d.body]:[],...D.defaultValue?[D.defaultValue]:[],...(D.successCalls||[]).flatMap(g=>g),...(D.errorCalls||[]).flatMap(g=>g),...(s.properties||[]).flatMap(g=>g),...(s.methods||[]).flatMap(g=>g),...(s.abstractMethods||[]).flatMap(g=>g),...u.error?[u.error]:[],...u.process?[u.process]:[],...T.throws?[T.throws]:[],...(i.andChildrenGroup||[]).flatMap(g=>g),...(i.orChildrenGroup||[]).flatMap(g=>g),...(f.entities||[]).flatMap(g=>g),...(f.functions||[]).flatMap(g=>g),...(f.functionCalls||[]).flatMap(g=>g),...(f.events||[]).flatMap(g=>g),...(f.conditions||[]).flatMap(g=>g),...(f.operations||[]).flatMap(g=>g),...(f.loops||[]).flatMap(g=>g),...(f.variableDeclarations||[]).flatMap(g=>g),...(f.variableInstances||[]).flatMap(g=>g),...(f.searches||[]).flatMap(g=>g),...(f.projects||[]).flatMap(g=>g),...(l.calls||[]).flatMap(g=>g)];r.type===n.DataType&&(i.entity&&a[B(i.entity)]&&a[B(i.entity)].parent&&B(a[B(i.entity)].parent)===r.id?M.push(i.entity):i.entity&&V.push(i.entity));const G={},_={};return V.forEach(g=>{const q=B(g);if(q&&e.ignoreBuiltInBaseEntities&&(si.includes(g.type)||(e.allBuiltInEntityIds||[]).includes(q)))return;const S=g.version;q&&(G[q]=S)}),M.forEach(g=>{const q=B(g);if(q&&e.ignoreBuiltInBaseEntities&&(si.includes(g.type)||(e.allBuiltInEntityIds||[]).includes(q)))return;const S=g.version;q&&(_[q]=S)}),{upstream:G,downstream:_}}function ZW(r,a){const e=[];if(xi.includes(r.type)){Ai(r).forEach(s=>{const l=Kl(s,a);l&&e.push(l)});const i=[...r.inputs||[],...r.outputs||[]].map(s=>{const l=Ga(s,a);return l?sP(l,a):null}).filter(s=>s!==null);e.push(...p(i))}if(it.includes(r.type)){const t=ed(r);t&&e.push(t)}return p(e)}function gn(r){const a=[];if(xi.includes(r.type)){r.calledBy.forEach(i=>{const s=Rt(i);s&&a.push(s)});const t=[...r.inputs||[],...r.outputs||[]].map(i=>ed(i)).filter(i=>i!==null);a.push(...p(t))}if(it.includes(r.type)){const e=ed(r);e&&a.push(e)}return p(a)}function Ai(r){return[...r.calledByEntry||[],...r.calledByError||[],...r.calledBySuccess||[]].filter(a=>a.type!==n.GenericReference)}function _w(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ActionDescriptor)throw new Error("Entity must be an action descriptor to be flattened");return[r,...r.inputs.flatMap(t=>j(t,a,e)),...r.outputs.flatMap(t=>j(t,a,e)),...r.error?j(r.error,a,e):[],...r.parent?j(r.parent,a,e):[]]}function Bw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ArgumentDeclaration)throw new Error("Entity must be an argument declaration to be flattened");return[r,...r.defaultValue?j(r.defaultValue,a):[],...r.writesValues.flatMap(t=>j(t,a,e)),...r.dataType?j(r.dataType,a,e):[],...r.parent?j(r.parent,a,e):[]]}function Mw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.BreakStatement)throw new Error("Entity must be a break statement to be flattened");return[r,...r.outputs.flatMap(t=>j(t,a,e)),...r.throws?j(r.throws,a,e):[],...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function Nw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.BuiltInBaseEntity)throw new Error("Entity must be a built-in base entity to be flattened");return[r,...(r.properties||[]).flatMap(t=>j(t,a,e)),...(r.methods||[]).flatMap(t=>j(t,a,e)),...(r.abstractMethods||[]).flatMap(t=>j(t,a,e)),...(r.extends||[]).flatMap(t=>j(t,a,e))]}function Lw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Condition)throw new Error("Entity must be a condition to be flattened");return[r,...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.successCalls||[]).flatMap(t=>j(t,a,e)),...(r.errorCalls||[]).flatMap(t=>j(t,a,e)),...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function jw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ContinueStatement)throw new Error("Entity must be a continue statement to be flattened");return[r,...r.outputs.flatMap(t=>j(t,a,e)),...r.throws?j(r.throws,a,e):[],...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function Uw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.DefinitionEntity)throw new Error("Entity must be a definition entity to be flattened");return[r,...(r.extends||[]).flatMap(t=>j(t,a,e)),...(r.implements||[]).flatMap(t=>j(t,a,e)),...(r.properties||[]).flatMap(t=>j(t,a,e)),...(r.methods||[]).flatMap(t=>j(t,a,e)),...(r.abstractMethods||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function $w(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.DataType)throw new Error("Entity must be a data type to be flattened");return[r,...(r.andChildrenGroup||[]).flatMap(t=>j(t,a,e)),...(r.orChildrenGroup||[]).flatMap(t=>j(t,a,e)),...r.entity?j(r.entity,a,e):[],...r.parent?j(r.parent,a,e):[]]}function Gw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.FunctionCall)throw new Error("Entity must be a function call to be flattened");return[r,...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.outputs||[]).flatMap(t=>j(t,a,e)),...r.error?j(r.error,a,e):[],...r.process?j(r.process,a,e):[],...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...(r.successCalls||[]).flatMap(t=>j(t,a,e)),...(r.errorCalls||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function gw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.FunctionDeclaration)throw new Error("Entity must be a function declaration to be flattened");return[r,...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.calls||[]).flatMap(t=>j(t,a,e)),...r.implements?j(r.implements,a,e):[],...r.parent?j(r.parent,a,e):[]]}function Fw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.GlobalEvent)throw new Error("Entity must be a global event to be flattened");return[r,...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.calls||[]).flatMap(t=>j(t,a,e)),...r.implements?j(r.implements,a,e):[],...r.parent?j(r.parent,a,e):[]]}function xw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.InputMap)throw new Error("Entity must be an input map to be flattened");return[r,...r.readsValue?j(r.readsValue,a,e):[],...r.declaration?j(r.declaration,a,e):[],...r.defaultValue?j(r.defaultValue,a,e):[],...r.parent?j(r.parent,a,e):[]]}function kw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.InstalledProject)throw new Error("Entity must be an installed project to be flattened");return[r,...(r.functions||[]).flatMap(t=>j(t,a,e)),...(r.events||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function Zw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.InternalCall)throw new Error("Entity must be an internal call to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>j(t,a,e)),...(r.errorCalls||[]).flatMap(t=>j(t,a,e)),...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.outputs||[]).flatMap(t=>j(t,a,e)),...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.error?j(r.error,a,e):[],...r.process?j(r.process,a,e):[],...r.parent?j(r.parent,a,e):[]]}function qw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.LiteralValue)throw new Error("Entity must be a literal value to be flattened");return[r,...r.valueAsTypeSingle?j(r.valueAsTypeSingle,a,e):[],...r.valueAsTypeList&&Array.isArray(r.valueAsTypeList)?r.valueAsTypeList.flatMap(t=>j(t,a,e)):[],...r.parent?j(r.parent,a,e):[]]}function Jw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Loop)throw new Error("Entity must be a loop to be flattened");return[r,...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.outputs||[]).flatMap(t=>j(t,a,e)),...(r.successCalls||[]).flatMap(t=>j(t,a,e)),...(r.errorCalls||[]).flatMap(t=>j(t,a,e)),...r.error?j(r.error,a,e):[],...r.process?j(r.process,a,e):[],...r.body?j(r.body,a,e):[],...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function Ww(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Operation)throw new Error("Entity must be an operation to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>j(t,a,e)),...(r.errorCalls||[]).flatMap(t=>j(t,a,e)),...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.outputs||[]).flatMap(t=>j(t,a,e)),...r.error?j(r.error,a,e):[],...r.process?j(r.process,a,e):[],...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function Sw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.OutputMap)throw new Error("Entity must be an output map to be flattened");return[r,...(r.writesValues||[]).flatMap(t=>j(t,a,e)),...r.declaration?j(r.declaration,a,e):[],...r.defaultValue?j(r.defaultValue,a,e):[],...r.parent?j(r.parent,a,e):[]]}function zw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.PrimitiveEntity)throw new Error("Entity must be a primitive entity to be flattened");return[r,...(r.properties||[]).flatMap(t=>j(t,a,e)),...(r.methods||[]).flatMap(t=>j(t,a,e)),...(r.abstractMethods||[]).flatMap(t=>j(t,a,e))]}function Yw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Project)throw new Error("Entity must be a project to be flattened");return[r,...(r.entities||[]).flatMap(t=>j(t,a,e)),...(r.functions||[]).flatMap(t=>j(t,a,e)),...(r.events||[]).flatMap(t=>j(t,a,e)),...(r.projects||[]).flatMap(t=>j(t,a,e)),...(r.variableDeclarations||[]).flatMap(t=>j(t,a,e)),...(r.variableInstances||[]).flatMap(t=>j(t,a,e)),...(r.operations||[]).flatMap(t=>j(t,a,e)),...(r.conditions||[]).flatMap(t=>j(t,a,e)),...(r.functionCalls||[]).flatMap(t=>j(t,a,e)),...(r.projects||[]).flatMap(t=>j(t,a,e)),...(r.loops||[]).flatMap(t=>j(t,a,e)),...(r.searches||[]).flatMap(t=>j(t,a,e))]}function Hw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Property)throw new Error("Entity must be a property to be flattened");return[r,...r.defaultValue?j(r.defaultValue,a,e):[],...r.dataType?j(r.dataType,a,e):[],...r.parent?j(r.parent,a,e):[]]}function Kw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ReturnDeclaration)throw new Error("Entity must be a return declaration to be flattened");return[r,...r.readsValue?j(r.readsValue,a,e):[],...r.defaultValue?j(r.defaultValue,a,e):[],...r.dataType?j(r.dataType,a,e):[],...r.parent?j(r.parent,a,e):[]]}function Xw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ReturnStatement)throw new Error("Entity must be a return statement to be flattened");return[r,...(r.outputs||[]).flatMap(t=>j(t,a,e)),...r.throws?j(r.throws,a,e):[],...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function Qw(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.Search)throw new Error("Entity must be a search to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>j(t,a,e)),...(r.errorCalls||[]).flatMap(t=>j(t,a,e)),...(r.inputsDeclarations||[]).flatMap(t=>j(t,a,e)),...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.outputsDeclarations||[]).flatMap(t=>j(t,a,e)),...(r.outputs||[]).flatMap(t=>j(t,a,e)),...r.error?j(r.error,a,e):[],...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.parent?j(r.parent,a,e):[]]}function eP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.ValueDescriptor)throw new Error("Entity must be a value descriptor to be flattened");return[r,...r.defaultValue?j(r.defaultValue,a,e):[],...r.dataType?j(r.dataType,a,e):[],...r.parent?j(r.parent,a,e):[]]}function tP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.VariableDeclaration)throw new Error("Entity must be a variable declaration to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>j(t,a,e)),...(r.errorCalls||[]).flatMap(t=>j(t,a,e)),...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.outputs||[]).flatMap(t=>j(t,a,e)),...(r.internalCalls||[]).flatMap(t=>j(t,a,e)),...(r.writesValues||[]).flatMap(t=>j(t,a,e)),...r.readsValue?j(r.readsValue,a,e):[],...r.defaultValue?j(r.defaultValue,a,e):[],...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.dataType?j(r.dataType,a,e):[],...r.parent?j(r.parent,a,e):[]]}function iP(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(a.has(r.id))return[];if(a.add(r.id),r.type!==n.VariableInstance)throw new Error("Entity must be a variable instance to be flattened");return[r,...(r.successCalls||[]).flatMap(t=>j(t,a,e)),...(r.errorCalls||[]).flatMap(t=>j(t,a,e)),...(r.inputs||[]).flatMap(t=>j(t,a,e)),...(r.outputs||[]).flatMap(t=>j(t,a,e)),...(r.internalCalls||[]).flatMap(t=>j(t,a,e)),...(r.writesValues||[]).flatMap(t=>j(t,a,e)),...r.readsValue?j(r.readsValue,a,e):[],...r.defaultValue?j(r.defaultValue,a,e):[],...(Ai(r)||[]).flatMap(t=>j(t,a,e)),...r.declaration?j(r.declaration,a,e):[],...r.parent?j(r.parent,a,e):[]]}function Gi(){const r=new Set,a=hI.flatMap(e=>j(e,r)).map(e=>e.id);if(!a.includes("http-request-error-return-delaration-id"))throw new Error("Built-in base entities must be included in the list");return a}function j(r,a=new Set,e={ignoreBuiltInBaseEntities:!1}){if(!r)throw new Error("Entity must be defined to be flattened");if(r.type===n.GenericReference)return[];if(e.ignoreBuiltInBaseEntities&&(si.includes(r.type)||Gi().includes(r.id)))return[];if(a.has(r.id))return[];switch(r.type){case n.FunctionCall:return Gw(r,a,e);case n.Operation:return Ww(r,a,e);case n.Condition:return Lw(r,a,e);case n.Loop:return Jw(r,a,e);case n.Search:return Qw(r,a,e);case n.GlobalEvent:return Fw(r,a,e);case n.ReturnStatement:return Xw(r,a,e);case n.ContinueStatement:return jw(r,a,e);case n.BreakStatement:return Mw(r,a,e);case n.VariableDeclaration:return tP(r,a,e);case n.DefinitionEntity:return Uw(r,a,e);case n.FunctionDeclaration:return gw(r,a,e);case n.Project:return Yw(r,a,e);case n.ActionDescriptor:return _w(r,a,e);case n.ArgumentDeclaration:return Bw(r,a,e);case n.ReturnDeclaration:return Kw(r,a,e);case n.ValueDescriptor:return eP(r,a,e);case n.InputMap:return xw(r,a,e);case n.OutputMap:return Sw(r,a,e);case n.DataType:return $w(r,a,e);case n.InstalledProject:return kw(r,a,e);case n.InternalCall:return Zw(r,a,e);case n.LiteralValue:return qw(r,a,e);case n.Property:return Hw(r,a,e);case n.VariableInstance:return iP(r,a,e);case n.BuiltInBaseEntity:return e.ignoreBuiltInBaseEntities?[]:Nw(r,a,e);case n.PrimitiveEntity:return e.ignoreBuiltInBaseEntities?[]:zw(r,a,e)}return[]}function Xc(r){return r.type===n.FunctionCall||r.type===n.InternalCall||[n.Operation,n.Condition,n.Loop].includes(r.type)?r.declaration.inputs:r.type===n.FunctionDeclaration||qn.includes(r.type)?r.inputs:r.type===n.Search?r.inputsDeclarations:[]}function qW(r,a){return a.type===n.Condition?a.inputs.find(e=>e.declaration.id===r.id):a.type===n.FunctionCall||a.type===n.Operation?a.inputs.find(e=>e.declaration.id===r.id):null}function rP(r){return dt.includes(r.type)?r.inputs:[]}function nP(r){var a;return r.type===n.FunctionCall?((a=r.declaration.returnStatements[0])==null?void 0:a.outputs)||[]:[n.Operation,n.Condition,n.Loop].includes(r.type)?r.declaration.outputs:r.type===n.Search?r.outputsDeclarations:ot.includes(r.type)?r.outputs:[]}function JW(r,a){return a.type===n.Condition?null:a.type===n.FunctionCall||a.type===n.Operation?a.outputs.find(e=>e.declaration.id===r.id):null}function WW(r){return r.type===n.Condition?[]:dt.includes(r.type)?r.outputs:[]}function ed(r){const a=r.readsValue;return a?Rt(a):null}function sP(r,a){const e=r.readsValue;return e?Kl(e,a):null}function aP(r){const a=r.internalCalls||[];return p(gt(p(a.flatMap(e=>[...e.successCalls,...e.errorCalls]))))}function Bs(r){const a=Kc(r),e=[];return a.forEach(t=>{if(it.includes(t.type))e.push(t);else if(wr.includes(t.type)){const i=t.parent;e.push(i)}}),e}function p(r){const a=new Set;return r.filter(e=>!e||a.has(e.id)?!1:(a.add(e.id),!0))}function on(r,a=!1){const e=[];if(r.type===n.Project&&e.push(...(r==null?void 0:r.entities)||[],...(r==null?void 0:r.functions)||[],...(r==null?void 0:r.variableDeclarations)||[],...(r==null?void 0:r.variableInstances)||[],...(r==null?void 0:r.searches)||[],...(r==null?void 0:r.loops)||[],...(r==null?void 0:r.operations)||[],...(r==null?void 0:r.conditions)||[],...(r==null?void 0:r.functionCalls)||[],...(r==null?void 0:r.events)||[],...(r==null?void 0:r.projects)||[]),ht.includes(r.type)&&e.push(...(r==null?void 0:r.detachedChildren)||[]),r.type===n.DefinitionEntity){const t=[...r.suggestedMethods,...r.methods].flatMap(i=>i.collapsed&&a?[]:on(i));e.push(...t)}if(r.type===n.Condition){const t=r.successCalls.map(s=>Rt(s)),i=r.errorCalls.map(s=>Rt(s));e.push(...t,...i)}if(qn.includes(r.type)){if(r.collapsed&&a)return[];const t=r.inputs.map(s=>Bs(s)).flat(),i=r.calls.map(s=>Rt(s));e.push(...p(t),...i)}if(dt.includes(r.type)&&r.type!==n.Condition&&r.type!==n.Loop){const t=r==null?void 0:r.outputs.map(l=>Bs(l)).flat(),i=r.successCalls.map(l=>Rt(l)),s=r.errorCalls.map(l=>Rt(l));e.push(...p(t),...i,...s)}if(it.includes(r.type)){const t=Bs(r),i=aP(r);e.push(...t,...i)}if(r.type===n.Loop){const t=r.outputs.map(l=>Bs(l)).flat();if(r.body){const l=on(r.body,a);e.push(...l)}const i=r.errorCalls.map(l=>Rt(l)),s=r.successCalls.map(l=>Rt(l));e.push(...p(t),...s,...i)}if(r.type===n.FunctionDeclaration){if(r.collapsed&&a)return[];const t=r.inputs.map(s=>Bs(s)).flat(),i=r.calls.map(s=>Rt(s));e.push(...p(t),...i)}return p(e)}function oP(r,a=!1){const e=on(r,a),t=[...e,...e.reduce((i,s)=>[...i,...oP(s,a)],[])];return p(t)}function lP(r){const a=gn(r),e=[...a,...a.reduce((t,i)=>[...t,...lP(i)],[])];return p(e)}function ga(r){return r.implements.reduce((a,e)=>e.type===n.DefinitionEntity?[...a,n.DefinitionEntity,...ga(e),...Fa(e)]:[...a,e.name],[])}function Fa(r){return r.extends.reduce((a,e)=>e.type===n.DefinitionEntity?[...a,n.DefinitionEntity,...Fa(e),...ga(e)]:[...a,e.name],[])}function Qc(r){return r.extends.reduce((a,e)=>e.type===n.DefinitionEntity?[...a,e,...Qc(e),...ef(e)]:[...a,e],[])}function ef(r){return r.implements.reduce((a,e)=>e.type===n.DefinitionEntity?[...a,e,...ef(e),...Qc(e)]:[...a,e],[])}function tf(r){return[...Fa(r),...ga(r)].filter((e,t,i)=>i.indexOf(e)===t)}function dP(r){return r.implements.length===0&&r.extends.length===0?null:r.implements.find(t=>t.type===n.BuiltInBaseEntity&&t.name===J.PERSISTED_ENTITY)?r:[...r.implements,...r.extends].reduce((t,i)=>{if(i.type===n.DefinitionEntity){const s=dP(i);if(s)return s}return t},null)}function SW(r){const a=r.extends.find(e=>e.type===n.BuiltInBaseEntity);return a&&a.type===n.BuiltInBaseEntity?a:null}function zW(r){const a=r.implements.find(e=>e.type===n.BuiltInBaseEntity);return a&&a.type===n.BuiltInBaseEntity?a:null}function uP(r){const a=r.extends.find(e=>e.type===n.DefinitionEntity);return a&&a.type===n.DefinitionEntity?a:null}function St(r){if(r.type===n.BuiltInBaseEntity)return[r];const a=[...r.implements,...r.extends].reduce((e,t)=>t.type===n.BuiltInBaseEntity?[...e,t]:t.type===n.DefinitionEntity?[...e,...St(t)]:e,[]);return p(a)}function xa(r){return r.type===n.PrimitiveEntity?!0:r.type===n.BuiltInBaseEntity?r.interactive:!St(r).find(t=>!t.interactive)}function YW(r){return r.parent===r.project&&r.project.variableDeclarations.includes(r)}function rf(r){return r.parent!==r.project?!1:n.VariableDeclaration===r.type?r.project.variableDeclarations.includes(r):n.VariableInstance===r.type?r.project.variableInstances.includes(r):n.FunctionCall===r.type?r.project.functionCalls.includes(r):n.Condition===r.type?r.project.conditions.includes(r):n.Operation===r.type?r.project.operations.includes(r):n.Loop===r.type?r.project.loops.includes(r):n.Search===r.type?r.project.searches.includes(r):!1}function pP(r){if([...rt,n.DefinitionEntity,n.InstalledProject,n.Project].includes(r.type)||rf(r))return!1;const a=gn(r);return a.length===0?!0:a.some(e=>pP(e))}function nf(r){return[...rt,n.DefinitionEntity,n.InstalledProject,n.Project].includes(r.type)||rf(r)?!1:gn(r).length===0}function cP(r,a=0){if(nf(r)){const e=gn(r);return e.length===0?r:e.map(i=>cP(i,a+1)).reduce((i,s)=>i?s&&s.x<i.x?s:i:s,null)}return null}function fP(r){const a=[];if(nf(r))a.push(r);else return[];return gn(r).forEach(t=>{a.push(...fP(t))}),a}function hP(r){return r.type===n.FunctionDeclaration&&r.parent!==r.project&&!![n.DefinitionEntity,n.Loop,n.InstalledProject].includes(r.parent.type)}function HW(r,a){const e=new Map;return r.forEach(t=>{e.set(t.id,t)}),a.forEach(t=>{e.set(t.id,t)}),Array.from(e.values())}function ka(r){switch(r){case n.DefinitionEntity:return dn;case n.FunctionDeclaration:return kr;case n.VariableDeclaration:return Hr;case n.VariableInstance:return Yr;case n.FunctionCall:return an;case n.Operation:return qr;case n.Condition:return zr;case n.ReturnStatement:return Jr;case n.Loop:return Sr;case n.Search:return Kr;case n.InputMap:return er;case n.OutputMap:return tr;case n.ArgumentDeclaration:return br;case n.ReturnDeclaration:return ri;case n.Property:return xr;case n.InstalledProject:return Xr;case n.Project:return m;case n.DataType:return Zr;case n.GlobalEvent:return Wr;case n.InternalCall:return Qr;case n.ValueDescriptor:return ir;case n.BuiltInBaseEntity:return Fi;case n.PrimitiveEntity:return ni;case n.ActionDescriptor:return We;case n.LiteralValue:return en;case n.ContinueStatement:return Gt;case n.BreakStatement:return tn;default:return null}}function zt(r,a,e=null){const t=r!=null&&r.parent?B(r==null?void 0:r.parent):null;let i=t?a.get(t):null,s=e||r;if(r.type===n.ReturnStatement)return It(r,a,s);if(r.type===n.FunctionDeclaration&&(i==null?void 0:i.type)===n.Loop)return i;if(rt.includes(r.type))return r;if(r.type===n.Loop)return s.id===r.id?i:r;if(si.includes(r.type))return null;const l=r.parent;if(!l)return null;if(l.type===n.GenericReference){const o=B(l);if(!o)return null;const d=a.get(o);return d?zt(d,a,s):null}else return l===a?a:zt(l,a,s)}function It(r,a,e=null){const t=r!=null&&r.parent?B(r==null?void 0:r.parent):null;let i=t?a.get(t):null,s=e||r;if(r.type===n.FunctionDeclaration&&(i==null?void 0:i.type)===n.Loop)return It(i.parent,a,s);if(rt.includes(r.type))return r;if(si.includes(r.type))return null;const l=r.parent;if(!l)return null;if(l.type===n.GenericReference){const o=B(l);if(!o)return null;const d=a.get(o);return d?It(d,a,s):null}else return l===a?a:It(l,a,s)}function sf(r,a){if(si.includes(r.type)||a.getBuiltIn(r.id))return null;const e=bi(r.parent,a);return e?e===a?ht.includes(r.type)?r:null:e.type===n.DefinitionEntity?r:sf(e,a):null}function td(r,a,e){if(r===a||a===e||r===e)return!1;const t=zt(a.parent,e);return t===r?!0:td(t,a,e)}var id=(r=>(r.SameBothLocal="same-both-local",r.AInB="a-in-b",r.BInA="b-in-a",r.ParallelInCommonParent="parallel-in-common-parent",r.ParallelInProject="parallel-in-project",r.AIsGlobalBIsNot="a-is-global-b-is-not",r.BIsGlobalAIsNot="b-is-global-a-is-not",r.SameBothGlobal="same-both-global",r))(id||{});function Za(r,a,e){const t=zt(r,e),i=zt(a,e);if(!t)throw new Error("Could not find scope owner for the entity: "+r.id);if(!i)throw new Error("Could not find scope owner for the entity: "+a.id);if(t===i&&t.type!==n.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:t};if(t===i&&t.type===n.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:t};if(t.type===n.Project&&i.type!==n.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:t};if(t.type!==n.Project&&i.type===n.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:i};if(td(t,i,e))return{compatible:!0,type:"b-in-a",commonAncestorScope:t};if(td(i,t,e))return{compatible:!0,type:"a-in-b",commonAncestorScope:i};const o=Yc(t,i);return o===e?{compatible:!1,type:"parallel-in-project",commonAncestorScope:o}:o?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:zt(o,e)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:e}}function yP(r,a,e){const t=Za(r,a,e);if(!t.compatible||t.type!=="same-both-local")return null;if(r===a)return r;let i=zt(r.parent,e);if(i){if(i===a)return a;if(i.type===n.Project)return r}else return r;for(;i;){if(i){if(i===a)return a;if(i.type===n.Project)return r}else return r;i=zt(i.parent,e)}let s=zt(a.parent,e);if(s){if(s===r)return r;if(s.type===n.Project)return a}else return a;for(;s;){if(s){if(s===r)return r;if(s.type===n.Project)return a}else return a;s=zt(s.parent,e)}return null}function mP(r){return r.length===0?null:r.length===1?r[0]:r.reduce((e,t)=>{const i=yP(e,t,t.project);return!i||i===t?e:t},r[0])}function bi(r,a){if(!r)return null;let e;return typeof r=="string"?e=r:r.type===n.GenericReference?e=B(r):e=r.id,e===a.id?a:a.get(e)}function ln(r){if(!r)return null;if(si.includes(r.type))return r;if(r.type===n.Project)return null;if(r.project.getBuiltIn(r.id))return r;const a=r.parent;return!a||a.type===n.Project?null:ln(a)}function qa(r){const a=[];function e(s,l){return a.some(o=>o.blockedByCaller===s&&o.blockedByCalling===l)}function t(s,l){e(s,l)||a.push({blockedByCaller:s,blockedByCalling:l})}const i=sf(r,r.project);return r.calledBySuccess.forEach(s=>{[...s.successCalls||[]].forEach(d=>{ot.includes(d.type)&&d!==r&&(Te(r).find(c=>c===d)||t(s,d))});let o;if(dt.includes(s.type)&&(o=s),o){const d=qa(o);d.reachable||Te(r).find(c=>c===s)||d.blocks.forEach(c=>{t(s,c.blockedByCalling)})}}),r.calledByError.forEach(s=>{[...s.errorCalls||[]].forEach(d=>{ot.includes(d.type)&&d!==r&&(Te(r).find(c=>c===d)||t(s,d))});let o;if(dt.includes(s.type)&&(o=s),o){const d=qa(o);d.reachable||Te(r).find(c=>c===s)||d.blocks.forEach(c=>{t(s,c.blockedByCalling)})}}),r.calledByEntry.forEach(s=>{if([...s.calls||[]].forEach(d=>{ot.includes(d.type)&&d!==r&&(Te(r).find(c=>c===d)||t(s,d))}),s===i)return;let o;if(s.type===n.FunctionDeclaration){const d=Rt(s);if(d.type===n.DefinitionEntity)return;d.type===n.Loop&&(o=d)}if(o){const d=qa(o);d.reachable||d.blocks.forEach(u=>{t(s,u.blockedByCalling)})}}),{reachable:a.length===0,entryPoint:i,blocks:a}}function KW(r){return Ka.includes(r.type)?r.type===n.FunctionDeclaration?!hP(r):!0:!1}function XW(r){if(n.ActionDescriptor===r.type){if(r.project.operationDeclarations.find(s=>s.id===r.id))return n.Operation;if(r.project.globalEventActionDescriptors.find(s=>s.id===r.id))return n.GlobalEvent;if(r.project.loopDeclarations.find(s=>s.id===r.id))return n.Loop;if(r.project.conditionDeclarations.find(s=>s.id===r.id))return n.Condition}return r.type}function rd(r,a){return r.type===n.BuiltInBaseEntity?r.name===a:!!Fa(r).includes(a)}function QW(r,a){return r.type===n.BuiltInBaseEntity?r.name===a:!!ga(r).includes(a)}function gi(r,a){return r.type===n.BuiltInBaseEntity?r.name===a:!!tf(r).includes(a)}function eS(r){const a=[];return r.entities.forEach(e=>{if(rd(e,J.PERSISTED_ENTITY)){a.push(e);return}}),p(a)}function tS(r){const a=[];return r.entities.forEach(e=>{if(rd(e,J.RELATIONAL_DATABASE)){a.push(e);return}}),p(a)}function iS(r){return r.type!==n.DefinitionEntity||r.abstract||!rd(r,J.PERSISTED_ENTITY)?null:(r==null?void 0:r.properties.find(e=>{var t;return((t=e.implements)==null?void 0:t.id)===k[n.BuiltInBaseEntity][J.PERSISTED_ENTITY].properties.primaryKey.id&&!e.abstract}))||null}function rS(r){if(r.type!==n.DefinitionEntity)return[];if(r.abstract)return[];if(!gi(r,J.PERSISTED_ENTITY))return r.id==="a2d0ec83-72ce-4f54-b059-a39e018fa86c"&&console.log("Entity does not have persisted base entity",r),[];const a=[],e=r.properties.filter(t=>{var i;return((i=t.implements)==null?void 0:i.id)!==k[n.BuiltInBaseEntity][J.PERSISTED_ENTITY].properties.database.id&&!t.abstract});return a.push(...e),a}function nS(r){var e;if(!r||r.type!==n.DefinitionEntity||!gi(r,J.PERSISTED_ENTITY))return null;const a=r.properties.find(t=>{var i;return((i=t.implements)==null?void 0:i.id)===k[n.BuiltInBaseEntity][J.PERSISTED_ENTITY].properties.database.id});return(e=a==null?void 0:a.getDefaultValue())==null?void 0:e.valueAsTypeSingle}function mt(r,a){var t;if(!ff.includes(a.type)||!r)return a.project||null;let e=a.project;return r.type===n.Project?e=r:((t=a.project)==null?void 0:t.id)!==r.project.id&&(e=r.project),e}function sS(r){switch(r){case n.Project:return m;case n.InstalledProject:return Xr;case n.DefinitionEntity:return dn;case n.FunctionDeclaration:return kr;case n.GlobalEvent:return Wr;case n.VariableInstance:return Yr;case n.VariableDeclaration:return Hr;case n.InputMap:return er;case n.OutputMap:return tr;case n.Condition:return zr;case n.Operation:return qr;case n.FunctionCall:return an;case n.ReturnDeclaration:return ri;case n.ArgumentDeclaration:return br;case n.PrimitiveEntity:return ni;case n.DataType:return Zr;case n.Property:return xr;case n.ActionDescriptor:return We;case n.ReturnStatement:return Jr;case n.ContinueStatement:return Gt;case n.BreakStatement:return tn;case n.Loop:return Sr;case n.Search:return Kr;case n.ValueDescriptor:return ir;case n.InternalCall:return Qr;case n.LiteralValue:return en}return null}function aS(r){const a={added:{},updated:{},removed:{},affected:[],seenEntities:[],self:r==null?void 0:r.self};return r==null||r.added.forEach(e=>{a.added[e.id]=e}),r==null||r.updated.forEach(e=>{a.updated[e.id]=e}),r==null||r.removed.forEach(e=>{a.removed[e.id]=e}),a.affected=Array.from(new Set(r==null?void 0:r.affected.map(e=>e.id))),a}function pt(r,a){const e=ka(r.type);return e?!e.MUTABLE_META_PROPERTIES.every(i=>{const s=r[i],l=a[i];return l===void 0||s===l?!0:Array.isArray(s)&&Array.isArray(l)?s.length!==l.length?!1:s.every((o,d)=>o===l[d]):!1}):!1}function nd(r,a={}){if(r.type===n.Project)return[];if(!r.parent)return[];const e=B(r.parent);if(!e)return[];const t=a[e];return t?[t.id,...nd(t,a)]:[]}function oS(r){const a=[],e=new Set;return[...r.listAdded,...r.listUpdated,...r.listAffected].forEach(t=>{const i=Rt(t);!i||e.has(i.id)||(e.add(i.id),a.push(i))}),p(a)}function lS(r){if(r.type===n.Condition)return null;if(r.type===n.Search)return r.project.getBuiltIn(k["value-descriptor"][Jn.SearchErrorOutputDescriptor].id)||null;if(r.type===n.Operation)return r.declaration.error;if(r.type===n.FunctionCall){const e=r.declaration.returnStatements.find(t=>!!t.throws);return(e==null?void 0:e.throws)||null}return null}function vP(r){const a=Uq(),e=r.toJSON();a.safeParse(e).success;const i=r.implements.flatMap(f=>dS(r,f)),s=r.extends.flatMap(f=>uS(r,f)),l=cS(r),o=pS(r);r.methods.flatMap(f=>f.validate());const d=[...i,...s,...l,...o];return Ke(r.errors,d)}function EP(r,a){const e=a.properties.filter(s=>s.abstract),t=[];let i=[...r.properties];return e.forEach(s=>{const l=i.find(o=>{var d;return((d=o.implements)==null?void 0:d.id)===s.id});l?i=i.filter(o=>o.id!==l.id):t.push(s)}),t}function TP(r,a){const e=a.abstractMethods,t=[];let i=[...r.methods];return e.forEach(s=>{const l=i.find(o=>{var d;return((d=o.implements)==null?void 0:d.id)===s.id});l?i=i.filter(o=>o.id!==l.id):t.push(s)}),t}function dS(r,a){const e=[];if(!a.abstract){const f=fe({id:r.id+"--"+x.ImplementingNonAbstractEntity,message:`Entity "${r.name}" with id "${r.id}" is implementing a non-abstract entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.ImplementingNonAbstractEntity,entity:r});return e.push(f.error),e}const t=a.properties.filter(f=>f.abstract),i=[];let s=[...r.properties];t.forEach(f=>{const c=s.find(T=>{var I;return((I=T.implements)==null?void 0:I.id)===f.id});c?s=s.filter(T=>T.id!==c.id):i.push(f)}),i.length&&i.forEach(f=>{const c=fe({id:r.id+"--"+x.MissingPropertyImplementation+"--"+f.id,message:`Property "${f.name}" with id "${f.id}" of entity "${a.name}" with id "${a.id}" is not implemented when entity "${r.name}" with id "${r.id}" implements it`,issue:null,severity:w.Error,code:x.MissingPropertyImplementation,entity:r});e.push(c.error)});const l=[];let o=[...r.methods];a.abstractMethods.forEach(f=>{const c=o.find(T=>{var I;return((I=T.implements)==null?void 0:I.id)===f.id});c?o=o.filter(T=>T.id!==c.id):l.push(f)}),l.length&&l.forEach(f=>{const c=fe({id:r.id+"--"+x.MissingMethodImplementation+"--"+f.id,message:`Method "${f.name}" with id "${f.id}" of entity "${a.name}" with id "${a.id}" is not implemented when entity "${r.name}" with id "${r.id}" implements it`,issue:null,severity:w.Error,code:x.MissingMethodImplementation,entity:r});e.push(c.error)});const d=[];a.properties.forEach(f=>{const c=s.find(T=>T.name===f.name);c&&d.push([c,f])}),d.length&&d.forEach(([f])=>{const c=fe({id:r.id+"--"+$.PropertyOverwritesOtherSiblingWithSameName+"--"+f.id,message:`Property "${f.name}" with id "${f.id}" of entity "${r.name}" with id "${r.id}" overwrites the property with the same name from the base entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:$.PropertyOverwritesOtherSiblingWithSameName,entity:r});e.push(c.error)});const u=[];return a.methods.forEach(f=>{const c=o.find(T=>T.name===f.name);c&&u.push([c,f])}),u.length&&u.forEach(([f])=>{const c=fe({id:r.id+"--"+$.MethodOverwritesOtherSiblingWithSameName+"--"+f.id,message:`Method "${f.name}" with id "${f.id}" of entity "${r.name}" with id "${r.id}" overwrites the method with the same name from the base entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:$.MethodOverwritesOtherSiblingWithSameName,entity:r});e.push(c.error)}),e}function uS(r,a){const e=[],t=[];if(!r.abstract&&a.abstract){const s=fe({id:r.id+"--"+a.id+"--"+x.NonAbstractExtendingAbstractEntity,message:`Entity "${r.name}" with id "${r.id}" is not-abstract but is extending an abstract entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.NonAbstractExtendingAbstractEntity,entity:r,firstRelationship:a});return e.push(s.error),e}if(r.abstract&&!a.abstract){const s=fe({id:r.id+"--"+a.id+"--"+x.AbstractExtendingNonAbstractEntity,message:`Entity "${r.name}" with id "${r.id}" is abstract but is extending an non-abstract entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.AbstractExtendingNonAbstractEntity,entity:r,firstRelationship:a});return e.push(s.error),e}r.properties.forEach(s=>{var o;const l=a.properties.find(d=>{var u;return d.name===s.name&&((u=s.extends)==null?void 0:u.id)!==d.id});((o=s.implements)==null?void 0:o.id)!==(l==null?void 0:l.id)&&l&&t.push(s)}),t.length&&t.forEach(s=>{const l=fe({id:r.id+"--"+$.PropertyOverwritesOtherSiblingWithSameName,message:`Property "${s.name}" with id "${s.id}" of entity "${r.name}" with id "${r.id}" overwrites the property with the same name from the extended entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:$.PropertyOverwritesOtherSiblingWithSameName,entity:r});e.push(l.error)});const i=[];return r.methods.forEach(s=>{var o;const l=a.methods.find(d=>{var u;return d.name===s.name&&((u=s.extends)==null?void 0:u.id)!==d.id});((o=s.implements)==null?void 0:o.id)!==(l==null?void 0:l.id)&&l&&i.push(s)}),i.length&&i.forEach(s=>{const l=fe({id:r.id+"--"+$.MethodOverwritesOtherSiblingWithSameName,message:`Method "${s.name}" with id "${s.id}" of entity "${r.name}" with id "${r.id}" overwrites the method with the same name from the extended entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:$.MethodOverwritesOtherSiblingWithSameName,entity:r});e.push(l.error)}),e}function pS(r){const a=[];if(!r.properties.length){const e=fe({id:r.id+"--"+x.NoProperties,message:"No properties implemented",issue:null,severity:w.Warning,code:x.NoProperties,entity:r});a.push(e.error)}return r.properties.forEach(e=>{e.validate()}),a}function cS(r){const a=[];if(r.abstract){if(r.methods.length){const e=fe({id:r.id+"--"+x.AbstractEntityWithNonAbstractMethods,message:`Entity "${r.name}" with id "${r.id}" is marked as abstract but has non-abstract methods`,issue:null,severity:w.Error,code:x.AbstractEntityWithNonAbstractMethods,entity:r});a.push(e.error)}if(r.properties.some(e=>!e.abstract)){const e=fe({id:r.id+"--"+x.AbstractEntityWithNonAbstractProperties,message:`Entity "${r.name}" with id "${r.id}" is marked as abstract but has non-abstract properties`,issue:null,severity:w.Error,code:x.AbstractEntityWithNonAbstractProperties,entity:r});a.push(e.error),r.properties.forEach(t=>{if(!t.abstract){const i=fe({id:r.id+"--"+x.StaticEntityWithNonStaticProperties+"--"+t.id,message:`Property "${t.name}" with id "${t.id}" of entity "${r.name}" with id "${r.id}" is not marked as abstract but the entity is marked as abstract`,issue:null,severity:w.Error,code:x.StaticEntityWithNonStaticProperties,entity:r});a.push(i.error)}})}}else{if(r.abstractMethods.length){const e=fe({id:r.id+"--"+x.AbstractPropertyInNonAbstractEntity,message:`Entity "${r.name}" with id "${r.id}" is not marked as abstract but has abstract methods`,issue:null,severity:w.Error,code:x.AbstractPropertyInNonAbstractEntity,entity:r});a.push(e.error)}r.properties.some(e=>e.abstract)&&r.properties.forEach(e=>{if(e.abstract){const t=fe({id:r.id+"--"+x.AbstractPropertyInNonAbstractEntity+"--"+e.id,message:`Property "${e.name}" with id "${e.id}" of entity "${r.name}" with id "${r.id}" is marked as abstract but the entity is not marked as abstract`,issue:null,severity:w.Error,code:x.AbstractPropertyInNonAbstractEntity,entity:r,firstRelationship:e});a.push(t.error)}})}return r.static&&r.properties.some(e=>!e.static)&&r.properties.forEach(e=>{if(!e.static){const t=fe({id:r.id+"--"+x.NonStaticPropertyInStaticEntity+"--"+e.id,message:`Property "${e.name}" with id "${e.id}" of entity "${r.name}" with id "${r.id}" is not marked as static but the entity is marked as static`,issue:null,severity:w.Error,code:x.NonStaticPropertyInStaticEntity,entity:r,firstRelationship:e});a.push(t.error)}}),a}function fS(r,a){const e=[],t=St(a);if(!a.abstract){const l=new Ye({id:r.id+"--"+a.id+"--"+x.ImplementingNonAbstractEntity,message:`Entity "${r.name}" with id "${r.id}" is implementing a non-abstract built-in entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.ImplementingNonAbstractEntity,entity:r,firstRelationship:a});e.push(l)}const i=r.implements.filter(l=>l.id!==a.id);if(r.abstract){const l=new Ye({id:r.id+"--"+a.id+"--"+x.AbstractEntityImplements,message:`Entity "${r.name}" with id "${r.id}" is marked as abstract and cannot implement built-in entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.AbstractEntityImplements,entity:r,firstRelationship:a});e.push(l)}if(r.static&&!a.static){const l=new Ye({id:r.id+"--"+a.id+"--"+x.StaticImplementingNonStaticEntity,message:`Entity "${r.name}" with id "${r.id}" is marked as static and cannot implement non-static built-in entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.StaticImplementingNonStaticEntity,entity:r,firstRelationship:a});e.push(l)}if(!r.static&&a.static){const l=new Ye({id:r.id+"--"+a.id+"--"+x.NonStaticImplementingStaticEntity,message:`Entity "${r.name}" with id "${r.id}" is not marked as static and cannot implement static built-in entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.NonStaticImplementingStaticEntity,entity:r,firstRelationship:a});e.push(l)}return i.length&&i.forEach(l=>{if(l.type===n.BuiltInBaseEntity){const o=t.filter(d=>d.id!==l.id);o.length&&o.forEach(d=>{if(d.id!==l.id){const u=new Ye({id:r.id+"--"+d.id+"--"+l.id+"--"+x.ImplementsIncompatibleEntities,message:`Entity "${r.name}" with id "${r.id}" is implementing built-in entity "${d.name}" with id "${d.id}" but also implements entity "${l.name}" with id "${l.id}" which is incompatible`,issue:null,severity:w.Error,code:x.ImplementsIncompatibleEntities,entity:r,firstRelationship:d,secondRelationship:l});e.push(u)}})}else{St(l).forEach(f=>{const c=t.filter(T=>T.id!==f.id);c.length&&c.forEach(T=>{if(T.id!==f.id){const I=new Ye({id:r.id+"--"+T.id+"--"+f.id+"--"+x.ImplementsIncompatibleEntities,message:`Entity "${r.name}" with id "${r.id}" is implementing built-in entity "${T.name}" with id "${T.id}" but also implements entity "${f.name}" with id "${f.id}" which is incompatible`,issue:null,severity:w.Error,code:x.ImplementsIncompatibleEntities,entity:r,firstRelationship:T,secondRelationship:f});e.push(I)}})});const d=Dr(a.ownDeclaredProperties,l.ownDeclaredProperties,$.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation,$.PropertyOverwritesOtherImplementedEntitysPropertyWithSameName);e.push(...d.errors);const u=Dr(a.abstractMethods,[...l.abstractMethods,...l.methods],$.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation,$.MethodOverwritesOtherImplementedEntitysMethodWithSameName);e.push(...u.errors)}}),p(r.extends.flatMap(l=>St(l))).forEach(l=>{if(!t.find(o=>o.id===l.id)){const o=new Ye({id:r.id+"--"+a.id+"--"+l.id+"--"+x.ExtendsIncompatibleEntities,message:`Entity "${r.name}" with id "${r.id}" is implementing built-in entity "${a.name}" with id "${a.id}" but also extends entity "${l.name}" with id "${l.id}" which is incompatible`,issue:null,severity:w.Error,code:x.ExtendsIncompatibleEntities,entity:r,firstRelationship:a,secondRelationship:l});e.push(o)}}),e}function hS(r,a,e=!1){const t=[],i=St(a);if(!r.abstract&&a.abstract){const f=fe({id:r.id+"--"+a.id+"--"+x.NonAbstractExtendingAbstractEntity,message:`Entity "${r.name}" with id "${r.id}" is not-abstract but is extending an abstract entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.NonAbstractExtendingAbstractEntity,entity:r,firstRelationship:a});t.push(f.error)}if(r.abstract&&!a.abstract){const f=fe({id:r.id+"--"+a.id+"--"+x.AbstractExtendingNonAbstractEntity,message:`Entity "${r.name}" with id "${r.id}" is abstract but is extending an non-abstract entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.AbstractExtendingNonAbstractEntity,entity:r,firstRelationship:a});t.push(f.error)}if(!r.static&&a.static){const f=fe({id:r.id+"--"+a.id+"--"+x.NonStaticExtendingStaticEntity,message:`Entity "${r.name}" with id "${r.id}" is not static but is extending a static entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.NonStaticExtendingStaticEntity,entity:r,firstRelationship:a});t.push(f.error)}if(r.static&&!a.static){const f=fe({id:r.id+"--"+a.id+"--"+x.StaticExtendingNonStaticEntity,message:`Entity "${r.name}" with id "${r.id}" is static but is extending an non-static entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.StaticExtendingNonStaticEntity,entity:r,firstRelationship:a});t.push(f.error)}if(!xa(a)){const f=fe({id:r.id+"--"+a.id+"--"+x.ExtendingNonInteractiveEntity,message:`Entity "${r.name}" with id "${r.id}" is extending an non-interactive entity "${a.name}" with id "${a.id}"`,issue:null,severity:w.Error,code:x.ExtendingNonInteractiveEntity,entity:r,firstRelationship:a});t.push(f.error)}const l=r.extends.filter(f=>f.id!==a.id);l.length&&l.forEach(f=>{if(f.type===n.BuiltInBaseEntity){const c=i.filter(T=>T.id!==f.id);c.length&&c.forEach(T=>{if(T.id!==f.id){const I=fe({id:r.id+"--"+T.id+"--"+f.id+"--"+x.ExtendsIncompatibleEntities,message:`Entity "${r.name}" with id "${r.id}" is extending built-in entity "${T.name}" with id "${T.id}" but also extends entity "${f.name}" with id "${f.id}" which is incompatible`,issue:null,severity:w.Error,code:x.ExtendsIncompatibleEntities,entity:r,firstRelationship:T,secondRelationship:f});t.push(I.error)}})}else{St(f).forEach(M=>{const G=i.filter(_=>_.id!==M.id);G.length&&G.forEach(_=>{if(_.id!==M.id){const g=new Ye({id:r.id+"--"+_.id+"--"+M.id+"--"+x.ImplementsIncompatibleEntities,message:`Entity "${r.name}" with id "${r.id}" is extending built-in entity "${_.name}" with id "${_.id}" but also extends or implements entity "${M.name}" with id "${M.id}" which is incompatible`,issue:null,severity:w.Error,code:x.ImplementsIncompatibleEntities,entity:r,firstRelationship:_,secondRelationship:M});t.push(g)}})});const T=!!St(f).find(M=>M.id===a.id);let I=[...f.properties];T&&(I=I.filter(M=>!a.properties.find(G=>{var _;return G.id===M.id||G.name===M.name||G.id===((_=M.implements)==null?void 0:_.id)})));let D=[...f.methods];T&&(D=D.filter(M=>!a.methods.find(G=>{var _;return G.id===M.id||G.name===M.name||G.id===((_=M.implements)==null?void 0:_.id)})));const O=Dr(a.ownDeclaredProperties,I,$.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation,$.PropertyOverwritesOtherExtendedEntitysPropertyWithSameName);t.push(...O.errors);const V=Dr(a.abstractMethods,D,$.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation,$.MethodOverwritesOtherExtendedEntitysMethodWithSameName);t.push(...V.errors)}}),e&&console.log("self.implements.length",r.implements.length),r.implements.length&&r.implements.forEach(f=>{if(f.type===n.BuiltInBaseEntity){const c=i.filter(T=>T.id!==f.id);c.length&&c.forEach(T=>{if(T.id!==f.id){const I=new Ye({id:r.id+"--"+T.id+"--"+f.id+"--"+x.ImplementsIncompatibleEntities,message:`Entity "${r.name}" with id "${r.id}" is implementing built-in entity "${T.name}" with id "${T.id}" but also implements entity "${f.name}" with id "${f.id}" which is incompatible`,issue:null,severity:w.Error,code:x.ImplementsIncompatibleEntities,entity:r,firstRelationship:T,secondRelationship:f});t.push(I)}})}else{St(f).forEach(D=>{const O=i.filter(V=>V.id!==D.id);O.length&&O.forEach(V=>{if(V.id!==D.id){const M=new Ye({id:r.id+"--"+V.id+"--"+D.id+"--"+x.ImplementsIncompatibleEntities,message:`Entity "${r.name}" with id "${r.id}" is implementing built-in entity "${V.name}" with id "${V.id}" but also implements entity "${D.name}" with id "${D.id}" which is incompatible`,issue:null,severity:w.Error,code:x.ImplementsIncompatibleEntities,entity:r,firstRelationship:V,secondRelationship:D});t.push(M)}})});const T=Dr(a.ownDeclaredProperties,f.ownDeclaredProperties,$.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation,$.PropertyOverwritesOtherImplementedEntitysPropertyWithSameName);t.push(...T.errors);const I=Dr(a.abstractMethods,[...f.abstractMethods,...f.methods],$.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation,$.MethodOverwritesOtherImplementedEntitysMethodWithSameName);t.push(...I.errors)}});const o=Dr(r.ownDeclaredProperties,a.ownDeclaredProperties,$.PropertyOverwritesOtherSiblingWithSameImplementation,$.PropertyOverwritesOtherSiblingWithSameName);t.push(...o.errors);const d=Dr(a.methods,a.abstractMethods,$.MethodOverwritesOtherSiblingWithSameImplementation,$.MethodOverwritesOtherSiblingWithSameName);return t.push(...d.errors),p(r.extends.flatMap(f=>St(f))).forEach(f=>{if(!i.find(c=>c.id===f.id)){const c=new Ye({id:r.id+"--"+a.id+"--"+f.id+"--"+x.ImplementsIncompatibleEntities,message:`Entity "${r.name}" with id "${r.id}" is extending built-in entity "${a.name}" with id "${a.id}" but also extends entity "${f.name}" with id "${f.id}" which is incompatible`,issue:null,severity:w.Error,code:x.ImplementsIncompatibleEntities,entity:r,firstRelationship:a,secondRelationship:f});t.push(c)}}),t}function yS(r){const a=[];return r.implements.forEach(e=>{if(!e.static){const t=new Ye({id:r.id+"--"+e.id+"--"+x.StaticImplementingNonStaticEntity,message:`Entity "${r.name}" with id "${r.id}" is static but implements entity "${e.name}" with id "${e.id}" which is non-static`,issue:null,severity:w.Error,code:x.StaticImplementingNonStaticEntity,entity:r,firstRelationship:e});a.push(t)}}),r.extends.forEach(e=>{if(!e.static){const t=new Ye({id:r.id+"--"+e.id+"--"+x.StaticExtendingNonStaticEntity,message:`Entity "${r.name}" with id "${r.id}" is static but extends entity "${e.name}" with id "${e.id}" which is non-static`,issue:null,severity:w.Error,code:x.StaticExtendingNonStaticEntity,entity:r,firstRelationship:e});a.push(t)}}),a}function mS(r){const a=[];if(r.implements.length){const e=new Ye({id:r.id+"--"+x.AbstractEntityImplements,message:`Entity "${r.name}" with id "${r.id}" cannot be marked as abstract because it implements other entities`,issue:null,severity:w.Error,code:x.AbstractEntityImplements,entity:r});a.push(e)}return r.extends.forEach(e=>{if(!e.abstract){const t=new Ye({id:r.id+"--"+e.id+"--"+x.AbstractExtendingNonAbstractEntity,message:`Entity "${r.name}" with id "${r.id}" is abstract but extends entity "${e.name}" with id "${e.id}" which is non-abstract`,issue:null,severity:w.Error,code:x.AbstractExtendingNonAbstractEntity,entity:r,firstRelationship:e});a.push(t)}}),a}function vS(r){const a=[];return r.extends.forEach(e=>{if(e.static){const t=new Ye({id:r.id+"--"+e.id+"--"+x.NonStaticExtendingStaticEntity,message:`Entity "${r.name}" with id "${r.id}" is non-static but extends entity "${e.name}" with id "${e.id}" which is static`,issue:null,severity:w.Error,code:x.NonStaticExtendingStaticEntity,entity:r,firstRelationship:e});a.push(t)}}),a}function ES(r){const a=[];return r.extends.forEach(e=>{if(e.abstract){const t=new Ye({id:r.id+"--"+e.id+"--"+x.NonAbstractExtendingAbstractEntity,message:`Entity "${r.name}" with id "${r.id}" is non-abstract but extends entity "${e.name}" with id "${e.id}" which is abstract`,issue:null,severity:w.Error,code:x.NonAbstractExtendingAbstractEntity,entity:r,firstRelationship:e});a.push(t)}}),a}const TS=Object.freeze(Object.defineProperty({__proto__:null,getBaseMethodsNotImplemented:TP,getBasePropertiesNotImplemented:EP,validate:vP,validateCanBecomeAbstract:mS,validateCanBecomeNonAbstract:ES,validateCanBecomeNonStatic:vS,validateCanBecomeStatic:yS,validateCanExtendEntity:hS,validateCanImplementEntity:fS},Symbol.toStringTag,{value:"Module"}));function IS(r,a){const e=[];if(r.parent)if(r.id===r.parent)e.push(new P({id:`${r.id}--${r.parent}--${R.SelfReference}`,code:R.SelfReference,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const t=a.get(r.parent);t?[n.Project,n.DataType].includes(t.type)||e.push(new P({id:`${r.id}--${r.parent}--${R.InvalidParentReference}`,code:R.InvalidParentReference,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):e.push(new P({id:`${r.id}--${r.parent}--${R.ReferencedEntityNotFound}`,code:R.ReferencedEntityNotFound,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return r.implements&&Array.isArray(r.implements)?r.implements.forEach(t=>{if(r.id===t){e.push(new P({id:`${r.id}--${t}--${R.SelfReference}`,code:R.SelfReference,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at one of the 'implements' references. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));return}const i=a.get(t);i?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(i.type)?i.abstract||e.push(new P({id:`${r.id}--${t}--${R.InvalidImplementsReference}`,code:R.InvalidImplementsReference,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):e.push(new P({id:`${r.id}--${t}--${R.InvalidImplementsReference}`,code:R.InvalidImplementsReference,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new P({id:`${r.id}--${t}--${R.ReferencedEntityNotFound}`,code:R.ReferencedEntityNotFound,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${t}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):e.push(new P({id:`${r.id}--${$.InvalidObjectStructure}`,code:$.InvalidObjectStructure,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' property that isn't an array.`,issue:null})),r.extends&&Array.isArray(r.extends)&&r.extends.forEach(t=>{const i=a.get(t);i?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(i.type)?i.abstract&&e.push(new P({id:`${r.id}--${t}--${R.InvalidExtendsReference}`,code:R.InvalidExtendsReference,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to a non-abstract entity. Did you want to use the property 'implements', which holds a list of references to absract entities, instead?`,issue:null})):e.push(new P({id:`${r.id}--${t}--${R.InvalidExtendsReference}`,code:R.InvalidExtendsReference,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to an entity of type 'definition-entity' or 'built-in-base-entity'.`,issue:null})):e.push(new P({id:`${r.id}--${t}--${R.ReferencedEntityNotFound}`,code:R.ReferencedEntityNotFound,severity:w.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${t}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),e}var sd=(r=>(r.Extends="extends",r.Implements="implements",r))(sd||{});const $e=class $e extends lt{constructor(e,t){super(e);h(this,"initialData");h(this,"id");h(this,"name");h(this,"description",null);h(this,"x");h(this,"y");h(this,"static");h(this,"abstract");h(this,"type",n.DefinitionEntity);h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"implements",[]);h(this,"project");h(this,"errors",[]);h(this,"parent");h(this,"detachedDependents",{});h(this,"knownVersions",null);h(this,"activeVersion",!1);h(this,"initialized",!1);h(this,"startedInitialization",!1);h(this,"suggestedProperties",[]);h(this,"suggestedMethods",[]);this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.description=e.description,this.x=e.x,this.y=e.y,this.static=e.static,this.abstract=e.abstract}static new(e=null){return{id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||E().toISOString(),author:(e==null?void 0:e.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DefinitionEntity,name:"",description:"",static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:null}}static fromGenerationTarget(e,t){let i=t;if(e.parent){const u=B(e.parent);i=t.get(u)}const s=[];e.implements&&e.implements.forEach(u=>{s.push(t.get(u)||t.getBuiltIn(u))});const l=[];e.extends&&e.extends.forEach(u=>{l.push(t.get(u)||t.getBuiltIn(u))});const o={id:e.id,version:m.UUID.uuid(),createdAt:E().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:e.name,type:n.DefinitionEntity,description:e.description,static:e.static,abstract:e.abstract,properties:[],methods:[],abstractMethods:[],extends:l,implements:s,x:0,y:0,parent:i},d=C(o,t);return d.setParent(i,null),d.initChildren(null),d}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const s=[],l=IS(i,t),o=Rc(i,t);s.push(...l,...o,...ut(i));const d=i.parent?t.get(i.parent):null;if(d&&d.type===n.DataType){const u=d;u.entity&&s.push(new P({id:`${e.id}--${R.NewEntityWouldOverriteExisting}`,code:R.NewEntityWouldOverriteExisting,severity:w.Error,message:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${u.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
|
|
407
407
|
You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
|
|
408
408
|
${rr({describe_entity:u.entity.id})}
|
|
409
|
-
Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:s,modifiedData:i}}get interactive(){return this.implements.length?this.implements.every(e=>e.interactive):!0}get allBasePropertiesFromExtendedAndImplementedEntities(){return p([...this.extends.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract),...e],[])])}get allBaseMethodsFromExtendedAndImplementedEntities(){return p([...this.extends.reduce((e,t)=>t.type!==n.DefinitionEntity?[]:[...[...t.ownDeclaredMethods,...t.allBaseMethodsFromExtendedAndImplementedEntities].filter(s=>s.type!==n.ActionDescriptor),...e],[]),...this.implements.reduce((e,t)=>t.type!==n.DefinitionEntity?t.abstractMethods:[...[...t.ownDeclaredMethods,...t.allBaseMethodsFromExtendedAndImplementedEntities].filter(s=>s.type!==n.ActionDescriptor),...e],[])])}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[]),...this.implements.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[])].filter(e=>!!e.abstract))}get extendedMethodsFromOriginalParents(){return p(this.extends.reduce((e,t)=>{if(t.type!==n.DefinitionEntity)return[];const i=[...t.ownDeclaredMethods,...t.extendedMethodsFromOriginalParents].filter(s=>s.type!==n.ActionDescriptor);return[...e,...i]},[]))}get implementedMethodsFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.type===n.DefinitionEntity?t.methods:[],s=[...t.abstractMethods].filter(l=>!i.find(o=>o.name===l.name));return[...i,...s,...e]},[]),...this.implements.reduce((e,t)=>[...t.abstractMethods,...e],[])].filter(e=>e.type===n.ActionDescriptor))}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}get extendedMethods(){return this.methods.filter(e=>e.isExtendedMethod)}get ownDeclaredMethods(){return this.methods.filter(e=>!e.isExtendedMethod)}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new P({id:`${this.id}--${R.InvalidParentUpdate}`,code:R.InvalidParentUpdate,severity:w.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}unsubscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]&&delete this.detachedDependents[t.entity.id]}),this}syncDependents(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-dependents"))){const t=[],i=[],s=[],l=[];return Object.values(this.detachedDependents).forEach(o=>{const d=o.entity.afterAllChildrenInitialized(e);t.push(...d.updated),i.push(...d.added),s.push(...d.removed),l.push(...d.affected)}),e==null||e.attemptAutoclose("sync-dependents",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}unsubscribeFromDependencies(){return this.implements.forEach(e=>{si.includes(e.type)||e.unsubscribeDependents([{entity:this,field:"implements"}])}),this}subscribeToDependencies(){return this.implements.forEach(e=>{si.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{si.includes(e.type)||e.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(e){if(e&&!E(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&E(e).isSame(E(this.createdAt))?this:(this.previousVersion=this.version,this.version=m.UUID.uuid(),this.createdAt=E(e).toISOString()||E().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new $e(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[this.version,e]]),e.properties=[...this.properties],e.methods=[...this.methods],e.abstractMethods=[...this.abstractMethods],e.extends=[...this.extends],e.implements=[...this.implements],e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],i=[],s=[],l=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[f,c]of this.knownVersions||new Map){if(u.set(f,c),c.activeVersion=!1,c.knownVersions)for(const[T,I]of c.knownVersions)u.set(T,I);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new $e(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.previousVersion=o.previousVersion,this.version=o.version,this.createdAt=o.createdAt,this.author=o.author,this.deleted=o.deleted,this.properties=o.properties,this.methods=o.methods,this.abstractMethods=o.abstractMethods,this.extends=o.extends,this.implements=o.implements,this.parent=o.parent,{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent){const l=B(this.initialData.parent),o=this.project.get(l);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return this.initialData.extends.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addExtension(d),d.type!==n.BuiltInBaseEntity&&e.push(d))}),this.initialData.implements.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addImplementation(d),d.type!==n.BuiltInBaseEntity&&e.push(d))}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],l=[];this.initialized=!0;const{updated:o,added:d,removed:u,affected:f}=this.syncImplementationProperties(e);t.push(...o),i.push(...d),s.push(...u),l.push(...f);const{updated:c,added:T,removed:I,affected:D}=this.addExtendedProperties(e);t.push(...c),i.push(...T),s.push(...I),l.push(...D);const{updated:O,added:V,removed:M}=this.removeUnrecognizedProperties(e);t.push(...O),i.push(...V),s.push(...M);const{updated:G,added:_,removed:g,affected:q}=this.syncImplementationMethods(e);t.push(...G),i.push(..._),s.push(...g),l.push(...q);const{updated:S,added:K,removed:de,affected:me}=this.addExtendedMethods(e);t.push(...S),i.push(...K),s.push(...de),l.push(...me);const{updated:z,added:oe,removed:Ft}=this.removeUnrecognizedMethods(e);return t.push(...z),i.push(...oe),s.push(...Ft),this.addSuggestions(),this.captureVersion(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-self-to-project"))){const t=[this],i=[],s=[],l=[];if(this.parent.type===n.DataType){const o=this.parent;o.entity=this,t.push(o)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}setParent(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,A.Updated))),t==null||t.attemptAutoclose("set-parent",this.id),this}addExtension(e){return this.extends.includes(e)||this.extends.push(e),this}removeExtension(e){return this.extends=this.extends.filter(t=>t.id!==e.id),this}addImplementation(e){return this.implements.includes(e)||this.implements.push(e),this}removeImplementation(e){return this.implements=this.implements.filter(t=>t.id!==e.id),this}removeProperty(e){return this.properties=this.properties.filter(t=>t.id!==e.id),this}addMethod(e){return this.methods.includes(e)||(this.methods.push(e),this.suggestedMethods=this.suggestedMethods.filter(t=>t.name!==e.name)),this}removeMethod(e){return this.methods=this.methods.filter(t=>t.id!==e.id),this}addProperty(e){return this.properties.includes(e)||(this.properties.push(e),this.suggestedProperties=this.suggestedProperties.filter(t=>t.name!==e.name)),this}addSuggestedProperty(e){return this.suggestedProperties.includes(e)||this.suggestedProperties.push(e),this}addSuggestedMethod(e){return this.suggestedMethods.includes(e)||this.suggestedMethods.push(e),this}removeSuggestedProperty(e){return this.suggestedProperties=this.suggestedProperties.filter(t=>t.id!==e.id),this}removeSuggestedMethod(e){return this.suggestedMethods=this.suggestedMethods.filter(t=>t.id!==e.id),this}addAbstractMethod(e){return this.abstractMethods.includes(e)||this.abstractMethods.push(e),this}removeAbstractMethod(e){return this.abstractMethods=this.abstractMethods.filter(t=>t.id!==e.id),this}initChildren(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.methods=this.initialData.methods.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.extends=this.initialData.extends.map(t=>C(t,this.project)),this.implements=this.initialData.implements.map(t=>C(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}removeUnrecognizedProperties(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-unrecognized-properties"))){const t=[],i=[],s=[],l=[];let o=[...this.properties];o=o.filter(u=>u.parent.id===this.id),o=o.filter(u=>!u.isExtendedProperty);const d=this.implementedPropertiesFromOriginalParents;return o=o.filter(u=>this.interactive&&!u.implements?!1:!d.find(f=>{var c;return f.id===((c=u.implements)==null?void 0:c.id)})),o.forEach(u=>{const f=u.remove({ignoreUpstream:!1},e);s.push(...f.removed),t.push(...f.updated)}),e==null||e.attemptAutoclose("remove-unrecognized-properties",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}removeUnrecognizedMethods(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-unrecognized-methods"))){const t=[],i=[],s=[],l=[];let o=[...this.methods];o=o.filter(u=>u.parent.id===this.id),o=o.filter(u=>!u.isExtendedMethod);const d=this.implementedMethodsFromOriginalParents;return o=o.filter(u=>this.interactive&&!u.implements?!1:!d.find(f=>{var c;return f.id===((c=u.implements)==null?void 0:c.id)})),o.forEach(u=>{const f=u.remove({ignoreUpstream:!1},e);s.push(...f.removed),t.push(...f.updated)}),e==null||e.attemptAutoclose("remove-unrecognized-methods",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}syncImplementationMethods(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-implementation-methods"))){const t=[],i=[],s=[],l=[],o=this.methods,d=this.implementedMethodsFromOriginalParents,u=[...this.allBaseMethodsFromExtendedAndImplementedEntities,...o];return d.filter(c=>!u.find(I=>{var D;return((D=I.implements)==null?void 0:D.id)===c.id})).forEach(c=>{if(this.methods.find(O=>{var V;return((V=O.implements)==null?void 0:V.id)===c.id}))return;const I=this.methods.find(O=>{var g,q;if(O.name===c.name&&!O.implements)return!0;const V=gi(this,J.CRON_JOB),M=gi(this,J.HTTP_ENDPOINT),G=((g=O.implements)==null?void 0:g.id)===k["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id,_=((q=O.implements)==null?void 0:q.id)===k["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.methods.handler.id;return!!(V&&!_&&!M&&G||M&&!G&&!V&&_)});if(I&&I.type===n.FunctionDeclaration){I.setImplements(c),I.metaSync({name:c.name},e),e==null||e.add(I,A.Updated),e==null||e.add(this,A.Updated);return}const D=c.implementAsFunctionDeclaration(e,this);i.push(D),e==null||e.add(D,A.Added),this.addMethod(D)}),e==null||e.attemptAutoclose("sync-implementation-methods",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}syncImplementationProperties(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],i=[],s=[],l=[],o=this.properties,d=this.implementedPropertiesFromOriginalParents,u=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return d.filter(c=>!u.find(I=>{var D;return((D=I.implements)==null?void 0:D.id)===c.id})).forEach(c=>{if(this.properties.find(O=>{var V;return((V=O.implements)==null?void 0:V.id)===c.id}))return;const I=this.properties.find(O=>O.name===c.name&&!!O.abstract&&!O.implements);if(I){I.implements=c,I.abstract=!1;return}const D=c.clone(e,this,m.UUID.uuid());D.initChildren(e),i.push(D),e==null||e.add(D,A.Added),D.setImplements(c,e),D.metaSync({abstract:!1},e),this.addProperty(D)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addExtendedMethods(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-extended-methods"))){const t=[],i=[],s=[],l=[],o=this.methods,u=this.extendedMethodsFromOriginalParents.filter(c=>c.type===n.FunctionDeclaration),f=new Set(o.filter(c=>{var T;return!!((T=c.extends)!=null&&T.id)}).map(c=>c.extends.id));return u.forEach(c=>{if(f.has(c.id))return;f.add(c.id);const T=c.clone(e,this,m.UUID.uuid());T.setExtends(c,e),T.initChildren(e),i.push(T),e==null||e.add(T,A.Added),this.addMethod(T)}),e==null||e.attemptAutoclose("add-extended-methods",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addExtendedProperties(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-extended-properties"))){const t=[],i=[],s=[],l=[],o=this.properties,d=this.extendedPropertiesFromOriginalParents,u=d.filter(c=>d.find(I=>{var D;return((D=I.implements)==null?void 0:D.id)===c.id})?!1:!c.abstract),f=new Set(o.filter(c=>{var T;return!!((T=c.extends)!=null&&T.id)}).map(c=>c.extends.id));return u.forEach(c=>{if(f.has(c.id))return;f.add(c.id);const T=c.clone(e,this,m.UUID.uuid());T.setExtends(c,e),T.initChildren(e),i.push(T),e==null||e.add(T,A.Added),this.addProperty(T)}),e==null||e.attemptAutoclose("add-extended-properties",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSuggestions(){return this.implements.forEach(e=>{EP(this,e).forEach(s=>{const l=s.toJSON();l.id=`_suggestion--parent--${this.id}--${s.id}`;const o=C(l,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),TP(this,e).forEach(s=>{const l=`_suggestion--parent--${this.id}--${s.id}`,o=s.implementAsFunctionDeclaration(null,this,l),d=C(o,this.project);if(d.suggestion=!0,d.setParent(this,null),d.initChildren(null),this.methods=this.methods.filter(u=>u.id!==l),d.inputs.forEach(u=>{u.suggestion=!0}),d.returnStatements.length){const u=d.returnStatements[0];u.suggestion=!0,u.outputs.forEach(f=>{f.suggestion=!0})}this.addSuggestedMethod(d)})}),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"meta-sync"))){const i=pt(this,e),s=this.toMeta();return this.name=e.name!==void 0?e.name:s.name,this.description=e.description!==void 0?e.description:s.description,this.x=e.x||s.x,this.y=e.y||s.y,this.static=e.static!==void 0?e.static:this.static,this.abstract=e.abstract!==void 0?e.abstract:this.abstract,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await $e.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await $e.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await $e.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await $e.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await $e.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await $e.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-entity"))){const i=[],s=[],l=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(s.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(d=>{const{updated:u,removed:f,added:c}=d.entity.onDetachedDependencyRemoved(this,d.field,t);i.push(...u),s.push(...f),l.push(...c)}),this.properties.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),this.methods.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),this.abstractMethods.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),this.suggestedProperties.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),this.suggestedMethods.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const d=this.parent.setEntity(null);i.push(d)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(l),updated:p(i),removed:p(s),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],l=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),Object.values(this.detachedDependents).forEach(o=>{const{updated:d,removed:u,added:f}=o.entity.onDetachedDependencyRestored(this,o.field,e);i.push(...d),s.push(...u),t.push(...f)}),this.properties.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.methods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.abstractMethods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.suggestedProperties.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.suggestedMethods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(l),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(i=>i.toFlat(e)),...this.implements.flatMap(i=>i.toFlat(e)),...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(i=>i.toFlatIds(e)),...this.implements.flatMap(i=>i.toFlatIds(e)),...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.parent.toFlatIds(e)])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,static:this.static,abstract:this.abstract,x:this.x,y:this.y,type:this.type,name:this.name}}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),implements:this.implements.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e)),parent:this.parent.toReference()})}toJSONClone(e=W){var i,s,l,o,d;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||yt(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(l=e.seenEntities)!=null&&l.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(d=e.seenEntities)==null||d.add(this.id),{id:t,version:m.UUID.uuid(),createdAt:e.timestamp||E().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(u=>u.toJSONClone({...e,newId:null})),methods:this.methods.map(u=>u.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(u=>u.toJSONClone({...e,newId:null})),implements:this.implements.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),extends:this.extends.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,name:this.name,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(s=>s.toReference(e)),methods:this.methods.map(s=>s.toReference(e)),abstractMethods:this.abstractMethods.map(s=>s.toReference(e)),implements:this.implements.map(s=>s.toReference(e)),extends:this.extends.map(s=>s.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e)),...this.implements.flatMap(i=>i.toFlatJSON(e)),...this.extends.flatMap(i=>i.toFlatJSON(e)),...this.parent.toFlatJSON(e)])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,static:this.static,abstract:this.abstract,extends:this.extends.map(t=>t.id),implements:this.implements.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.DefinitionEntity).flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.DefinitionEntity).flatMap(i=>i.toFlatGenerationTarget(e)),...this.parent.toFlatGenerationTarget(e)])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){return this.errors=vP(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){var O,V,M;let l=mt(t,this);const o=this.toJSON(),d=i||m.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const u=d.split("-id"),f=u[u.length-1||0]||d;o.id=d,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||E().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=st(o,l);t&&c.setParent(t,null),s&&c.subscribe(),c.initChildren(e),e==null||e.add(c,A.Added);const T=(O=this.properties)==null?void 0:O.map(G=>G.clone(e,c,m.UUID.uuid(),s));c.properties=T;const I=(V=this.methods)==null?void 0:V.map((G,_)=>G.clone(e,c,f+"-method-"+_+"-id",s));c.methods=I;const D=(M=this.abstractMethods)==null?void 0:M.map((G,_)=>G.clone(e,c,f+"-abstract-method-"+_+"-id",s));return c.abstractMethods=D,e==null||e.attemptAutoclose("clone-entity",this.id),c}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"implement-definition-entity")),i){const s=Yl(this,e,t,i);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),s}getAllInteractiveMethods(){const e=this.implements.filter(i=>i.type===n.DefinitionEntity||i.type===n.BuiltInBaseEntity&&i.interactive);return p([...this.methods,...this.extends.flatMap(i=>i.getAllInteractiveMethods()),...e.flatMap(i=>i.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const i=[],s=[],l=[],o=[];if(this.parent.type!==n.DataType||!this.parent.inferred)return t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const d=[];e.forEach(c=>{d.find(I=>F(I,this.project)===F(c,this.project))||d.push(c)});const u=this.properties.filter(c=>!c.dataType);d.forEach(c=>{var M,G;const T=u.find(_=>F(_,this.project)===F(c,this.project));if(!T)return;const D=Gn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),O=$i(D,t),V=O==null?void 0:O.clone(t,T,m.UUID.uuid(),!0);if(V){const _=(M=T.dataType)==null?void 0:M.merge(V,t);T.dataType&&(_==null?void 0:_.self.id)!==T.dataType.id&&T.dataType.remove({ignoreUpstream:!1},t),V.id!==((G=_==null?void 0:_.self)==null?void 0:G.id)&&V.remove({ignoreUpstream:!1},t),_!=null&&_.self&&(_.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(_.self,A.Added),T.setDataType(_.self),t==null||t.add(T,A.Updated))}c.setDeclaration(T),t==null||t.add(c,A.Updated)});const f=[];return d.forEach(c=>{if(!c.declaration){f.push(c);return}}),f.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(f.forEach(c=>{var _,g,q,S;const T=this.properties.find(K=>F(K,this.project)===F(c,this.project));if(T){if(c.setDeclaration(T),!T.getDataType(t)){const de=Gn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),me=$i(de),z=me==null?void 0:me.clone(t,T,m.UUID.uuid(),!0);if(z){const oe=(_=T.dataType)==null?void 0:_.merge(z,t);T.dataType&&(oe==null?void 0:oe.self.id)!==T.dataType.id&&T.dataType.remove({ignoreUpstream:!1},t),z.id!==((g=oe==null?void 0:oe.self)==null?void 0:g.id)&&z.remove({ignoreUpstream:!1},t),oe!=null&&oe.self&&(oe.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(oe.self,A.Added),T.setDataType(oe.self),t==null||t.add(T,A.Updated))}}return}const I={id:m.UUID.uuid(),type:n.Property,version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||E().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:F(c,this.project),description:c.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:c.index,implements:null,extends:null,dataType:null,parent:this.toReference()},D=C(I,this.project);D.setParent(this,t),D.initChildren(t),t==null||t.add(D,A.Added);const V=Gn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),M=$i(V),G=M==null?void 0:M.clone(t,D,m.UUID.uuid(),!0);if(G){const K=(q=D.dataType)==null?void 0:q.merge(G,t);D.dataType&&(K==null?void 0:K.self.id)!==D.dataType.id&&D.dataType.remove({ignoreUpstream:!1},t),G.id!==((S=K==null?void 0:K.self)==null?void 0:S.id)&&G.remove({ignoreUpstream:!1},t),K!=null&&K.self&&(K.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(K.self,A.Added),D.setDataType(K.self),t==null||t.add(D,A.Updated))}return this.addProperty(D),c.setDeclaration(D),t==null||t.add(c,A.Updated),D}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:p(i),updated:p(s),removed:p(l),affected:p(o),self:this})}};h($e,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...i)=>null}),h($e,"type",n.DefinitionEntity),h($e,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),h($e,"PARENT_TYPES",[...$e.USER_MANAGED_PARENT_TYPES]),h($e,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),h($e,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),h($e,"BASE_PROPERTIES",[...$e.MUTABLE_BASE_PROPERTIES,...$e.INMUTABLE_BASE_PROPERTIES]),h($e,"MUTABLE_META_PROPERTIES",[...$e.MUTABLE_BASE_PROPERTIES,"x","y"]),h($e,"INMUTABLE_META_PROPERTIES",[...$e.INMUTABLE_BASE_PROPERTIES]),h($e,"META_PROPERTIES",[...$e.MUTABLE_META_PROPERTIES,...$e.INMUTABLE_META_PROPERTIES]),h($e,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),h($e,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),h($e,"UPSTREAM_PROPERTIES",[...$e.MUTABLE_UPSTREAM_PROPERTIES,...$e.INMUTABLE_UPSTREAM_PROPERTIES]),h($e,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),h($e,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),h($e,"DOWNSTREAM_PROPERTIES",[...$e.MUTABLE_DOWNSTREAM_PROPERTIES,...$e.INMUTABLE_DOWNSTREAM_PROPERTIES]),h($e,"PROPERTIES",[...$e.META_PROPERTIES,...$e.UPSTREAM_PROPERTIES,...$e.DOWNSTREAM_PROPERTIES]);let dn=$e;function AS(r){const a=y5(),e=r.toJSON();a.safeParse(e).success;const i=[];return Ke(r.errors,i)}const Sa=class Sa extends lt{constructor(e,t){super(e);h(this,"initialData");h(this,"id");h(this,"version");h(this,"name");h(this,"description",null);h(this,"type",n.BuiltInBaseEntity);h(this,"abstract",!1);h(this,"static");h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"interactive",!1);h(this,"errors",[]);h(this,"project");this.initialData=this.initialData||e,this.project=this.project||t,this.id=this.id||e.id,this.version=this.version||e.version,this.name=this.name||e.name,this.static=this.static||e.static,this.interactive=this.interactive||e.interactive,this.abstract=e.abstract,this.properties=this.initialData.properties.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.extends=this.initialData.extends.map(i=>C(i,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract);return[...e,...i]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=U,...t){return await Sa.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.extends.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.extends.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,interactive:this.interactive,abstract:this.abstract,static:this.static,type:this.type,name:this.name}}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=W){return{id:this.id+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=W){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=AS(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}implement(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),null,!0,"implement-built-in-base-entity")),i){const s=Yl(this,e,t,i);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),s}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Sa&&e.push(...i.getAllInteractiveMethods())})),p(e)}};h(Sa,"repository",{APILoad:async(e,...t)=>null});let Fi=Sa;function bS(r){const a=a5(),e=r.toJSON();a.safeParse(e).success;const i=[];return Ke(r.errors,i)}const dd=class dd extends lt{constructor(e,t){super(e);h(this,"initialData");h(this,"id");h(this,"name");h(this,"description",null);h(this,"type",n.PrimitiveEntity);h(this,"static");h(this,"abstract");h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"errors",[]);h(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.parent=this,s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.parent=this,s})}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract);return[...e,...i]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=U,...t){return await dd.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,static:this.static,abstract:this.abstract,type:this.type,name:this.name}}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=W){return{id:this.id+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=W){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=bS(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const e=[];return e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Fi&&e.push(...i.getAllInteractiveMethods())}),p(e)}};h(dd,"repository",{APILoad:async(e,...t)=>null});let ni=dd;function st(r,a){if(!r)throw new Error("Entity is null");const e=a.get(r.id);switch(r.type){case n.LiteralValue:return e||new en(r,a);case n.DefinitionEntity:return e||new dn(r,a);case n.PrimitiveEntity:return e||new ni(r,a);case n.FunctionDeclaration:return e||new kr(r,a);case n.GlobalEvent:return e||new Wr(r,a);case n.DataType:return e||new Zr(r,a);case n.Property:return e||new xr(r,a);case n.FunctionCall:return e||new an(r,a);case n.Condition:return e||new zr(r,a);case n.Operation:return e||new qr(r,a);case n.VariableDeclaration:return e||new Hr(r,a);case n.VariableInstance:return e||new Yr(r,a);case n.OutputMap:return e||new tr(r,a);case n.ReturnDeclaration:return e||new ri(r,a);case n.ArgumentDeclaration:return e||new br(r,a);case n.InputMap:return e||new er(r,a);case n.Project:return e||new m(r);case n.InstalledProject:return e||new Xr(r,a);case n.ActionDescriptor:return e||new We(r,a);case n.ReturnStatement:return e||new Jr(r,a);case n.Loop:return e||new Sr(r,a);case n.Search:return e||new Kr(r,a);case n.ValueDescriptor:return e||new ir(r,a);case n.BuiltInBaseEntity:return e||new Fi(r,a);case n.InternalCall:return e||new Qr(r,a);case n.ContinueStatement:return e||new Gt(r,a);case n.BreakStatement:return e||new tn(r,a);case n.GenericReference:return a.get(r.entityId);default:throw new Error("Invalid entity type: "+r.type)}}function C(r,a){if(!r)throw new Error("Entity is null");const e=st(r,a);return e.subscribe(),e}function RS(r,a){if(!r)throw new Error("Entity is null");switch(r.type){case n.LiteralValue:return en.fromGenerationTarget(r,a);case n.DefinitionEntity:return dn.fromGenerationTarget(r,a);case n.FunctionDeclaration:return kr.fromGenerationTarget(r,a);case n.GlobalEvent:return Wr.fromGenerationTarget(r,a);case n.DataType:return Zr.fromGenerationTarget(r,a);case n.Property:return xr.fromGenerationTarget(r,a);case n.FunctionCall:return an.fromGenerationTarget(r,a);case n.Condition:return zr.fromGenerationTarget(r,a);case n.Operation:return qr.fromGenerationTarget(r,a);case n.VariableDeclaration:return Hr.fromGenerationTarget(r,a);case n.VariableInstance:return Yr.fromGenerationTarget(r,a);case n.OutputMap:return tr.fromGenerationTarget(r,a);case n.ReturnDeclaration:return ri.fromGenerationTarget(r,a);case n.ArgumentDeclaration:return br.fromGenerationTarget(r,a);case n.InputMap:return er.fromGenerationTarget(r,a);case n.InstalledProject:return Xr.fromGenerationTarget(r,a);case n.ReturnStatement:return Jr.fromGenerationTarget(r,a);case n.Loop:return Sr.fromGenerationTarget(r,a);case n.Search:return Kr.fromGenerationTarget(r,a);case n.ActionDescriptor:return We.fromGenerationTarget(r,a);case n.ValueDescriptor:return ir.fromGenerationTarget(r,a);case n.InternalCall:return Qr.fromGenerationTarget(r,a);case n.ContinueStatement:return Gt.fromGenerationTarget(r,a);case n.BreakStatement:return tn.fromGenerationTarget(r,a);default:throw new Error("Invalid entity type: "+r.type)}}const W={seenEntityMaps:new Map,seenEntities:new Set,timestamp:E().toISOString()};class IP{constructor(){h(this,"initialData")}}const U={cascade:!1},AP={APILoad:async(r,...a)=>null},DS={APICreate:async(r,...a)=>r,APIUpdate:async(r,...a)=>r,APIDelete:async(r,...a)=>r,APIClone:async(r,...a)=>{},APILoadVersion:async(r,a,...e)=>null,...AP};class OS{}class wS extends IP{}class PS{}class VS{}class CS{}class af{}class _S extends af{}class BS extends af{}class MS{}class Or{static initReadsValue(a){if(a.initialData.readsValue&&a.initialData.readsValue.type!==n.GenericReference)a.readsValue=C(a.initialData.readsValue,a.project);else if(a.initialData.readsValue&&a.initialData.readsValue.type===n.GenericReference){const e=bi(a.initialData.readsValue,a.project);e&&(a.readsValue=e)}if(a.readsValue){if(it.includes(a.readsValue.type)){let e=a.parent;ht.includes(e.type)||(e=e.parent);const t=a.type===n.InputMap&&a.parent.type===n.Loop;t&&(e=a.parent.parent),a.readsValue.setParent(e,null),a.readsValue.initChildren(null),!t&&e.detachedChildren.includes(a)?e.replaceDetachedChild(a,a.readsValue):t||e.subscribeDetachedChild(a.readsValue)}a.readsValue.addValueReader(a,null)}return a.readsValue}static hydrateReadsValue(a){if(a.initialData.readsValue&&a.initialData.readsValue.type!==n.GenericReference)a.readsValue=C(a.initialData.readsValue,a.project);else if(a.initialData.readsValue&&a.initialData.readsValue.type===n.GenericReference){const e=bi(a.initialData.readsValue,a.project);e&&(a.readsValue=e)}if(a.readsValue){if(it.includes(a.readsValue.type)){let e=a.parent;ht.includes(e.type)||(e=e.parent);const t=a.type===n.InputMap&&a.parent.type===n.Loop;t&&(e=a.parent.parent),a.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(a)?e.replaceDetachedChild(a,a.readsValue):t||e.subscribeDetachedChild(a.readsValue)}a.readsValue.addValueReader(a,null)}return a.readsValue}}class Ja{static initWritesValues(a,e){const t=a.initialData.writesValues.reduce((s,l)=>{if(l.type===n.GenericReference||a.writesValues.some(d=>d.id===l.id))return s;const o=C(l,a.project);return o.setValueWriter(a,null),it.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...s,o]},[]),i=[...a.writesValues];return a.writesValues=p([...i,...t]),a.writesValues}}class NS{}class LS{constructor(a){h(this,"eventName");h(this,"callbacks",[]);this.eventName=a}on(a){if(typeof a!="function")throw new Error("Event callback must be a function");this.callbacks.includes(a)||this.callbacks.push(a)}off(a){if(typeof a!="function")throw new Error("Event callback must be a function");this.callbacks=this.callbacks.filter(e=>e!==a)}destroy(){this.callbacks=[]}}class of{constructor(){h(this,"subscribedEvents",{});h(this,"on",this._on);h(this,"emit",this._emit);h(this,"off",this._off);h(this,"destroy",this._destroy)}getEvent(a){return this.subscribedEvents[a]||(this.subscribedEvents[a]=new LS(a)),this.subscribedEvents[a]}_on(a,e){this.getEvent(a).on(e)}_emit(a,...e){const t=this.getEvent(a);t&&t.callbacks.forEach(i=>{i.apply(null,e)})}_off(a,e){const t=this.getEvent(a);t&&(e?t.off(e):(t.destroy(),delete this.subscribedEvents[a]))}_destroy(){Object.keys(this.subscribedEvents).forEach(a=>{this._off(a)}),this.subscribedEvents={}}}var Bt=(r=>(r.DEFINITION_ENTITY_ADDED="definition-entity-added",r.DEFINITION_ENTITY_REMOVED="definition-entity-removed",r.DEFINITION_ENTITY_UPDATED="definition-entity-updated",r.PERSISTED_DEFINITION_ENTITY_ADDED="persisted-definition-entity-added",r.PERSISTED_DEFINITION_ENTITY_REMOVED="persisted-definition-entity-removed",r.PERSISTED_DEFINITION_ENTITY_UPDATED="persisted-definition-entity-updated",r.RELATIONAL_DATABASE_DEFINITION_ENTITY_ADDED="relational-database-definition-entity-added",r.RELATIONAL_DATABASE_DEFINITION_ENTITY_REMOVED="relational-database-definition-entity-removed",r.RELATIONAL_DATABASE_DEFINITION_ENTITY_UPDATED="relational-database-definition-entity-updated",r))(Bt||{});function jS(r,a){a.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!=="constructor"&&Object.defineProperty(r.prototype,t,Object.getOwnPropertyDescriptor(e.prototype,t))})})}class bP extends lt{constructor(...a){super(...a),Object.assign(this,new of)}}jS(bP,[of]);const re=class re extends bP{constructor(e){super(e);h(this,"initialData");h(this,"id");h(this,"type",n.Project);h(this,"name",null);h(this,"description",null);h(this,"x");h(this,"y");h(this,"entities",[]);h(this,"projects",[]);h(this,"functions",[]);h(this,"events",[]);h(this,"variableDeclarations",[]);h(this,"variableInstances",[]);h(this,"conditions",[]);h(this,"operations",[]);h(this,"functionCalls",[]);h(this,"loops",[]);h(this,"searches",[]);h(this,"primitives",[]);h(this,"builtInBaseEntities",[]);h(this,"operationDeclarations",[]);h(this,"globalEventActionDescriptors",[]);h(this,"loopDeclarations",[]);h(this,"loopDeclarationsBodies",[]);h(this,"conditionDeclarations",[]);h(this,"valueDescriptors",[]);h(this,"dataTypes",[]);h(this,"project");h(this,"instances",{});h(this,"builtInInstances",{});h(this,"deletedInstances",{});h(this,"errors",[]);h(this,"references",[]);h(this,"history",[]);h(this,"undoableStackValueIndex",-1);h(this,"detachedDependents",{});h(this,"knownVersions",null);h(this,"activeVersion",!1);h(this,"initialized",!1);h(this,"startedInitialization",!1);h(this,"onCloseChangeSetCallback",null);h(this,"onRequestActiveValueCallback",null);this.initialData=e,this.id=e.id,this.name=e.name,this.description=e.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!re.UUID||re.UUID.isBackup)&&(re.UUID=So==null?void 0:So()),re.UUID||(re.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:t=>t})}catch(t){console.error("Error initializing UUID module",t),re.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:i=>i}}}static injectUUIDModule(e){re.UUID=e}static new(e=null){return{id:re.UUID.uuid(),version:re.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||E().toISOString(),author:(e==null?void 0:e.author)||re.sessionAuthor,previousVersion:null,deleted:!1,type:n.Project,name:"",description:"",entities:[],functions:[],events:[],projects:[],variableDeclarations:[],variableInstances:[],conditions:[],operations:[],functionCalls:[],loops:[],searches:[]}}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const s=[];return s.push(...ut(i)),{errors:s,modifiedData:i}}async closePendingChangeSets(){const e=this.history.find(t=>t.dirty&&!t.open);e&&await this.closeChangeSet(e)}onRequestActiveValue(e){this.onRequestActiveValueCallback=e}async onCloseChangeSet(e){this.onCloseChangeSetCallback=e,await this.closePendingChangeSets()}async closeChangeSet(e){const t=this.history.findIndex(l=>l.id===e.id),i=this.history.slice(0,t),s=i[i.length-1];if(!(s!=null&&s.dirty)&&this.onCloseChangeSetCallback){(await this.onCloseChangeSetCallback(e)).success&&(e.dirty=!1,this.closePendingChangeSets());return}}toLatestChangeSet(e,t,i,s=!1,l="here-this"){if(!this.history.length)return new b(this,e,t,i,s,l);const o=this.history[this.history.length-1];return o.open?o:this.addChangeSet(new b(this,e,t,i,s,l))}addChangeSet(e){if(!this.history.length)return this.undoableStackValueIndex=u1(this.undoableStackValueIndex,this.history,e),e;const t=this.history.find(s=>s.id===(e==null?void 0:e.id));if(t)return t;const i=this.history.find(s=>s.open);if(i)throw console.warn("Previous still open: ",i),console.warn("New change set: ",e),new Error(`There is already an open change-set with id '${i.id}'.`);return this.undoableStackValueIndex=u1(this.undoableStackValueIndex,this.history,e),e}discardChangeSet(e){const t=this.history.findIndex(i=>i.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}async inject(...e){return await Promise.all(e.map(t=>new Promise(async i=>{await t.init(this),i(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}unsubscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]&&delete this.detachedDependents[t.entity.id]}),this}syncDependents(e=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"sync-dependents"))){const t=[],i=[],s=[],l=[];return Object.values(this.detachedDependents).forEach(o=>{const d=o.entity.afterAllChildrenInitialized(e);t.push(...d.updated),i.push(...d.added),s.push(...d.removed),l.push(...d.affected)}),e==null||e.attemptAutoclose("sync-dependents",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}unsubscribeFromDependencies(){return this}subscribeToDependencies(){return this}increaseVersion(e){if(e&&!E(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&E(e).isSame(E(this.createdAt))?this:(this.previousVersion=this.version,this.version=re.UUID.uuid(),this.createdAt=E(e).toISOString()||E().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new re(this);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[this.version,e]]),e.entities=[...this.entities],e.projects=[...this.projects],e.functions=[...this.functions],e.events=[...this.events],e.variableDeclarations=[...this.variableDeclarations],e.variableInstances=[...this.variableInstances],e.conditions=[...this.conditions],e.operations=[...this.operations],e.functionCalls=[...this.functionCalls],e.loops=[...this.loops],e.searches=[...this.searches],this}recursiveCaptureUpstreamVersions(e){const t=[],i=[],s=[],l=[];return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[f,c]of this.knownVersions||new Map){if(u.set(f,c),c.activeVersion=!1,c.knownVersions)for(const[T,I]of c.knownVersions)u.set(T,I);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new re(u)}return this.metaSync(o.toShallowJSON(),null),this.previousVersion=o.previousVersion,this.version=o.version,this.createdAt=o.createdAt,this.author=o.author,this.deleted=o.deleted,this.entities=o.entities,this.projects=o.projects,this.functions=o.functions,this.events=o.events,this.variableDeclarations=o.variableDeclarations,this.variableInstances=o.variableInstances,this.conditions=o.conditions,this.operations=o.operations,this.functionCalls=o.functionCalls,this.loops=o.loops,this.searches=o.searches,{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=null){const t=[],i=[],s=[],l=[];return this.initialized=!0,this.validate(),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e){const t=[],i=[],s=[],l=[];return this.subscribe(),this.subscribeToDependencies(),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(e){return this.operationDeclarations.includes(e)}isGlobalEventActionDescriptor(e){return this.globalEventActionDescriptors.includes(e)}isLoopDeclaration(e){return this.loopDeclarations.includes(e)}isConditionDeclaration(e){return this.conditionDeclarations.includes(e)}initChildren(e=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.projects=this.initialData.projects.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.variableInstances=this.initialData.variableInstances.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.conditions=this.initialData.conditions.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.operations=this.initialData.operations.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.functions=this.initialData.functions.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.events=this.initialData.events.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.functionCalls=this.initialData.functionCalls.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.loops=this.initialData.loops.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.searches=this.initialData.searches.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeDeletedInstance(e){return(!this.deletedInstances[e.id]||this.deletedInstances[e.id]!==e)&&(this.deletedInstances[e.id]=e),this}subscribeBuiltInInstance(e){return(!this.builtInInstances[e.id]||this.builtInInstances[e.id]!==e)&&(this.builtInInstances[e.id]=e),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(e){return delete this.instances[e.id],this}unsubscribeDeletedInstance(e){return delete this.deletedInstances[e.id],this}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getDeleted(e){return this.deletedInstances[e]||null}getManaged(e){return this.getBuiltIn(e)?null:this.instances[e]||null}getBuiltIn(e){return this.builtInInstances[e]||null}findSubscribedInstanceFromReference(e){return this.instances[e.entityId]||null}findSubscribedBuiltInInstanceFromReference(e){return this.builtInInstances[e.entityId]||null}metaSync(e,t=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"meta-sync"))){const i=pt(this,e),s=this.toMeta();return this.name=e.name!==void 0?e.name:s.name,this.description=e.description!==void 0?e.description:s.description,this.x=e.x||s.x,this.y=e.y||s.y,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await re.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await re.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await re.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await re.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await re.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await re.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}getAllBuiltInIds(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlatIds(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlatIds(e)),...this.operationDeclarations.flatMap(t=>t.toFlatIds(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlatIds(e)),...this.loopDeclarations.flatMap(t=>t.toFlatIds(e)),...this.conditionDeclarations.flatMap(t=>t.toFlatIds(e)),...this.valueDescriptors.flatMap(t=>t.toFlatIds(e)),...this.dataTypes.flatMap(t=>t.toFlatIds(e))]}getAllBuiltIn(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlat(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlat(e)),...this.operationDeclarations.flatMap(t=>t.toFlat(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlat(e)),...this.loopDeclarations.flatMap(t=>t.toFlat(e)),...this.conditionDeclarations.flatMap(t=>t.toFlat(e)),...this.valueDescriptors.flatMap(t=>t.toFlat(e)),...this.dataTypes.flatMap(t=>t.toFlat(e))]}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.entities.flatMap(i=>i.toFlat(e)),...this.functions.flatMap(i=>i.toFlat(e)),...this.events.flatMap(i=>i.toFlat(e)),...this.projects.flatMap(i=>i.toFlat(e)),...this.variableDeclarations.flatMap(i=>i.toFlat(e)),...this.variableInstances.flatMap(i=>i.toFlat(e)),...this.conditions.flatMap(i=>i.toFlat(e)),...this.operations.flatMap(i=>i.toFlat(e)),...this.functionCalls.flatMap(i=>i.toFlat(e)),...this.loops.flatMap(i=>i.toFlat(e)),...this.searches.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(i=>i.toFlatIds(e)),...this.functions.flatMap(i=>i.toFlatIds(e)),...this.events.flatMap(i=>i.toFlatIds(e)),...this.projects.flatMap(i=>i.toFlatIds(e)),...this.variableDeclarations.flatMap(i=>i.toFlatIds(e)),...this.variableInstances.flatMap(i=>i.toFlatIds(e)),...this.conditions.flatMap(i=>i.toFlatIds(e)),...this.operations.flatMap(i=>i.toFlatIds(e)),...this.functionCalls.flatMap(i=>i.toFlatIds(e)),...this.loops.flatMap(i=>i.toFlatIds(e)),...this.searches.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,type:this.type,name:this.name}}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(t=>t.toJSON(e)),variableDeclarations:this.variableDeclarations.map(t=>t.toJSON(e)),variableInstances:this.variableInstances.map(t=>t.toJSON(e)),conditions:this.conditions.map(t=>t.toJSON(e)),operations:this.operations.map(t=>t.toJSON(e)),loops:this.loops.map(t=>t.toJSON(e)),searches:this.searches.map(t=>t.toJSON(e)),functions:this.functions.map(t=>t.toJSON(e)),events:this.events.map(t=>t.toJSON(e)),projects:this.projects.map(t=>t.toJSON(e)),functionCalls:this.functionCalls.map(t=>t.toJSON(e))})}toJSONClone(e={uuidStrategy:"uuid"}){const t=new Map,i=new Set,s=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(l=>{if(s.includes(l)){t.set(l,l);return}t.set(l,re.UUID.uuid())}),i.add(this.id),{id:t.get(this.id),version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),projects:this.projects.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),variableDeclarations:this.variableDeclarations.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),variableInstances:this.variableInstances.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),conditions:this.conditions.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),operations:this.operations.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),functions:this.functions.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),events:this.events.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),functionCalls:this.functionCalls.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),loops:this.loops.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),searches:this.searches.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null}))}}toReference(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+re.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(s=>s.toReference(e)),functions:this.functions.map(s=>s.toReference(e)),events:this.events.map(s=>s.toReference(e)),projects:this.projects.map(s=>s.toReference(e)),variableDeclarations:this.variableDeclarations.map(s=>s.toReference(e)),variableInstances:this.variableInstances.map(s=>s.toReference(e)),conditions:this.conditions.map(s=>s.toReference(e)),operations:this.operations.map(s=>s.toReference(e)),functionCalls:this.functionCalls.map(s=>s.toReference(e)),loops:this.loops.map(s=>s.toReference(e)),searches:this.searches.map(s=>s.toReference(e))}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(i=>i.toFlatJSON(e)),...this.functions.flatMap(i=>i.toFlatJSON(e)),...this.events.flatMap(i=>i.toFlatJSON(e)),...this.projects.flatMap(i=>i.toFlatJSON(e)),...this.variableDeclarations.flatMap(i=>i.toFlatJSON(e)),...this.variableInstances.flatMap(i=>i.toFlatJSON(e)),...this.conditions.flatMap(i=>i.toFlatJSON(e)),...this.operations.flatMap(i=>i.toFlatJSON(e)),...this.functionCalls.flatMap(i=>i.toFlatJSON(e)),...this.loops.flatMap(i=>i.toFlatJSON(e)),...this.searches.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.events.flatMap(i=>i.toFlatGenerationTarget(e)),...this.projects.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(i=>i.toFlatGenerationTarget(e)),...this.conditions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.operations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.loops.flatMap(i=>i.toFlatGenerationTarget(e)),...this.searches.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.entities.forEach(e=>e.clearErrors()),this.projects.forEach(e=>e.clearErrors()),this.functions.forEach(e=>e.clearErrors()),this.events.forEach(e=>e.clearErrors()),this.variableDeclarations.forEach(e=>e.clearErrors()),this.variableInstances.forEach(e=>e.clearErrors()),this.conditions.forEach(e=>e.clearErrors()),this.operations.forEach(e=>e.clearErrors()),this.functionCalls.forEach(e=>e.clearErrors()),this.loops.forEach(e=>e.clearErrors()),this.searches.forEach(e=>e.clearErrors()),this}validate(){const e=Bq(),t=this.toJSON();return e.safeParse(t),this.validateChildren(),{success:!0,error:null,data:t}}validateChildren(){this.entities.forEach(e=>e.validate()),this.projects.forEach(e=>e.validate()),this.functions.forEach(e=>e.validate()),this.events.forEach(e=>e.validate()),this.variableDeclarations.forEach(e=>e.validate()),this.variableInstances.forEach(e=>e.validate()),this.conditions.forEach(e=>e.validate()),this.operations.forEach(e=>e.validate()),this.functionCalls.forEach(e=>e.validate()),this.loops.forEach(e=>e.validate()),this.searches.forEach(e=>e.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(t=>t.getErrors()),...this.projects.flatMap(t=>t.getErrors()),...this.functions.flatMap(t=>t.getErrors()),...this.events.flatMap(t=>t.getErrors()),...this.variableDeclarations.flatMap(t=>t.getErrors()),...this.variableInstances.flatMap(t=>t.getErrors()),...this.conditions.flatMap(t=>t.getErrors()),...this.operations.flatMap(t=>t.getErrors()),...this.functionCalls.flatMap(t=>t.getErrors()),...this.loops.flatMap(t=>t.getErrors()),...this.searches.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(e){return this.entities.find(t=>t.id===e)||null}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearch(e){return this.searches.includes(e)||this.searches.push(e),this}removeDefinitionEntity(e){const t=this.entities.findIndex(i=>i.id===e.id);if(t>-1){const i=this.entities[t];return this.entities.splice(t,1),i}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(i=>i.id===e.id);if(t>-1){const i=this.functions[t];return this.functions.splice(t,1),i}return null}removeExternalProject(e){const t=this.projects.findIndex(i=>i.id===e.id);if(t>-1){const i=this.projects[t];return this.projects.splice(t,1),i}return null}removeGlobalEvent(e){const t=this.events.findIndex(i=>i.id===e.id);if(t>-1){const i=this.events[t];return this.events.splice(t,1),i}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(i=>i.id===e.id);if(t>-1){const i=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),i}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(t=>t.methods)]}getTerminationStatements(){return[...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.ReturnStatement||l.type===n.ContinueStatement||l.type===n.BreakStatement)]},[])]}getFunctionDeclaration(e){return this.functions.find(t=>t.id===e)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.functionCalls.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.operations.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.loops.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.searches.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.functionCalls.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.conditions.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.loops.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.searches.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.operations.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.loops.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.searches.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.functionCalls.reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.conditions.reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.operations.reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.loops.reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.searches.reduce((t,i)=>{const s=He(i);return[...t,...s]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.functionCalls.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.conditions.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.operations.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.loops.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.searches.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[])]}getVariableDeclarations(){return p([...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.functionCalls.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.conditions.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.operations.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.loops.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.searches.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[])])}getLoops(){return[...this.loops,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[]),...this.functionCalls.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[]),...this.conditions.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[]),...this.operations.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[]),...this.searches.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[])]}getSearches(){return[...this.searches,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[]),...this.functionCalls.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[]),...this.conditions.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[]),...this.operations.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[]),...this.loops.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[])]}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(i=>{if(!i.declaration){const s=i.initialData,l=s.declaration.entityId||s.declaration.id,o=t.find(d=>d.id===l);o&&i.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===J.PERSISTED_ENTITY)||null}requestActiveValue(e){var i;const t=(i=this.onRequestActiveValueCallback)==null?void 0:i.call(this,e);return t?t||null:e.getDefaultValue()}undo(){const e=this.history[this.undoableStackValueIndex+1],t=this.history[this.undoableStackValueIndex];return l1(e||"initial",t||"initial",this)}redo(){const e=this.history[this.undoableStackValueIndex-1],t=this.history[this.undoableStackValueIndex];return l1(e||"initial",t||"initial",this)}};h(re,"sessionAuthor","1"),h(re,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),h(re,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...i)=>null}),h(re,"type",n.Project),h(re,"USER_MANAGED_PARENT_TYPES",[]),h(re,"PARENT_TYPES",[...re.USER_MANAGED_PARENT_TYPES]),h(re,"MUTABLE_BASE_PROPERTIES",["name","description"]),h(re,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),h(re,"BASE_PROPERTIES",[...re.MUTABLE_BASE_PROPERTIES,...re.INMUTABLE_BASE_PROPERTIES]),h(re,"MUTABLE_META_PROPERTIES",[...re.MUTABLE_BASE_PROPERTIES,"x","y"]),h(re,"INMUTABLE_META_PROPERTIES",[...re.INMUTABLE_BASE_PROPERTIES]),h(re,"META_PROPERTIES",[...re.MUTABLE_META_PROPERTIES,...re.INMUTABLE_META_PROPERTIES]),h(re,"MUTABLE_UPSTREAM_PROPERTIES",[]),h(re,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),h(re,"UPSTREAM_PROPERTIES",[...re.MUTABLE_UPSTREAM_PROPERTIES,...re.INMUTABLE_UPSTREAM_PROPERTIES]),h(re,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),h(re,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),h(re,"DOWNSTREAM_PROPERTIES",[...re.MUTABLE_DOWNSTREAM_PROPERTIES,...re.INMUTABLE_DOWNSTREAM_PROPERTIES]),h(re,"PROPERTIES",[...re.META_PROPERTIES,...re.UPSTREAM_PROPERTIES,...re.DOWNSTREAM_PROPERTIES]);let m=re;var RP=(r=>(r.PersistChangeSet="persist-change-set",r.CreateSingle="create-single",r.CreateBulk="create-bulk",r.CreateSingleNested="create-single-nested",r.CreateBulkNested="create-bulk-nested",r.Update="update",r.Clone="clone",r.Delete="delete",r.Load="load",r.LoadNested="load-nested",r.LoadVersion="load-version",r))(RP||{});class DP extends We{constructor(e){super(Bi,e);h(this,"id",Qe.Parallel);h(this,"name",Qe.Parallel);h(this,"description","Execute a list of actions one after the other");h(this,"version","1");h(this,"autoexecutable",!0);h(this,"initialData",Bi);h(this,"type",n.ActionDescriptor);h(this,"inputs",[]);h(this,"outputs",[]);h(this,"error",null);h(this,"project");this.project=e,this.inputs=Bi.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=Bi.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=Bi.error?C(Bi.error,this.project):null}}class OP extends We{constructor(e){super(Ht,e);h(this,"id",Ht.id);h(this,"name",Ht.name);h(this,"description",Ht.description);h(this,"version",Ht.version);h(this,"autoexecutable",!1);h(this,"initialData",Ht);h(this,"type",n.ActionDescriptor);h(this,"inputs",[]);h(this,"outputs",[]);h(this,"error",null);h(this,"project");this.project=e,this.inputs=Ht.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=Ht.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=Ht.error?C(Ht.error,this.project):null}}class wP extends We{constructor(e){super(ur,e);h(this,"id",Qe.Sequential);h(this,"name",Qe.Sequential);h(this,"description","Execute a list of actions one after the other");h(this,"version","1");h(this,"autoexecutable",!0);h(this,"initialData",ur);h(this,"type",n.ActionDescriptor);h(this,"inputs",[]);h(this,"outputs",[]);h(this,"error",null);h(this,"project");this.project=e,this.inputs=ur.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=ur.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=ur.error?C(ur.error,this.project):null}}class US extends We{constructor(a){super(js,a)}}class $S extends We{constructor(a){super(cn,a)}}class GS extends We{constructor(e){super(fn,e);h(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===k.operation[et.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===k.operation[et.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===k.operation[et.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"get-entity-to-match-validate-data"))){const i=this.project.requestActiveValue(e),s=i==null?void 0:i.valueAsTypeSingle;return t==null||t.attemptAutoclose("get-entity-to-match-validate-data",this.id),s}syncOperationInstance(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const i=[],s=[],l=[],o=[],d=this.getEntityToMatchInputMap(e);if(d){const{added:c,updated:T,removed:I,affected:D}=this.syncEntityToMatchInputMapDataType(d,t);i.push(...T),s.push(...c),l.push(...I),o.push(...D)}const u=this.getDataToValidateInputMap(e);if(u){const{added:c,updated:T,removed:I,affected:D}=this.syncDataToValidateInputMapDataType(u,t);i.push(...T),s.push(...c),l.push(...I),o.push(...D)}const f=this.getOutputDataOutputMap(e);if(f){const{added:c,updated:T,removed:I,affected:D}=this.syncOutputDataOutputMapDataType(f,t);i.push(...T),s.push(...c),l.push(...I),o.push(...D)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:p(i),added:p(s),removed:p(l),affected:p(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var f,c,T,I,D,O,V,M,G,_,g,q,S,K,de;const i=[],s=[],l=[],o=[];if(((f=e.declaration)==null?void 0:f.id)!==k.operation[et.Validate].inputs.entityToMatch.id)return t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const d=this.project.requestActiveValue(e),u=d==null?void 0:d.valueAsTypeSingle;if(!e.dataType){const me={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:(t==null?void 0:t.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:((c=e.declaration.dataType)==null?void 0:c.options)||null,implementationChooseOne:((T=e.declaration.dataType)==null?void 0:T.implementationChooseOne)||!1,staticEntities:((I=e.declaration.dataType)==null?void 0:I.staticEntities)??null,interactiveEntities:((D=e.declaration.dataType)==null?void 0:D.interactiveEntities)??null,actionEntities:((O=e.declaration.dataType)==null?void 0:O.actionEntities)??null,isList:((V=e.declaration.dataType)==null?void 0:V.isList)||!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:(u==null?void 0:u.toJSON())||null,like:!0,inferred:!0,parent:e.toReference()},z=C(me,e.project);z.hydrateAncestors(),z.setParent(e,t),z.initChildren(t),z.setEntity(u),t==null||t.add(z,A.Added),i.push(z),e.setDataType(z)}return(K=e.dataType)==null||K.metaSync({inferred:!0,like:!1,asType:!0,options:((M=e.declaration.dataType)==null?void 0:M.options)||null,implementationChooseOne:((G=e.declaration.dataType)==null?void 0:G.implementationChooseOne)||!1,staticEntities:((_=e.declaration.dataType)==null?void 0:_.staticEntities)??null,interactiveEntities:((g=e.declaration.dataType)==null?void 0:g.interactiveEntities)??null,actionEntities:((q=e.declaration.dataType)==null?void 0:q.actionEntities)??null,isList:((S=e.declaration.dataType)==null?void 0:S.isList)||!1},t),(de=e.dataType)==null||de.setEntity(u),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var c,T,I;const i=[],s=[],l=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==k.operation[et.Validate].inputs.dataToValidate.id)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const d=this.getEntityToMatchInputMap(e.parent);if(!d)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(d,t))return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const D={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:(t==null?void 0:t.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.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:e.toReference()},O=C(D,e.project);O.setParent(e,t),O.initChildren(t),t==null||t.add(O,A.Added),i.push(O),e.setDataType(O)}(T=e.dataType)==null||T.metaSync({inferred:!0,like:!0,asType:!1},t);const f=this.getEntityToMatch(d,t);return(I=e.dataType)==null||I.setEntity(f),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var T,I,D;const i=[],s=[],l=[],o=[];if(((T=e.declaration)==null?void 0:T.id)!==k.operation[et.Validate].outputs.outputEntity.id)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const d=this.getEntityToMatchInputMap(e.parent);if(!d)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(d,t))return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const f=this.project.requestActiveValue(d),c=(f==null?void 0:f.valueAsTypeSingle)||null;if(!e.dataType){const O={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:(t==null?void 0:t.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:(c==null?void 0:c.toJSON())||null,like:!0,inferred:!0,parent:e.toReference()},V=C(O,e.project);V.hydrateAncestors(),V.setParent(e,t),V.initChildren(t),V.setEntity(c),t==null||t.add(V,A.Added),i.push(V),e.setDataType(V)}return(I=e.dataType)==null||I.metaSync({inferred:!0,like:!0,asType:!1},t),(D=e.dataType)==null||D.setEntity(c),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var s,l,o;if(((s=e.declaration)==null?void 0:s.id)===k.operation[et.Validate].inputs.entityToMatch.id){const{added:d,updated:u,removed:f,affected:c}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:p(u),added:p(d),removed:p(f),affected:p(c),self:e.dataType}}if(((l=e.declaration)==null?void 0:l.id)===k.operation[et.Validate].inputs.dataToValidate.id){const{added:d,updated:u,removed:f,affected:c}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:p(u),added:p(d),removed:p(f),affected:p(c),self:e.dataType}}const i=(o=e.declaration)==null?void 0:o.getDataType(t);if(i&&i.isResolved)return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:i};if(e.readsValue){const d=$i(e.readsValue,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:d}}return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var i;if(((i=e.declaration)==null?void 0:i.id)===k.operation[et.Validate].outputs.outputEntity.id){const{added:s,updated:l,removed:o,affected:d}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:p(l),added:p(s),removed:p(o),affected:p(d),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class gS extends We{constructor(a){super(Ad,a)}}class FS extends We{constructor(a){super(Rd,a)}}class xS extends We{constructor(a){super(Dd,a)}}class kS extends We{constructor(a){super(to,a)}}class ZS extends We{constructor(a){super(Xa,a)}}class qS extends We{constructor(a){super(Ls,a)}}function JS(r){const a=[new wP(r),new DP(r),new OP(r),new US(r),new $S(r),new GS(r),new kS(r),new gS(r),new xS(r),new FS(r),new ZS(r),new qS(r),new We(Id,r),new We(Td,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.operationDeclarations=a,a}class PP extends Fi{constructor(e){super(Nt,e);h(this,"initialData");h(this,"id",J.PERSISTED_ENTITY);h(this,"version","1");h(this,"name",J.PERSISTED_ENTITY);h(this,"description",Nt.description);h(this,"type",n.BuiltInBaseEntity);h(this,"abstract",Nt.abstract);h(this,"static",Nt.static);h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"errors",[]);h(this,"project");this.initialData=Nt,this.project=e,this.id=Nt.id,this.version=Nt.version,this.name=Nt.name,this.static=Nt.static,this.abstract=Nt.abstract,this.properties=this.initialData.properties.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.methods=this.initialData.methods.map(t=>{const i=C(t,this.project);return i.parent=this,i}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const i=C(t,this.project);return i.parent=this,i}),this.extends=this.initialData.extends.map(t=>C(t,this.project))}}var VP=(r=>(r.StatusCodeMustBeNumber="status-code-must-be-number",r.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",r))(VP||{});function CP(r,a){const e=[];if(typeof a!="number"){const t=new Ye({id:r.id+"--status-code-must-be-number",message:`Entity of type ${r.type} with id "${r.id}" has an invalid value "${a}". The value must be a number.`,issue:null,severity:w.Error,code:"status-code-must-be-number",entity:r});return e.push(t),{errors:e,override:a}}if(a<100){const t=new Ye({id:r.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${r.type} with id "${r.id}" has an invalid value "${a}". The value must be a number between 100 and 599.`,issue:null,severity:w.Error,code:"status-code-must-be-between-100-and-599",entity:r});e.push(t)}if(a>599){const t=new Ye({id:r.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${r.type} with id "${r.id}" has an invalid value "${a}". The value must be a number between 100 and 599.`,issue:null,severity:w.Error,code:"status-code-must-be-between-100-and-599",entity:r});e.push(t)}return{errors:e,override:a}}class _P extends Fi{constructor(e){super(ai,e);h(this,"initialData");h(this,"id",J.PERSISTED_ENTITY);h(this,"version","1");h(this,"name",J.PERSISTED_ENTITY);h(this,"description",ai.description);h(this,"type",n.BuiltInBaseEntity);h(this,"abstract",ai.abstract);h(this,"static",ai.static);h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"errors",[]);h(this,"project");this.initialData=ai,this.project=e,this.id=ai.id,this.version=ai.version,this.name=ai.name,this.static=ai.static,this.abstract=ai.abstract,this.properties=this.initialData.properties.map(l=>{const o=C(l,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.methods=this.initialData.methods.map(l=>{const o=C(l,this.project);return o.parent=this,o}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const o=C(l,this.project);return o.parent=this,o}),this.extends=this.initialData.extends.map(l=>C(l,this.project));const t=this.properties.find(l=>l.id===k["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!t)throw new Error("Path property not found in endpoint entity");t._codeNativeValueValidation=(l,o)=>fw(l,o);const i=this.abstractMethods.find(l=>l.id===k["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!i)throw new Error("Handler method not found in endpoint entity");const s=i.outputs.find(l=>l.id===k["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.outputs.statusCode.id);if(!s)throw new Error("Status code output not found in handler method");s.codeNativeValueValidation=(l,o)=>CP(l,o)}}const WS="test_primitive_entities_export";class SS extends Fi{constructor(e){super(Ot,e);h(this,"initialData");h(this,"id",J.PERSISTED_ENTITY);h(this,"version","1");h(this,"name",J.PERSISTED_ENTITY);h(this,"description",Ot.description);h(this,"type",n.BuiltInBaseEntity);h(this,"abstract",Ot.abstract);h(this,"static",Ot.static);h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"errors",[]);h(this,"project");this.initialData=Ot,this.project=e,this.id=Ot.id,this.version=Ot.version,this.name=Ot.name,this.static=Ot.static,this.abstract=Ot.abstract,this.properties=this.initialData.properties.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.parent=this,s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.parent=this,s}),this.extends=this.initialData.extends.map(i=>C(i,this.project));const t=this.properties.find(i=>i.id===k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!t)throw new Error("Path property not found in endpoint entity");t._codeNativeValueValidation=(i,s)=>hw(i,s)}}function zS(r){const a=[new PP(r),new _P(r),new SS(r),new Fi(Ot,r),new Fi(To,r)];return a.forEach(e=>{r.subscribeBuiltInInstance(e)}),r.builtInBaseEntities=a,a}function YS(r){const a=[new ni(ae,r),new ni(ar,r),new ni(Ee,r),new ni(fd,r),new ni(Vt,r),new ni(or,r),new ni(Zi,r),new ni(lr,r),new ni(Wn,r)];return a.forEach(e=>{r.subscribeBuiltInInstance(e)}),r.primitives=a,a}function HS(r){const a=[new We(Ao,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.globalEventActionDescriptors=a,a}function KS(r){const a=[new We(gs,r),new We(Pr,r),new We($s,r),new We(Yn,r),new We(Hn,r),new We(uo,r)];a.forEach(t=>{t.initChildren(null),r.subscribeBuiltInInstance(t)}),r.loopDeclarations=a;const e=[new We(ho,r),new We(Gs,r),new We(co,r),new We($d,r),new We(gd,r),new We(po,r)];return e.forEach(t=>{t.initChildren(null),r.subscribeBuiltInInstance(t)}),r.loopDeclarationsBodies=e,a}function XS(r){const a=[new ir(bo,r),new ir(su,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.valueDescriptors=a,a}function QS(r){const a=[new We(En,r),new We(ts,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.conditionDeclarations=a,a}const Fn={},ad={},Wa={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function BP(r,{enrich:a}={enrich:!0}){const e=r.project,t=r.record,i=new Ua(e),s=new Set;t[e.id]=e,s.add(e.id);const l=E().toISOString();Object.values(t).forEach(u=>{!u||i.allBuiltInEntityIds.includes(u.id)||s.add(u.id)}),i.order=Array.from(s),i.flatRecord=t,i.orderEntities();const o=od(r.project);o.instances[e.id]=o;const d=a?o.addChangeSet(new b(o,m.sessionAuthor,l,o,!0,"project-init-from-fetch-result")):null;return i.visit(u=>{if(u.id===o.id)return;const f=C(u,o);f.hydrateAncestors(),f.addSelfToProject(null)}),a?(i.visit(u=>{const f=o.get(u.id);f&&f.afterAllChildrenInitialized(d)}),o.afterAllChildrenInitialized(d)):ld(o,l).forEach(f=>{f.remove({ignoreUpstream:!0},null)}),o.instancesList.forEach(u=>{u.previousVersion=null}),d==null||d.attemptAutoclose("project-init-from-fetch-result",o.id),o}async function ez(r,a=Wa){const e={...Wa,...a};if(e.empty)return{data:{project:{id:r.id,type:n.Project,version:m.UUID.uuid(),createdAt:E().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(e.mock){const i={...cp};return i.id=r.id,{data:{project:i,record:{}}}}return console.log("Fetching project from external API"),new Promise(async i=>{try{if(e.onFetch){const s=await e.onFetch(r.id);if(s){i({data:s});return}}else i({data:null})}catch(s){console.error("Error fetching project: ",s),i({data:null})}})}function od(r){const a=new m(r);return YS(a),zS(a),JS(a),HS(a),KS(a),XS(a),QS(a),Array.from(new Set([...a.getAllBuiltInIds(),...Gi()])).forEach(t=>{if(!a.builtInInstances[t]&&a.instances[t])a.builtInInstances[t]=a.instances[t],delete a.instances[t];else if(!a.builtInInstances[t])throw new Error(`Built in entity was not properly initialized: ${t}`)}),a}function ld(r,a){return r.instancesList.filter(t=>E(t.createdAt).isAfter(E(a)||!!t.previousVersion))}function tz(r,{enrich:a}={enrich:!0}){const e=new Map,t=Array.from(new Set([...r.getAllBuiltInIds(),...Gi()]));Object.keys(r.instances).forEach(u=>{if(t.includes(u)){e.set(u,u);return}const f=r.get(u);if(!nd(f,{...r.instances,...r.builtInInstances}).every(I=>!t.includes(I))){e.set(u,u);return}e.set(u,m.UUID.uuid())});const i=E().toISOString(),s=r.toShallowJSON({seenEntityMaps:e});s.previousVersion=null,s.createdAt=i,s.version=m.UUID.uuid();const l=od(s),o=a?l.addChangeSet(new b(l,m.sessionAuthor,i,l,!0,"project-clone")):null,d=new Ua(r);return d.visit(u=>{const f=u.toShallowJSON({seenEntityMaps:e});f.previousVersion=null,f.createdAt=i,f.version=m.UUID.uuid();const c=C(f,l);c.hydrateAncestors(),c.addSelfToProject(o),o==null||o.add(c,A.Added)}),a?(d.visit(u=>{const f=l.get(e.get(u.id));f&&f.afterAllChildrenInitialized(o)}),l.afterAllChildrenInitialized(o)):ld(l,i).forEach(f=>{f.remove({ignoreUpstream:!0},null)}),l.instancesList.forEach(u=>{u.previousVersion=null}),o==null||o.attemptAutoclose("project-clone",l.id),l}function MP(r,{enrich:a}={enrich:!0}){const e=od(r),t=E().toISOString(),i=a?e.addChangeSet(new b(e,m.sessionAuthor,t,e,!0,"project-init")):null;i&&(i.type=_c.Automatic);const s=new Ua(r);return s.visit(l=>{const o=C(l,e);o.hydrateAncestors(),o.addSelfToProject(i)}),a?(s.visit(l=>{const o=e.get(l.id);o&&o.afterAllChildrenInitialized(i)}),e.afterAllChildrenInitialized(i)):ld(e,t).forEach(o=>{o.remove({ignoreUpstream:!0},null)}),i==null||i.attemptAutoclose("project-init",e.id),e}async function iz(r,a=Wa){const e={...Wa,...a};if(r.id&&Fn[r.id]&&!e.ignoreCache)return Fn[r.id];if(r.id&&ad[r.id]&&!e.ignoreCache)return await ad[r.id],Fn[r.id];const t=ez(r,e);r.id&&(ad[r.id]=t);const i=await t;if(i.data){let s;return e.mock?s=MP(cp,{enrich:!!e.enrich}):i.data instanceof m?s=i.data:s=BP(i.data,{enrich:!!e.enrich}),Fn[r.id]=s,r.id&&delete ad[r.id],s}return null}function rz(r){return Fn[r.id]&&delete Fn[r.id],null}y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=kc,y.ALL_BUILT_IN_BASE_ENTITIES=WT,y.ALL_BUILT_IN_CONDITION_ENTITIES=aI,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=lI,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=IE,y.ALL_BUILT_IN_LOOP_ENTITIES=TE,y.ALL_BUILT_IN_OPERATION_ENTITIES=B0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=Tf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=hI,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=fI,y.ActionDescriptorState=We,y.ActionInputMapState=oW,y.ActionOutputMapState=uW,y.AppendToListOperationInputIds=Py,y.AppendToListOperationOutputIds=Vy,y.ArgumentDeclarationDependencyField=k1,y.ArgumentDeclarationState=br,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Gc,y.BUILT_IN_BASE_ENTITY_IDS=k,y.BUILT_IN_ENTITY_TYPES=si,y.BaseCanvasDraggableState=PS,y.BaseEntityNames=J,y.BaseState=wS,y.BaseValueDescriptorIds=Jn,y.BreakStatementDependencyField=W1,y.BreakStatementState=tn,y.BuiltInBaseEntityState=Fi,y.CACHED_PROJECTS_BY_ID=Fn,y.CALLABLE_ENTITIES_EXPLANATION=TW,y.CALLABLE_TYPES=xi,y.CALLER_ENTITIES_EXPLANATION=K1,y.CALLER_TYPES=ki,y.CALLS_UPDATE_EXPLANATION=nn,y.COMPARISON_CONDITIONS=nI,y.CONDITIONS=sI,y.CUSTOM_ENTITY_OPERATIONS=Ym,y.CallableEntityClass=CS,y.CallerEntityClass=af,y.ChangeSet=b,y.ChangeSetChangeCaptureType=_c,y.ChangeSetEntityChangeType=A,y.ChildEntityState=VS,y.CommonStringValidationErrorCodes=cw,y.ComparisonOperatorTypes=ft,y.ConditionDependencyField=P1,y.ConditionState=zr,y.ContinueStatementDependencyField=A1,y.ContinueStatementState=Gt,y.CreateNewInputIds=Rm,y.CreateNewOutputIds=Dm,y.DRAGGABLE_CALLABLE_TYPES=cd,y.DRAGGABLE_CALLER_TYPES=pf,y.DRAGGABLE_ELEMENT_TYPES=Ka,y.DRAGGABLE_EXECUTABLE_TYPES=$P,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=Ha,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=pd,y.DataTypeCompatibilityTypes=Pi,y.DataTypeDependencyField=Bc,y.DataTypeParentChildRelation=Pt,y.DataTypeState=Zr,y.DefinitionEntityDependencyField=sd,y.DefinitionEntityState=dn,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=DS,y.ENTITIES_WITH_VALLUES_EXPLANATION=ql,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=U,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=W,y.ENTITY_TYPES=GP,y.ENTITY_WITH_DECLARATION_TYPES=jP,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=ht,y.ENTITY_WITH_NAMES_TYPES=cf,y.ENTITY_WITH_PARENT_TYPES=NP,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=df,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=LP,y.ENTITY_WITH_VALUE_TYPES=lf,y.ENTRY_POINT_ENTITIES_EXPLANATION=La,y.ENTRY_POINT_TYPES=rt,y.EVENT_TYPES=qn,y.EXECUTABLE_TYPES=UP,y.EXECUTION_OPERATIONS=bm,y.EndpointEntity=_P,y.EntityAction=RP,y.EntityError=Ye,y.EntityErrorSeverity=w,y.EntityGenerationError=P,y.EntityGenerationErrorCode=R,y.EntityInstanceErrorCode=x,y.EntityOperations=et,y.EntityType=n,y.EntityWithLogicScopeClass=NS,y.EntityWithValueClass=MS,y.EntryPointEntityClass=_S,y.Events=of,y.ExecutionOperations=Qe,y.ExecutionTerminationType=D1,y.FunctionCallDependencyField=lw,y.FunctionCallState=an,y.FunctionDeclarationDependencyField=f1,y.FunctionDeclarationState=kr,y.GET_PROJECT_OPTIONS_DEFAULTS=Wa,y.GLOBAL_EVENT_DECLARATIONS=oI,y.GetLastInListOperationInputIds=yy,y.GetLastInListOperationOutputIds=my,y.GlobalEventNames=sr,y.GlobalEventState=Wr,y.HTTPOperations=Ut,y.HTTPStatucCodeValidationErrorCodes=VP,y.HTTP_OPERATIONS=C0,y.InputMapDependencyField=G1,y.InputMapState=er,y.InstalledProjectState=Xr,y.InternalCallDependencyField=U1,y.InternalCallState=Qr,y.JoinListOperationInputIds=jh,y.JoinListOperationOutputIds=Uh,y.LIST_OPERATIONS=xy,y.ListOperations=ye,y.LiteralValueDependencyField=q1,y.LiteralValueState=en,y.LoopDependencyField=O1,y.LoopState=Sr,y.LoopTypes=ee,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=sn,y.NUMBER_OPERATIONS=Yf,y.NumberOperations=tt,y.OPERATION_DECLARATIONS=_0,y.OperationDependencyField=m1,y.OperationState=qr,y.OutputMapDependencyField=F1,y.OutputMapParentChildRelation=Zn,y.OutputMapState=tr,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Jl,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=rn,y.PASS_THROUGH_CALLABLE_TYPES=dt,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=uf,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=xc,y.ParallelExecutionOperation=DP,y.PassThroughCallableEntityClass=BS,y.PersistedEntity=PP,y.PersistedEntityMethods=hi,y.PrimitiveEntityState=ni,y.PrimitiveTypes=N,y.ProjectState=m,y.ProjectStateEvents=Bt,y.PropertyDependencyField=p1,y.PropertyState=xr,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=AP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=IW,y.ReturnDeclarationDependencyField=E1,y.ReturnDeclarationState=ri,y.ReturnStatementDependencyField=Mc,y.ReturnStatementState=Jr,y.STANDALONE_CONDITIONS=YT,y.STRING_OPERATIONS=Lh,y.ScopeCompatibilityType=id,y.SearchDependencyField=M1,y.SearchState=Kr,y.SequentialExecutionOperation=wP,y.SequentialExecutionOperationInputIds=dm,y.SequentialExecutionOperationOutputIds=um,y.SharedEntityErrorCode=$,y.SharedStateFunctionality=IP,y.SplitListOperationInputIds=Kh,y.SplitListOperationOutputIds=Xh,y.StandaloneOperatorTypes=Ri,y.StringOperations=Ae,y.TERMINATION_TYPES=ot,y.Traverser=Ua,y.USER_MANAGED_ENTITY_TYPES=ff,y.UserManagedEntityStateTemplate=OS,y.VALUE_READING_ENTITIES_EXPLANATION=Fc,y.VALUE_READING_TYPES=wr,y.VALUE_WRITING_ENTITIES_EXPLANATION=X1,y.VALUE_WRITING_TYPES=Et,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=gc,y.VARIABLE_TYPES=it,y.ValueAutogenerationType=vt,y.ValueDescriptorDependencyField=z1,y.ValueDescriptorParentChildRelation=L,y.ValueDescriptorState=ir,y.ValueReadingEntityClass=Or,y.ValueWritingEntityClass=Ja,y.VariableDeclarationDependencyField=_1,y.VariableDeclarationState=Hr,y.VariableInputMapState=aW,y.VariableInstanceDependencyField=Lc,y.VariableInstanceState=Yr,y.VariableOutputMapState=dW,y.WaitOperation=OP,y.WaitOperationInputIds=im,y.WaitOperationOutputIds=rm,y.actionDescriptorValidation=XJ,y.appendToListOperation=to,y.appendToListOperationElementToAppendArgument=wd,y.appendToListOperationElementToAppendArgumentParentRef=Uy,y.appendToListOperationElementToAppendArgumentRef=By,y.appendToListOperationError=Fy,y.appendToListOperationErrorParentRef=gy,y.appendToListOperationListArgument=Od,y.appendToListOperationListArgumentParentRef=jy,y.appendToListOperationListArgumentRef=Cy,y.appendToListOperationListDataType=_y,y.appendToListOperationResultListDataType=Ly,y.appendToListOperationResultListReturn=Gy,y.appendToListOperationResultListReturnParentRef=$y,y.appendToListOperationResultListReturnRef=Ny,y.appendToListOperationSecondListDataType=My,y.applyNewScope=Q,y.argumentDeclarationValidation=pW,y.asGenerationActionExample=rr,y.booleanPrototype=ar,y.breakStatementValidation=hW,y.calculateNewParentBasedOnCallers=zc,y.capitalizeFirstLetter=_t,y.changeSetJSONRecordToUniqueIds=GJ,y.checkAreDataTypesCompatible=Vi,y.checkAreDefinitionEntitiesCompatibleAsDataType=SO,y.checkArePropertiesCompatibleAsDataType=WO,y.checkExtendsBaseEntity=rd,y.checkHasBaseEntity=gi,y.checkHasMetadataChanged=pt,y.checkImplementationsOverlap=Dr,y.checkImplementsBaseEntity=QW,y.checkIsBranchDependentButNotDirectlyOnBranch=$a,y.checkIsBranchDependentOnBranch=NW,y.checkIsCallableEntityReachable=qa,y.checkIsCanvasEntity=KW,y.checkIsDetachedBranch=pP,y.checkIsDetachedBranchShallow=nf,y.checkIsGlobalVariable=YW,y.checkIsGloballyDeclared=rf,y.checkIsMethod=hP,y.checkIsNestedScope=td,y.checkScopeCompatibility=Za,y.cloneProject=tz,y.conditionValidation=QJ,y.continueStatementValidation=zJ,y.convertToAbstract=CW,y.convertToNonAbstract=_W,y.convertToNonStatic=MW,y.convertToStatic=BW,y.countedLoopActionDescriptor=gs,y.countedLoopActionDescriptorDynamicReturnDeclaration=pE,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=uE,y.countedLoopActionDescriptorStringArgumentDeclaration=dE,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=oE,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=sE,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=nE,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=aE,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=lE,y.countedLoopBodyActionDescriptor=ho,y.countedLoopBodyActionDescriptorAnyDynamicArgument=mE,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=yE,y.countedLoopBodyActionDescriptorAnyDynamicReturn=EE,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=vE,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=xd,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=fE,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=cE,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=hE,y.createDefinitionEntityFromJSONObject=Hl,y.createEntityError=fe,y.createNestedDataTypeForEntity=pw,y.createNewInstanceOperation=cn,y.createNewInstanceOperationEntityToInstanciateArgument=Mm,y.createNewInstanceOperationEntityToInstanciateArgumentRef=Cm,y.createNewInstanceOperationEntityToInstanciateDataType=_m,y.createNewInstanceOperationError=Um,y.createNewInstanceOperationErrorParentRef=jm,y.createNewInstanceOperationNewEntityDataArgument=Vm,y.createNewInstanceOperationNewEntityDataArgumentDataType=Pm,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=wm,y.createNewInstanceOperationNewEntityDataArgumentParentRef=Om,y.createNewInstanceOperationOutputEntityDeclaration=Lm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=Nm,y.createNewInstanceOperationRef=Bm,y.createSemanticId=s1,y.createStateFromGenerationTargetType=RS,y.createStateFromType=st,y.createStateFromTypeAndSubscribe=C,y.cronJobBuiltInBaseEntity=To,y.cronJobBuiltInBaseEntityExpressionProperty=qT,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=WP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=kT,y.cronJobBuiltInBaseEntityRef=ZT,y.cronJobTriggeredFunctionDeclarationBlueprint=tu,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=FT,y.dataTypeCompatibilityToErrorExplanation=aw,y.dataTypeValidation=kJ,y.datePrototype=Zi,y.dateValueAutogenerationSchema=vp,y.definitionEntityToZodSchema=_I,y.definitionEntityValidation=TS,y.deletePersistedEntityMethod=eu,y.deletePersistedEntityMethodParentRef=OT,y.deleteRootProject=rz,y.endpointBuiltInBaseEntity=ai,y.endpointBuiltInBaseEntityRef=DE,y.endpointBuiltInBaseEntityRefFour=aT,y.endpointBuiltInBaseEntityRefThree=NE,y.endpointBuiltInBaseEntityRefTwo=CE,y.endpointBuiltInCorsProperty=OE,y.endpointBuiltInCorsPropertyDataType=RE,y.endpointBuiltInCorsPropertyDataTypeRef=AE,y.endpointBuiltInCorsPropertyRef=bE,y.endpointBuiltInMethodProperty=Zd,y.endpointBuiltInMethodPropertyDataType=ME,y.endpointBuiltInMethodPropertyDataTypeRef=_E,y.endpointBuiltInMethodPropertyRef=BE,y.endpointBuiltInPathProperty=kd,y.endpointBuiltInPathPropertyDataType=VE,y.endpointBuiltInPathPropertyDataTypeRef=wE,y.endpointBuiltInPathPropertyRef=PE,y.endpointPathParamsArgumentDeclaration=Jd,y.endpointPathParamsArgumentDeclarationRef=ZE,y.endpointPathParamsVariableDataType=qE,y.endpointPathParamsVariableDataTypeRef=kE,y.endpointReachedTriggerActionDescriptor=Kd,y.endpointReachedTriggerActionDescriptorRef=JE,y.endpointReachedTriggerActionDescriptorRefFour=zE,y.endpointReachedTriggerActionDescriptorRefThree=SE,y.endpointReachedTriggerActionDescriptorRefTwo=WE,y.endpointRequestBodyArgumentDeclaration=Sd,y.endpointRequestBodyArgumentDeclarationRef=$E,y.endpointRequestBodyVariableDataType=GE,y.endpointRequestHeadersArgumentDeclaration=qd,y.endpointRequestHeadersArgumentDeclarationRef=jE,y.endpointRequestHeadersVariableDataType=UE,y.endpointRequestHeadersVariableDataTypeRef=LE,y.endpointRequestQueryParamsArgumentDeclaration=Wd,y.endpointRequestQueryParamsArgumentDeclarationRef=FE,y.endpointRequestQueryParamsVariableDataType=xE,y.endpointRequestQueryParamsVariableDataTypeRef=gE,y.endpointResponseBodyDataType=nT,y.endpointResponseBodyReturnDeclaration=Hd,y.endpointResponseBodyReturnDeclarationRef=rT,y.endpointResponseCodeDataType=HE,y.endpointResponseCodeReturnDeclaration=zd,y.endpointResponseCodeReturnDeclarationDefaultValueParentRef=XE,y.endpointResponseCodeReturnDeclarationRef=YE,y.endpointResponseHeadersDataType=tT,y.endpointResponseHeadersDataTypeRef=QE,y.endpointResponseHeadersReturnDeclaration=Yd,y.endpointResponseHeadersReturnDeclarationRef=eT,y.endpointReturnStatementRef=KE,y.endpointReturnStatementRefThree=sT,y.endpointReturnStatementRefTwo=iT,y.enrichFromKnownEntities=Ga,y.enumOptionsProperty=Ef,y.enumOptionsPropertyDataType=mf,y.enumOptionsPropertyDataTypeRef=hf,y.enumOptionsPropertyRef=yf,y.enumPrototype=or,y.enumPrototypeRef=vf,y.executionBuiltInBaseEntity=Io,y.executionBuiltInEntityAbortMethod=iu,y.executionBuiltInEntityAbortMethodParentRef=JT,y.filterOutDuplicateEntities=p,y.filterOutDuplicateErrors=K3,y.findEntityFromKeys=Wc,y.findReferenceToSelfInList=Cw,y.findReferencesToSelfInProject=kW,y.flattenActionDescriptor=_w,y.flattenArgumentDeclaration=Bw,y.flattenBreakStatement=Mw,y.flattenBuiltInBaseEntity=Nw,y.flattenCalls=Ci,y.flattenCanvasAncestorsUntil=_s,y.flattenCondition=Lw,y.flattenContinueStatement=jw,y.flattenDataType=$w,y.flattenDefinitionEntity=Uw,y.flattenDefinitionEntityExtensionAndImplementationTypes=tf,y.flattenDefinitionEntityExtensionTypes=Fa,y.flattenDefinitionEntityExtensions=Qc,y.flattenDefinitionEntityImplementations=ef,y.flattenDefinitionEntityImplementionTypes=ga,y.flattenDerivedCanvasEntities=ci,y.flattenDetachedBranch=fP,y.flattenElementCalls=Te,y.flattenElementCallsOnTheSameScope=xW,y.flattenEntity=j,y.flattenFunctionCall=Gw,y.flattenFunctionDeclaration=gw,y.flattenGlobalEvent=Fw,y.flattenInputMap=xw,y.flattenInstalledProject=kw,y.flattenInternalCall=Zw,y.flattenLiteralValue=qw,y.flattenLoop=Jw,y.flattenOperation=Ww,y.flattenOutputMap=Sw,y.flattenPrimitiveEntity=zw,y.flattenProject=Yw,y.flattenProjectElements=Vw,y.flattenProperty=Hw,y.flattenRelatedCanvasElementsOnTheLeft=lP,y.flattenRelatedCanvasElementsOnTheRight=oP,y.flattenReturnDeclaration=Kw,y.flattenReturnStatement=Xw,y.flattenSearch=Qw,y.flattenValueDescriptor=eP,y.flattenVariableDeclaration=tP,y.flattenVariableInstance=iP,y.flattenVariableReads=Pw,y.flattenVariableWrites=ww,y.flattenVariables=He,y.fromChangeSetToRecordChangeSet=aS,y.fromZodParseToEntityGenerationErrors=jc,y.functionCallValidation=VW,y.functionDeclarationValidation=xJ,y.generate=HC,y.generateActionExample=AW,y.generateExecutionDataType=VJ,y.generateIdFromStrategy=yt,y.generateMutablePropertiesExplanation=xl,y.generateRandomBoolean=rA,y.generateRandomDate=LI,y.generateRandomDateAfter=BI,y.generateRandomDateBefore=MI,y.generateRandomDateBetweenRange=NI,y.generateRandomNumber=XI,y.generateRandomNumberAfter=YI,y.generateRandomNumberBefore=HI,y.generateRandomNumberBetweenRange=KI,y.generateRandomText=iA,y.generateRandomTextAfter=QI,y.generateRandomTextBefore=eA,y.generateRandomTextBetweenRange=tA,y.generateUniqueUUID=zI,y.getAllActionDescriptorsForConditions=zl,y.getAllActionDescriptorsForGlobalEvents=Wl,y.getAllActionDescriptorsForLoops=Sl,y.getAllActionDescriptorsForOperations=OW,y.getAllBuiltInEntityIds=Gi,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=rw,y.getBaseBuiltInEntities=St,y.getBaseSchemaBasedOnType=Y1,y.getBuiltInEntityOwner=ln,y.getCallableEntityReferenceSchema=Ct,y.getCallableEntityTypeSchema=LD,y.getCalledBy=Ai,y.getCallerEntityReferenceSchema=tq,y.getCallerEntityTypeSchema=eq,y.getCalls=Hc,y.getCanvasEntitiesDerivedFromInternalCalls=aP,y.getCanvasEntitiesDerivedFromWrites=Bs,y.getCanvasEntityDerivedFromValueReadingEntity=ed,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=sP,y.getCanvasEntityReferenceSchema=Eq,y.getCanvasEntityTypeSchema=vq,y.getChildrenEntityWithValues=jW,y.getColumnProperties=rS,y.getCommonAncestor=Yc,y.getCommonChildren=yw,y.getDatabaseEntities=tS,y.getDatabaseEntity=nS,y.getDeclaration=Gn,y.getDeclarationOutputedError=lS,y.getDeepestScope=mP,y.getDraggableCallableEntityReferenceSchema=UD,y.getDraggableCallableEntityTypeSchema=jD,y.getDraggableCallerEntityReferenceSchema=rq,y.getDraggableCallerEntityTypeSchema=iq,y.getDraggableExecutableEntityReferenceSchema=oq,y.getDraggableExecutableEntityTypeSchema=aq,y.getDraggablePassThroughCallableEntityReferenceSchema=Cl,y.getDraggablePassThroughCallableEntityTypeSchema=Vl,y.getDraggablePlayableEntityReferenceSchema=cq,y.getDraggablePlayableEntityTypeSchema=pq,y.getEntitiesCreatedSinceInitialization=ld,y.getEntityArgumentDeclarations=Xc,y.getEntityInputMaps=rP,y.getEntityOutputMaps=WW,y.getEntityReferenceSchema=mq,y.getEntityReturnDeclarations=nP,y.getEntityTypeSchema=yq,y.getEntityWithLogicScopeReferenceSchema=Tr,y.getEntityWithLogicScopeTypeSchema=lq,y.getEntityWithValueReferenceSchema=ND,y.getEntityWithValueTypeSchema=QZ,y.getEntryPointEntityReferenceSchema=wt,y.getEntryPointEntityTypeSchema=Gr,y.getEventEntityReferenceSchema=wl,y.getEventEntityTypeSchema=Ol,y.getExecutableEntityReferenceSchema=sq,y.getExecutableEntityTypeSchema=nq,y.getExtendedBuiltInEntity=SW,y.getExtendedDefinitionEntity=uP,y.getFirstNonLoopScopeOwner=It,y.getGenerationTargetSchemaBasedOnType=H1,y.getHeadIfPartOfDetachedBranch=cP,y.getHighestScope=yP,y.getImplementedBuiltInEntity=zW,y.getIsInteractive=xa,y.getLastInListOperation=Dd,y.getLastInListOperationError=wy,y.getLastInListOperationErrorParentRef=Oy,y.getLastInListOperationInputListArgument=by,y.getLastInListOperationInputListArgumentParentRef=Ay,y.getLastInListOperationInputListArgumentRef=vy,y.getLastInListOperationInputListDataType=Ey,y.getLastInListOperationOutputElementDataType=Iy,y.getLastInListOperationOutputElementReturn=Dy,y.getLastInListOperationOutputElementReturnParentRef=Ry,y.getLastInListOperationOutputElementReturnRef=Ty,y.getLinkedEntitiesFromArgumentDeclaration=FW,y.getLowestPersistedEntityImplementation=dP,y.getParentCallableEntity=mw,y.getParentCallerEntity=Ew,y.getParentCanvasEntities=gt,y.getParentCanvasEntity=Rt,y.getParentCanvasEntityFromTransfer=Kl,y.getParentEntryPoint=LW,y.getParentPassthroughCallableEntity=vw,y.getPassThroughCallableEntityReferenceSchema=nt,y.getPassThroughCallableEntityTypeSchema=Pl,y.getPeristedEntities=eS,y.getPlayableEntityReferenceSchema=uq,y.getPlayableEntityTypeSchema=dq,y.getProject=iz,y.getPrototypeByType=ka,y.getRecusriveParentsIds=nd,y.getReferenceEntityId=B,y.getReferencedEntitiesStateOrErrors=Zl,y.getReferencedEntityStateOrErrors=Uc,y.getReferencedIds=Ql,y.getRelatedCanvasElementsOnTheLeft=gn,y.getRelatedCanvasElementsOnTheLeftFromTransfer=ZW,y.getRelatedCanvasElementsOnTheRight=on,y.getRootEntryPointScopeOwner=sf,y.getScopeOwner=zt,y.getStateClassFromType=sS,y.getTerminationReferenceSchema=hq,y.getTerminationTypeSchema=fq,y.getTouchedCanvasEntitiesFromChangeSet=oS,y.getUsedArgFromDeclaration=qW,y.getUsedReturnFromDeclaration=JW,y.getValueReadingEntityReferenceSchema=MD,y.getValueReadingEntityTypeSchema=Er,y.getValueWritingEntityReferenceSchema=XZ,y.getValueWritingEntityTypeSchema=Ra,y.getVariableFromInputMapping=Iw,y.getVariableFromReturnVariablePointer=Rw,y.getVariableReferenceSchema=$r,y.getVariableTypeSchema=Mn,y.getVariablesFromArgumentDeclarations=Xl,y.getVariablesFromInputMaps=Aw,y.getVariablesFromOutputMapping=Dw,y.getVariablesFromOutputMaps=Ow,y.getVariablesFromReturnDeclarations=bw,y.getVariablesInSameOrHigherScope=bc,y.getWrites=Kc,y.globalEventValidation=YJ,y.groupCallsBasedOnParallelizableExecution=$W,y.handleAfterEntityImplementationSideEffects=uw,y.handleBeforeEntityImplementationSideEffects=dw,y.httpRequestBodyArgument=so,y.httpRequestBodyArgumentRef=l0,y.httpRequestBodyDataType=d0,y.httpRequestHeadersArgument=no,y.httpRequestHeadersArgumentRef=a0,y.httpRequestHeadersDataType=o0,y.httpRequestMethodArgument=io,y.httpRequestMethodArgumentRef=n0,y.httpRequestMethodDataType=s0,y.httpRequestMethodDataTypeRef=i0,y.httpRequestOperation=js,y.httpRequestOperationErrorValueDescriptor=Md,y.httpRequestOperationErrorValueDescriptorDatatype=V0,y.httpRequestOperationErrorValueDescriptorRef=P0,y.httpRequestOperationRef=R0,y.httpRequestOperationRefEight=O0,y.httpRequestOperationRefFive=A0,y.httpRequestOperationRefFour=I0,y.httpRequestOperationRefNine=w0,y.httpRequestOperationRefSeven=D0,y.httpRequestOperationRefSix=b0,y.httpRequestOperationRefThree=T0,y.httpRequestOperationRefTwo=E0,y.httpRequestQueryParamsArgument=Bd,y.httpRequestQueryParamsArgumentRef=e0,y.httpRequestQueryParamsDataType=t0,y.httpRequestVariableURLArgument=ro,y.httpRequestVariableURLArgumentRef=Xm,y.httpRequestVariableURLDataType=Qm,y.httpRequestVariableURLDataTypeRef=Hm,y.httpResponseBodyReturnDataType=v0,y.httpResponseBodyReturnDataTypeRef=y0,y.httpResponseBodyReturnReturn=lo,y.httpResponseBodyReturnReturnRef=m0,y.httpResponseCodeDataType=p0,y.httpResponseCodeReturn=ao,y.httpResponseCodeReturnRef=u0,y.httpResponseHeadersDataType=h0,y.httpResponseHeadersDataTypeRef=c0,y.httpResponseHeadersReturn=oo,y.httpResponseHeadersReturnRef=f0,y.httpStatusCodeValueValidation=CP,y.implement=Yl,y.inferArgumentDeclarationDataType=zO,y.inferDataType=$i,y.inferInputMapDataType=Tc,y.inferOutputMapDataType=Ac,y.inferPropertyDataType=KO,y.inferReturnDeclarationDataType=Ic,y.inferValueDescriptorDataType=XO,y.inferVariableDeclarationDataType=HO,y.inferVariableInstanceDataType=YO,y.initBaseProjectEntity=od,y.initProject=MP,y.initProjectFromFetchResult=BP,y.inputMapValidation=sW,y.installedProjectValidation=rW,y.internalCallValidation=nW,y.isPromise=Jc,y.iterateOverListActionDescriptorListArgumentDeclaration=lv,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=av,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=sv,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=ov,y.iterateOverListLoopActionDescriptor=Pr,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=uv,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=dv,y.iterateOverListLoopBodyActionDescriptor=Gs,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=Tv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Ev,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=Av,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=Iv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=fo,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=cv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=pv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=fv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=vv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=yv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=hv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=mv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=wv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=Dv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=Rv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=Ov,y.iterateOverObjectKeysLoopActionDescriptor=Yn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=Vv,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=Pv,y.iterateOverObjectKeysLoopBodyActionDescriptor=$d,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=$v,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Uv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=gv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=Gv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Ud,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=_v,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Cv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Bv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=jv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Nv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Mv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Lv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=qv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=kv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=xv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=Zv,y.iterateOverObjectValuesLoopActionDescriptor=Hn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=Wv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=Jv,y.iterateOverObjectValuesLoopBodyActionDescriptor=gd,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=tE,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=eE,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=rE,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=iE,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Gd,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=zv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Sv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Yv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Qv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Kv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Hv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Xv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=S0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=W0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=J0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=Z0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=k0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=q0,y.iterateOverStringLoopActionDescriptor=$s,y.iterateOverStringLoopBodyActionDescriptor=co,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=tv,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=ev,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=rv,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=iv,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Ld,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=Y0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=z0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=H0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=jd,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=X0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=K0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Q0,y.joinListOperation=Ad,y.joinListOperationError=Hh,y.joinListOperationErrorParentRef=Yh,y.joinListOperationFirstListArgument=qh,y.joinListOperationFirstListArgumentParentRef=Zh,y.joinListOperationFirstListArgumentRef=$h,y.joinListOperationFirstListDataType=Gh,y.joinListOperationResultListDataType=kh,y.joinListOperationResultListReturn=zh,y.joinListOperationResultListReturnParentRef=Sh,y.joinListOperationResultListReturnRef=xh,y.joinListOperationSecondListArgument=Wh,y.joinListOperationSecondListArgumentParentRef=Jh,y.joinListOperationSecondListArgumentRef=gh,y.joinListOperationSecondListDataType=Fh,y.joinListWithLastSeparator=se,y.joinStringsOperation=Ls,y.joinStringsOperationDynamicStringArgument=mh,y.joinStringsOperationDynamicStringArgumentParentRef=yh,y.joinStringsOperationDynamicStringArgumentRef=fh,y.joinStringsOperationDynamicStringDataType=hh,y.joinStringsOperationError=ch,y.joinStringsOperationErrorParentRef=ph,y.joinStringsOperationFirstStringArgument=Qa,y.joinStringsOperationFirstStringArgumentParentRef=ih,y.joinStringsOperationFirstStringArgumentRef=Hf,y.joinStringsOperationFirstStringDataType=Kf,y.joinStringsOperationResultStringDataType=th,y.joinStringsOperationResultStringReturn=Ns,y.joinStringsOperationResultStringReturnParentRef=uh,y.joinStringsOperationResultStringReturnRef=eh,y.joinStringsOperationSecondStringArgument=eo,y.joinStringsOperationSecondStringArgumentParentRef=dh,y.joinStringsOperationSecondStringArgumentRef=Xf,y.joinStringsOperationSecondStringDataType=Qf,y.joinStringsOperationSeparatorStringArgument=lh,y.joinStringsOperationSeparatorStringArgumentParentRef=oh,y.joinStringsOperationSeparatorStringArgumentRef=rh,y.joinStringsOperationSeparatorStringDataType=ah,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=sh,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=nh,y.keyValuePrototype=Wn,y.literalValudValidation=cW,y.loopValidation=KJ,y.lowercaseFirstLetter=Na,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=Nd,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=j0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=L0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=U0,y.manualFlowLoopActionDescriptor=uo,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=N0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=M0,y.manualFlowLoopBodyActionDescriptor=po,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=G0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=$0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=F0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=g0,y.mapActionDescriptorToTypeItRepresents=XW,y.mergeEntityErrorsList=X3,y.mergeListOfEntities=HW,y.methodDefaultValue=r0,y.mockClientProject=cp,y.moreThanOrEqualCondition=ts,y.moreThanOrEqualConditionLeftHandArgument=QT,y.moreThanOrEqualConditionLeftHandArgumentDataType=KT,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=HT,y.moreThanOrEqualConditionLeftHandArgumentParentRef=XT,y.moreThanOrEqualConditionRightHandArgument=rI,y.moreThanOrEqualConditionRightHandArgumentDataType=tI,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=eI,y.moreThanOrEqualConditionRightHandArgumentParentRef=iI,y.noSpacesOrDashesValueValidation=hw,y.noSpacesValueValidation=fw,y.notEmptyCondition=En,y.notEmptyConditionArgument=zT,y.notEmptyConditionRef=ST,y.nullPrototype=fd,y.numberAdditionOperation=Xa,y.numberAdditionOperationDynamicSummandArgument=Mf,y.numberAdditionOperationDynamicSummandArgumentType=Bf,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=_f,y.numberAdditionOperationError=Cf,y.numberAdditionOperationErrorParentRef=Vf,y.numberAdditionOperationFirstNumberArgument=hd,y.numberAdditionOperationFirstNumberArgumentRef=If,y.numberAdditionOperationFirstNumberDataType=Af,y.numberAdditionOperationRef=wf,y.numberAdditionOperationRefThree=md,y.numberAdditionOperationRefTwo=Pf,y.numberAdditionOperationResultNumberDataType=Of,y.numberAdditionOperationResultNumberReturn=vd,y.numberAdditionOperationResultNumberReturnRef=Df,y.numberAdditionOperationSecondNumberArgument=yd,y.numberAdditionOperationSecondNumberArgumentRef=bf,y.numberAdditionOperationSecondNumberDataType=Rf,y.numberPrototype=Ee,y.numberSubtractionOperation=Td,y.numberSubtractionOperationDynamicSubtrahendArgument=zf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=Sf,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Wf,y.numberSubtractionOperationError=Jf,y.numberSubtractionOperationErrorParentRef=qf,y.numberSubtractionOperationFirstNumberArgument=gf,y.numberSubtractionOperationFirstNumberArgumentRef=Nf,y.numberSubtractionOperationFirstNumberDataType=Lf,y.numberSubtractionOperationRef=Ed,y.numberSubtractionOperationRefThree=kf,y.numberSubtractionOperationRefTwo=Ff,y.numberSubtractionOperationResultNumberDataType=Gf,y.numberSubtractionOperationResultNumberReturn=Zf,y.numberSubtractionOperationResultNumberReturnRef=$f,y.numberSubtractionOperationSecondNumberArgument=xf,y.numberSubtractionOperationSecondNumberArgumentRef=jf,y.numberSubtractionOperationSecondNumberDataType=Uf,y.numberValueAutogenerationSchema=mp,y.operationValidation=JJ,y.outputMapValidation=lW,y.parallelExecutionOperation=Bi,y.parallelExecutionOperationError=tm,y.parallelExecutionOperationErrorParentRef=em,y.parallelExecutionOperationListOfExecutionResultsDataType=Ky,y.parallelExecutionOperationListOfExecutionResultsReturn=Vd,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Hy,y.parallelExecutionOperationListOfFunctionsArgument=Pd,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=Yy,y.parallelExecutionOperationListOfFunctionsArgumentRef=zy,y.parallelExecutionOperationListOfFunctionsBlueprint=Sy,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=Jy,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=qy,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=Zy,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=ky,y.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Wy,y.parallelExecutionOperationRef=Xy,y.parallelExecutionOperationRefThree=Qy,y.persistedBuiltInBaseEntity=Nt,y.persistedBuiltInBaseEntityDatabaseProperty=Xn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=VT,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=ZP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=CT,y.persistedBuiltInBaseEntityDatabasePropertyRef=PT,y.persistedBuiltInBaseEntityPrimaryKeyProperty=Qn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=$T,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=BT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=_T,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=GT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=UT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=NT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=MT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=jT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=LT,y.processOutputGlobalValueDescriptorDataType=uI,y.processOutputGlobalValueDescriptorReturn=bo,y.processOutputGlobalValueDescriptorReturnRef=dI,y.projectPublicationCompletedGlobalEvent=Ao,y.propertyToZodSchema=CI,y.propertyValidation=jJ,y.relationalDatabaseBuiltInBaseEntity=Ot,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Qd,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=RT,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=bT,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=DT,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=AT,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=Xd,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=IT,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=ET,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=TT,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=yo,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=dT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=oT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=lT,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=Eo,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=vT,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=yT,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=mT,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=vo,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=fT,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=kP,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDefaultValueParentRef=hT,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=cT,y.relationalDatabaseBuiltInBaseEntityRef=Kn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=mo,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=pT,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=xP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=uT,y.resolveActionDescriptorName=n1,y.resolveBaseEntityName=e1,y.resolveBuiltInBaseEntityDataTypeLabel=t1,y.resolveClonedEntityProject=mt,y.resolveConditionOperatorLabel=Fl,y.resolveDataType=$l,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Sc,y.resolveDataTypeLabel=gl,y.resolveDefinitionEntityDataTypeLabel=NJ,y.resolveEntityDataTypeLabel=MJ,y.resolveEntityName=F,y.resolveFirstCallsSecond=GW,y.resolveFirstWritesSecond=gW,y.resolvePrimaryKeyProperty=iS,y.resolvePrimitiveEntityName=r1,y.resolveSearchName=i1,y.resolveVariableScope=CJ,y.returnDeclarationValidation=WJ,y.returnStatementValidation=SJ,y.searchStatementErrorGlobalValueDescriptor=su,y.searchStatementErrorGlobalValueDescriptorDataType=cI,y.searchStatementErrorGlobalValueDescriptorRef=pI,y.searchValidation=iW,y.sequentialExecutionOperation=ur,y.sequentialExecutionOperationError=Am,y.sequentialExecutionOperationErrorParentRef=Im,y.sequentialExecutionOperationListOfExecutionResultsDataType=vm,y.sequentialExecutionOperationListOfExecutionResultsReturn=_d,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=Tm,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=mm,y.sequentialExecutionOperationListOfFunctionsArgument=Cd,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=ym,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=Em,y.sequentialExecutionOperationListOfFunctionsArgumentRef=hm,y.sequentialExecutionOperationListOfFunctionsBlueprint=fm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=cm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=pm,y.softDeletePersistedEntityMethod=qP,y.softDeletePersistedEntityMethodParentRef=gT,y.sortCallsBasedOnExecutionDependencies=Tw,y.sortChildrenEntitiesBasedOnExecutionDependencies=UW,y.splitListOperation=Rd,y.splitListOperationError=hy,y.splitListOperationErrorParentRef=fy,y.splitListOperationFirstOutputListDataType=ry,y.splitListOperationFirstOutputListReturn=dy,y.splitListOperationFirstOutputListReturnParentRef=ly,y.splitListOperationFirstOutputListReturnRef=bd,y.splitListOperationInputListArgument=sy,y.splitListOperationInputListArgumentParentRef=ny,y.splitListOperationInputListArgumentRef=Qh,y.splitListOperationInputListDataType=ey,y.splitListOperationSecondOutputListDataType=uy,y.splitListOperationSecondOutputListReturn=cy,y.splitListOperationSecondOutputListReturnParentRef=py,y.splitListOperationSplitIndexArgument=oy,y.splitListOperationSplitIndexArgumentParentRef=ay,y.splitListOperationSplitIndexArgumentRef=ty,y.splitListOperationSplitIndexDataType=iy,y.splitStringOperation=Id,y.splitStringOperationError=Nh,y.splitStringOperationErrorParentRef=Mh,y.splitStringOperationFirstPartResultStringDataType=bh,y.splitStringOperationFirstPartResultStringReturn=Bh,y.splitStringOperationFirstPartResultStringReturnParentRef=_h,y.splitStringOperationFirstPartResultStringReturnRef=Ah,y.splitStringOperationIndexArgument=Vh,y.splitStringOperationIndexArgumentParentRef=Ph,y.splitStringOperationIndexArgumentRef=Th,y.splitStringOperationIndexDataType=Ih,y.splitStringOperationSecondPartResultStringDataType=Dh,y.splitStringOperationSecondPartResultStringReturn=gP,y.splitStringOperationSecondPartResultStringReturnParentRef=Ch,y.splitStringOperationSecondPartResultStringReturnRef=Rh,y.splitStringOperationStringArgument=wh,y.splitStringOperationStringArgumentParentRef=Oh,y.splitStringOperationStringArgumentRef=vh,y.splitStringOperationStringDataType=Eh,y.stringPrototype=ae,y.stringValueAutogenerationSchema=yp,y.suggestNewIdForEntity=Cc,y.test_primitive_entities_export=WS,y.toCamelCase=_J,y.toEntityState=bi,y.toKebabCase=QO,y.toLowerCaseKebabCase=Gl,y.toPascalCase=BJ,y.untypedDataPrototype=Vt,y.updateErrorsList=Ke,y.urlDefaultValue=Km,y.uuidPrototype=lr,y.validateArgumentDeclarationName=Pc,y.validateCalledByErrorIdInAction=RW,y.validateCalledByIdInAction=bW,y.validateCallers=iw,y.validateConditionEntityDeclaration=wW,y.validateDataOperation=fn,y.validateDataOperationDataToValidateArgument=Fm,y.validateDataOperationDataToValidateArgumentParentRef=gm,y.validateDataOperationDataToValidateArgumentRef=$m,y.validateDataOperationDataToValidateDataType=Gm,y.validateDataOperationEntityToMatchTypeArgument=qm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=Zm,y.validateDataOperationEntityToMatchTypeArgumentRef=xm,y.validateDataOperationEntityToMatchTypeDataType=km,y.validateDataOperationError=zm,y.validateDataOperationErrorParentRef=Sm,y.validateDataOperationOutputEntityDeclaration=Wm,y.validateDataOperationOutputEntityDeclarationParentRef=Jm,y.validateDefinitionEntityName=Rc,y.validateEntryCaller=tw,y.validateErrorCaller=ew,y.validateFunctionCallDeclaration=nw,y.validateFunctionDeclarationName=Dc,y.validateGeneratedEntityParentIsNotBuiltInEntity=EW,y.validateGeneration=mW,y.validateGenerationTarget=ut,y.validateGenerationUpdate=vW,y.validateLoopEntityDeclaration=PW,y.validateName=LJ,y.validateOperationEntityDeclaration=sw,y.validatePropertyName=wc,y.validateReachability=Rr,y.validateReadsValueInActionPayload=DW,y.validateReferenceObject=kl,y.validateReferenceToOne=$c,y.validateReferences=bt,y.validateReturnDeclarationName=Vc,y.validateSuccessCaller=Q1,y.validateValueReaderGenerationUpdate=ja,y.validateValueWritter=Zc,y.validateVariableDeclarationName=Oc,y.validateVariableInternalCallUse=qc,y.valueAutogenerationCurrentDateAndTimeSchema=pD,y.valueAutogenerationGenericSchema=ul,y.valueAutogenerationOptions=Ep,y.valueAutogenerationOptionsSchema=uD,y.valueAutogenerationRandomBooleanSchema=hp,y.valueAutogenerationRandomDateBetweenSchema=ID,y.valueAutogenerationRandomDateFromSchema=ED,y.valueAutogenerationRandomDateSchema=fl,y.valueAutogenerationRandomDateUntilSchema=TD,y.valueAutogenerationRandomNumberBetweenSchema=hD,y.valueAutogenerationRandomNumberFromSchema=cD,y.valueAutogenerationRandomNumberSchema=pl,y.valueAutogenerationRandomNumberUntilSchema=fD,y.valueAutogenerationRandomSchema=ma,y.valueAutogenerationRandomTextBetweenSchema=vD,y.valueAutogenerationRandomTextFromSchema=yD,y.valueAutogenerationRandomTextSchema=cl,y.valueAutogenerationRandomTextUntilSchema=mD,y.valueAutogenerationRangeValueTypesSchema=ya,y.valueAutogenerationUniqueSchema=fp,y.valueDescriptorValidation=yW,y.variableDeclarationValidation=eW,y.variableInstanceValidation=tW,y.waitOperation=Ht,y.waitOperationMillisecondsNumberArgument=pn,y.waitOperationMillisecondsNumberArgumentRef=nm,y.waitOperationMillisecondsNumberDataType=sm,y.waitOperationOperationError=lm,y.waitOperationOperationErrorParentRef=om,y.waitOperationRef=am,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
409
|
+
Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:s,modifiedData:i}}get interactive(){return this.implements.length?this.implements.every(e=>e.interactive):!0}get allBasePropertiesFromExtendedAndImplementedEntities(){return p([...this.extends.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract),...e],[])])}get allBaseMethodsFromExtendedAndImplementedEntities(){return p([...this.extends.reduce((e,t)=>t.type!==n.DefinitionEntity?[]:[...[...t.ownDeclaredMethods,...t.allBaseMethodsFromExtendedAndImplementedEntities].filter(s=>s.type!==n.ActionDescriptor),...e],[]),...this.implements.reduce((e,t)=>t.type!==n.DefinitionEntity?t.abstractMethods:[...[...t.ownDeclaredMethods,...t.allBaseMethodsFromExtendedAndImplementedEntities].filter(s=>s.type!==n.ActionDescriptor),...e],[])])}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[]),...this.implements.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[])].filter(e=>!!e.abstract))}get extendedMethodsFromOriginalParents(){return p(this.extends.reduce((e,t)=>{if(t.type!==n.DefinitionEntity)return[];const i=[...t.ownDeclaredMethods,...t.extendedMethodsFromOriginalParents].filter(s=>s.type!==n.ActionDescriptor);return[...e,...i]},[]))}get implementedMethodsFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.type===n.DefinitionEntity?t.methods:[],s=[...t.abstractMethods].filter(l=>!i.find(o=>o.name===l.name));return[...i,...s,...e]},[]),...this.implements.reduce((e,t)=>[...t.abstractMethods,...e],[])].filter(e=>e.type===n.ActionDescriptor))}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}get extendedMethods(){return this.methods.filter(e=>e.isExtendedMethod)}get ownDeclaredMethods(){return this.methods.filter(e=>!e.isExtendedMethod)}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new P({id:`${this.id}--${R.InvalidParentUpdate}`,code:R.InvalidParentUpdate,severity:w.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors:t,modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}unsubscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]&&delete this.detachedDependents[t.entity.id]}),this}syncDependents(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-dependents"))){const t=[],i=[],s=[],l=[];return Object.values(this.detachedDependents).forEach(o=>{const d=o.entity.afterAllChildrenInitialized(e);t.push(...d.updated),i.push(...d.added),s.push(...d.removed),l.push(...d.affected)}),e==null||e.attemptAutoclose("sync-dependents",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];return t==="implements"&&this.removeImplementation(e),t==="extends"&&this.removeExtension(e),{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];return t==="implements"&&this.addImplementation(e),t==="extends"&&this.addExtension(e),{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}unsubscribeFromDependencies(){return this.implements.forEach(e=>{si.includes(e.type)||e.unsubscribeDependents([{entity:this,field:"implements"}])}),this}subscribeToDependencies(){return this.implements.forEach(e=>{si.includes(e.type)||e.subscribeDependents([{entity:this,field:"implements"}])}),this.extends.forEach(e=>{si.includes(e.type)||e.subscribeDependents([{entity:this,field:"extends"}])}),this}increaseVersion(e){if(e&&!E(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&E(e).isSame(E(this.createdAt))?this:(this.previousVersion=this.version,this.version=m.UUID.uuid(),this.createdAt=E(e).toISOString()||E().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new $e(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[this.version,e]]),e.properties=[...this.properties],e.methods=[...this.methods],e.abstractMethods=[...this.abstractMethods],e.extends=[...this.extends],e.implements=[...this.implements],e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],i=[],s=[],l=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[f,c]of this.knownVersions||new Map){if(u.set(f,c),c.activeVersion=!1,c.knownVersions)for(const[T,I]of c.knownVersions)u.set(T,I);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new $e(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.previousVersion=o.previousVersion,this.version=o.version,this.createdAt=o.createdAt,this.author=o.author,this.deleted=o.deleted,this.properties=o.properties,this.methods=o.methods,this.abstractMethods=o.abstractMethods,this.extends=o.extends,this.implements=o.implements,this.parent=o.parent,{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent){const l=B(this.initialData.parent),o=this.project.get(l);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return this.initialData.extends.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addExtension(d),d.type!==n.BuiltInBaseEntity&&e.push(d))}),this.initialData.implements.forEach(l=>{const o=B(l),d=this.project.get(o);d&&(this.addImplementation(d),d.type!==n.BuiltInBaseEntity&&e.push(d))}),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],l=[];this.initialized=!0;const{updated:o,added:d,removed:u,affected:f}=this.syncImplementationProperties(e);t.push(...o),i.push(...d),s.push(...u),l.push(...f);const{updated:c,added:T,removed:I,affected:D}=this.addExtendedProperties(e);t.push(...c),i.push(...T),s.push(...I),l.push(...D);const{updated:O,added:V,removed:M}=this.removeUnrecognizedProperties(e);t.push(...O),i.push(...V),s.push(...M);const{updated:G,added:_,removed:g,affected:q}=this.syncImplementationMethods(e);t.push(...G),i.push(..._),s.push(...g),l.push(...q);const{updated:S,added:K,removed:de,affected:me}=this.addExtendedMethods(e);t.push(...S),i.push(...K),s.push(...de),l.push(...me);const{updated:z,added:oe,removed:Ft}=this.removeUnrecognizedMethods(e);return t.push(...z),i.push(...oe),s.push(...Ft),this.addSuggestions(),this.captureVersion(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-self-to-project"))){const t=[this],i=[],s=[],l=[];if(this.parent.type===n.DataType){const o=this.parent;o.entity=this,t.push(o)}else this.project.addDefinitionEntity(this);return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}setParent(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,A.Updated))),t==null||t.attemptAutoclose("set-parent",this.id),this}addExtension(e){return this.extends.includes(e)||this.extends.push(e),this}removeExtension(e){return this.extends=this.extends.filter(t=>t.id!==e.id),this}addImplementation(e){return this.implements.includes(e)||this.implements.push(e),this}removeImplementation(e){return this.implements=this.implements.filter(t=>t.id!==e.id),this}removeProperty(e){return this.properties=this.properties.filter(t=>t.id!==e.id),this}addMethod(e){return this.methods.includes(e)||(this.methods.push(e),this.suggestedMethods=this.suggestedMethods.filter(t=>t.name!==e.name)),this}removeMethod(e){return this.methods=this.methods.filter(t=>t.id!==e.id),this}addProperty(e){return this.properties.includes(e)||(this.properties.push(e),this.suggestedProperties=this.suggestedProperties.filter(t=>t.name!==e.name)),this}addSuggestedProperty(e){return this.suggestedProperties.includes(e)||this.suggestedProperties.push(e),this}addSuggestedMethod(e){return this.suggestedMethods.includes(e)||this.suggestedMethods.push(e),this}removeSuggestedProperty(e){return this.suggestedProperties=this.suggestedProperties.filter(t=>t.id!==e.id),this}removeSuggestedMethod(e){return this.suggestedMethods=this.suggestedMethods.filter(t=>t.id!==e.id),this}addAbstractMethod(e){return this.abstractMethods.includes(e)||this.abstractMethods.push(e),this}removeAbstractMethod(e){return this.abstractMethods=this.abstractMethods.filter(t=>t.id!==e.id),this}initChildren(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.properties=this.initialData.properties.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.methods=this.initialData.methods.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(e),i}),this.extends=this.initialData.extends.map(t=>C(t,this.project)),this.implements=this.initialData.implements.map(t=>C(t,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}removeUnrecognizedProperties(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-unrecognized-properties"))){const t=[],i=[],s=[],l=[];let o=[...this.properties];o=o.filter(u=>u.parent.id===this.id),o=o.filter(u=>!u.isExtendedProperty);const d=this.implementedPropertiesFromOriginalParents;return o=o.filter(u=>this.interactive&&!u.implements?!1:!d.find(f=>{var c;return f.id===((c=u.implements)==null?void 0:c.id)})),o.forEach(u=>{const f=u.remove({ignoreUpstream:!1},e);s.push(...f.removed),t.push(...f.updated)}),e==null||e.attemptAutoclose("remove-unrecognized-properties",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}removeUnrecognizedMethods(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-unrecognized-methods"))){const t=[],i=[],s=[],l=[];let o=[...this.methods];o=o.filter(u=>u.parent.id===this.id),o=o.filter(u=>!u.isExtendedMethod);const d=this.implementedMethodsFromOriginalParents;return o=o.filter(u=>this.interactive&&!u.implements?!1:!d.find(f=>{var c;return f.id===((c=u.implements)==null?void 0:c.id)})),o.forEach(u=>{const f=u.remove({ignoreUpstream:!1},e);s.push(...f.removed),t.push(...f.updated)}),e==null||e.attemptAutoclose("remove-unrecognized-methods",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}syncImplementationMethods(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-implementation-methods"))){const t=[],i=[],s=[],l=[],o=this.methods,d=this.implementedMethodsFromOriginalParents,u=[...this.allBaseMethodsFromExtendedAndImplementedEntities,...o];return d.filter(c=>!u.find(I=>{var D;return((D=I.implements)==null?void 0:D.id)===c.id})).forEach(c=>{if(this.methods.find(O=>{var V;return((V=O.implements)==null?void 0:V.id)===c.id}))return;const I=this.methods.find(O=>{var g,q;if(O.name===c.name&&!O.implements)return!0;const V=gi(this,J.CRON_JOB),M=gi(this,J.HTTP_ENDPOINT),G=((g=O.implements)==null?void 0:g.id)===k["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id,_=((q=O.implements)==null?void 0:q.id)===k["built-in-base-entity"].BUILT_IN_CRON_JOB_ENTITY.methods.handler.id;return!!(V&&!_&&!M&&G||M&&!G&&!V&&_)});if(I&&I.type===n.FunctionDeclaration){I.setImplements(c),I.metaSync({name:c.name},e),e==null||e.add(I,A.Updated),e==null||e.add(this,A.Updated);return}const D=c.implementAsFunctionDeclaration(e,this);i.push(D),e==null||e.add(D,A.Added),this.addMethod(D)}),e==null||e.attemptAutoclose("sync-implementation-methods",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}syncImplementationProperties(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-implementation-properties"))){const t=[],i=[],s=[],l=[],o=this.properties,d=this.implementedPropertiesFromOriginalParents,u=[...this.allBasePropertiesFromExtendedAndImplementedEntities,...o];return d.filter(c=>!u.find(I=>{var D;return((D=I.implements)==null?void 0:D.id)===c.id})).forEach(c=>{if(this.properties.find(O=>{var V;return((V=O.implements)==null?void 0:V.id)===c.id}))return;const I=this.properties.find(O=>O.name===c.name&&!!O.abstract&&!O.implements);if(I){I.implements=c,I.abstract=!1;return}const D=c.clone(e,this,m.UUID.uuid());D.initChildren(e),i.push(D),e==null||e.add(D,A.Added),D.setImplements(c,e),D.metaSync({abstract:!1},e),this.addProperty(D)}),e==null||e.attemptAutoclose("sync-implementation-properties",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addExtendedMethods(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-extended-methods"))){const t=[],i=[],s=[],l=[],o=this.methods,u=this.extendedMethodsFromOriginalParents.filter(c=>c.type===n.FunctionDeclaration),f=new Set(o.filter(c=>{var T;return!!((T=c.extends)!=null&&T.id)}).map(c=>c.extends.id));return u.forEach(c=>{if(f.has(c.id))return;f.add(c.id);const T=c.clone(e,this,m.UUID.uuid());T.setExtends(c,e),T.initChildren(e),i.push(T),e==null||e.add(T,A.Added),this.addMethod(T)}),e==null||e.attemptAutoclose("add-extended-methods",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addExtendedProperties(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"add-extended-properties"))){const t=[],i=[],s=[],l=[],o=this.properties,d=this.extendedPropertiesFromOriginalParents,u=d.filter(c=>d.find(I=>{var D;return((D=I.implements)==null?void 0:D.id)===c.id})?!1:!c.abstract),f=new Set(o.filter(c=>{var T;return!!((T=c.extends)!=null&&T.id)}).map(c=>c.extends.id));return u.forEach(c=>{if(f.has(c.id))return;f.add(c.id);const T=c.clone(e,this,m.UUID.uuid());T.setExtends(c,e),T.initChildren(e),i.push(T),e==null||e.add(T,A.Added),this.addProperty(T)}),e==null||e.attemptAutoclose("add-extended-properties",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSuggestions(){return this.implements.forEach(e=>{EP(this,e).forEach(s=>{const l=s.toJSON();l.id=`_suggestion--parent--${this.id}--${s.id}`;const o=C(l,this.project);o.suggestion=!0,o.setParent(this,null),o.initChildren(null),this.addSuggestedProperty(o)}),TP(this,e).forEach(s=>{const l=`_suggestion--parent--${this.id}--${s.id}`,o=s.implementAsFunctionDeclaration(null,this,l),d=C(o,this.project);if(d.suggestion=!0,d.setParent(this,null),d.initChildren(null),this.methods=this.methods.filter(u=>u.id!==l),d.inputs.forEach(u=>{u.suggestion=!0}),d.returnStatements.length){const u=d.returnStatements[0];u.suggestion=!0,u.outputs.forEach(f=>{f.suggestion=!0})}this.addSuggestedMethod(d)})}),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"meta-sync"))){const i=pt(this,e),s=this.toMeta();return this.name=e.name!==void 0?e.name:s.name,this.description=e.description!==void 0?e.description:s.description,this.x=e.x||s.x,this.y=e.y||s.y,this.static=e.static!==void 0?e.static:this.static,this.abstract=e.abstract!==void 0?e.abstract:this.abstract,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await $e.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await $e.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await $e.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await $e.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await $e.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await $e.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"remove-entity"))){const i=[],s=[],l=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(s.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(d=>{const{updated:u,removed:f,added:c}=d.entity.onDetachedDependencyRemoved(this,d.field,t);i.push(...u),s.push(...f),l.push(...c)}),this.properties.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),this.methods.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),this.abstractMethods.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),this.suggestedProperties.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),this.suggestedMethods.forEach(d=>{const{updated:u,removed:f}=d.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...f)}),!e){if(this.parent.type===n.Project)this.parent.removeDefinitionEntity(this);else if(this.parent.type===n.DataType){const d=this.parent.setEntity(null);i.push(d)}}return t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(l),updated:p(i),removed:p(s),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],l=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),Object.values(this.detachedDependents).forEach(o=>{const{updated:d,removed:u,added:f}=o.entity.onDetachedDependencyRestored(this,o.field,e);i.push(...d),s.push(...u),t.push(...f)}),this.properties.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.methods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.abstractMethods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.suggestedProperties.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),this.suggestedMethods.forEach(o=>{const{updated:d}=o.restore({},e);i.push(...d)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(l),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(i=>i.toFlat(e)),...this.implements.flatMap(i=>i.toFlat(e)),...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.parent.toFlat(e)])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(i=>i.toFlatIds(e)),...this.implements.flatMap(i=>i.toFlatIds(e)),...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.parent.toFlatIds(e)])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,static:this.static,abstract:this.abstract,x:this.x,y:this.y,type:this.type,name:this.name}}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),implements:this.implements.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e)),parent:this.parent.toReference()})}toJSONClone(e=W){var i,s,l,o,d;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||yt(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(l=e.seenEntities)!=null&&l.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(d=e.seenEntities)==null||d.add(this.id),{id:t,version:m.UUID.uuid(),createdAt:e.timestamp||E().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(u=>u.toJSONClone({...e,newId:null})),methods:this.methods.map(u=>u.toJSONClone({...e,newId:null})),abstractMethods:this.abstractMethods.map(u=>u.toJSONClone({...e,newId:null})),implements:this.implements.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),extends:this.extends.map(u=>u.type===n.BuiltInBaseEntity?u.toJSON():u.toJSONClone({...e,newId:null})),parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,name:this.name,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(s=>s.toReference(e)),methods:this.methods.map(s=>s.toReference(e)),abstractMethods:this.abstractMethods.map(s=>s.toReference(e)),implements:this.implements.map(s=>s.toReference(e)),extends:this.extends.map(s=>s.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e)),...this.implements.flatMap(i=>i.toFlatJSON(e)),...this.extends.flatMap(i=>i.toFlatJSON(e)),...this.parent.toFlatJSON(e)])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,static:this.static,abstract:this.abstract,extends:this.extends.map(t=>t.id),implements:this.implements.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.DefinitionEntity).flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.DefinitionEntity).flatMap(i=>i.toFlatGenerationTarget(e)),...this.parent.toFlatGenerationTarget(e)])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){return this.errors=vP(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){var O,V,M;let l=mt(t,this);const o=this.toJSON(),d=i||m.UUID.uuid();o.properties=[],o.methods=[],o.abstractMethods=[];const u=d.split("-id"),f=u[u.length-1||0]||d;o.id=d,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||E().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const c=st(o,l);t&&c.setParent(t,null),s&&c.subscribe(),c.initChildren(e),e==null||e.add(c,A.Added);const T=(O=this.properties)==null?void 0:O.map(G=>G.clone(e,c,m.UUID.uuid(),s));c.properties=T;const I=(V=this.methods)==null?void 0:V.map((G,_)=>G.clone(e,c,f+"-method-"+_+"-id",s));c.methods=I;const D=(M=this.abstractMethods)==null?void 0:M.map((G,_)=>G.clone(e,c,f+"-abstract-method-"+_+"-id",s));return c.abstractMethods=D,e==null||e.attemptAutoclose("clone-entity",this.id),c}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"implement-definition-entity")),i){const s=Yl(this,e,t,i);return t==null||t.attemptAutoclose("implement-definition-entity",this.id),s}getAllInteractiveMethods(){const e=this.implements.filter(i=>i.type===n.DefinitionEntity||i.type===n.BuiltInBaseEntity&&i.interactive);return p([...this.methods,...this.extends.flatMap(i=>i.getAllInteractiveMethods()),...e.flatMap(i=>i.getAllInteractiveMethods())])}inferFromInputs(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"infer-definition-entity-from-inputs"))){const i=[],s=[],l=[],o=[];if(this.parent.type!==n.DataType||!this.parent.inferred)return t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};const d=[];e.forEach(c=>{d.find(I=>F(I,this.project)===F(c,this.project))||d.push(c)});const u=this.properties.filter(c=>!c.dataType);d.forEach(c=>{var M,G;const T=u.find(_=>F(_,this.project)===F(c,this.project));if(!T)return;const D=Gn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),O=$i(D,t),V=O==null?void 0:O.clone(t,T,m.UUID.uuid(),!0);if(V){const _=(M=T.dataType)==null?void 0:M.merge(V,t);T.dataType&&(_==null?void 0:_.self.id)!==T.dataType.id&&T.dataType.remove({ignoreUpstream:!1},t),V.id!==((G=_==null?void 0:_.self)==null?void 0:G.id)&&V.remove({ignoreUpstream:!1},t),_!=null&&_.self&&(_.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(_.self,A.Added),T.setDataType(_.self),t==null||t.add(T,A.Updated))}c.setDeclaration(T),t==null||t.add(c,A.Updated)});const f=[];return d.forEach(c=>{if(!c.declaration){f.push(c);return}}),f.length===0?(t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(f.forEach(c=>{var _,g,q,S;const T=this.properties.find(K=>F(K,this.project)===F(c,this.project));if(T){if(c.setDeclaration(T),!T.getDataType(t)){const de=Gn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),me=$i(de),z=me==null?void 0:me.clone(t,T,m.UUID.uuid(),!0);if(z){const oe=(_=T.dataType)==null?void 0:_.merge(z,t);T.dataType&&(oe==null?void 0:oe.self.id)!==T.dataType.id&&T.dataType.remove({ignoreUpstream:!1},t),z.id!==((g=oe==null?void 0:oe.self)==null?void 0:g.id)&&z.remove({ignoreUpstream:!1},t),oe!=null&&oe.self&&(oe.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(oe.self,A.Added),T.setDataType(oe.self),t==null||t.add(T,A.Updated))}}return}const I={id:m.UUID.uuid(),type:n.Property,version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||E().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:F(c,this.project),description:c.description,defaultValue:null,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,constant:!0,index:c.index,implements:null,extends:null,dataType:null,parent:this.toReference()},D=C(I,this.project);D.setParent(this,t),D.initChildren(t),t==null||t.add(D,A.Added);const V=Gn(c.parent).getMasterInputWithValueWritterFromAllInstances(c),M=$i(V),G=M==null?void 0:M.clone(t,D,m.UUID.uuid(),!0);if(G){const K=(q=D.dataType)==null?void 0:q.merge(G,t);D.dataType&&(K==null?void 0:K.self.id)!==D.dataType.id&&D.dataType.remove({ignoreUpstream:!1},t),G.id!==((S=K==null?void 0:K.self)==null?void 0:S.id)&&G.remove({ignoreUpstream:!1},t),K!=null&&K.self&&(K.self.metaSync({inferred:!0,like:!0},t),t==null||t.add(K.self,A.Added),D.setDataType(K.self),t==null||t.add(D,A.Updated))}return this.addProperty(D),c.setDeclaration(D),t==null||t.add(c,A.Updated),D}),t==null||t.attemptAutoclose("infer-definition-entity-from-inputs",this.id),{added:p(i),updated:p(s),removed:p(l),affected:p(o),self:this})}};h($e,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...i)=>null}),h($e,"type",n.DefinitionEntity),h($e,"USER_MANAGED_PARENT_TYPES",[n.Project,n.DataType]),h($e,"PARENT_TYPES",[...$e.USER_MANAGED_PARENT_TYPES]),h($e,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),h($e,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),h($e,"BASE_PROPERTIES",[...$e.MUTABLE_BASE_PROPERTIES,...$e.INMUTABLE_BASE_PROPERTIES]),h($e,"MUTABLE_META_PROPERTIES",[...$e.MUTABLE_BASE_PROPERTIES,"x","y"]),h($e,"INMUTABLE_META_PROPERTIES",[...$e.INMUTABLE_BASE_PROPERTIES]),h($e,"META_PROPERTIES",[...$e.MUTABLE_META_PROPERTIES,...$e.INMUTABLE_META_PROPERTIES]),h($e,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),h($e,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),h($e,"UPSTREAM_PROPERTIES",[...$e.MUTABLE_UPSTREAM_PROPERTIES,...$e.INMUTABLE_UPSTREAM_PROPERTIES]),h($e,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),h($e,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),h($e,"DOWNSTREAM_PROPERTIES",[...$e.MUTABLE_DOWNSTREAM_PROPERTIES,...$e.INMUTABLE_DOWNSTREAM_PROPERTIES]),h($e,"PROPERTIES",[...$e.META_PROPERTIES,...$e.UPSTREAM_PROPERTIES,...$e.DOWNSTREAM_PROPERTIES]);let dn=$e;function AS(r){const a=y5(),e=r.toJSON();a.safeParse(e).success;const i=[];return Ke(r.errors,i)}const Sa=class Sa extends lt{constructor(e,t){super(e);h(this,"initialData");h(this,"id");h(this,"version");h(this,"name");h(this,"description",null);h(this,"type",n.BuiltInBaseEntity);h(this,"abstract",!1);h(this,"static");h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"interactive",!1);h(this,"errors",[]);h(this,"project");this.initialData=this.initialData||e,this.project=this.project||t,this.id=this.id||e.id,this.version=this.version||e.version,this.name=this.name||e.name,this.static=this.static||e.static,this.interactive=this.interactive||e.interactive,this.abstract=e.abstract,this.properties=this.initialData.properties.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.extends=this.initialData.extends.map(i=>C(i,this.project))}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract);return[...e,...i]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=U,...t){return await Sa.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.extends.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.extends.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,interactive:this.interactive,abstract:this.abstract,static:this.static,type:this.type,name:this.name}}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=W){return{id:this.id+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=W){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=AS(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}implement(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),null,!0,"implement-built-in-base-entity")),i){const s=Yl(this,e,t,i);return t==null||t.attemptAutoclose("implement-built-in-base-entity",this.id),s}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Sa&&e.push(...i.getAllInteractiveMethods())})),p(e)}};h(Sa,"repository",{APILoad:async(e,...t)=>null});let Fi=Sa;function bS(r){const a=a5(),e=r.toJSON();a.safeParse(e).success;const i=[];return Ke(r.errors,i)}const dd=class dd extends lt{constructor(e,t){super(e);h(this,"initialData");h(this,"id");h(this,"name");h(this,"description",null);h(this,"type",n.PrimitiveEntity);h(this,"static");h(this,"abstract");h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"errors",[]);h(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.parent=this,s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.parent=this,s})}get allBasePropertiesFromExtendedAndImplementedEntities(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.allBasePropertiesFromExtendedAndImplementedEntities].filter(s=>!s.abstract);return[...e,...i]},[]))}get extendedPropertiesFromOriginalParents(){return p(this.extends.reduce((e,t)=>{const i=[...t.ownDeclaredProperties,...t.extendedPropertiesFromOriginalParents].filter(s=>!s.abstract);return[...e,...i]},[]))}get implementedPropertiesFromOriginalParents(){return p([...this.extends.reduce((e,t)=>{const i=t.implementedPropertiesFromOriginalParents,s=[...t.ownDeclaredProperties].filter(l=>!!l.abstract&&!i.find(o=>o.name===l.name));return[...i,...s,...e]},[])])}get extendedProperties(){return this.properties.filter(e=>e.isExtendedProperty)}get ownDeclaredProperties(){return this.properties.filter(e=>!e.isExtendedProperty)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async APILoad(e=U,...t){return await dd.repository.APILoad(this.id,...t),this}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,static:this.static,abstract:this.abstract,type:this.type,name:this.name}}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,properties:this.properties.map(t=>t.toJSON(e)),methods:this.methods.map(t=>t.toJSON(e)),abstractMethods:this.abstractMethods.map(t=>t.toJSON(e)),extends:this.extends.map(t=>t.toJSON(e))})}toReference(e=W){return{id:this.id+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,version:this.version,entityType:this.type}}toShallowJSON(e=W){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,properties:this.properties.map(t=>t.toReference()),methods:this.methods.map(t=>t.toReference()),abstractMethods:this.abstractMethods.map(t=>t.toReference()),extends:this.extends.map(t=>t.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=bS(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}getAllInteractiveMethods(){const e=[];return e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Fi&&e.push(...i.getAllInteractiveMethods())}),p(e)}};h(dd,"repository",{APILoad:async(e,...t)=>null});let ni=dd;function st(r,a){if(!r)throw new Error("Entity is null");const e=a.get(r.id);switch(r.type){case n.LiteralValue:return e||new en(r,a);case n.DefinitionEntity:return e||new dn(r,a);case n.PrimitiveEntity:return e||new ni(r,a);case n.FunctionDeclaration:return e||new kr(r,a);case n.GlobalEvent:return e||new Wr(r,a);case n.DataType:return e||new Zr(r,a);case n.Property:return e||new xr(r,a);case n.FunctionCall:return e||new an(r,a);case n.Condition:return e||new zr(r,a);case n.Operation:return e||new qr(r,a);case n.VariableDeclaration:return e||new Hr(r,a);case n.VariableInstance:return e||new Yr(r,a);case n.OutputMap:return e||new tr(r,a);case n.ReturnDeclaration:return e||new ri(r,a);case n.ArgumentDeclaration:return e||new br(r,a);case n.InputMap:return e||new er(r,a);case n.Project:return e||new m(r);case n.InstalledProject:return e||new Xr(r,a);case n.ActionDescriptor:return e||new We(r,a);case n.ReturnStatement:return e||new Jr(r,a);case n.Loop:return e||new Sr(r,a);case n.Search:return e||new Kr(r,a);case n.ValueDescriptor:return e||new ir(r,a);case n.BuiltInBaseEntity:return e||new Fi(r,a);case n.InternalCall:return e||new Qr(r,a);case n.ContinueStatement:return e||new Gt(r,a);case n.BreakStatement:return e||new tn(r,a);case n.GenericReference:return a.get(r.entityId);default:throw new Error("Invalid entity type: "+r.type)}}function C(r,a){if(!r)throw new Error("Entity is null");const e=st(r,a);return e.subscribe(),e}function RS(r,a){if(!r)throw new Error("Entity is null");switch(r.type){case n.LiteralValue:return en.fromGenerationTarget(r,a);case n.DefinitionEntity:return dn.fromGenerationTarget(r,a);case n.FunctionDeclaration:return kr.fromGenerationTarget(r,a);case n.GlobalEvent:return Wr.fromGenerationTarget(r,a);case n.DataType:return Zr.fromGenerationTarget(r,a);case n.Property:return xr.fromGenerationTarget(r,a);case n.FunctionCall:return an.fromGenerationTarget(r,a);case n.Condition:return zr.fromGenerationTarget(r,a);case n.Operation:return qr.fromGenerationTarget(r,a);case n.VariableDeclaration:return Hr.fromGenerationTarget(r,a);case n.VariableInstance:return Yr.fromGenerationTarget(r,a);case n.OutputMap:return tr.fromGenerationTarget(r,a);case n.ReturnDeclaration:return ri.fromGenerationTarget(r,a);case n.ArgumentDeclaration:return br.fromGenerationTarget(r,a);case n.InputMap:return er.fromGenerationTarget(r,a);case n.InstalledProject:return Xr.fromGenerationTarget(r,a);case n.ReturnStatement:return Jr.fromGenerationTarget(r,a);case n.Loop:return Sr.fromGenerationTarget(r,a);case n.Search:return Kr.fromGenerationTarget(r,a);case n.ActionDescriptor:return We.fromGenerationTarget(r,a);case n.ValueDescriptor:return ir.fromGenerationTarget(r,a);case n.InternalCall:return Qr.fromGenerationTarget(r,a);case n.ContinueStatement:return Gt.fromGenerationTarget(r,a);case n.BreakStatement:return tn.fromGenerationTarget(r,a);default:throw new Error("Invalid entity type: "+r.type)}}const W={seenEntityMaps:new Map,seenEntities:new Set,timestamp:E().toISOString()};class IP{constructor(){h(this,"initialData")}}const U={cascade:!1},AP={APILoad:async(r,...a)=>null},DS={APICreate:async(r,...a)=>r,APIUpdate:async(r,...a)=>r,APIDelete:async(r,...a)=>r,APIClone:async(r,...a)=>{},APILoadVersion:async(r,a,...e)=>null,...AP};class OS{}class wS extends IP{}class PS{}class VS{}class CS{}class af{}class _S extends af{}class BS extends af{}class MS{}class Or{static initReadsValue(a){if(a.initialData.readsValue&&a.initialData.readsValue.type!==n.GenericReference)a.readsValue=C(a.initialData.readsValue,a.project);else if(a.initialData.readsValue&&a.initialData.readsValue.type===n.GenericReference){const e=bi(a.initialData.readsValue,a.project);e&&(a.readsValue=e)}if(a.readsValue){if(it.includes(a.readsValue.type)){let e=a.parent;ht.includes(e.type)||(e=e.parent);const t=a.type===n.InputMap&&a.parent.type===n.Loop;t&&(e=a.parent.parent),a.readsValue.setParent(e,null),a.readsValue.initChildren(null),!t&&e.detachedChildren.includes(a)?e.replaceDetachedChild(a,a.readsValue):t||e.subscribeDetachedChild(a.readsValue)}a.readsValue.addValueReader(a,null)}return a.readsValue}static hydrateReadsValue(a){if(a.initialData.readsValue&&a.initialData.readsValue.type!==n.GenericReference)a.readsValue=C(a.initialData.readsValue,a.project);else if(a.initialData.readsValue&&a.initialData.readsValue.type===n.GenericReference){const e=bi(a.initialData.readsValue,a.project);e&&(a.readsValue=e)}if(a.readsValue){if(it.includes(a.readsValue.type)){let e=a.parent;ht.includes(e.type)||(e=e.parent);const t=a.type===n.InputMap&&a.parent.type===n.Loop;t&&(e=a.parent.parent),a.readsValue.setParent(e,null),!t&&e.detachedChildren.includes(a)?e.replaceDetachedChild(a,a.readsValue):t||e.subscribeDetachedChild(a.readsValue)}a.readsValue.addValueReader(a,null)}return a.readsValue}}class Ja{static initWritesValues(a,e){const t=a.initialData.writesValues.reduce((s,l)=>{if(l.type===n.GenericReference||a.writesValues.some(d=>d.id===l.id))return s;const o=C(l,a.project);return o.setValueWriter(a,null),it.includes(o.type)&&(o.setParent(e,null),o.initChildren(null)),[...s,o]},[]),i=[...a.writesValues];return a.writesValues=p([...i,...t]),a.writesValues}}class NS{}class LS{constructor(a){h(this,"eventName");h(this,"callbacks",[]);this.eventName=a}on(a){if(typeof a!="function")throw new Error("Event callback must be a function");this.callbacks.includes(a)||this.callbacks.push(a)}off(a){if(typeof a!="function")throw new Error("Event callback must be a function");this.callbacks=this.callbacks.filter(e=>e!==a)}destroy(){this.callbacks=[]}}class of{constructor(){h(this,"subscribedEvents",{});h(this,"on",this._on);h(this,"emit",this._emit);h(this,"off",this._off);h(this,"destroy",this._destroy)}getEvent(a){return this.subscribedEvents[a]||(this.subscribedEvents[a]=new LS(a)),this.subscribedEvents[a]}_on(a,e){this.getEvent(a).on(e)}_emit(a,...e){const t=this.getEvent(a);t&&t.callbacks.forEach(i=>{i.apply(null,e)})}_off(a,e){const t=this.getEvent(a);t&&(e?t.off(e):(t.destroy(),delete this.subscribedEvents[a]))}_destroy(){Object.keys(this.subscribedEvents).forEach(a=>{this._off(a)}),this.subscribedEvents={}}}var Bt=(r=>(r.DEFINITION_ENTITY_ADDED="definition-entity-added",r.DEFINITION_ENTITY_REMOVED="definition-entity-removed",r.DEFINITION_ENTITY_UPDATED="definition-entity-updated",r.PERSISTED_DEFINITION_ENTITY_ADDED="persisted-definition-entity-added",r.PERSISTED_DEFINITION_ENTITY_REMOVED="persisted-definition-entity-removed",r.PERSISTED_DEFINITION_ENTITY_UPDATED="persisted-definition-entity-updated",r.RELATIONAL_DATABASE_DEFINITION_ENTITY_ADDED="relational-database-definition-entity-added",r.RELATIONAL_DATABASE_DEFINITION_ENTITY_REMOVED="relational-database-definition-entity-removed",r.RELATIONAL_DATABASE_DEFINITION_ENTITY_UPDATED="relational-database-definition-entity-updated",r))(Bt||{});function jS(r,a){a.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!=="constructor"&&Object.defineProperty(r.prototype,t,Object.getOwnPropertyDescriptor(e.prototype,t))})})}class bP extends lt{constructor(...a){super(...a),Object.assign(this,new of)}}jS(bP,[of]);const re=class re extends bP{constructor(e){super(e);h(this,"initialData");h(this,"id");h(this,"type",n.Project);h(this,"name",null);h(this,"description",null);h(this,"x");h(this,"y");h(this,"entities",[]);h(this,"projects",[]);h(this,"functions",[]);h(this,"events",[]);h(this,"variableDeclarations",[]);h(this,"variableInstances",[]);h(this,"conditions",[]);h(this,"operations",[]);h(this,"functionCalls",[]);h(this,"loops",[]);h(this,"searches",[]);h(this,"primitives",[]);h(this,"builtInBaseEntities",[]);h(this,"operationDeclarations",[]);h(this,"globalEventActionDescriptors",[]);h(this,"loopDeclarations",[]);h(this,"loopDeclarationsBodies",[]);h(this,"conditionDeclarations",[]);h(this,"valueDescriptors",[]);h(this,"dataTypes",[]);h(this,"project");h(this,"instances",{});h(this,"builtInInstances",{});h(this,"deletedInstances",{});h(this,"errors",[]);h(this,"references",[]);h(this,"history",[]);h(this,"undoableStackValueIndex",-1);h(this,"detachedDependents",{});h(this,"knownVersions",null);h(this,"activeVersion",!1);h(this,"initialized",!1);h(this,"startedInitialization",!1);h(this,"onCloseChangeSetCallback",null);h(this,"onAddChangeSetCallback",null);h(this,"onRequestActiveValueCallback",null);this.initialData=e,this.id=e.id,this.name=e.name,this.description=e.description,this.x=0,this.y=0,this.instances[this.id]=this;try{(!re.UUID||re.UUID.isBackup)&&(re.UUID=So==null?void 0:So()),re.UUID||(re.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:t=>t})}catch(t){console.error("Error initializing UUID module",t),re.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:i=>i}}}static injectUUIDModule(e){re.UUID=e}static new(e=null){return{id:re.UUID.uuid(),version:re.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||E().toISOString(),author:(e==null?void 0:e.author)||re.sessionAuthor,previousVersion:null,deleted:!1,type:n.Project,name:"",description:"",entities:[],functions:[],events:[],projects:[],variableDeclarations:[],variableInstances:[],conditions:[],operations:[],functionCalls:[],loops:[],searches:[]}}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const s=[];return s.push(...ut(i)),{errors:s,modifiedData:i}}async closePendingChangeSets(){const e=this.history.find(t=>t.dirty&&!t.open);e&&await this.closeChangeSet(e)}onRequestActiveValue(e){this.onRequestActiveValueCallback=e}async onCloseChangeSet(e){this.onCloseChangeSetCallback=e,await this.closePendingChangeSets()}onAddChangeSet(e){this.onAddChangeSetCallback=e}async closeChangeSet(e){const t=this.history.findIndex(l=>l.id===e.id),i=this.history.slice(0,t),s=i[i.length-1];if(!(s!=null&&s.dirty)&&this.onCloseChangeSetCallback){(await this.onCloseChangeSetCallback(e)).success&&(e.dirty=!1,this.closePendingChangeSets());return}}toLatestChangeSet(e,t,i,s=!1,l="here-this"){if(!this.history.length)return new b(this,e,t,i,s,l);const o=this.history[this.history.length-1];return o.open?o:this.addChangeSet(new b(this,e,t,i,s,l))}addChangeSet(e){var s,l;if(!this.history.length)return this.undoableStackValueIndex=u1(this.undoableStackValueIndex,this.history,e),(s=this.onAddChangeSetCallback)==null||s.call(this,e,this.undoableStackValueIndex),e;const t=this.history.find(o=>o.id===(e==null?void 0:e.id));if(t)return t;const i=this.history.find(o=>o.open);if(i)throw console.warn("Previous still open: ",i),console.warn("New change set: ",e),new Error(`There is already an open change-set with id '${i.id}'.`);return this.undoableStackValueIndex=u1(this.undoableStackValueIndex,this.history,e),(l=this.onAddChangeSetCallback)==null||l.call(this,e,this.undoableStackValueIndex),e}discardChangeSet(e){const t=this.history.findIndex(i=>i.id===(e==null?void 0:e.id));return t!==-1&&this.history.splice(t,1),this}async inject(...e){return await Promise.all(e.map(t=>new Promise(async i=>{await t.init(this),i(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}unsubscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]&&delete this.detachedDependents[t.entity.id]}),this}syncDependents(e=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"sync-dependents"))){const t=[],i=[],s=[],l=[];return Object.values(this.detachedDependents).forEach(o=>{const d=o.entity.afterAllChildrenInitialized(e);t.push(...d.updated),i.push(...d.added),s.push(...d.removed),l.push(...d.affected)}),e==null||e.attemptAutoclose("sync-dependents",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],l=[],o=[],d=[];return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],l=[],o=[],d=[];return{updated:p(s),added:p(l),removed:p(o),affected:p(d),self:this}}unsubscribeFromDependencies(){return this}subscribeToDependencies(){return this}increaseVersion(e){if(e&&!E(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&E(e).isSame(E(this.createdAt))?this:(this.previousVersion=this.version,this.version=re.UUID.uuid(),this.createdAt=E(e).toISOString()||E().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new re(this);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[this.version,e]]),e.entities=[...this.entities],e.projects=[...this.projects],e.functions=[...this.functions],e.events=[...this.events],e.variableDeclarations=[...this.variableDeclarations],e.variableInstances=[...this.variableInstances],e.conditions=[...this.conditions],e.operations=[...this.operations],e.functionCalls=[...this.functionCalls],e.loops=[...this.loops],e.searches=[...this.searches],this}recursiveCaptureUpstreamVersions(e){const t=[],i=[],s=[],l=[];return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}async restoreVersion(e){var d;const t=[],i=[],s=[],l=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this};if(!this.knownVersions){const u=new Map;for(const[f,c]of this.knownVersions||new Map){if(u.set(f,c),c.activeVersion=!1,c.knownVersions)for(const[T,I]of c.knownVersions)u.set(T,I);c.knownVersions=null}}let o=(d=this.knownVersions)==null?void 0:d.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new re(u)}return this.metaSync(o.toShallowJSON(),null),this.previousVersion=o.previousVersion,this.version=o.version,this.createdAt=o.createdAt,this.author=o.author,this.deleted=o.deleted,this.entities=o.entities,this.projects=o.projects,this.functions=o.functions,this.events=o.events,this.variableDeclarations=o.variableDeclarations,this.variableInstances=o.variableInstances,this.conditions=o.conditions,this.operations=o.operations,this.functionCalls=o.functionCalls,this.loops=o.loops,this.searches=o.searches,{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=null){const t=[],i=[],s=[],l=[];return this.initialized=!0,this.validate(),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}addSelfToProject(e){const t=[],i=[],s=[],l=[];return this.subscribe(),this.subscribeToDependencies(),{updated:p(t),added:p(i),removed:p(s),affected:p(l),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(e){return this.operationDeclarations.includes(e)}isGlobalEventActionDescriptor(e){return this.globalEventActionDescriptors.includes(e)}isLoopDeclaration(e){return this.loopDeclarations.includes(e)}isConditionDeclaration(e){return this.conditionDeclarations.includes(e)}initChildren(e=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.entities=this.initialData.entities.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.projects=this.initialData.projects.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.variableDeclarations=this.initialData.variableDeclarations.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.variableInstances=this.initialData.variableInstances.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.conditions=this.initialData.conditions.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.operations=this.initialData.operations.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.functions=this.initialData.functions.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.events=this.initialData.events.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.functionCalls=this.initialData.functionCalls.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.loops=this.initialData.loops.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.searches=this.initialData.searches.map(t=>{const i=C(t,this);return i.setParent(this,null),i.initChildren(e),i}),this.attachOrphanReferences(),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeDeletedInstance(e){return(!this.deletedInstances[e.id]||this.deletedInstances[e.id]!==e)&&(this.deletedInstances[e.id]=e),this}subscribeBuiltInInstance(e){return(!this.builtInInstances[e.id]||this.builtInInstances[e.id]!==e)&&(this.builtInInstances[e.id]=e),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(e){return delete this.instances[e.id],this}unsubscribeDeletedInstance(e){return delete this.deletedInstances[e.id],this}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getDeleted(e){return this.deletedInstances[e]||null}getManaged(e){return this.getBuiltIn(e)?null:this.instances[e]||null}getBuiltIn(e){return this.builtInInstances[e]||null}findSubscribedInstanceFromReference(e){return this.instances[e.entityId]||null}findSubscribedBuiltInInstanceFromReference(e){return this.builtInInstances[e.entityId]||null}metaSync(e,t=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"meta-sync"))){const i=pt(this,e),s=this.toMeta();return this.name=e.name!==void 0?e.name:s.name,this.description=e.description!==void 0?e.description:s.description,this.x=e.x||s.x,this.y=e.y||s.y,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,A.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,A.Added):i&&(t==null||t.add(this,A.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await re.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await re.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await re.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await re.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await re.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await re.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"remove-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}restore({}={},e=this.project.addChangeSet(new b(this.project,re.sessionAuthor,E().toISOString(),this,!0,"restore-entity"))){return{added:[],updated:[],removed:[],affected:[],self:this}}getAllBuiltInIds(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlatIds(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlatIds(e)),...this.operationDeclarations.flatMap(t=>t.toFlatIds(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlatIds(e)),...this.loopDeclarations.flatMap(t=>t.toFlatIds(e)),...this.conditionDeclarations.flatMap(t=>t.toFlatIds(e)),...this.valueDescriptors.flatMap(t=>t.toFlatIds(e)),...this.dataTypes.flatMap(t=>t.toFlatIds(e))]}getAllBuiltIn(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlat(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlat(e)),...this.operationDeclarations.flatMap(t=>t.toFlat(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlat(e)),...this.loopDeclarations.flatMap(t=>t.toFlat(e)),...this.conditionDeclarations.flatMap(t=>t.toFlat(e)),...this.valueDescriptors.flatMap(t=>t.toFlat(e)),...this.dataTypes.flatMap(t=>t.toFlat(e))]}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.entities.flatMap(i=>i.toFlat(e)),...this.functions.flatMap(i=>i.toFlat(e)),...this.events.flatMap(i=>i.toFlat(e)),...this.projects.flatMap(i=>i.toFlat(e)),...this.variableDeclarations.flatMap(i=>i.toFlat(e)),...this.variableInstances.flatMap(i=>i.toFlat(e)),...this.conditions.flatMap(i=>i.toFlat(e)),...this.operations.flatMap(i=>i.toFlat(e)),...this.functionCalls.flatMap(i=>i.toFlat(e)),...this.loops.flatMap(i=>i.toFlat(e)),...this.searches.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.entities.flatMap(i=>i.toFlatIds(e)),...this.functions.flatMap(i=>i.toFlatIds(e)),...this.events.flatMap(i=>i.toFlatIds(e)),...this.projects.flatMap(i=>i.toFlatIds(e)),...this.variableDeclarations.flatMap(i=>i.toFlatIds(e)),...this.variableInstances.flatMap(i=>i.toFlatIds(e)),...this.conditions.flatMap(i=>i.toFlatIds(e)),...this.operations.flatMap(i=>i.toFlatIds(e)),...this.functionCalls.flatMap(i=>i.toFlatIds(e)),...this.loops.flatMap(i=>i.toFlatIds(e)),...this.searches.flatMap(i=>i.toFlatIds(e))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,type:this.type,name:this.name}}toJSON(e=new Set){return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(t=>t.toJSON(e)),variableDeclarations:this.variableDeclarations.map(t=>t.toJSON(e)),variableInstances:this.variableInstances.map(t=>t.toJSON(e)),conditions:this.conditions.map(t=>t.toJSON(e)),operations:this.operations.map(t=>t.toJSON(e)),loops:this.loops.map(t=>t.toJSON(e)),searches:this.searches.map(t=>t.toJSON(e)),functions:this.functions.map(t=>t.toJSON(e)),events:this.events.map(t=>t.toJSON(e)),projects:this.projects.map(t=>t.toJSON(e)),functionCalls:this.functionCalls.map(t=>t.toJSON(e))})}toJSONClone(e={uuidStrategy:"uuid"}){const t=new Map,i=new Set,s=this.getAllBuiltInIds();return Object.keys(this.instances).forEach(l=>{if(s.includes(l)){t.set(l,l);return}t.set(l,re.UUID.uuid())}),i.add(this.id),{id:t.get(this.id),version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),projects:this.projects.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),variableDeclarations:this.variableDeclarations.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),variableInstances:this.variableInstances.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),conditions:this.conditions.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),operations:this.operations.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),functions:this.functions.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),events:this.events.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),functionCalls:this.functionCalls.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),loops:this.loops.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null})),searches:this.searches.map(l=>l.toJSONClone({...e,seenEntityMaps:t,seenEntities:i,newId:null}))}}toReference(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+re.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=W){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,entities:this.entities.map(s=>s.toReference(e)),functions:this.functions.map(s=>s.toReference(e)),events:this.events.map(s=>s.toReference(e)),projects:this.projects.map(s=>s.toReference(e)),variableDeclarations:this.variableDeclarations.map(s=>s.toReference(e)),variableInstances:this.variableInstances.map(s=>s.toReference(e)),conditions:this.conditions.map(s=>s.toReference(e)),operations:this.operations.map(s=>s.toReference(e)),functionCalls:this.functionCalls.map(s=>s.toReference(e)),loops:this.loops.map(s=>s.toReference(e)),searches:this.searches.map(s=>s.toReference(e))}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.entities.flatMap(i=>i.toFlatJSON(e)),...this.functions.flatMap(i=>i.toFlatJSON(e)),...this.events.flatMap(i=>i.toFlatJSON(e)),...this.projects.flatMap(i=>i.toFlatJSON(e)),...this.variableDeclarations.flatMap(i=>i.toFlatJSON(e)),...this.variableInstances.flatMap(i=>i.toFlatJSON(e)),...this.conditions.flatMap(i=>i.toFlatJSON(e)),...this.operations.flatMap(i=>i.toFlatJSON(e)),...this.functionCalls.flatMap(i=>i.toFlatJSON(e)),...this.loops.flatMap(i=>i.toFlatJSON(e)),...this.searches.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.events.flatMap(i=>i.toFlatGenerationTarget(e)),...this.projects.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(i=>i.toFlatGenerationTarget(e)),...this.conditions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.operations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.loops.flatMap(i=>i.toFlatGenerationTarget(e)),...this.searches.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.entities.forEach(e=>e.clearErrors()),this.projects.forEach(e=>e.clearErrors()),this.functions.forEach(e=>e.clearErrors()),this.events.forEach(e=>e.clearErrors()),this.variableDeclarations.forEach(e=>e.clearErrors()),this.variableInstances.forEach(e=>e.clearErrors()),this.conditions.forEach(e=>e.clearErrors()),this.operations.forEach(e=>e.clearErrors()),this.functionCalls.forEach(e=>e.clearErrors()),this.loops.forEach(e=>e.clearErrors()),this.searches.forEach(e=>e.clearErrors()),this}validate(){const e=Bq(),t=this.toJSON();return e.safeParse(t),this.validateChildren(),{success:!0,error:null,data:t}}validateChildren(){this.entities.forEach(e=>e.validate()),this.projects.forEach(e=>e.validate()),this.functions.forEach(e=>e.validate()),this.events.forEach(e=>e.validate()),this.variableDeclarations.forEach(e=>e.validate()),this.variableInstances.forEach(e=>e.validate()),this.conditions.forEach(e=>e.validate()),this.operations.forEach(e=>e.validate()),this.functionCalls.forEach(e=>e.validate()),this.loops.forEach(e=>e.validate()),this.searches.forEach(e=>e.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(t=>t.getErrors()),...this.projects.flatMap(t=>t.getErrors()),...this.functions.flatMap(t=>t.getErrors()),...this.events.flatMap(t=>t.getErrors()),...this.variableDeclarations.flatMap(t=>t.getErrors()),...this.variableInstances.flatMap(t=>t.getErrors()),...this.conditions.flatMap(t=>t.getErrors()),...this.operations.flatMap(t=>t.getErrors()),...this.functionCalls.flatMap(t=>t.getErrors()),...this.loops.flatMap(t=>t.getErrors()),...this.searches.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return this}getDefinitionEntity(e){return this.entities.find(t=>t.id===e)||null}addDefinitionEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearch(e){return this.searches.includes(e)||this.searches.push(e),this}removeDefinitionEntity(e){const t=this.entities.findIndex(i=>i.id===e.id);if(t>-1){const i=this.entities[t];return this.entities.splice(t,1),i}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(i=>i.id===e.id);if(t>-1){const i=this.functions[t];return this.functions.splice(t,1),i}return null}removeExternalProject(e){const t=this.projects.findIndex(i=>i.id===e.id);if(t>-1){const i=this.projects[t];return this.projects.splice(t,1),i}return null}removeGlobalEvent(e){const t=this.events.findIndex(i=>i.id===e.id);if(t>-1){const i=this.events[t];return this.events.splice(t,1),i}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(i=>i.id===e.id);if(t>-1){const i=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),i}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(t=>t.methods)]}getTerminationStatements(){return[...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.ReturnStatement||l.type===n.ContinueStatement||l.type===n.BreakStatement)]},[])]}getFunctionDeclaration(e){return this.functions.find(t=>t.id===e)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.functionCalls.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.operations.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.loops.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[]),...this.searches.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.functionCalls.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.conditions.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.loops.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[]),...this.searches.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.operations.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.loops.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[]),...this.searches.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.functionCalls.reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.conditions.reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.operations.reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.loops.reduce((t,i)=>{const s=He(i);return[...t,...s]},[]),...this.searches.reduce((t,i)=>{const s=He(i);return[...t,...s]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.functionCalls.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.conditions.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.operations.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.loops.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[]),...this.searches.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableInstance);return[...t,...l]},[])]}getVariableDeclarations(){return p([...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.functionCalls.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.conditions.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.operations.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.loops.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[]),...this.searches.reduce((t,i)=>{const l=He(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...l]},[])])}getLoops(){return[...this.loops,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[]),...this.functionCalls.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[]),...this.conditions.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[]),...this.operations.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[]),...this.searches.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Loop)]},[])]}getSearches(){return[...this.searches,...this.getEntryPoints().reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[]),...this.functionCalls.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[]),...this.conditions.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[]),...this.operations.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[]),...this.loops.reduce((t,i)=>{const s=Te(i);return[...t,...s.filter(l=>l.type===n.Search)]},[])]}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(i=>{if(!i.declaration){const s=i.initialData,l=s.declaration.entityId||s.declaration.id,o=t.find(d=>d.id===l);o&&i.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===J.PERSISTED_ENTITY)||null}requestActiveValue(e){var i;const t=(i=this.onRequestActiveValueCallback)==null?void 0:i.call(this,e);return t?t||null:e.getDefaultValue()}undo(){const e=this.history[this.undoableStackValueIndex+1],t=this.history[this.undoableStackValueIndex];return l1(e||"initial",t||"initial",this)}redo(){const e=this.history[this.undoableStackValueIndex-1],t=this.history[this.undoableStackValueIndex];return l1(e||"initial",t||"initial",this)}};h(re,"sessionAuthor","1"),h(re,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),h(re,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...i)=>null}),h(re,"type",n.Project),h(re,"USER_MANAGED_PARENT_TYPES",[]),h(re,"PARENT_TYPES",[...re.USER_MANAGED_PARENT_TYPES]),h(re,"MUTABLE_BASE_PROPERTIES",["name","description"]),h(re,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),h(re,"BASE_PROPERTIES",[...re.MUTABLE_BASE_PROPERTIES,...re.INMUTABLE_BASE_PROPERTIES]),h(re,"MUTABLE_META_PROPERTIES",[...re.MUTABLE_BASE_PROPERTIES,"x","y"]),h(re,"INMUTABLE_META_PROPERTIES",[...re.INMUTABLE_BASE_PROPERTIES]),h(re,"META_PROPERTIES",[...re.MUTABLE_META_PROPERTIES,...re.INMUTABLE_META_PROPERTIES]),h(re,"MUTABLE_UPSTREAM_PROPERTIES",[]),h(re,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),h(re,"UPSTREAM_PROPERTIES",[...re.MUTABLE_UPSTREAM_PROPERTIES,...re.INMUTABLE_UPSTREAM_PROPERTIES]),h(re,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),h(re,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),h(re,"DOWNSTREAM_PROPERTIES",[...re.MUTABLE_DOWNSTREAM_PROPERTIES,...re.INMUTABLE_DOWNSTREAM_PROPERTIES]),h(re,"PROPERTIES",[...re.META_PROPERTIES,...re.UPSTREAM_PROPERTIES,...re.DOWNSTREAM_PROPERTIES]);let m=re;var RP=(r=>(r.PersistChangeSet="persist-change-set",r.CreateSingle="create-single",r.CreateBulk="create-bulk",r.CreateSingleNested="create-single-nested",r.CreateBulkNested="create-bulk-nested",r.Update="update",r.Clone="clone",r.Delete="delete",r.Load="load",r.LoadNested="load-nested",r.LoadVersion="load-version",r))(RP||{});class DP extends We{constructor(e){super(Bi,e);h(this,"id",Qe.Parallel);h(this,"name",Qe.Parallel);h(this,"description","Execute a list of actions one after the other");h(this,"version","1");h(this,"autoexecutable",!0);h(this,"initialData",Bi);h(this,"type",n.ActionDescriptor);h(this,"inputs",[]);h(this,"outputs",[]);h(this,"error",null);h(this,"project");this.project=e,this.inputs=Bi.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=Bi.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=Bi.error?C(Bi.error,this.project):null}}class OP extends We{constructor(e){super(Ht,e);h(this,"id",Ht.id);h(this,"name",Ht.name);h(this,"description",Ht.description);h(this,"version",Ht.version);h(this,"autoexecutable",!1);h(this,"initialData",Ht);h(this,"type",n.ActionDescriptor);h(this,"inputs",[]);h(this,"outputs",[]);h(this,"error",null);h(this,"project");this.project=e,this.inputs=Ht.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=Ht.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=Ht.error?C(Ht.error,this.project):null}}class wP extends We{constructor(e){super(ur,e);h(this,"id",Qe.Sequential);h(this,"name",Qe.Sequential);h(this,"description","Execute a list of actions one after the other");h(this,"version","1");h(this,"autoexecutable",!0);h(this,"initialData",ur);h(this,"type",n.ActionDescriptor);h(this,"inputs",[]);h(this,"outputs",[]);h(this,"error",null);h(this,"project");this.project=e,this.inputs=ur.inputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.outputs=ur.outputs.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.error=ur.error?C(ur.error,this.project):null}}class US extends We{constructor(a){super(js,a)}}class $S extends We{constructor(a){super(cn,a)}}class GS extends We{constructor(e){super(fn,e);h(this,"autoexecutable",!0)}getEntityToMatchInputMap(e){return e.inputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===k.operation[et.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(e){return e.inputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===k.operation[et.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(e){return e.outputs.find(t=>{var i;return((i=t.declaration)==null?void 0:i.id)===k.operation[et.Validate].outputs.outputEntity.id})||null}getEntityToMatch(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"get-entity-to-match-validate-data"))){const i=this.project.requestActiveValue(e),s=i==null?void 0:i.valueAsTypeSingle;return t==null||t.attemptAutoclose("get-entity-to-match-validate-data",this.id),s}syncOperationInstance(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-operation-instance-validate-data"))){const i=[],s=[],l=[],o=[],d=this.getEntityToMatchInputMap(e);if(d){const{added:c,updated:T,removed:I,affected:D}=this.syncEntityToMatchInputMapDataType(d,t);i.push(...T),s.push(...c),l.push(...I),o.push(...D)}const u=this.getDataToValidateInputMap(e);if(u){const{added:c,updated:T,removed:I,affected:D}=this.syncDataToValidateInputMapDataType(u,t);i.push(...T),s.push(...c),l.push(...I),o.push(...D)}const f=this.getOutputDataOutputMap(e);if(f){const{added:c,updated:T,removed:I,affected:D}=this.syncOutputDataOutputMapDataType(f,t);i.push(...T),s.push(...c),l.push(...I),o.push(...D)}return t==null||t.attemptAutoclose("sync-operation-instance-validate-data",this.id),{updated:p(i),added:p(s),removed:p(l),affected:p(o),self:e}}syncEntityToMatchInputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-entity-to-match-input-map-data-type"))){var f,c,T,I,D,O,V,M,G,_,g,q,S,K,de;const i=[],s=[],l=[],o=[];if(((f=e.declaration)==null?void 0:f.id)!==k.operation[et.Validate].inputs.entityToMatch.id)return t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const d=this.project.requestActiveValue(e),u=d==null?void 0:d.valueAsTypeSingle;if(!e.dataType){const me={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:(t==null?void 0:t.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:((c=e.declaration.dataType)==null?void 0:c.options)||null,implementationChooseOne:((T=e.declaration.dataType)==null?void 0:T.implementationChooseOne)||!1,staticEntities:((I=e.declaration.dataType)==null?void 0:I.staticEntities)??null,interactiveEntities:((D=e.declaration.dataType)==null?void 0:D.interactiveEntities)??null,actionEntities:((O=e.declaration.dataType)==null?void 0:O.actionEntities)??null,isList:((V=e.declaration.dataType)==null?void 0:V.isList)||!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:(u==null?void 0:u.toJSON())||null,like:!0,inferred:!0,parent:e.toReference()},z=C(me,e.project);z.hydrateAncestors(),z.setParent(e,t),z.initChildren(t),z.setEntity(u),t==null||t.add(z,A.Added),i.push(z),e.setDataType(z)}return(K=e.dataType)==null||K.metaSync({inferred:!0,like:!1,asType:!0,options:((M=e.declaration.dataType)==null?void 0:M.options)||null,implementationChooseOne:((G=e.declaration.dataType)==null?void 0:G.implementationChooseOne)||!1,staticEntities:((_=e.declaration.dataType)==null?void 0:_.staticEntities)??null,interactiveEntities:((g=e.declaration.dataType)==null?void 0:g.interactiveEntities)??null,actionEntities:((q=e.declaration.dataType)==null?void 0:q.actionEntities)??null,isList:((S=e.declaration.dataType)==null?void 0:S.isList)||!1},t),(de=e.dataType)==null||de.setEntity(u),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-entity-to-match-input-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}syncDataToValidateInputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-data-to-validate-input-map-data-type"))){var c,T,I;const i=[],s=[],l=[],o=[];if(((c=e.declaration)==null?void 0:c.id)!==k.operation[et.Validate].inputs.dataToValidate.id)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const d=this.getEntityToMatchInputMap(e.parent);if(!d)return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(d,t))return t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!e.dataType){const D={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:(t==null?void 0:t.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.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:e.toReference()},O=C(D,e.project);O.setParent(e,t),O.initChildren(t),t==null||t.add(O,A.Added),i.push(O),e.setDataType(O)}(T=e.dataType)==null||T.metaSync({inferred:!0,like:!0,asType:!1},t);const f=this.getEntityToMatch(d,t);return(I=e.dataType)==null||I.setEntity(f),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-data-to-validate-input-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}syncOutputDataOutputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"sync-output-data-output-map-data-type"))){var T,I,D;const i=[],s=[],l=[],o=[];if(((T=e.declaration)==null?void 0:T.id)!==k.operation[et.Validate].outputs.outputEntity.id)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const d=this.getEntityToMatchInputMap(e.parent);if(!d)return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};if(!this.getEntityToMatch(d,t))return t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:[],added:[],removed:[],affected:[],self:null};const f=this.project.requestActiveValue(d),c=(f==null?void 0:f.valueAsTypeSingle)||null;if(!e.dataType){const O={id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(t==null?void 0:t.timestamp)||new Date().toISOString(),author:(t==null?void 0:t.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.DataType,parentRelationType:null,options:null,implementationChooseOne:!1,staticEntities:null,interactiveEntities:null,actionEntities:null,isList:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:(c==null?void 0:c.toJSON())||null,like:!0,inferred:!0,parent:e.toReference()},V=C(O,e.project);V.hydrateAncestors(),V.setParent(e,t),V.initChildren(t),V.setEntity(c),t==null||t.add(V,A.Added),i.push(V),e.setDataType(V)}return(I=e.dataType)==null||I.metaSync({inferred:!0,like:!0,asType:!1},t),(D=e.dataType)==null||D.setEntity(c),e.dataType&&s.push(e.dataType),t==null||t.attemptAutoclose("sync-output-data-output-map-data-type",this.id),{updated:p(s),added:p(i),removed:p(l),affected:p(o),self:e.dataType}}inferInputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"infer-input-map-data-type-validate-data"))){var s,l,o;if(((s=e.declaration)==null?void 0:s.id)===k.operation[et.Validate].inputs.entityToMatch.id){const{added:d,updated:u,removed:f,affected:c}=this.syncEntityToMatchInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:p(u),added:p(d),removed:p(f),affected:p(c),self:e.dataType}}if(((l=e.declaration)==null?void 0:l.id)===k.operation[et.Validate].inputs.dataToValidate.id){const{added:d,updated:u,removed:f,affected:c}=this.syncDataToValidateInputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-input-map-data-type",this.id),{updated:p(u),added:p(d),removed:p(f),affected:p(c),self:e.dataType}}const i=(o=e.declaration)==null?void 0:o.getDataType(t);if(i&&i.isResolved)return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:i};if(e.readsValue){const d=$i(e.readsValue,t);return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:d}}return t==null||t.attemptAutoclose("infer-input-map-data-type-validate-data",this.id),{updated:[],added:[],removed:[],affected:[],self:null}}inferOutputMapDataType(e,t=this.project.addChangeSet(new b(this.project,m.sessionAuthor,E().toISOString(),this,!0,"infer-output-map-data-type-validate-data"))){var i;if(((i=e.declaration)==null?void 0:i.id)===k.operation[et.Validate].outputs.outputEntity.id){const{added:s,updated:l,removed:o,affected:d}=this.syncOutputDataOutputMapDataType(e,t);return t==null||t.attemptAutoclose("infer-output-map-data-type-validate-data",this.id),{updated:p(l),added:p(s),removed:p(o),affected:p(d),self:e.dataType}}return{updated:[],added:[],removed:[],affected:[],self:null}}}class gS extends We{constructor(a){super(Ad,a)}}class FS extends We{constructor(a){super(Rd,a)}}class xS extends We{constructor(a){super(Dd,a)}}class kS extends We{constructor(a){super(to,a)}}class ZS extends We{constructor(a){super(Xa,a)}}class qS extends We{constructor(a){super(Ls,a)}}function JS(r){const a=[new wP(r),new DP(r),new OP(r),new US(r),new $S(r),new GS(r),new kS(r),new gS(r),new xS(r),new FS(r),new ZS(r),new qS(r),new We(Id,r),new We(Td,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.operationDeclarations=a,a}class PP extends Fi{constructor(e){super(Nt,e);h(this,"initialData");h(this,"id",J.PERSISTED_ENTITY);h(this,"version","1");h(this,"name",J.PERSISTED_ENTITY);h(this,"description",Nt.description);h(this,"type",n.BuiltInBaseEntity);h(this,"abstract",Nt.abstract);h(this,"static",Nt.static);h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"errors",[]);h(this,"project");this.initialData=Nt,this.project=e,this.id=Nt.id,this.version=Nt.version,this.name=Nt.name,this.static=Nt.static,this.abstract=Nt.abstract,this.properties=this.initialData.properties.map(t=>{const i=C(t,this.project);return i.setParent(this,null),i.initChildren(null),i}),this.methods=this.initialData.methods.map(t=>{const i=C(t,this.project);return i.parent=this,i}),this.abstractMethods=this.initialData.abstractMethods.map(t=>{const i=C(t,this.project);return i.parent=this,i}),this.extends=this.initialData.extends.map(t=>C(t,this.project))}}var VP=(r=>(r.StatusCodeMustBeNumber="status-code-must-be-number",r.StatusCodeMustBeBetween100And599="status-code-must-be-between-100-and-599",r))(VP||{});function CP(r,a){const e=[];if(typeof a!="number"){const t=new Ye({id:r.id+"--status-code-must-be-number",message:`Entity of type ${r.type} with id "${r.id}" has an invalid value "${a}". The value must be a number.`,issue:null,severity:w.Error,code:"status-code-must-be-number",entity:r});return e.push(t),{errors:e,override:a}}if(a<100){const t=new Ye({id:r.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${r.type} with id "${r.id}" has an invalid value "${a}". The value must be a number between 100 and 599.`,issue:null,severity:w.Error,code:"status-code-must-be-between-100-and-599",entity:r});e.push(t)}if(a>599){const t=new Ye({id:r.id+"--status-code-must-be-between-100-and-599",message:`Entity of type ${r.type} with id "${r.id}" has an invalid value "${a}". The value must be a number between 100 and 599.`,issue:null,severity:w.Error,code:"status-code-must-be-between-100-and-599",entity:r});e.push(t)}return{errors:e,override:a}}class _P extends Fi{constructor(e){super(ai,e);h(this,"initialData");h(this,"id",J.PERSISTED_ENTITY);h(this,"version","1");h(this,"name",J.PERSISTED_ENTITY);h(this,"description",ai.description);h(this,"type",n.BuiltInBaseEntity);h(this,"abstract",ai.abstract);h(this,"static",ai.static);h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"errors",[]);h(this,"project");this.initialData=ai,this.project=e,this.id=ai.id,this.version=ai.version,this.name=ai.name,this.static=ai.static,this.abstract=ai.abstract,this.properties=this.initialData.properties.map(l=>{const o=C(l,this.project);return o.setParent(this,null),o.initChildren(null),o}),this.methods=this.initialData.methods.map(l=>{const o=C(l,this.project);return o.parent=this,o}),this.abstractMethods=this.initialData.abstractMethods.map(l=>{const o=C(l,this.project);return o.parent=this,o}),this.extends=this.initialData.extends.map(l=>C(l,this.project));const t=this.properties.find(l=>l.id===k["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.properties.path.id);if(!t)throw new Error("Path property not found in endpoint entity");t._codeNativeValueValidation=(l,o)=>fw(l,o);const i=this.abstractMethods.find(l=>l.id===k["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.id);if(!i)throw new Error("Handler method not found in endpoint entity");const s=i.outputs.find(l=>l.id===k["built-in-base-entity"].BUILT_IN_HTTP_ENDPOINT_ENTITY.methods.handler.outputs.statusCode.id);if(!s)throw new Error("Status code output not found in handler method");s.codeNativeValueValidation=(l,o)=>CP(l,o)}}const WS="test_primitive_entities_export";class SS extends Fi{constructor(e){super(Ot,e);h(this,"initialData");h(this,"id",J.PERSISTED_ENTITY);h(this,"version","1");h(this,"name",J.PERSISTED_ENTITY);h(this,"description",Ot.description);h(this,"type",n.BuiltInBaseEntity);h(this,"abstract",Ot.abstract);h(this,"static",Ot.static);h(this,"properties",[]);h(this,"methods",[]);h(this,"abstractMethods",[]);h(this,"extends",[]);h(this,"errors",[]);h(this,"project");this.initialData=Ot,this.project=e,this.id=Ot.id,this.version=Ot.version,this.name=Ot.name,this.static=Ot.static,this.abstract=Ot.abstract,this.properties=this.initialData.properties.map(i=>{const s=C(i,this.project);return s.setParent(this,null),s.initChildren(null),s}),this.methods=this.initialData.methods.map(i=>{const s=C(i,this.project);return s.parent=this,s}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const s=C(i,this.project);return s.parent=this,s}),this.extends=this.initialData.extends.map(i=>C(i,this.project));const t=this.properties.find(i=>i.id===k["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.identifier.id);if(!t)throw new Error("Path property not found in endpoint entity");t._codeNativeValueValidation=(i,s)=>hw(i,s)}}function zS(r){const a=[new PP(r),new _P(r),new SS(r),new Fi(Ot,r),new Fi(To,r)];return a.forEach(e=>{r.subscribeBuiltInInstance(e)}),r.builtInBaseEntities=a,a}function YS(r){const a=[new ni(ae,r),new ni(ar,r),new ni(Ee,r),new ni(fd,r),new ni(Vt,r),new ni(or,r),new ni(Zi,r),new ni(lr,r),new ni(Wn,r)];return a.forEach(e=>{r.subscribeBuiltInInstance(e)}),r.primitives=a,a}function HS(r){const a=[new We(Ao,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.globalEventActionDescriptors=a,a}function KS(r){const a=[new We(gs,r),new We(Pr,r),new We($s,r),new We(Yn,r),new We(Hn,r),new We(uo,r)];a.forEach(t=>{t.initChildren(null),r.subscribeBuiltInInstance(t)}),r.loopDeclarations=a;const e=[new We(ho,r),new We(Gs,r),new We(co,r),new We($d,r),new We(gd,r),new We(po,r)];return e.forEach(t=>{t.initChildren(null),r.subscribeBuiltInInstance(t)}),r.loopDeclarationsBodies=e,a}function XS(r){const a=[new ir(bo,r),new ir(su,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.valueDescriptors=a,a}function QS(r){const a=[new We(En,r),new We(ts,r)];return a.forEach(e=>{e.initChildren(null),r.subscribeBuiltInInstance(e)}),r.conditionDeclarations=a,a}const Fn={},ad={},Wa={empty:!1,enrich:!0,mock:!1,ignoreCache:!1,onFetch:async()=>null,manuallyInit:!1};function BP(r,{enrich:a}={enrich:!0}){const e=r.project,t=r.record,i=new Ua(e),s=new Set;t[e.id]=e,s.add(e.id);const l=E().toISOString();Object.values(t).forEach(u=>{!u||i.allBuiltInEntityIds.includes(u.id)||s.add(u.id)}),i.order=Array.from(s),i.flatRecord=t,i.orderEntities();const o=od(r.project);o.instances[e.id]=o;const d=a?o.addChangeSet(new b(o,m.sessionAuthor,l,o,!0,"project-init-from-fetch-result")):null;return i.visit(u=>{if(u.id===o.id)return;const f=C(u,o);f.hydrateAncestors(),f.addSelfToProject(null)}),a?(i.visit(u=>{const f=o.get(u.id);f&&f.afterAllChildrenInitialized(d)}),o.afterAllChildrenInitialized(d)):ld(o,l).forEach(f=>{f.remove({ignoreUpstream:!0},null)}),o.instancesList.forEach(u=>{u.previousVersion=null}),d==null||d.attemptAutoclose("project-init-from-fetch-result",o.id),o}async function ez(r,a=Wa){const e={...Wa,...a};if(e.empty)return{data:{project:{id:r.id,type:n.Project,version:m.UUID.uuid(),createdAt:E().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]},record:{}}};if(e.mock){const i={...cp};return i.id=r.id,{data:{project:i,record:{}}}}return console.log("Fetching project from external API"),new Promise(async i=>{try{if(e.onFetch){const s=await e.onFetch(r.id);if(s){i({data:s});return}}else i({data:null})}catch(s){console.error("Error fetching project: ",s),i({data:null})}})}function od(r){const a=new m(r);return YS(a),zS(a),JS(a),HS(a),KS(a),XS(a),QS(a),Array.from(new Set([...a.getAllBuiltInIds(),...Gi()])).forEach(t=>{if(!a.builtInInstances[t]&&a.instances[t])a.builtInInstances[t]=a.instances[t],delete a.instances[t];else if(!a.builtInInstances[t])throw new Error(`Built in entity was not properly initialized: ${t}`)}),a}function ld(r,a){return r.instancesList.filter(t=>E(t.createdAt).isAfter(E(a)||!!t.previousVersion))}function tz(r,{enrich:a}={enrich:!0}){const e=new Map,t=Array.from(new Set([...r.getAllBuiltInIds(),...Gi()]));Object.keys(r.instances).forEach(u=>{if(t.includes(u)){e.set(u,u);return}const f=r.get(u);if(!nd(f,{...r.instances,...r.builtInInstances}).every(I=>!t.includes(I))){e.set(u,u);return}e.set(u,m.UUID.uuid())});const i=E().toISOString(),s=r.toShallowJSON({seenEntityMaps:e});s.previousVersion=null,s.createdAt=i,s.version=m.UUID.uuid();const l=od(s),o=a?l.addChangeSet(new b(l,m.sessionAuthor,i,l,!0,"project-clone")):null,d=new Ua(r);return d.visit(u=>{const f=u.toShallowJSON({seenEntityMaps:e});f.previousVersion=null,f.createdAt=i,f.version=m.UUID.uuid();const c=C(f,l);c.hydrateAncestors(),c.addSelfToProject(o),o==null||o.add(c,A.Added)}),a?(d.visit(u=>{const f=l.get(e.get(u.id));f&&f.afterAllChildrenInitialized(o)}),l.afterAllChildrenInitialized(o)):ld(l,i).forEach(f=>{f.remove({ignoreUpstream:!0},null)}),l.instancesList.forEach(u=>{u.previousVersion=null}),o==null||o.attemptAutoclose("project-clone",l.id),l}function MP(r,{enrich:a}={enrich:!0}){const e=od(r),t=E().toISOString(),i=a?e.addChangeSet(new b(e,m.sessionAuthor,t,e,!0,"project-init")):null;i&&(i.type=_c.Automatic);const s=new Ua(r);return s.visit(l=>{const o=C(l,e);o.hydrateAncestors(),o.addSelfToProject(i)}),a?(s.visit(l=>{const o=e.get(l.id);o&&o.afterAllChildrenInitialized(i)}),e.afterAllChildrenInitialized(i)):ld(e,t).forEach(o=>{o.remove({ignoreUpstream:!0},null)}),i==null||i.attemptAutoclose("project-init",e.id),e}async function iz(r,a=Wa){const e={...Wa,...a};if(r.id&&Fn[r.id]&&!e.ignoreCache)return Fn[r.id];if(r.id&&ad[r.id]&&!e.ignoreCache)return await ad[r.id],Fn[r.id];const t=ez(r,e);r.id&&(ad[r.id]=t);const i=await t;if(i.data){let s;return e.mock?s=MP(cp,{enrich:!!e.enrich}):i.data instanceof m?s=i.data:s=BP(i.data,{enrich:!!e.enrich}),Fn[r.id]=s,r.id&&delete ad[r.id],s}return null}function rz(r){return Fn[r.id]&&delete Fn[r.id],null}y.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=kc,y.ALL_BUILT_IN_BASE_ENTITIES=WT,y.ALL_BUILT_IN_CONDITION_ENTITIES=aI,y.ALL_BUILT_IN_GLOBAL_EVENT_ENTITIES=lI,y.ALL_BUILT_IN_LOOP_BODY_ENTITIES=IE,y.ALL_BUILT_IN_LOOP_ENTITIES=TE,y.ALL_BUILT_IN_OPERATION_ENTITIES=B0,y.ALL_BUILT_IN_PRIMITIVE_ENTITIES=Tf,y.ALL_BUILT_IN_TOP_LEVEL_ENTITIES=hI,y.ALL_BUILT_IN_VALUE_DESCRIPTORS=fI,y.ActionDescriptorState=We,y.ActionInputMapState=oW,y.ActionOutputMapState=uW,y.AppendToListOperationInputIds=Py,y.AppendToListOperationOutputIds=Vy,y.ArgumentDeclarationDependencyField=k1,y.ArgumentDeclarationState=br,y.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=Gc,y.BUILT_IN_BASE_ENTITY_IDS=k,y.BUILT_IN_ENTITY_TYPES=si,y.BaseCanvasDraggableState=PS,y.BaseEntityNames=J,y.BaseState=wS,y.BaseValueDescriptorIds=Jn,y.BreakStatementDependencyField=W1,y.BreakStatementState=tn,y.BuiltInBaseEntityState=Fi,y.CACHED_PROJECTS_BY_ID=Fn,y.CALLABLE_ENTITIES_EXPLANATION=TW,y.CALLABLE_TYPES=xi,y.CALLER_ENTITIES_EXPLANATION=K1,y.CALLER_TYPES=ki,y.CALLS_UPDATE_EXPLANATION=nn,y.COMPARISON_CONDITIONS=nI,y.CONDITIONS=sI,y.CUSTOM_ENTITY_OPERATIONS=Ym,y.CallableEntityClass=CS,y.CallerEntityClass=af,y.ChangeSet=b,y.ChangeSetChangeCaptureType=_c,y.ChangeSetEntityChangeType=A,y.ChildEntityState=VS,y.CommonStringValidationErrorCodes=cw,y.ComparisonOperatorTypes=ft,y.ConditionDependencyField=P1,y.ConditionState=zr,y.ContinueStatementDependencyField=A1,y.ContinueStatementState=Gt,y.CreateNewInputIds=Rm,y.CreateNewOutputIds=Dm,y.DRAGGABLE_CALLABLE_TYPES=cd,y.DRAGGABLE_CALLER_TYPES=pf,y.DRAGGABLE_ELEMENT_TYPES=Ka,y.DRAGGABLE_EXECUTABLE_TYPES=$P,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=Ha,y.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=pd,y.DataTypeCompatibilityTypes=Pi,y.DataTypeDependencyField=Bc,y.DataTypeParentChildRelation=Pt,y.DataTypeState=Zr,y.DefinitionEntityDependencyField=sd,y.DefinitionEntityState=dn,y.EDITABLE_PERSISTANCE_REPOSITORY_DEFAULTS=DS,y.ENTITIES_WITH_VALLUES_EXPLANATION=ql,y.ENTITY_PERSISTANCE_OPTIONS_DEFAULTS=U,y.ENTITY_RECUSION_OPTIONS_DEFAULTS=W,y.ENTITY_TYPES=GP,y.ENTITY_WITH_DECLARATION_TYPES=jP,y.ENTITY_WITH_LOGIC_SCOPE_TYPES=ht,y.ENTITY_WITH_NAMES_TYPES=cf,y.ENTITY_WITH_PARENT_TYPES=NP,y.ENTITY_WITH_USER_MANAGED_DECLARATION_TYPES=df,y.ENTITY_WITH_USER_MANAGED_SINGLE_IMPLEMENTS_TYPES=LP,y.ENTITY_WITH_VALUE_TYPES=lf,y.ENTRY_POINT_ENTITIES_EXPLANATION=La,y.ENTRY_POINT_TYPES=rt,y.EVENT_TYPES=qn,y.EXECUTABLE_TYPES=UP,y.EXECUTION_OPERATIONS=bm,y.EndpointEntity=_P,y.EntityAction=RP,y.EntityError=Ye,y.EntityErrorSeverity=w,y.EntityGenerationError=P,y.EntityGenerationErrorCode=R,y.EntityInstanceErrorCode=x,y.EntityOperations=et,y.EntityType=n,y.EntityWithLogicScopeClass=NS,y.EntityWithValueClass=MS,y.EntryPointEntityClass=_S,y.Events=of,y.ExecutionOperations=Qe,y.ExecutionTerminationType=D1,y.FunctionCallDependencyField=lw,y.FunctionCallState=an,y.FunctionDeclarationDependencyField=f1,y.FunctionDeclarationState=kr,y.GET_PROJECT_OPTIONS_DEFAULTS=Wa,y.GLOBAL_EVENT_DECLARATIONS=oI,y.GetLastInListOperationInputIds=yy,y.GetLastInListOperationOutputIds=my,y.GlobalEventNames=sr,y.GlobalEventState=Wr,y.HTTPOperations=Ut,y.HTTPStatucCodeValidationErrorCodes=VP,y.HTTP_OPERATIONS=C0,y.InputMapDependencyField=G1,y.InputMapState=er,y.InstalledProjectState=Xr,y.InternalCallDependencyField=U1,y.InternalCallState=Qr,y.JoinListOperationInputIds=jh,y.JoinListOperationOutputIds=Uh,y.LIST_OPERATIONS=xy,y.ListOperations=ye,y.LiteralValueDependencyField=q1,y.LiteralValueState=en,y.LoopDependencyField=O1,y.LoopState=Sr,y.LoopTypes=ee,y.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=sn,y.NUMBER_OPERATIONS=Yf,y.NumberOperations=tt,y.OPERATION_DECLARATIONS=_0,y.OperationDependencyField=m1,y.OperationState=qr,y.OutputMapDependencyField=F1,y.OutputMapParentChildRelation=Zn,y.OutputMapState=tr,y.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=Jl,y.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=rn,y.PASS_THROUGH_CALLABLE_TYPES=dt,y.PASS_THROUGH_CALLABLE_TYPES_WITH_OUTPUTS=uf,y.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=xc,y.ParallelExecutionOperation=DP,y.PassThroughCallableEntityClass=BS,y.PersistedEntity=PP,y.PersistedEntityMethods=hi,y.PrimitiveEntityState=ni,y.PrimitiveTypes=N,y.ProjectState=m,y.ProjectStateEvents=Bt,y.PropertyDependencyField=p1,y.PropertyState=xr,y.READ_ONLY_ENTITY_PERSISTANCE_REPOSITORY=AP,y.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=IW,y.ReturnDeclarationDependencyField=E1,y.ReturnDeclarationState=ri,y.ReturnStatementDependencyField=Mc,y.ReturnStatementState=Jr,y.STANDALONE_CONDITIONS=YT,y.STRING_OPERATIONS=Lh,y.ScopeCompatibilityType=id,y.SearchDependencyField=M1,y.SearchState=Kr,y.SequentialExecutionOperation=wP,y.SequentialExecutionOperationInputIds=dm,y.SequentialExecutionOperationOutputIds=um,y.SharedEntityErrorCode=$,y.SharedStateFunctionality=IP,y.SplitListOperationInputIds=Kh,y.SplitListOperationOutputIds=Xh,y.StandaloneOperatorTypes=Ri,y.StringOperations=Ae,y.TERMINATION_TYPES=ot,y.Traverser=Ua,y.USER_MANAGED_ENTITY_TYPES=ff,y.UserManagedEntityStateTemplate=OS,y.VALUE_READING_ENTITIES_EXPLANATION=Fc,y.VALUE_READING_TYPES=wr,y.VALUE_WRITING_ENTITIES_EXPLANATION=X1,y.VALUE_WRITING_TYPES=Et,y.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=gc,y.VARIABLE_TYPES=it,y.ValueAutogenerationType=vt,y.ValueDescriptorDependencyField=z1,y.ValueDescriptorParentChildRelation=L,y.ValueDescriptorState=ir,y.ValueReadingEntityClass=Or,y.ValueWritingEntityClass=Ja,y.VariableDeclarationDependencyField=_1,y.VariableDeclarationState=Hr,y.VariableInputMapState=aW,y.VariableInstanceDependencyField=Lc,y.VariableInstanceState=Yr,y.VariableOutputMapState=dW,y.WaitOperation=OP,y.WaitOperationInputIds=im,y.WaitOperationOutputIds=rm,y.actionDescriptorValidation=XJ,y.appendToListOperation=to,y.appendToListOperationElementToAppendArgument=wd,y.appendToListOperationElementToAppendArgumentParentRef=Uy,y.appendToListOperationElementToAppendArgumentRef=By,y.appendToListOperationError=Fy,y.appendToListOperationErrorParentRef=gy,y.appendToListOperationListArgument=Od,y.appendToListOperationListArgumentParentRef=jy,y.appendToListOperationListArgumentRef=Cy,y.appendToListOperationListDataType=_y,y.appendToListOperationResultListDataType=Ly,y.appendToListOperationResultListReturn=Gy,y.appendToListOperationResultListReturnParentRef=$y,y.appendToListOperationResultListReturnRef=Ny,y.appendToListOperationSecondListDataType=My,y.applyNewScope=Q,y.argumentDeclarationValidation=pW,y.asGenerationActionExample=rr,y.booleanPrototype=ar,y.breakStatementValidation=hW,y.calculateNewParentBasedOnCallers=zc,y.capitalizeFirstLetter=_t,y.changeSetJSONRecordToUniqueIds=GJ,y.checkAreDataTypesCompatible=Vi,y.checkAreDefinitionEntitiesCompatibleAsDataType=SO,y.checkArePropertiesCompatibleAsDataType=WO,y.checkExtendsBaseEntity=rd,y.checkHasBaseEntity=gi,y.checkHasMetadataChanged=pt,y.checkImplementationsOverlap=Dr,y.checkImplementsBaseEntity=QW,y.checkIsBranchDependentButNotDirectlyOnBranch=$a,y.checkIsBranchDependentOnBranch=NW,y.checkIsCallableEntityReachable=qa,y.checkIsCanvasEntity=KW,y.checkIsDetachedBranch=pP,y.checkIsDetachedBranchShallow=nf,y.checkIsGlobalVariable=YW,y.checkIsGloballyDeclared=rf,y.checkIsMethod=hP,y.checkIsNestedScope=td,y.checkScopeCompatibility=Za,y.cloneProject=tz,y.conditionValidation=QJ,y.continueStatementValidation=zJ,y.convertToAbstract=CW,y.convertToNonAbstract=_W,y.convertToNonStatic=MW,y.convertToStatic=BW,y.countedLoopActionDescriptor=gs,y.countedLoopActionDescriptorDynamicReturnDeclaration=pE,y.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=uE,y.countedLoopActionDescriptorStringArgumentDeclaration=dE,y.countedLoopActionDescriptorStringArgumentDeclarationDataType=oE,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=sE,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=nE,y.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=aE,y.countedLoopActionDescriptorStringArgumentDeclarationParentRef=lE,y.countedLoopBodyActionDescriptor=ho,y.countedLoopBodyActionDescriptorAnyDynamicArgument=mE,y.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=yE,y.countedLoopBodyActionDescriptorAnyDynamicReturn=EE,y.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=vE,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=xd,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=fE,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=cE,y.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=hE,y.createDefinitionEntityFromJSONObject=Hl,y.createEntityError=fe,y.createNestedDataTypeForEntity=pw,y.createNewInstanceOperation=cn,y.createNewInstanceOperationEntityToInstanciateArgument=Mm,y.createNewInstanceOperationEntityToInstanciateArgumentRef=Cm,y.createNewInstanceOperationEntityToInstanciateDataType=_m,y.createNewInstanceOperationError=Um,y.createNewInstanceOperationErrorParentRef=jm,y.createNewInstanceOperationNewEntityDataArgument=Vm,y.createNewInstanceOperationNewEntityDataArgumentDataType=Pm,y.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=wm,y.createNewInstanceOperationNewEntityDataArgumentParentRef=Om,y.createNewInstanceOperationOutputEntityDeclaration=Lm,y.createNewInstanceOperationOutputEntityDeclarationParentRef=Nm,y.createNewInstanceOperationRef=Bm,y.createSemanticId=s1,y.createStateFromGenerationTargetType=RS,y.createStateFromType=st,y.createStateFromTypeAndSubscribe=C,y.cronJobBuiltInBaseEntity=To,y.cronJobBuiltInBaseEntityExpressionProperty=qT,y.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=WP,y.cronJobBuiltInBaseEntityExpressionPropertyRef=kT,y.cronJobBuiltInBaseEntityRef=ZT,y.cronJobTriggeredFunctionDeclarationBlueprint=tu,y.cronJobTriggeredFunctionDeclarationBlueprintParentRef=FT,y.dataTypeCompatibilityToErrorExplanation=aw,y.dataTypeValidation=kJ,y.datePrototype=Zi,y.dateValueAutogenerationSchema=vp,y.definitionEntityToZodSchema=_I,y.definitionEntityValidation=TS,y.deletePersistedEntityMethod=eu,y.deletePersistedEntityMethodParentRef=OT,y.deleteRootProject=rz,y.endpointBuiltInBaseEntity=ai,y.endpointBuiltInBaseEntityRef=DE,y.endpointBuiltInBaseEntityRefFour=aT,y.endpointBuiltInBaseEntityRefThree=NE,y.endpointBuiltInBaseEntityRefTwo=CE,y.endpointBuiltInCorsProperty=OE,y.endpointBuiltInCorsPropertyDataType=RE,y.endpointBuiltInCorsPropertyDataTypeRef=AE,y.endpointBuiltInCorsPropertyRef=bE,y.endpointBuiltInMethodProperty=Zd,y.endpointBuiltInMethodPropertyDataType=ME,y.endpointBuiltInMethodPropertyDataTypeRef=_E,y.endpointBuiltInMethodPropertyRef=BE,y.endpointBuiltInPathProperty=kd,y.endpointBuiltInPathPropertyDataType=VE,y.endpointBuiltInPathPropertyDataTypeRef=wE,y.endpointBuiltInPathPropertyRef=PE,y.endpointPathParamsArgumentDeclaration=Jd,y.endpointPathParamsArgumentDeclarationRef=ZE,y.endpointPathParamsVariableDataType=qE,y.endpointPathParamsVariableDataTypeRef=kE,y.endpointReachedTriggerActionDescriptor=Kd,y.endpointReachedTriggerActionDescriptorRef=JE,y.endpointReachedTriggerActionDescriptorRefFour=zE,y.endpointReachedTriggerActionDescriptorRefThree=SE,y.endpointReachedTriggerActionDescriptorRefTwo=WE,y.endpointRequestBodyArgumentDeclaration=Sd,y.endpointRequestBodyArgumentDeclarationRef=$E,y.endpointRequestBodyVariableDataType=GE,y.endpointRequestHeadersArgumentDeclaration=qd,y.endpointRequestHeadersArgumentDeclarationRef=jE,y.endpointRequestHeadersVariableDataType=UE,y.endpointRequestHeadersVariableDataTypeRef=LE,y.endpointRequestQueryParamsArgumentDeclaration=Wd,y.endpointRequestQueryParamsArgumentDeclarationRef=FE,y.endpointRequestQueryParamsVariableDataType=xE,y.endpointRequestQueryParamsVariableDataTypeRef=gE,y.endpointResponseBodyDataType=nT,y.endpointResponseBodyReturnDeclaration=Hd,y.endpointResponseBodyReturnDeclarationRef=rT,y.endpointResponseCodeDataType=HE,y.endpointResponseCodeReturnDeclaration=zd,y.endpointResponseCodeReturnDeclarationDefaultValueParentRef=XE,y.endpointResponseCodeReturnDeclarationRef=YE,y.endpointResponseHeadersDataType=tT,y.endpointResponseHeadersDataTypeRef=QE,y.endpointResponseHeadersReturnDeclaration=Yd,y.endpointResponseHeadersReturnDeclarationRef=eT,y.endpointReturnStatementRef=KE,y.endpointReturnStatementRefThree=sT,y.endpointReturnStatementRefTwo=iT,y.enrichFromKnownEntities=Ga,y.enumOptionsProperty=Ef,y.enumOptionsPropertyDataType=mf,y.enumOptionsPropertyDataTypeRef=hf,y.enumOptionsPropertyRef=yf,y.enumPrototype=or,y.enumPrototypeRef=vf,y.executionBuiltInBaseEntity=Io,y.executionBuiltInEntityAbortMethod=iu,y.executionBuiltInEntityAbortMethodParentRef=JT,y.filterOutDuplicateEntities=p,y.filterOutDuplicateErrors=K3,y.findEntityFromKeys=Wc,y.findReferenceToSelfInList=Cw,y.findReferencesToSelfInProject=kW,y.flattenActionDescriptor=_w,y.flattenArgumentDeclaration=Bw,y.flattenBreakStatement=Mw,y.flattenBuiltInBaseEntity=Nw,y.flattenCalls=Ci,y.flattenCanvasAncestorsUntil=_s,y.flattenCondition=Lw,y.flattenContinueStatement=jw,y.flattenDataType=$w,y.flattenDefinitionEntity=Uw,y.flattenDefinitionEntityExtensionAndImplementationTypes=tf,y.flattenDefinitionEntityExtensionTypes=Fa,y.flattenDefinitionEntityExtensions=Qc,y.flattenDefinitionEntityImplementations=ef,y.flattenDefinitionEntityImplementionTypes=ga,y.flattenDerivedCanvasEntities=ci,y.flattenDetachedBranch=fP,y.flattenElementCalls=Te,y.flattenElementCallsOnTheSameScope=xW,y.flattenEntity=j,y.flattenFunctionCall=Gw,y.flattenFunctionDeclaration=gw,y.flattenGlobalEvent=Fw,y.flattenInputMap=xw,y.flattenInstalledProject=kw,y.flattenInternalCall=Zw,y.flattenLiteralValue=qw,y.flattenLoop=Jw,y.flattenOperation=Ww,y.flattenOutputMap=Sw,y.flattenPrimitiveEntity=zw,y.flattenProject=Yw,y.flattenProjectElements=Vw,y.flattenProperty=Hw,y.flattenRelatedCanvasElementsOnTheLeft=lP,y.flattenRelatedCanvasElementsOnTheRight=oP,y.flattenReturnDeclaration=Kw,y.flattenReturnStatement=Xw,y.flattenSearch=Qw,y.flattenValueDescriptor=eP,y.flattenVariableDeclaration=tP,y.flattenVariableInstance=iP,y.flattenVariableReads=Pw,y.flattenVariableWrites=ww,y.flattenVariables=He,y.fromChangeSetToRecordChangeSet=aS,y.fromZodParseToEntityGenerationErrors=jc,y.functionCallValidation=VW,y.functionDeclarationValidation=xJ,y.generate=HC,y.generateActionExample=AW,y.generateExecutionDataType=VJ,y.generateIdFromStrategy=yt,y.generateMutablePropertiesExplanation=xl,y.generateRandomBoolean=rA,y.generateRandomDate=LI,y.generateRandomDateAfter=BI,y.generateRandomDateBefore=MI,y.generateRandomDateBetweenRange=NI,y.generateRandomNumber=XI,y.generateRandomNumberAfter=YI,y.generateRandomNumberBefore=HI,y.generateRandomNumberBetweenRange=KI,y.generateRandomText=iA,y.generateRandomTextAfter=QI,y.generateRandomTextBefore=eA,y.generateRandomTextBetweenRange=tA,y.generateUniqueUUID=zI,y.getAllActionDescriptorsForConditions=zl,y.getAllActionDescriptorsForGlobalEvents=Wl,y.getAllActionDescriptorsForLoops=Sl,y.getAllActionDescriptorsForOperations=OW,y.getAllBuiltInEntityIds=Gi,y.getAllGloballyDeclaredFunctionDeclarationsExplanation=rw,y.getBaseBuiltInEntities=St,y.getBaseSchemaBasedOnType=Y1,y.getBuiltInEntityOwner=ln,y.getCallableEntityReferenceSchema=Ct,y.getCallableEntityTypeSchema=LD,y.getCalledBy=Ai,y.getCallerEntityReferenceSchema=tq,y.getCallerEntityTypeSchema=eq,y.getCalls=Hc,y.getCanvasEntitiesDerivedFromInternalCalls=aP,y.getCanvasEntitiesDerivedFromWrites=Bs,y.getCanvasEntityDerivedFromValueReadingEntity=ed,y.getCanvasEntityDerivedFromValueReadingEntityFromTransfer=sP,y.getCanvasEntityReferenceSchema=Eq,y.getCanvasEntityTypeSchema=vq,y.getChildrenEntityWithValues=jW,y.getColumnProperties=rS,y.getCommonAncestor=Yc,y.getCommonChildren=yw,y.getDatabaseEntities=tS,y.getDatabaseEntity=nS,y.getDeclaration=Gn,y.getDeclarationOutputedError=lS,y.getDeepestScope=mP,y.getDraggableCallableEntityReferenceSchema=UD,y.getDraggableCallableEntityTypeSchema=jD,y.getDraggableCallerEntityReferenceSchema=rq,y.getDraggableCallerEntityTypeSchema=iq,y.getDraggableExecutableEntityReferenceSchema=oq,y.getDraggableExecutableEntityTypeSchema=aq,y.getDraggablePassThroughCallableEntityReferenceSchema=Cl,y.getDraggablePassThroughCallableEntityTypeSchema=Vl,y.getDraggablePlayableEntityReferenceSchema=cq,y.getDraggablePlayableEntityTypeSchema=pq,y.getEntitiesCreatedSinceInitialization=ld,y.getEntityArgumentDeclarations=Xc,y.getEntityInputMaps=rP,y.getEntityOutputMaps=WW,y.getEntityReferenceSchema=mq,y.getEntityReturnDeclarations=nP,y.getEntityTypeSchema=yq,y.getEntityWithLogicScopeReferenceSchema=Tr,y.getEntityWithLogicScopeTypeSchema=lq,y.getEntityWithValueReferenceSchema=ND,y.getEntityWithValueTypeSchema=QZ,y.getEntryPointEntityReferenceSchema=wt,y.getEntryPointEntityTypeSchema=Gr,y.getEventEntityReferenceSchema=wl,y.getEventEntityTypeSchema=Ol,y.getExecutableEntityReferenceSchema=sq,y.getExecutableEntityTypeSchema=nq,y.getExtendedBuiltInEntity=SW,y.getExtendedDefinitionEntity=uP,y.getFirstNonLoopScopeOwner=It,y.getGenerationTargetSchemaBasedOnType=H1,y.getHeadIfPartOfDetachedBranch=cP,y.getHighestScope=yP,y.getImplementedBuiltInEntity=zW,y.getIsInteractive=xa,y.getLastInListOperation=Dd,y.getLastInListOperationError=wy,y.getLastInListOperationErrorParentRef=Oy,y.getLastInListOperationInputListArgument=by,y.getLastInListOperationInputListArgumentParentRef=Ay,y.getLastInListOperationInputListArgumentRef=vy,y.getLastInListOperationInputListDataType=Ey,y.getLastInListOperationOutputElementDataType=Iy,y.getLastInListOperationOutputElementReturn=Dy,y.getLastInListOperationOutputElementReturnParentRef=Ry,y.getLastInListOperationOutputElementReturnRef=Ty,y.getLinkedEntitiesFromArgumentDeclaration=FW,y.getLowestPersistedEntityImplementation=dP,y.getParentCallableEntity=mw,y.getParentCallerEntity=Ew,y.getParentCanvasEntities=gt,y.getParentCanvasEntity=Rt,y.getParentCanvasEntityFromTransfer=Kl,y.getParentEntryPoint=LW,y.getParentPassthroughCallableEntity=vw,y.getPassThroughCallableEntityReferenceSchema=nt,y.getPassThroughCallableEntityTypeSchema=Pl,y.getPeristedEntities=eS,y.getPlayableEntityReferenceSchema=uq,y.getPlayableEntityTypeSchema=dq,y.getProject=iz,y.getPrototypeByType=ka,y.getRecusriveParentsIds=nd,y.getReferenceEntityId=B,y.getReferencedEntitiesStateOrErrors=Zl,y.getReferencedEntityStateOrErrors=Uc,y.getReferencedIds=Ql,y.getRelatedCanvasElementsOnTheLeft=gn,y.getRelatedCanvasElementsOnTheLeftFromTransfer=ZW,y.getRelatedCanvasElementsOnTheRight=on,y.getRootEntryPointScopeOwner=sf,y.getScopeOwner=zt,y.getStateClassFromType=sS,y.getTerminationReferenceSchema=hq,y.getTerminationTypeSchema=fq,y.getTouchedCanvasEntitiesFromChangeSet=oS,y.getUsedArgFromDeclaration=qW,y.getUsedReturnFromDeclaration=JW,y.getValueReadingEntityReferenceSchema=MD,y.getValueReadingEntityTypeSchema=Er,y.getValueWritingEntityReferenceSchema=XZ,y.getValueWritingEntityTypeSchema=Ra,y.getVariableFromInputMapping=Iw,y.getVariableFromReturnVariablePointer=Rw,y.getVariableReferenceSchema=$r,y.getVariableTypeSchema=Mn,y.getVariablesFromArgumentDeclarations=Xl,y.getVariablesFromInputMaps=Aw,y.getVariablesFromOutputMapping=Dw,y.getVariablesFromOutputMaps=Ow,y.getVariablesFromReturnDeclarations=bw,y.getVariablesInSameOrHigherScope=bc,y.getWrites=Kc,y.globalEventValidation=YJ,y.groupCallsBasedOnParallelizableExecution=$W,y.handleAfterEntityImplementationSideEffects=uw,y.handleBeforeEntityImplementationSideEffects=dw,y.httpRequestBodyArgument=so,y.httpRequestBodyArgumentRef=l0,y.httpRequestBodyDataType=d0,y.httpRequestHeadersArgument=no,y.httpRequestHeadersArgumentRef=a0,y.httpRequestHeadersDataType=o0,y.httpRequestMethodArgument=io,y.httpRequestMethodArgumentRef=n0,y.httpRequestMethodDataType=s0,y.httpRequestMethodDataTypeRef=i0,y.httpRequestOperation=js,y.httpRequestOperationErrorValueDescriptor=Md,y.httpRequestOperationErrorValueDescriptorDatatype=V0,y.httpRequestOperationErrorValueDescriptorRef=P0,y.httpRequestOperationRef=R0,y.httpRequestOperationRefEight=O0,y.httpRequestOperationRefFive=A0,y.httpRequestOperationRefFour=I0,y.httpRequestOperationRefNine=w0,y.httpRequestOperationRefSeven=D0,y.httpRequestOperationRefSix=b0,y.httpRequestOperationRefThree=T0,y.httpRequestOperationRefTwo=E0,y.httpRequestQueryParamsArgument=Bd,y.httpRequestQueryParamsArgumentRef=e0,y.httpRequestQueryParamsDataType=t0,y.httpRequestVariableURLArgument=ro,y.httpRequestVariableURLArgumentRef=Xm,y.httpRequestVariableURLDataType=Qm,y.httpRequestVariableURLDataTypeRef=Hm,y.httpResponseBodyReturnDataType=v0,y.httpResponseBodyReturnDataTypeRef=y0,y.httpResponseBodyReturnReturn=lo,y.httpResponseBodyReturnReturnRef=m0,y.httpResponseCodeDataType=p0,y.httpResponseCodeReturn=ao,y.httpResponseCodeReturnRef=u0,y.httpResponseHeadersDataType=h0,y.httpResponseHeadersDataTypeRef=c0,y.httpResponseHeadersReturn=oo,y.httpResponseHeadersReturnRef=f0,y.httpStatusCodeValueValidation=CP,y.implement=Yl,y.inferArgumentDeclarationDataType=zO,y.inferDataType=$i,y.inferInputMapDataType=Tc,y.inferOutputMapDataType=Ac,y.inferPropertyDataType=KO,y.inferReturnDeclarationDataType=Ic,y.inferValueDescriptorDataType=XO,y.inferVariableDeclarationDataType=HO,y.inferVariableInstanceDataType=YO,y.initBaseProjectEntity=od,y.initProject=MP,y.initProjectFromFetchResult=BP,y.inputMapValidation=sW,y.installedProjectValidation=rW,y.internalCallValidation=nW,y.isPromise=Jc,y.iterateOverListActionDescriptorListArgumentDeclaration=lv,y.iterateOverListActionDescriptorListArgumentDeclarationDataType=av,y.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=sv,y.iterateOverListActionDescriptorListArgumentDeclarationParentRef=ov,y.iterateOverListLoopActionDescriptor=Pr,y.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=uv,y.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=dv,y.iterateOverListLoopBodyActionDescriptor=Gs,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=Tv,y.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Ev,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=Av,y.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=Iv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=fo,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=cv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=pv,y.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=fv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=vv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=yv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=hv,y.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=mv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=wv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=Dv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=Rv,y.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=Ov,y.iterateOverObjectKeysLoopActionDescriptor=Yn,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=Vv,y.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=Pv,y.iterateOverObjectKeysLoopBodyActionDescriptor=$d,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=$v,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Uv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=gv,y.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=Gv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Ud,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=_v,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Cv,y.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Bv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=jv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Nv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Mv,y.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Lv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=qv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=kv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=xv,y.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=Zv,y.iterateOverObjectValuesLoopActionDescriptor=Hn,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=Wv,y.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=Jv,y.iterateOverObjectValuesLoopBodyActionDescriptor=gd,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=tE,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=eE,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=rE,y.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=iE,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Gd,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=zv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Sv,y.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Yv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Qv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Kv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Hv,y.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Xv,y.iterateOverStringActionDescriptorDynamicReturnDeclaration=S0,y.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=W0,y.iterateOverStringActionDescriptorStringArgumentDeclaration=J0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=Z0,y.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=k0,y.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=q0,y.iterateOverStringLoopActionDescriptor=$s,y.iterateOverStringLoopBodyActionDescriptor=co,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=tv,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=ev,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=rv,y.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=iv,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Ld,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=Y0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=z0,y.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=H0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=jd,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=X0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=K0,y.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Q0,y.joinListOperation=Ad,y.joinListOperationError=Hh,y.joinListOperationErrorParentRef=Yh,y.joinListOperationFirstListArgument=qh,y.joinListOperationFirstListArgumentParentRef=Zh,y.joinListOperationFirstListArgumentRef=$h,y.joinListOperationFirstListDataType=Gh,y.joinListOperationResultListDataType=kh,y.joinListOperationResultListReturn=zh,y.joinListOperationResultListReturnParentRef=Sh,y.joinListOperationResultListReturnRef=xh,y.joinListOperationSecondListArgument=Wh,y.joinListOperationSecondListArgumentParentRef=Jh,y.joinListOperationSecondListArgumentRef=gh,y.joinListOperationSecondListDataType=Fh,y.joinListWithLastSeparator=se,y.joinStringsOperation=Ls,y.joinStringsOperationDynamicStringArgument=mh,y.joinStringsOperationDynamicStringArgumentParentRef=yh,y.joinStringsOperationDynamicStringArgumentRef=fh,y.joinStringsOperationDynamicStringDataType=hh,y.joinStringsOperationError=ch,y.joinStringsOperationErrorParentRef=ph,y.joinStringsOperationFirstStringArgument=Qa,y.joinStringsOperationFirstStringArgumentParentRef=ih,y.joinStringsOperationFirstStringArgumentRef=Hf,y.joinStringsOperationFirstStringDataType=Kf,y.joinStringsOperationResultStringDataType=th,y.joinStringsOperationResultStringReturn=Ns,y.joinStringsOperationResultStringReturnParentRef=uh,y.joinStringsOperationResultStringReturnRef=eh,y.joinStringsOperationSecondStringArgument=eo,y.joinStringsOperationSecondStringArgumentParentRef=dh,y.joinStringsOperationSecondStringArgumentRef=Xf,y.joinStringsOperationSecondStringDataType=Qf,y.joinStringsOperationSeparatorStringArgument=lh,y.joinStringsOperationSeparatorStringArgumentParentRef=oh,y.joinStringsOperationSeparatorStringArgumentRef=rh,y.joinStringsOperationSeparatorStringDataType=ah,y.joinStringsOperationSeparatorStringDataTypeDefaultValue=sh,y.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=nh,y.keyValuePrototype=Wn,y.literalValudValidation=cW,y.loopValidation=KJ,y.lowercaseFirstLetter=Na,y.manualFlowActionDescriptorDeclarationArgumentDeclaration=Nd,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=j0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=L0,y.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=U0,y.manualFlowLoopActionDescriptor=uo,y.manualFlowLoopActionDescriptorDynamicReturnDeclaration=N0,y.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=M0,y.manualFlowLoopBodyActionDescriptor=po,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=G0,y.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=$0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=F0,y.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=g0,y.mapActionDescriptorToTypeItRepresents=XW,y.mergeEntityErrorsList=X3,y.mergeListOfEntities=HW,y.methodDefaultValue=r0,y.mockClientProject=cp,y.moreThanOrEqualCondition=ts,y.moreThanOrEqualConditionLeftHandArgument=QT,y.moreThanOrEqualConditionLeftHandArgumentDataType=KT,y.moreThanOrEqualConditionLeftHandArgumentDataTypeParentRef=HT,y.moreThanOrEqualConditionLeftHandArgumentParentRef=XT,y.moreThanOrEqualConditionRightHandArgument=rI,y.moreThanOrEqualConditionRightHandArgumentDataType=tI,y.moreThanOrEqualConditionRightHandArgumentDataTypeParentRef=eI,y.moreThanOrEqualConditionRightHandArgumentParentRef=iI,y.noSpacesOrDashesValueValidation=hw,y.noSpacesValueValidation=fw,y.notEmptyCondition=En,y.notEmptyConditionArgument=zT,y.notEmptyConditionRef=ST,y.nullPrototype=fd,y.numberAdditionOperation=Xa,y.numberAdditionOperationDynamicSummandArgument=Mf,y.numberAdditionOperationDynamicSummandArgumentType=Bf,y.numberAdditionOperationDynamicSummandArgumentTypeParentRef=_f,y.numberAdditionOperationError=Cf,y.numberAdditionOperationErrorParentRef=Vf,y.numberAdditionOperationFirstNumberArgument=hd,y.numberAdditionOperationFirstNumberArgumentRef=If,y.numberAdditionOperationFirstNumberDataType=Af,y.numberAdditionOperationRef=wf,y.numberAdditionOperationRefThree=md,y.numberAdditionOperationRefTwo=Pf,y.numberAdditionOperationResultNumberDataType=Of,y.numberAdditionOperationResultNumberReturn=vd,y.numberAdditionOperationResultNumberReturnRef=Df,y.numberAdditionOperationSecondNumberArgument=yd,y.numberAdditionOperationSecondNumberArgumentRef=bf,y.numberAdditionOperationSecondNumberDataType=Rf,y.numberPrototype=Ee,y.numberSubtractionOperation=Td,y.numberSubtractionOperationDynamicSubtrahendArgument=zf,y.numberSubtractionOperationDynamicSubtrahendArgumentType=Sf,y.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=Wf,y.numberSubtractionOperationError=Jf,y.numberSubtractionOperationErrorParentRef=qf,y.numberSubtractionOperationFirstNumberArgument=gf,y.numberSubtractionOperationFirstNumberArgumentRef=Nf,y.numberSubtractionOperationFirstNumberDataType=Lf,y.numberSubtractionOperationRef=Ed,y.numberSubtractionOperationRefThree=kf,y.numberSubtractionOperationRefTwo=Ff,y.numberSubtractionOperationResultNumberDataType=Gf,y.numberSubtractionOperationResultNumberReturn=Zf,y.numberSubtractionOperationResultNumberReturnRef=$f,y.numberSubtractionOperationSecondNumberArgument=xf,y.numberSubtractionOperationSecondNumberArgumentRef=jf,y.numberSubtractionOperationSecondNumberDataType=Uf,y.numberValueAutogenerationSchema=mp,y.operationValidation=JJ,y.outputMapValidation=lW,y.parallelExecutionOperation=Bi,y.parallelExecutionOperationError=tm,y.parallelExecutionOperationErrorParentRef=em,y.parallelExecutionOperationListOfExecutionResultsDataType=Ky,y.parallelExecutionOperationListOfExecutionResultsReturn=Vd,y.parallelExecutionOperationListOfExecutionResultsReturnRef=Hy,y.parallelExecutionOperationListOfFunctionsArgument=Pd,y.parallelExecutionOperationListOfFunctionsArgumentDatatype=Yy,y.parallelExecutionOperationListOfFunctionsArgumentRef=zy,y.parallelExecutionOperationListOfFunctionsBlueprint=Sy,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=Jy,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicInputParentRef=qy,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=Zy,y.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutputParentRef=ky,y.parallelExecutionOperationListOfFunctionsBlueprintParentRef=Wy,y.parallelExecutionOperationRef=Xy,y.parallelExecutionOperationRefThree=Qy,y.persistedBuiltInBaseEntity=Nt,y.persistedBuiltInBaseEntityDatabaseProperty=Xn,y.persistedBuiltInBaseEntityDatabasePropertyDataType=VT,y.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=ZP,y.persistedBuiltInBaseEntityDatabasePropertyParentRef=CT,y.persistedBuiltInBaseEntityDatabasePropertyRef=PT,y.persistedBuiltInBaseEntityPrimaryKeyProperty=Qn,y.persistedBuiltInBaseEntityPrimaryKeyPropertyDataType=$T,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOption=BT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyNumberDataTypeOptionParentRef=_T,y.persistedBuiltInBaseEntityPrimaryKeyPropertyParentRef=GT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyRef=UT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOption=NT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyStringDataTypeOptionParentRef=MT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOption=jT,y.persistedBuiltInBaseEntityPrimaryKeyPropertyUUIDDataTypeOptionParentRef=LT,y.processOutputGlobalValueDescriptorDataType=uI,y.processOutputGlobalValueDescriptorReturn=bo,y.processOutputGlobalValueDescriptorReturnRef=dI,y.projectPublicationCompletedGlobalEvent=Ao,y.propertyToZodSchema=CI,y.propertyValidation=jJ,y.relationalDatabaseBuiltInBaseEntity=Ot,y.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Qd,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataType=RT,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=bT,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=DT,y.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=AT,y.relationalDatabaseBuiltInBaseEntityDefaultProperty=Xd,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataType=IT,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=ET,y.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=TT,y.relationalDatabaseBuiltInBaseEntityIdentifierProperty=yo,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataType=dT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=oT,y.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=lT,y.relationalDatabaseBuiltInBaseEntityMinSizeProperty=Eo,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataType=vT,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=yT,y.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=mT,y.relationalDatabaseBuiltInBaseEntityPasswordProperty=vo,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataType=fT,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=kP,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyDefaultValueParentRef=hT,y.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=cT,y.relationalDatabaseBuiltInBaseEntityRef=Kn,y.relationalDatabaseBuiltInBaseEntityUsernameProperty=mo,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataType=pT,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=xP,y.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=uT,y.resolveActionDescriptorName=n1,y.resolveBaseEntityName=e1,y.resolveBuiltInBaseEntityDataTypeLabel=t1,y.resolveClonedEntityProject=mt,y.resolveConditionOperatorLabel=Fl,y.resolveDataType=$l,y.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Sc,y.resolveDataTypeLabel=gl,y.resolveDefinitionEntityDataTypeLabel=NJ,y.resolveEntityDataTypeLabel=MJ,y.resolveEntityName=F,y.resolveFirstCallsSecond=GW,y.resolveFirstWritesSecond=gW,y.resolvePrimaryKeyProperty=iS,y.resolvePrimitiveEntityName=r1,y.resolveSearchName=i1,y.resolveVariableScope=CJ,y.returnDeclarationValidation=WJ,y.returnStatementValidation=SJ,y.searchStatementErrorGlobalValueDescriptor=su,y.searchStatementErrorGlobalValueDescriptorDataType=cI,y.searchStatementErrorGlobalValueDescriptorRef=pI,y.searchValidation=iW,y.sequentialExecutionOperation=ur,y.sequentialExecutionOperationError=Am,y.sequentialExecutionOperationErrorParentRef=Im,y.sequentialExecutionOperationListOfExecutionResultsDataType=vm,y.sequentialExecutionOperationListOfExecutionResultsReturn=_d,y.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=Tm,y.sequentialExecutionOperationListOfExecutionResultsReturnRef=mm,y.sequentialExecutionOperationListOfFunctionsArgument=Cd,y.sequentialExecutionOperationListOfFunctionsArgumentDatatype=ym,y.sequentialExecutionOperationListOfFunctionsArgumentParentRef=Em,y.sequentialExecutionOperationListOfFunctionsArgumentRef=hm,y.sequentialExecutionOperationListOfFunctionsBlueprint=fm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=cm,y.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=pm,y.softDeletePersistedEntityMethod=qP,y.softDeletePersistedEntityMethodParentRef=gT,y.sortCallsBasedOnExecutionDependencies=Tw,y.sortChildrenEntitiesBasedOnExecutionDependencies=UW,y.splitListOperation=Rd,y.splitListOperationError=hy,y.splitListOperationErrorParentRef=fy,y.splitListOperationFirstOutputListDataType=ry,y.splitListOperationFirstOutputListReturn=dy,y.splitListOperationFirstOutputListReturnParentRef=ly,y.splitListOperationFirstOutputListReturnRef=bd,y.splitListOperationInputListArgument=sy,y.splitListOperationInputListArgumentParentRef=ny,y.splitListOperationInputListArgumentRef=Qh,y.splitListOperationInputListDataType=ey,y.splitListOperationSecondOutputListDataType=uy,y.splitListOperationSecondOutputListReturn=cy,y.splitListOperationSecondOutputListReturnParentRef=py,y.splitListOperationSplitIndexArgument=oy,y.splitListOperationSplitIndexArgumentParentRef=ay,y.splitListOperationSplitIndexArgumentRef=ty,y.splitListOperationSplitIndexDataType=iy,y.splitStringOperation=Id,y.splitStringOperationError=Nh,y.splitStringOperationErrorParentRef=Mh,y.splitStringOperationFirstPartResultStringDataType=bh,y.splitStringOperationFirstPartResultStringReturn=Bh,y.splitStringOperationFirstPartResultStringReturnParentRef=_h,y.splitStringOperationFirstPartResultStringReturnRef=Ah,y.splitStringOperationIndexArgument=Vh,y.splitStringOperationIndexArgumentParentRef=Ph,y.splitStringOperationIndexArgumentRef=Th,y.splitStringOperationIndexDataType=Ih,y.splitStringOperationSecondPartResultStringDataType=Dh,y.splitStringOperationSecondPartResultStringReturn=gP,y.splitStringOperationSecondPartResultStringReturnParentRef=Ch,y.splitStringOperationSecondPartResultStringReturnRef=Rh,y.splitStringOperationStringArgument=wh,y.splitStringOperationStringArgumentParentRef=Oh,y.splitStringOperationStringArgumentRef=vh,y.splitStringOperationStringDataType=Eh,y.stringPrototype=ae,y.stringValueAutogenerationSchema=yp,y.suggestNewIdForEntity=Cc,y.test_primitive_entities_export=WS,y.toCamelCase=_J,y.toEntityState=bi,y.toKebabCase=QO,y.toLowerCaseKebabCase=Gl,y.toPascalCase=BJ,y.untypedDataPrototype=Vt,y.updateErrorsList=Ke,y.urlDefaultValue=Km,y.uuidPrototype=lr,y.validateArgumentDeclarationName=Pc,y.validateCalledByErrorIdInAction=RW,y.validateCalledByIdInAction=bW,y.validateCallers=iw,y.validateConditionEntityDeclaration=wW,y.validateDataOperation=fn,y.validateDataOperationDataToValidateArgument=Fm,y.validateDataOperationDataToValidateArgumentParentRef=gm,y.validateDataOperationDataToValidateArgumentRef=$m,y.validateDataOperationDataToValidateDataType=Gm,y.validateDataOperationEntityToMatchTypeArgument=qm,y.validateDataOperationEntityToMatchTypeArgumentParentRef=Zm,y.validateDataOperationEntityToMatchTypeArgumentRef=xm,y.validateDataOperationEntityToMatchTypeDataType=km,y.validateDataOperationError=zm,y.validateDataOperationErrorParentRef=Sm,y.validateDataOperationOutputEntityDeclaration=Wm,y.validateDataOperationOutputEntityDeclarationParentRef=Jm,y.validateDefinitionEntityName=Rc,y.validateEntryCaller=tw,y.validateErrorCaller=ew,y.validateFunctionCallDeclaration=nw,y.validateFunctionDeclarationName=Dc,y.validateGeneratedEntityParentIsNotBuiltInEntity=EW,y.validateGeneration=mW,y.validateGenerationTarget=ut,y.validateGenerationUpdate=vW,y.validateLoopEntityDeclaration=PW,y.validateName=LJ,y.validateOperationEntityDeclaration=sw,y.validatePropertyName=wc,y.validateReachability=Rr,y.validateReadsValueInActionPayload=DW,y.validateReferenceObject=kl,y.validateReferenceToOne=$c,y.validateReferences=bt,y.validateReturnDeclarationName=Vc,y.validateSuccessCaller=Q1,y.validateValueReaderGenerationUpdate=ja,y.validateValueWritter=Zc,y.validateVariableDeclarationName=Oc,y.validateVariableInternalCallUse=qc,y.valueAutogenerationCurrentDateAndTimeSchema=pD,y.valueAutogenerationGenericSchema=ul,y.valueAutogenerationOptions=Ep,y.valueAutogenerationOptionsSchema=uD,y.valueAutogenerationRandomBooleanSchema=hp,y.valueAutogenerationRandomDateBetweenSchema=ID,y.valueAutogenerationRandomDateFromSchema=ED,y.valueAutogenerationRandomDateSchema=fl,y.valueAutogenerationRandomDateUntilSchema=TD,y.valueAutogenerationRandomNumberBetweenSchema=hD,y.valueAutogenerationRandomNumberFromSchema=cD,y.valueAutogenerationRandomNumberSchema=pl,y.valueAutogenerationRandomNumberUntilSchema=fD,y.valueAutogenerationRandomSchema=ma,y.valueAutogenerationRandomTextBetweenSchema=vD,y.valueAutogenerationRandomTextFromSchema=yD,y.valueAutogenerationRandomTextSchema=cl,y.valueAutogenerationRandomTextUntilSchema=mD,y.valueAutogenerationRangeValueTypesSchema=ya,y.valueAutogenerationUniqueSchema=fp,y.valueDescriptorValidation=yW,y.variableDeclarationValidation=eW,y.variableInstanceValidation=tW,y.waitOperation=Ht,y.waitOperationMillisecondsNumberArgument=pn,y.waitOperationMillisecondsNumberArgumentRef=nm,y.waitOperationMillisecondsNumberDataType=sm,y.waitOperationOperationError=lm,y.waitOperationOperationErrorParentRef=om,y.waitOperationRef=am,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -98,6 +98,7 @@ export declare class ProjectState extends CombinedVersionedEvents implements IPr
|
|
|
98
98
|
onCloseChangeSetCallback: ((changeSet: ChangeSet) => Promise<{
|
|
99
99
|
success: boolean;
|
|
100
100
|
}>) | null;
|
|
101
|
+
onAddChangeSetCallback: ((changeSet: ChangeSet, undoableStackValueIndex: number) => void) | null;
|
|
101
102
|
onRequestActiveValueCallback: ((valueOwner: EntityWithValueState) => LiteralValueState | null) | null;
|
|
102
103
|
constructor(initialData: IProject | IProjectTransfer);
|
|
103
104
|
static sessionAuthor: string;
|
|
@@ -130,6 +131,7 @@ export declare class ProjectState extends CombinedVersionedEvents implements IPr
|
|
|
130
131
|
onCloseChangeSet(callback: (changeSet: ChangeSet) => Promise<{
|
|
131
132
|
success: boolean;
|
|
132
133
|
}>): Promise<void>;
|
|
134
|
+
onAddChangeSet(callback: (changeSet: ChangeSet, undoableStackValueIndex: number) => void): void;
|
|
133
135
|
closeChangeSet(changeSet: ChangeSet): Promise<void>;
|
|
134
136
|
toLatestChangeSet(author: string, timestamp: string, // ISO 8601 format
|
|
135
137
|
self: UserManagedEntityState | null, autoclose?: boolean, autoCloseActionName?: string): ChangeSet;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyx-code/project-logic-tree",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6278",
|
|
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",
|