@elyx-code/project-logic-tree 0.0.6677 → 0.0.6678

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.cjs CHANGED
@@ -47,12 +47,12 @@ You shouldn't have to manually update a 'parent' property. The equivalent result
47
47
  ${Fb(n)}`})):c.push(new De({id:`${i.id}--${ne.ReferencedEntityNotFound}`,code:ne.ReferencedEntityNotFound,severity:pe.Error,message:`Entity of type '${i.type}' with id '${i.id}' has an 'declaration' property that isn't found in the project. The 'declaration' property must point to one of the built-in action descriptors reserved for '${o.Condition}' entities.
48
48
  ${Fb(n)}`})):c.push(new De({id:`${i.id}--${Ie.InvalidObjectStructure}`,code:Ie.InvalidObjectStructure,severity:pe.Error,message:`Entity of type '${i.type}' with id '${i.id}' is missing the 'declaration' property. This property is required for a '${i.type}' entity and must point to one of the built-in action descriptors reserved for '${o.Condition}' entities.
49
49
  ${Fb(n)}`})),{errors:c,modifiedData:l}}validateGeneratedUpdate(i){const n=[];return i.parent&&n.push(new De({id:`${this.id}--${ne.InvalidParentUpdate}`,code:ne.InvalidParentUpdate,severity:pe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
50
- If an entity is called by another, they must be in the same scope, which means they have the same parent.`})),{errors:n,modifiedData:i}}subscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-dependents"))){const n=[],l=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const T=y.entity.afterAllChildrenInitialized(i);n.push(...T.updated),l.push(...T.added),c.push(...T.removed),e.push(...T.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}onDetachedDependencyRemoved(i,n,l){const c=[],e=[],y=[],T=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.remove({ignoreUpstream:!1},l);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}onDetachedDependencyRestored(i,n,l){const c=[],e=[],y=[],T=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.restore({},l);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}unsubscribeFromDependencies(){return this.parent.unsubscribeDependents([{entity:this,field:"parent"}]),this}subscribeToDependencies(){var i;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),this}increaseVersion(i){if(i&&!M(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&M(i).isSame(M(this.createdAt))?this:(this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=M(i).toISOString()||M().toISOString(),this)}captureVersion(){var n;const i=((n=this.knownVersions)==null?void 0:n.get(this.version))||new Ai(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.declaration=this.declaration,i.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,i.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const n=[],l=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);n.push(this.parent,...y.updated),l.push(...y.added),c.push(...y.removed)}return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}async restoreVersion(i){var T;const n=[],l=[],c=[],e=[];if(this.version===i)return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this};if(!this.knownVersions){const v=new Map;for(const[E,b]of this.knownVersions||new Map){if(v.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[O,P]of b.knownVersions)v.set(O,P);b.knownVersions=null}}let y=(T=this.knownVersions)==null?void 0:T.get(i);if(!y){const v=await this.APILoadVersion({},i);if(!v)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Ai(v,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.declaration=y.declaration,this.andChildrenGroup=y.andChildrenGroup,this.orChildrenGroup=y.orChildrenGroup,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.parent=y.parent,{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}updateWithShallowTransfer(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.UpdateWithShallowTransfer))){var l,c;if(!this.checkCanEdit(this,n))return te.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,n),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,i.parent){const e=re(i.parent),y=this.project.get(e),T=this.parent;if(T&&T.id!==(y==null?void 0:y.id)&&this.removeFromParent(n),y)this.setParent(y,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const e=re(i.declaration),y=this.project.get(e);y&&this.setDeclaration(y)}return(l=i.andChildrenGroup)==null||l.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addToAndGroup(T,n),T.setParent(this,n))}),[...this.andChildrenGroup||[]].forEach(e=>{var T;((T=i.andChildrenGroup)==null?void 0:T.find(v=>re(v)===e.id))||(this.removeChildGroup(e,n),e.removeFromParent(n))}),(c=i.orChildrenGroup)==null||c.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addToOrGroup(T,n),T.setParent(this,n))}),[...this.orChildrenGroup||[]].forEach(e=>{var T;((T=i.orChildrenGroup)==null?void 0:T.find(v=>re(v)===e.id))||(this.removeChildGroup(e,n),e.removeFromParent(n))}),i.calledByEntry.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addEntryCaller(T,n),T.addCall(this,n))}),[...this.calledByEntry].forEach(e=>{i.calledByEntry.find(T=>re(T)===e.id)||(this.removeCaller(e,n),e.removeCall(this,n))}),i.calledBySuccess.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addSuccessCaller(T,n),T.addSuccessCall(this,n))}),[...this.calledBySuccess].forEach(e=>{i.calledBySuccess.find(T=>re(T)===e.id)||(this.removeCaller(e,n),e.removeCall(this,n))}),i.calledByError.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addErrorCaller(T,n),T.addErrorCall(this,n))}),[...this.calledBySuccess].forEach(e=>{i.calledBySuccess.find(T=>re(T)===e.id)||(this.removeCaller(e,n),e.removeCall(this,n))}),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],n=[],l=[],c=[];if(this.initialData.parent){const e=re(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' 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 e=re(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.addEntryCaller(T,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.addSuccessCaller(T,null)}),this.initialData.calledByError.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.addErrorCaller(T,null)}),{updated:D(i),added:D(n),removed:D(l),affected:D(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AfterAllChildrenInitialized))){var E,b;if(!this.checkCanEdit(this,i))return te.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];if(this.initialized=!0,this.parent.type===o.Condition){let O=this.index||0;const P=(this.parent.declaration.id===sr.And?this.parent.andChildrenGroup||[]:this.parent.orChildrenGroup||[]).filter(L=>!L.deleted&&L.id!==this.id);P.length&&(O>P.length+1?O=P.length:O<0&&(O=0)),P.find(L=>(L.index||0)===O&&!L.deleted)&&P.filter(L=>(L.index||0)>=O&&!L.deleted).forEach(L=>{L.metaSync({index:(L.index||0)+1},i),i==null||i.add(L,H.Updated),n.push(L)}),this.metaSync({index:O},i)}(E=this.andChildrenGroup)!=null&&E.length&&this.andChildrenGroup.sort((O,P)=>(O.index||0)-(P.index||0)),(b=this.orChildrenGroup)!=null&&b.length&&this.orChildrenGroup.sort((O,P)=>(O.index||0)-(P.index||0)),this.inputs.sort((O,P)=>{var $,L;return(O.index??(($=O.declaration)==null?void 0:$.index))-(P.index??((L=P.declaration)==null?void 0:L.index))});const{updated:y,added:T,removed:v}=this.syncInputs(i);return n.push(...y),l.push(...T),c.push(...v),this.captureVersion(),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-self-to-project"))){const n=[this],l=[],c=[],e=[];return this.parent===this.project?this.project.addCondition(this):this.parent.type===o.Condition&&(this.parent.declaration.id===sr.And?this.parent.addToAndGroup(this,i):this.parent.declaration.id===sr.Or&&this.parent.addToOrGroup(this,i)),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),n.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),n.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),n.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),n.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),n.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveInput))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this;const l=this.inputs.findIndex(c=>c.id===i.id);return l>-1&&(this.inputs.splice(l,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this}addInput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddInput))){return this.checkCanEdit(this,n)?this.inputs.includes(i)?(n==null||n.attemptAutoclose(_.AddInput,this.id),this):(this.inputs.push(i),n==null||n.add(this,H.Affected),n==null||n.attemptAutoclose(_.AddInput,this.id),this):(te.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.AddInput,this.id),this)}addOutput(i){return this}removeOutput(i){return this}addSuccessCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddSuccessCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCaller,n)?(this.calledBySuccess.find(c=>c.id===i.id)||(this.calledBySuccess.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddSuccessCaller,this.id),this):this}addErrorCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddErrorCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCaller,n)?(this.calledByError.find(c=>c.id===i.id)||(this.calledByError.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddErrorCaller,this.id),this):this}addEntryCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddEntryCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddEntryCaller,n)?(this.calledByEntry.find(c=>c.id===i.id)||(this.calledByEntry.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddEntryCaller,this.id),this):this}addErrorCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddErrorCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCall,n)?(this.errorCalls.find(c=>c.id===i.id)||(this.errorCalls.push(i),l&&ht(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddErrorCall,this.id),this):this}addSuccessCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddSuccessCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCall,n)?(this.successCalls.find(c=>c.id===i.id)||(this.successCalls.push(i),l&&ht(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddSuccessCall,this.id),this):this}removeCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveCall)),l=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCall,n))return this;const c=this.successCalls.findIndex(y=>y.id===i.id);c>-1&&(this.successCalls.splice(c,1),n==null||n.add(this,H.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),n==null||n.add(this,H.Affected)),l&&ht(this,n),n==null||n.attemptAutoclose(_.RemoveCall,this.id),this}removeCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCaller,n)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),l&&ht(this,n),n==null||n.attemptAutoclose(_.RemoveCaller,this.id),this):this}setParent(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetParent,n)?(((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetParent,this.id),this):this}removeChildGroup(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveChildGroup))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[removeChildGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.RemoveChildGroup,this.id),this;if(this.andChildrenGroup){const l=this.andChildrenGroup.findIndex(c=>c.id===i.id);l!==-1&&(this.andChildrenGroup.splice(l,1),n==null||n.add(this,H.Updated))}if(this.orChildrenGroup){const l=this.orChildrenGroup.findIndex(c=>c.id===i.id);l!==-1&&(this.orChildrenGroup.splice(l,1),n==null||n.add(this,H.Updated))}return n==null||n.attemptAutoclose(_.RemoveChildGroup,this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=he(this.initialData.declaration,this.project),this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(n=>{const l=he(n,this.project);return l.setParent(this,null),l.initChildren(i),l})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(n=>{const l=he(n,this.project);return l.setParent(this,null),l.initChildren(i),l})),this.successCalls=this.initialData.successCalls.map(n=>{const l=he(n,this.project);if(l.addSuccessCaller(this,null),[o.BreakStatement,o.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===o.ReturnStatement){const c=en(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==o.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.errorCalls=this.initialData.errorCalls.map(n=>{const l=he(n,this.project);if(l.addErrorCaller(this,null),[o.BreakStatement,o.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===o.ReturnStatement){const c=en(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==o.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.inputs=this.initialData.inputs.map(n=>{const l=he(n,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"meta-sync"))){const l=$r(this,i,n),c=xr(this,l),e=this.toMeta();return this.x=l.x!==void 0?l.x:e.x,this.y=l.y!==void 0?l.y:e.y,this.index=l.index!==void 0?l.index:e.index,super.baseMetaSync(l,this,n),l.deleted===!0&&!e.deleted?n==null||n.add(this,H.Removed):l.deleted===!1&&e.deleted?n==null||n.add(this,H.Added):c&&(n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ge,...n){return await Ai.repository.APILoad(this.id,...n),this}async APICreate(i=Ge,...n){return await Ai.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(i=Ge,...n){return await Ai.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(i=Ge,...n){return await Ai.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(i=Ge,...n){return await Ai.repository.APIClone(this.id,...n),this}async APILoadVersion(i=Ge,n,...l){return await Ai.repository.APILoadVersion(this.id,n,...l)}removeFromParent(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveFromParent))){var y;if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.parent.type===o.Project?(this.parent.removeCondition(this),e.push(this.parent)):((y=this.parent)==null?void 0:y.type)===o.Condition?this.parent.removeChildGroup(this):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:D(c),updated:D(n),removed:D(l),affected:D(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveEntity))){var T;if(!this.checkCanDelete(this,n))return te.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${_.RemoveEntity}-${this.id}`,action:_.RemoveEntity,owner:this,errorReason:tr.ActionOwnerEntityNonDeletable,rootAction:((T=n==null?void 0:n.self)==null?void 0:T.id)===this.id&&(n==null?void 0:n.autoCloseActionName)===_.RemoveEntity}),n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[],c=[],e=[],y=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:O}=v.entity.onDetachedDependencyRemoved(this,v.field,n);l.push(...E),c.push(...b),e.push(...O)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},n);c.push(...E),l.push(...b)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},n);c.push(...E),l.push(...b)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);l.push(...E),c.push(...b)}),this.successCalls.forEach(v=>{l.push(v),v.removeCaller(this,n)}),this.errorCalls.forEach(v=>{l.push(v),v.removeCaller(this,n)}),!i){const v=this.removeFromParent(n);e.push(...v.added),l.push(...v.updated),c.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{l.push(E),E.removeCall(this,n)})}return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:D(e),updated:D(l),removed:D(c),affected:D(y),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RestoreEntity))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:T,removed:v,added:E}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...T),c.push(...v),n.push(...E)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(y=>{const{updated:T,added:v}=y.restore({},i);l.push(...T),n.push(...v)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(y=>{const{updated:T,added:v}=y.restore({},i);l.push(...T),n.push(...v)}),this.inputs.forEach(y=>{const{updated:T}=y.restore({},i);l.push(...T)}),this.successCalls.forEach(y=>{l.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{l.push(y),y.addErrorCaller(this,i)}),this.calledBySuccess.forEach(y=>{l.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{l.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{l.push(y),y.addCall(this,i)}),this.parent.type===o.Project&&this.project.addCondition(this),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this})}toFlat(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((l=this.andChildrenGroup)==null?void 0:l.flatMap(e=>e.toFlat(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlat(i)))||[],...this.inputs.flatMap(e=>e.toFlat(i)),...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.calledBy.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((l=this.andChildrenGroup)==null?void 0:l.flatMap(e=>e.toFlatIds(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlatIds(i)))||[],...this.inputs.flatMap(e=>e.toFlatIds(i)),...this.successCalls.flatMap(e=>e.toFlatIds(i)),...this.errorCalls.flatMap(e=>e.toFlatIds(i)),...this.calledBy.flatMap(e=>e.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,index:this.index,x:this.x,y:this.y,type:this.type,editable:this.editable,deletable:this.deletable}}toJSON(i=new Set){var n,l;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(i),andChildrenGroup:((n=this.andChildrenGroup)==null?void 0:n.map(c=>c.toJSON(i)))||null,orChildrenGroup:((l=this.orChildrenGroup)==null?void 0:l.map(c=>c.toJSON(i)))||null,successCalls:this.successCalls.map(c=>c.toJSON(i)),errorCalls:this.errorCalls.map(c=>c.toJSON(i)),calledBySuccess:this.calledBySuccess.map(c=>c.toReference()),calledByError:this.calledByError.map(c=>c.toReference()),calledByEntry:this.calledByEntry.map(c=>c.toReference()),inputs:this.inputs.map(c=>c.toJSON(i)),parent:this.parent.toReference()})}toJSONClone(i=pt){var l,c,e,y,T,v,E;let n;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?n=i.seenEntityMaps.get(this.id):(n=i.newId||jr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,n)),(c=i.seenEntities)!=null&&c.has(n)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(n),(T=i.seenEntities)==null||T.add(this.id),{id:n,version:x.UUID.uuid(),createdAt:i.timestamp||M().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(),andChildrenGroup:((v=this.andChildrenGroup)==null?void 0:v.map(b=>b.toJSONClone({...i,newId:null})))||null,orChildrenGroup:((E=this.orChildrenGroup)==null?void 0:E.map(b=>b.toJSONClone({...i,newId:null})))||null,successCalls:this.successCalls.map(b=>b.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(b=>b.toJSONClone({...i,newId:null})),calledBySuccess:this.calledBySuccess.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),inputs:this.inputs.map(b=>b.toJSONClone({...i,newId:null})),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=pt){var l;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n+"--"+x.UUID.uuid()+"--ref",type:o.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(i=pt){var l,c,e;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toReference(i),andChildrenGroup:((c=this.andChildrenGroup)==null?void 0:c.map(y=>y.toReference(i)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(y=>y.toReference(i)))||null,inputs:this.inputs.map(y=>y.toReference(i)),successCalls:this.successCalls.map(y=>y.toReference(i)),errorCalls:this.errorCalls.map(y=>y.toReference(i)),calledBySuccess:this.calledBySuccess.map(y=>y.toReference(i)),calledByError:this.calledByError.map(y=>y.toReference(i)),calledByEntry:this.calledByEntry.map(y=>y.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((l=this.andChildrenGroup)==null?void 0:l.flatMap(e=>e.toFlatJSON(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlatJSON(i)))||[],...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(){const i=this.parent.type===o.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(n=>n.id),calledBySuccess:this.calledBySuccess.map(n=>n.id),calledByError:this.calledByError.map(n=>n.id),parent:i}}toFlatGenerationTarget(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((l=this.andChildrenGroup)==null?void 0:l.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...this.inputs.flatMap(e=>e.toFlatGenerationTarget(i)),...this.successCalls.flatMap(e=>e.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(e=>e.toFlatGenerationTarget(i))])}clearErrors(){var i,n;return this.errors=[],(i=this.andChildrenGroup)==null||i.forEach(l=>l.clearErrors()),(n=this.orChildrenGroup)==null||n.forEach(l=>l.clearErrors()),this.inputs.forEach(l=>l.clearErrors()),this.successCalls.forEach(l=>l.clearErrors()),this.errorCalls.forEach(l=>l.clearErrors()),this}validate(){const i=oPe(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(n=>n.getErrors())]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.CloneEntity)),n=null,l=null,c=!0){var L,U,F;const e=Pr(n,this),y=this.toJSON(),T=l||x.UUID.uuid();y.inputs=[];const v=T.split("-id"),E=v[v.length-1||0]||T;y.id=T,y.version=x.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||M().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.deletable=!0,y.editable=!0;const b=Gi(y,e);n?b.setParent(n,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,H.Added);const O=(L=this.andChildrenGroup)==null?void 0:L.map(Z=>Z.clone(i,b,x.UUID.uuid(),c)),P=(U=this.orChildrenGroup)==null?void 0:U.map(Z=>Z.clone(i,b,x.UUID.uuid(),c));b.andChildrenGroup=O||null,b.orChildrenGroup=P||null;const $=(F=this.inputs)==null?void 0:F.map((Z,X)=>Z.clone(i,b,E+"-input-map-"+X+"-id",c));return b.inputs=$,i==null||i.attemptAutoclose(_.CloneEntity,this.id),b}addToAndGroup(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddToAndGroup))){return this.checkCanEdit(this,n)?(this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(i)||(this.andChildrenGroup.push(i),n==null||n.add(i,H.Affected)),n==null||n.attemptAutoclose(_.AddToAndGroup,this.id),this):(te.Logger.warn(`[addToAndGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.AddToAndGroup,this.id),this)}addToOrGroup(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddToOrGroup))){return this.checkCanEdit(this,n)?(this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(i)||(this.orChildrenGroup.push(i),n==null||n.add(i,H.Affected)),n==null||n.attemptAutoclose(_.AddToOrGroup,this.id),this):(te.Logger.warn(`[addToOrGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.AddToOrGroup,this.id),this)}removeUnrecognizedInputs(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.inputs.forEach(T=>{if(!this.declaration.inputs.find(E=>{var b;return E.id===((b=T.declaration)==null?void 0:b.id)})){const E=T.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated)}}),this.inputs.filter((T,v)=>{const E=this.inputs.findIndex(O=>O.declaration===T.declaration&&O!==T);if(E===-1)return!1;const b=this.inputs[E];return M(b==null?void 0:b.createdAt).isSame(M(T.createdAt))?v>E:!!M(b==null?void 0:b.createdAt).isAfter(T.createdAt)}).forEach(T=>{const v=T.remove({ignoreUpstream:!1},i);c.push(...v.removed),n.push(...v.updated)}),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}syncInputs(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SyncInputs))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[syncInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.SyncInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[],y=this.declaration.inputs.filter(b=>b.parentRelationType===B.FixedArguments&&!this.inputs.find(O=>O.declaration.id===b.id));this.inputs.sort((b,O)=>b.index-O.index),y.forEach(b=>{this.inputs.forEach($=>{$.index>=b.index&&$.metaSync({index:$.index+1},i)});const O={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.InputMap,parentRelationType:null,declaration:b.toJSON(),readsValue:null,defaultValue:null,index:b.index,name:null,codeName:null,description:null,parent:this.toReference()},P=he(O,this.project);P.setParent(this,i),P.initChildren(i),i==null||i.add(P,H.Added),P.addSelfToProject(i)}),this.inputs.sort((b,O)=>b.index-O.index);const{updated:T,added:v,removed:E}=this.removeUnrecognizedInputs(i);return n.push(...T),l.push(...v),c.push(...E),i==null||i.attemptAutoclose(_.SyncInputs,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return[]}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return[]}getDataType(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"get-data-type"))){var l;const n=((l=this.declaration)==null?void 0:l.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),n}};I(Ai,"repository",{APICreate:async(i,...n)=>i,APIUpdate:async(i,...n)=>i,APIDelete:async(i,...n)=>i,APIClone:async(i,...n)=>{},APILoad:async(i,...n)=>null,APILoadVersion:async(i,n,...l)=>null}),I(Ai,"type",o.Condition),I(Ai,"USER_MANAGED_PARENT_TYPES",[...yr,o.Project,o.Condition]),I(Ai,"PARENT_TYPES",[...Ai.USER_MANAGED_PARENT_TYPES]),I(Ai,"MUTABLE_BASE_PROPERTIES",["operator"]),I(Ai,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","index"]),I(Ai,"BASE_PROPERTIES",[...Ai.MUTABLE_BASE_PROPERTIES,...Ai.INMUTABLE_BASE_PROPERTIES]),I(Ai,"MUTABLE_META_PROPERTIES",["x","y"]),I(Ai,"INMUTABLE_META_PROPERTIES",[...Ai.INMUTABLE_BASE_PROPERTIES]),I(Ai,"META_PROPERTIES",[...Ai.MUTABLE_META_PROPERTIES,...Ai.INMUTABLE_META_PROPERTIES]),I(Ai,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),I(Ai,"INMUTABLE_UPSTREAM_PROPERTIES",[]),I(Ai,"UPSTREAM_PROPERTIES",[...Ai.MUTABLE_UPSTREAM_PROPERTIES,...Ai.INMUTABLE_UPSTREAM_PROPERTIES]),I(Ai,"MUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup","successCalls","errorCalls","inputsDeclarations","inputs"]),I(Ai,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),I(Ai,"DOWNSTREAM_PROPERTIES",[...Ai.MUTABLE_DOWNSTREAM_PROPERTIES,...Ai.INMUTABLE_DOWNSTREAM_PROPERTIES]),I(Ai,"PROPERTIES",[...Ai.META_PROPERTIES,...Ai.UPSTREAM_PROPERTIES,...Ai.DOWNSTREAM_PROPERTIES]);let Iu=Ai;var $e=(d=>(d.Inherited="inherited",d.DefaultValue="default-value",d.Missing="missing",d.Empty="empty",d.AutoCalculated="auto-calculated",d.QueuedAutocalculation="queued-autocalculation",d.External="external",d.Testing="testing",d.ExecutionResult="execution-result",d))($e||{});const uPe={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function o$i(d,p){return{...uPe,id:d,project:p}}class Am{constructor(p,i){I(this,"initialized",!1);I(this,"id");I(this,"project");I(this,"values",{});I(this,"onWriteCallback",()=>{});I(this,"onRemoveCallback",()=>{});this.id=p,this.project=i,this.init()}onWrite(p){this.onWriteCallback=p}onRemove(p){this.onRemoveCallback=p}init(){var n;if(!((n=this.project)!=null&&n.id)||this.initialized)return;const p={},i={};Object.keys(p).forEach(l=>{const c=p[l],e=new Jr(c,this.project);try{if(c.parent){const v=this.project.findSubscribedInstanceFromReference(c.parent);if(!v)return;e.setParent(v,null),e.hydrateAncestors(),e.initChildren(null)}else if(c.standaloneParent){const v=this.project.findSubscribedInstanceFromReference(c.standaloneParent);if(!v)return;e.standalone=!0,e.setStandaloneParent(v),e.hydrateAncestors(),e.initChildren(null)}i[l]=e;const y=e.parent||e.standaloneParent,T=fPe(e,y,this.project);T?i[l]=T:delete p[l]}catch(y){te.Logger.error("Error hydrating ancestors: ",y),delete p[l]}}),this.values={...this.values,...i},this.initialized=!0}toJSON(){const p={};return Object.keys(this.values).forEach(i=>{p[i]=this.values[i].toJSON()}),p}writeValue(p,i){if(!p)throw new Error("The value owner entity is required when writing a value to a value store");let l=this.values[p.id];if(!l)if(i instanceof Jr)l=i;else if(i)l=Gi(i,this.project);else{const c={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:null,deletable:!0,editable:!0,type:o.LiteralValue,standaloneParent:p.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:oc(p.getDataType(null))};l=Gi(c,this.project)}l.standalone=!0,l.initialData.standaloneParent||te.Logger.warn("instance.initialData: ",l.initialData),l.setStandaloneParent(p),l.hydrateAncestors(),l.initChildren(null),i&&(l.metaSync({...i},null),l.setValueAsType(i.valueAsType,null)),this.values[p.id]=l,this.onWriteCallback(p,l)}readValue(p){return this.values[p]||null}removeValue(p){if(!this.values[p])return;delete this.values[p];const i=this.project.get(p);i&&this.onRemoveCallback(i)}clear(){this.values={}}}function mr(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)}function pPe(d){if(Array.isArray(d))return d.map(T=>typeof T=="number"?T:e(T)?Number(T):String(T));const p=[];let i=0,n="",l=!1,c=null;for(;i<d.length;){const T=d[i];if(T==="."&&!l){n.length&&(p.push(y(n)),n=""),i++;continue}if(T==="["&&!l){n.length&&(p.push(y(n)),n=""),l=!0,i++;continue}if(l){if(!c&&(T==='"'||T==="'")){c=T,i++;continue}if(c){if(T==="\\"&&i+1<d.length){n+=d[i+1],i+=2;continue}if(T===c){c=null,i++;continue}n+=T,i++;continue}if(T==="]"){p.push(y(n)),n="",l=!1,i++;continue}if(/\s/.test(T)&&!c){i++;continue}n+=T,i++;continue}n+=T,i++}return n.length&&p.push(y(n)),p;function e(T){return/^[0-9]+$/.test(T)}function y(T){const v=T.trim();return e(v)?Number(v):v}}function HV(d,p,i){if(d==null)return i;const n=pPe(p);let l=d;for(let c=0;c<n.length;c++){const e=n[c];if(l==null)return i;if(Array.isArray(l)&&typeof e=="number"){if(!(e in l))return i;l=l[e]}else{if(!Object.prototype.hasOwnProperty.call(l,e))return i;l=l[e]}}return l}const d$i=new Set(["__proto__","prototype","constructor"]);function u$i(d){return typeof d=="string"&&d$i.has(d)}function cPe(d,p,i,n){const{createMissing:l=!0,coerce:c=!0}=n??{};if(d==null||typeof d!="object")throw new TypeError("set(...) expects a non-null object as target.");const e=pPe(p);if(e.length===0)throw new Error("set(...) path must not be empty.");let y=d;for(let T=0;T<e.length;T++){const v=e[T];if(u$i(v))throw new Error(`Refusing to set unsafe key "${String(v)}" on object.`);const E=T===e.length-1,O=typeof e[T+1]=="number",P=Array.isArray(y)&&typeof v=="number";if(E){if(P&&y[v]==null&&!l)throw new Error(`set(...) missing array index "${String(v)}" (createMissing=false).`);return y[v]=i,d}else{if(!Object.prototype.hasOwnProperty.call(y,v)||y[v]==null){if(!l)throw new Error(`set(...) missing parent at segment "${String(v)}" (createMissing=false).`);y[v]=O?[]:{}}else{const $=y[v],L=$!==null&&typeof $=="object",U=Array.isArray($);if(O){if(!U){if(!c)throw new Error(`set(...) expected an array at "${String(v)}" but found non-array (coerce=false).`);y[v]=[]}}else if(!L||U){if(!c)throw new Error(`set(...) expected an object at "${String(v)}" but found non-object (coerce=false).`);y[v]={}}}y=y[v]}}return d}function av(d){return globalThis.structuredClone?structuredClone(d):JSON.parse(JSON.stringify(d))}function p$i(d){if(Array.isArray(d))return d.slice();const p=[];let i="",n=0;for(;n<d.length;){const l=d[n];if(l==="."||l==="["||l==="]"){if(i.length){const c=Number(i);p.push(!Number.isNaN(c)&&/^\d+$/.test(i)?c:i),i=""}if(l==="["){n++;let c="";for(;n<d.length&&d[n]!=="]";)c+=d[n++];const e=Number(c);p.push(!Number.isNaN(e)&&/^\d+$/.test(c)?e:c)}n++;continue}i+=l,n++}if(i.length){const l=Number(i);p.push(!Number.isNaN(l)&&/^\d+$/.test(i)?l:i)}return p}function WV(d,p,i){const n=p$i(p);if(n.length===0)throw new Error("Path must not be empty.");const l=n[n.length-1];let c=d;for(let e=0;e<n.length-1;e++){const y=n[e],T=typeof n[e+1]=="number",v=c==null?void 0:c[y];if(v==null){if(!i)throw new Error(`Missing parent at segment "${String(y)}" for path "${Array.isArray(p)?JSON.stringify(p):p}".`);c[y]=T?[]:{}}else if(typeof v!="object"||v!==null&&Array.isArray(v)!==T&&typeof n[e+1]=="number"){if(!i)throw new Error(`Parent at "${String(y)}" is not a container suitable for continuing the path.`);c[y]=T?[]:{}}c=c[y]}return{target:c,lastKey:l}}function Zl(d,p,i,n){var y;let l;if(((y=d==null?void 0:d.entity)==null?void 0:y.type)===o.PrimitiveEntity)switch(d.entity.name){case oe.EntityTemplate:l=oe.EntityTemplate;break;case oe.String:l=oe.String;break;case oe.Number:l=oe.Number;break;case oe.Boolean:l=oe.Boolean;break;case oe.Null:l=oe.Null;break;case oe.Enum:l=oe.Enum;break;case oe.KeyValue:l=oe.KeyValue;break;case oe.Untyped:l=oe.Untyped;break;case oe.KeyValue:l=oe.KeyValue;break;case oe.Date:l=oe.Date;break;case oe.UUID:l=oe.UUID;break;case oe.File:l=oe.File;break;case oe.Void:l=oe.Void;break;case oe.ActionDescriptor:l=oe.ActionDescriptor;break;case oe.Bytes:l=oe.Bytes;break;default:throw new Error(`Primitive type ${le(d.entity,i)} is not supported`)}else l=oe.Untyped;const c=Jr.new(n);c.name=l,c.parent=p.toReference();const e=he(c,i);return e.hydrateAncestors(),n==null||n.add(e,H.Added),e.addSelfToProject(n),e.initChildren(n),e}function yl(d,p,i=new Set){var n,l,c;if(i.has(d.id))return[];if(i.add(d.id),St.includes(d.type)){const e=Zn(d);return D([e,...[e].flatMap(y=>yl(y,p,i))])}else if(d.type===o.OutputMap){if(St.includes(d.parent.type)&&((n=d.declaration)==null?void 0:n.type)===o.Property&&d.declaration.static)return D([d,d.declaration,...[d,d.declaration].flatMap(e=>yl(e,p,i))])}else if(d.type===o.InputMap){if(St.includes(d.parent.type)&&((l=d.declaration)==null?void 0:l.type)===o.Property&&((c=d.declaration)!=null&&c.static))return D([d.declaration,...[d.declaration].flatMap(e=>yl(e,p,i))]);if(kt.includes(d.parent.type)){const e=[d,...d.getCounterparts()];return D([...e,...e.flatMap(y=>yl(y,p,i))])}}return[d]}function fPe(d,p,i){return d}function Nh(d,p,i=!1){const n=d.readsValue;let l=null;const c=Ru(n,p,i);if(c){const e={sources:[c],target:d};l={value:c.value,valueOwner:d,type:$e.Inherited,inheritanceLink:e}}return l}function Et(d,p,i){var y;if(!p)return null;let n;if(((y=d==null?void 0:d.entity)==null?void 0:y.type)===o.PrimitiveEntity)switch(d.entity.name){case oe.EntityTemplate:n=oe.EntityTemplate;break;case oe.String:n=oe.String;break;case oe.Number:n=oe.Number;break;case oe.Boolean:n=oe.Boolean;break;case oe.Null:n=oe.Null;break;case oe.Enum:n=oe.Enum;break;case oe.KeyValue:n=oe.KeyValue;break;case oe.Untyped:n=oe.Untyped;break;case oe.KeyValue:n=oe.KeyValue;break;case oe.Date:n=oe.Date;break;case oe.UUID:n=oe.UUID;break;case oe.File:n=oe.File;break;case oe.Void:n=oe.Void;break;case oe.ActionDescriptor:n=oe.ActionDescriptor;break;default:throw new Error(`Primitive type ${le(d.entity,i)} is not supported`)}else n=oe.Untyped;if(!i.get(p.id))return null;const c=Jr.new(null);c.name=n,c.standaloneParent=p.toReference();let e=new Jr(c,i);return e.hydrateAncestors(),e.standalone=!0,e.setStandaloneParent(p),e.initChildren(null),e}function yPe(d,p,i=!1){var c,e;if(p.execution&&p.execution.hasEntity(d)&&!i){const y=(c=p.lastExecutionResults)==null?void 0:c.readValue(d.id);if(y)return{value:y,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(e=p.localTestValues)==null?void 0:e.readValue(d.id),l=p.getValueTypePreference(d.id);return n&&!i&&(l===null||l!==$e.DefaultValue)?{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null}:null}function wb(d,p,i,n=!1){var e,y;const l={...d},c=p.inputs;if(!c)return l;for(const T of c){if(!Nv(T))continue;const v=xm(T,i,n);if(v&&v.value){const E=le(T,i.project),b=T.codeName||((e=T.declaration)==null?void 0:e.codeName)||Wi(E);l[b]=qn((v==null?void 0:v.value)||null)?l[b]:(y=v==null?void 0:v.value)==null?void 0:y.value}}return l}function gm(d,p,i,n=!1){var e,y;const l={...d},c=p.inputs;if(!c)return l;for(const T of c){if(!Nv(T))continue;const v=lv(T,i,n);if(v&&v.value){const E=le(T,i.project),b=T.codeName||((e=T.declaration)==null?void 0:e.codeName)||Wi(E);l[b]=(y=v==null?void 0:v.value)==null?void 0:y.value}}return l}function hPe(d,p,i=!1){var E,b,O,P,$,L,U;let n={};if(((b=(E=d.dataType)==null?void 0:E.entity)==null?void 0:b.type)===o.DefinitionEntity&&(n={...n,...d.dataType.entity.getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(d)&&!i){const F=(O=p.lastExecutionResults)==null?void 0:O.readValue(d.id);if(F){if(mr(F.value)){const X={...n,...F.value},se={...gm(X,d,p,i)};F.metaSync({value:se},null)}return{value:F,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}}const l=!!((P=p.execution)!=null&&P.entities.length),c=($=p.execution)==null?void 0:$.hasEntity(d),e=d.readsValue;let y=null;if(e){const F=(L=p.execution)==null?void 0:L.hasEntity(e);if((!l||l&&F&&c||l&&!F&&!c)&&(y=Nh(d,p,i),y&&y.value&&mr(y.value.value))){const X={...n,...y.value.value},se={...gm(X,d,p,i)};y.value.metaSync({value:se},null)}}const T=d.getDefaultValue(),v=p.getValueTypePreference(d.id);if(!y&&T){const F=T;if(F&&F.value===null&&F.autogeneration){const Z=OI(F);if(F.metaSync({value:Z},null),mr(Z)){const X={...gm(Z,d,p,i)};F.metaSync({value:X},null)}}(i||v===null||v!==$e.Testing)&&(y={value:F,valueOwner:d,type:(F==null?void 0:F.value)===null?$e.Empty:$e.DefaultValue,inheritanceLink:null})}if(!y||y.type===$e.DefaultValue&&!i||v===null||v!==$e.DefaultValue){const F=(U=p.localTestValues)==null?void 0:U.readValue(d.id);if(F){if(mr(F.value)){const Z={...n,...F.value},X={...gm(Z,d,p,i)};F.metaSync({value:X},null)}return{value:F,valueOwner:d,type:$e.Testing,inheritanceLink:null}}}return y||{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}}function mPe(d,p,i=!1){var e,y,T,v,E;let n={};if(((y=(e=d.dataType)==null?void 0:e.entity)==null?void 0:y.type)===o.DefinitionEntity&&(n={...n,...d.dataType.entity.getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(d)&&!i){const b=(T=p.lastExecutionResults)==null?void 0:T.readValue(d.id);if(b){if(mr(b.value)){const P={...n,...b.value},$=wb(P,d,p,i);b==null||b.metaSync({value:$},null)}return{value:b,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}}const l=(v=p.localTestValues)==null?void 0:v.readValue(d.id),c=p.getValueTypePreference(d.id);if(l&&!i&&(c===null||c!==$e.DefaultValue)){if(mr(l.value)){const O={...n,...l.value},P=wb(O,d,p,i);l.metaSync({value:P},null)}return{value:l,valueOwner:d,type:$e.Testing,inheritanceLink:null}}if((E=d.dataType)!=null&&E.entity&&d.dataType.entity.type===o.DefinitionEntity&&d.dataType.isObject()){const b=Et(d.dataType,d,p.project);return b==null||b.metaSync({value:wb(n,d,p,i)},null),{value:b,valueOwner:d,type:$e.DefaultValue,inheritanceLink:null}}return null}function sv(d,p,i=!1){var E,b,O,P,$;if((E=d.dataType)!=null&&E.isObject())return hPe(d,p,i);const n=ki(d),l=!!((b=p.execution)!=null&&b.entities.length),c=(O=p.execution)==null?void 0:O.hasEntity(n),e=d.readsValue;let y=null;if(e){const L=(P=p.execution)==null?void 0:P.hasEntity(e);(!l||l&&L&&c||l&&!L&&!c)&&(y=Nh(d,p,i))}const T=d.getDefaultValue(),v=p.getValueTypePreference(d.id);if(!y&&T){const L=T;if(L&&L.value===null&&L.autogeneration){const U=OI(L);L.metaSync({value:U},null)}(i||v===null||v!==$e.Testing)&&(y={value:L,valueOwner:d,type:(L==null?void 0:L.value)===null?$e.Empty:$e.DefaultValue,inheritanceLink:null})}if(!y||y.type===$e.DefaultValue&&!i||v===null||v!==$e.DefaultValue){const L=($=p.localTestValues)==null?void 0:$.readValue(d.id);if(L)return{value:L,valueOwner:d,type:$e.Testing,inheritanceLink:null}}return y||{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}}function zV(d,p,i=!1){var e,y,T;if((e=d.dataType)!=null&&e.isObject())return mPe(d,p);if(p.execution&&p.execution.hasEntity(d)&&!i){const v=(y=p.lastExecutionResults)==null?void 0:y.readValue(d.id);if(v)return{value:v,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(T=p.localTestValues)==null?void 0:T.readValue(d.id),l=p.getValueTypePreference(d.id);return n&&!i&&(l===null||l!==$e.DefaultValue)?{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null}:sv(d,p,i)}function JV(d,p,i=!1){var b,O,P,$;const n=!!((b=p.execution)!=null&&b.entities.length),l=(O=p.execution)==null?void 0:O.hasEntity(d);let c=null;const e=d.readsValue;if(e){const L=(P=p.execution)==null?void 0:P.hasEntity(e);(!n||n&&L&&l||n&&!L&&!l)&&(c=Nh(d,p,i))}const y=d.declaration;if(!c&&y){const L=sv(y,p);L&&L.value&&(c=L)}const T=p.getValueTypePreference(d.id);if(!c||c.type===$e.DefaultValue&&!i||T===null||T!==$e.DefaultValue){const L=($=p.localTestValues)==null?void 0:$.readValue(d.id);if(L)return{value:L,valueOwner:d,type:$e.Testing,inheritanceLink:null}}const v=Hd(d);return v&&l&&!c?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:l&&!v&&!c?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:c||{value:null,valueOwner:d,type:$e.External,inheritanceLink:null}}function TPe(d,p,i=!1){return zV(d.declaration,p,i)}function vPe(d,p,i=!1){var b,O,P,$;if(!i&&p.execution&&p.execution.hasEntity(d)){const L=(b=p.lastExecutionResults)==null?void 0:b.readValue(d.id);if(L)return{value:L,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=ki(d),l=d.parent.type===o.FunctionDeclaration&&d.parent.parent.type===o.Loop?d.parent:null,c=!!((O=p.execution)!=null&&O.hasEntity(n))||!!l&&!!((P=p.execution)!=null&&P.hasEntity(l));let e=null;const y=d.getDefaultValue(),T=p.getValueTypePreference(d.id);if(y){const L=y||null;if(L&&L.value===null&&L.autogeneration){const U=OI(L);L.metaSync({value:U},null)}(i||T===null||T!==$e.Testing)&&(e={value:L,valueOwner:d,type:(L==null?void 0:L.value)===null?$e.Empty:$e.DefaultValue,inheritanceLink:null})}if(!e||e.type===$e.DefaultValue&&!i||T===null||T!==$e.DefaultValue){const L=($=p.localTestValues)==null?void 0:$.readValue(d.id),U=p.getValueTypePreference(d.id);if(L&&!i&&(U===null||U!==$e.DefaultValue))return{value:L,valueOwner:d,type:$e.Testing,inheritanceLink:null}}const v=Hd(d);let E=v&&c&&!e;return n.type===o.Loop&&c&&(E=!1),E?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:c&&!v&&!e?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:e||{value:null,valueOwner:d,type:$e.External,inheritanceLink:null}}function YV(d,p,i=!1){var O,P,$,L,U;if(p.execution&&p.execution.hasEntity(d)&&!i){const F=(O=p.lastExecutionResults)==null?void 0:O.readValue(d.id);if(F)return{value:F,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=ki(d),l=!!((P=p.execution)!=null&&P.entities.length),c=($=p.execution)==null?void 0:$.hasEntity(n),e=d.readsValue;let y=null;if(e){const F=(L=p.execution)==null?void 0:L.hasEntity(e);(!l||l&&F&&c||l&&!F&&!c)&&(y=Nh(d,p,i))}const T=d.getDefaultValue(),v=p.getValueTypePreference(d.id);if(!y&&T){const F=T;(i||v===null||v!==$e.Testing)&&(y={value:F,valueOwner:d,type:$e.DefaultValue,inheritanceLink:null})}if(!y||y.type===$e.DefaultValue&&!i||v===null||v!==$e.DefaultValue){const F=(U=p.localTestValues)==null?void 0:U.readValue(d.id);if(F)return{value:F,valueOwner:d,type:$e.Testing,inheritanceLink:null}}const E=Hd(d);return E&&!y?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:!E&&!y?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:y}function EPe(d,p,i=!1){var y,T,v,E,b,O,P,$,L,U,F,Z,X;if(p.execution&&p.execution.hasEntity(d)&&!i){const se=(y=p.lastExecutionResults)==null?void 0:y.readValue(d.id);if(se)return{value:se,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=Fm(d);if(py.includes(n.type)){const se=Ru(n,p,i),Q=d.codeName||((T=d.declaration)==null?void 0:T.codeName)||Wi(le(d,p.project));if(se!=null&&se.value&&mr(se.value.value)){const fe=se.value.value[Q],de=Et(d.getDataType(null),d,p.project);return de==null||de.metaSync({value:fe},null),{value:de,valueOwner:d,type:se.type,inheritanceLink:{sources:[se],target:d}}}return null}const l=(v=p.execution)==null?void 0:v.hasEntity(n),c=((E=p.execution)==null?void 0:E.state)===mN.Running;if((b=p.persistedExecutionResults)!=null&&b.values[d.id]&&!l&&!c&&!i){const se=(O=p.persistedExecutionResults)==null?void 0:O.readValue(d.id);if((se==null?void 0:se.value)!==null||(se==null?void 0:se.valueAsType)!==null)return{value:se,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const e=d.parent;if(!e)throw new Error(`Couldn't find the parent that generates the output ${d.id}`);switch(e.type){case o.VariableInstance:{const Q=JV(e,p,i);if(Q&&Q.value){const de=d.declaration;if(mr(Q.value.value)){const ce=Q.value.value[de.name],me=Et(((P=d.declaration)==null?void 0:P.dataType)||null,d,p.project);return me==null||me.metaSync({value:ce},null),{value:me,valueOwner:d,type:$e.Inherited,inheritanceLink:{sources:[Q],target:d}}}}const fe=Et((($=d.declaration)==null?void 0:$.dataType)||null,d,p.project);return fe==null||fe.metaSync({value:null},null),{value:fe,valueOwner:d,type:$e.Inherited,inheritanceLink:{sources:Q?[Q]:[],target:d}}}case o.VariableDeclaration:{const Q=sv(e,p,i);if(Q&&Q.value){const de=d.declaration;if(mr(Q.value.value)){const ce=Q.value.value[de.name],me=Et(((L=d.declaration)==null?void 0:L.dataType)||null,d,p.project);return me==null||me.metaSync({value:ce},null),{value:me,valueOwner:d,type:$e.Inherited,inheritanceLink:{sources:[Q],target:d}}}}const fe=Et(((U=d.declaration)==null?void 0:U.dataType)||null,d,p.project);return fe==null||fe.metaSync({value:null},null),{value:fe,valueOwner:d,type:$e.Inherited,inheritanceLink:{sources:Q?[Q]:[],target:d}}}case o.Operation:{const se=e.outputs.map(fe=>{var de,ce;if((de=p.persistedExecutionResults)!=null&&de.values[fe.id]){const me=(ce=p.persistedExecutionResults)==null?void 0:ce.values[fe.id];if(me.value!==null||me.valueAsType!==null)return{value:me,valueOwner:fe,type:$e.ExecutionResult,inheritanceLink:null}}}).filter(fe=>!!fe),Q=Et(((F=d.declaration)==null?void 0:F.dataType)||null,d,p.project);return Q==null||Q.metaSync({value:null},null),{value:Q,valueOwner:d,type:$e.QueuedAutocalculation,inheritanceLink:se.length?{sources:se,target:d}:null}}case o.FunctionCall:{const se=e.inputs.map(fe=>Yb(fe,p,i)).filter(fe=>!!fe),Q=Et(((Z=d.declaration)==null?void 0:Z.dataType)||null,d,p.project);return Q==null||Q.metaSync({value:null},null),{value:Q,valueOwner:d,type:$e.QueuedAutocalculation,inheritanceLink:se.length?{sources:se,target:d}:null}}case o.Loop:{const se=e.inputs.map(fe=>Yb(fe,p,i)).filter(fe=>!!fe),Q=Et(((X=d.declaration)==null?void 0:X.dataType)||null,d,p.project);return Q==null||Q.metaSync({value:null},null),{value:Q,valueOwner:d,type:$e.QueuedAutocalculation,inheritanceLink:se.length?{sources:se,target:d}:null}}case o.Search:return{value:null,valueOwner:d,type:$e.QueuedAutocalculation,inheritanceLink:null}}return null}function Cw(d,p,i=!1){var b,O,P;if(![...kt,...St].includes(d.parent.type)||!Nv(d))return null;if(((b=d.declaration)==null?void 0:b.type)===o.Property&&d.declaration.static)return Ru(d.declaration,p);const n=lv(d,p,i);if(n&&n.type!==$e.Empty&&n.type!==$e.Missing)return n;const l=Zn(d.parent),c=ho(l,p,i),e=d.codeName||((O=d.declaration)==null?void 0:O.codeName)||Wi(le(d,p.project)),y=Et(d.getDataType(null),d,p.project),T=Hd(d),v=(P=c==null?void 0:c.value)==null?void 0:P.value;if(v&&mr(v)){let $=v[e];return v[e]===void 0&&($=null),y==null||y.metaSync({value:$},null),T&&qn(y)?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:{value:y,valueOwner:d,type:c.type,inheritanceLink:{sources:c?[c]:[],target:d}}}return T?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}}function _w(d,p,i=!1){var b,O,P,$,L,U,F;if(![...kt,...St].includes(d.parent.type)||!Nv(d))return null;if(((b=d.declaration)==null?void 0:b.type)===o.Property&&d.declaration.static)return Ru(d.declaration,p,i);const n=Zn(d.parent),l=Ru(n,p,i),c=d.parent===n?d:n.inputs.find(Z=>{var X,se;return((X=Z.declaration)==null?void 0:X.id)===((se=d.declaration)==null?void 0:se.id)}),e=xm(c,p,i),y=d.codeName||((O=d.declaration)==null?void 0:O.codeName)||Wi(le(d,p.project)),T=Et(d.getDataType(null),d,p.project),v=Hd(d),E=(P=l==null?void 0:l.value)==null?void 0:P.value;if(((l==null?void 0:l.type)===$e.ExecutionResult||(l==null?void 0:l.type)===$e.Testing)&&!i&&E&&mr(E)){let Z=E[y];return E[y]===void 0&&(Z=null),T==null||T.metaSync({value:Z},null),{value:T,valueOwner:d,type:l.type,inheritanceLink:{sources:l?[l]:[],target:d}}}if(e&&e.type!==$e.Empty&&e.type!==$e.Missing)return e;if(E&&mr(E)){let Z=E[y];E[y]===void 0&&(Z=null),T==null||T.metaSync({value:Z},null);const X=v&&qn(T),se=!!(($=p.execution)!=null&&$.entities.length),Q=(L=p.execution)==null?void 0:L.hasEntity(n),fe=n.readsValue;if(fe){const de=(U=p.execution)==null?void 0:U.hasEntity(fe);if(X&&(!se||se&&de&&Q||se&&!de&&!Q))return{value:null,valueOwner:d,type:$e.Inherited,inheritanceLink:null}}if(d.readsValue){const de=(F=p.execution)==null?void 0:F.hasEntity(d.readsValue);if(X&&(!se||se&&de&&Q||se&&!de&&!Q))return{value:null,valueOwner:d,type:$e.Inherited,inheritanceLink:null}}return X?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:{value:T,valueOwner:d,type:l.type,inheritanceLink:{sources:l?[l]:[],target:d}}}return xm(d,p,i)}function lv(d,p,i=!1){var O,P,$,L,U,F;const n=ki(d),l=!!((O=p.execution)!=null&&O.entities.length),c=(P=p.execution)==null?void 0:P.hasEntity(n),e=d.readsValue;let y=null;if(e){const Z=($=p.execution)==null?void 0:$.hasEntity(e);(!l||l&&Z&&c||l&&!Z&&!c)&&(y=Nh(d,p,i))}const T=d.getDefaultValue(),v=p.getValueTypePreference(d.id);if(!y&&T&&(i||v===null||v!==$e.Testing)&&(y={value:T,valueOwner:d,type:qn(T)?$e.Empty:$e.DefaultValue,inheritanceLink:null}),!y&&d.declaration){const Z=Ru(d.declaration,p,i);Z&&Z.value&&(i||v===null||v!==$e.Testing)&&(y={...Z,valueOwner:d,type:$e.DefaultValue})}if(!y||y.type===$e.DefaultValue||(y==null?void 0:y.type)===$e.Empty){const Z=(L=p.persistedExecutionResults)==null?void 0:L.readValue(d.id);if(Z&&!i)return{value:Z,valueOwner:d,type:$e.Testing,inheritanceLink:null};const X=(U=p.localTestValues)==null?void 0:U.readValue(d.id);if(X&&!i&&(v===null||v!==$e.DefaultValue))return{value:X,valueOwner:d,type:$e.Testing,inheritanceLink:null}}const E=Hd(d),b=E&&(!y||(y==null?void 0:y.type)===$e.Empty);if(d.readsValue){const Z=(F=p.execution)==null?void 0:F.hasEntity(d.readsValue);if(b&&(!l||l&&Z&&c||l&&!Z&&!c))return{value:null,valueOwner:d,type:$e.Inherited,inheritanceLink:null}}return b?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:(y==null?void 0:y.inheritanceLink)||null}:!E&&(!y||y.type===$e.Inherited)&&!(y!=null&&y.inheritanceLink)?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:y}function xm(d,p,i=!1){var e,y;if(p.execution&&p.execution.hasEntity(d)&&!i){const T=(e=p.lastExecutionResults)==null?void 0:e.readValue(d.id);if(T)return{value:T,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(y=p.localTestValues)==null?void 0:y.readValue(d.id),l=p.getValueTypePreference(d.id);return n&&!i&&(l===null||l!==$e.DefaultValue)?{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null}:lv(d,p,i)}function Yb(d,p,i=!1){var n,l;return St.includes(d.parent.type)&&(n=Zn(d.parent).dataType)!=null&&n.isObject()||kt.includes(d.parent.type)&&(l=d.parent.getDataType(null))!=null&&l.isObject()?Cw(d,p,i):lv(d,p,i)}function bPe(d,p,i=!1){var n,l;return St.includes(d.parent.type)&&(n=Zn(d.parent).dataType)!=null&&n.isObject()||kt.includes(d.parent.type)&&(l=d.parent.getDataType(null))!=null&&l.isObject()?_w(d,p,i):xm(d,p,i)}function APe(d,p,i=!1){var v,E;if(!d.static)return null;if(p.execution){const b=(v=p.lastExecutionResults)==null?void 0:v.readValue(d.id);if(b&&!i)return{value:b,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(E=p.localTestValues)==null?void 0:E.readValue(d.id),l=p.getValueTypePreference(d.id);if(n&&!i&&(l===null||l!==$e.DefaultValue))return{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null};const c=d.getDefaultValue();let e=null;return c&&(i||l===null||l!==$e.Testing)&&(e={value:c,valueOwner:d,type:$e.DefaultValue,inheritanceLink:null}),Hd(d)&&qn(e==null?void 0:e.value)?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:qn(e==null?void 0:e.value)?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:e}function gPe(d,p,i=!1){var v,E;if(p.execution&&p.execution.hasEntity(d)&&!i){const b=(v=p.lastExecutionResults)==null?void 0:v.readValue(d.id);if(b)return{value:b,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(E=p.localTestValues)==null?void 0:E.readValue(d.id),l=p.getValueTypePreference(d.id);if(n&&!i&&(l===null||l!==$e.DefaultValue))return{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null};const c=d.getDefaultValue();let e=null;return c&&(i||l===null||l!==$e.Testing)&&(e={value:c,valueOwner:d,type:$e.DefaultValue,inheritanceLink:null}),Hd(d)&&qn((e==null?void 0:e.value)||null)?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:qn((e==null?void 0:e.value)||null)?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:e}function Ru(d,p,i=!1){switch(d.type){case o.ArgumentDeclaration:return vPe(d,p,i);case o.InputMap:return bPe(d,p,i);case o.VariableDeclaration:return zV(d,p,i);case o.VariableInstance:return TPe(d,p,i);case o.OutputMap:return EPe(d,p,i);case o.ReturnStatement:case o.BreakStatement:case o.ContinueStatement:return YV(d,p,i);case o.Property:return APe(d,p,i);case o.ValueDescriptor:return gPe(d,p,i);case o.Operation:case o.FunctionCall:case o.InternalCall:case o.Search:return yPe(d,p,i);default:return null}}function ho(d,p,i=!1){switch(d.type){case o.InputMap:return Yb(d,p,i);case o.VariableDeclaration:return sv(d,p,i);case o.VariableInstance:return JV(d,p,i);case o.ReturnStatement:case o.BreakStatement:case o.ContinueStatement:return YV(d,p,i);default:return null}}function c$i(d){var p;if(d&&d.type===$e.DefaultValue&&d.value&&d.valueOwner&&(!RA.includes(d.valueOwner.type)||((p=d.valueOwner.getDefaultValue())==null?void 0:p.id)===d.value.id)){const i=Et(d.valueOwner.getDataType(null),d.valueOwner,d.valueOwner.project);return{type:$e.DefaultValue,value:i,valueOwner:d.valueOwner,inheritanceLink:null}}return d}function yc(d,p,i,n){let l=!1,c=null,e=null;n instanceof q?(l=!0,c=n,e=null):(c=null,e=n);const y=d.parent;return p.getVariableDeclarations().forEach(v=>{var b,O,P,$,L,U;const E=v.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===y.id){let F=l?v.getDefaultValue():e==null?void 0:e.readValue(v.id);F?!l&&F&&F.id===((O=v.getDefaultValue())==null?void 0:O.id)&&(F=Et(v.getDataType(null),v,p)):l?F=Zl(v.getDataType(null),v,p,c):F=Et(v.getDataType(null),v,p);const Z=le(d,p),X=d.codeName||((P=d.extends)==null?void 0:P.codeName)||(($=d.implements[0])==null?void 0:$.codeName)||Wi(Z);let se={};((U=(L=v.dataType)==null?void 0:L.entity)==null?void 0:U.type)===o.DefinitionEntity&&(se={...se,...v.dataType.entity.getActiveRawDefaultValue()}),mr(F==null?void 0:F.value)&&(se={...se,...F.value}),se[X]=i,F==null||F.metaSync({value:se},c),l||e==null||e.writeValue(v,F);return}}),c}function $m(d,p,i,n){var P,$,L,U;let l=!1,c=null,e=null;n instanceof q?(l=!0,c=n,e=null):(c=null,e=n);const y=Zn(d.parent),T=y.getDataType(null);if(!(T!=null&&T.isObject()))return c;let v=l?y.getDefaultValue():e==null?void 0:e.readValue(y.id);v?!l&&v&&v.id===((P=y.getDefaultValue())==null?void 0:P.id)&&(v=Et(y.getDataType(null),y,p)):l?v=Zl(y.getDataType(null),y,p,c):v=Et(y.getDataType(null),y,p);const E=le(d,p),b=d.codeName||(($=d.declaration)==null?void 0:$.codeName)||Wi(E);let O={};if(((U=(L=y.dataType)==null?void 0:L.entity)==null?void 0:U.type)===o.DefinitionEntity&&(O={...O,...y.dataType.entity.getActiveRawDefaultValue()}),mr(v==null?void 0:v.value)&&(O={...O,...v.value}),O[b]=i,v==null||v.metaSync({value:O},c),l||e==null||e.writeValue(y,v),(i===""||i===null||i===void 0)&&d.type===o.OutputMap){const F=y.inputs.find(Z=>{var X,se;return((X=Z.declaration)==null?void 0:X.id)===((se=d.declaration)==null?void 0:se.id)||le(Z,p)===E});if(F){let Z=l?F.getDefaultValue():e==null?void 0:e.readValue(F.id);Z&&Z.metaSync({value:null},c),l||e==null||e.removeValue(F.id)}}return c}function IPe(d,p,i){var e,y,T,v,E;let n=!1,l=null,c=null;if(i instanceof q?(n=!0,l=i,c=null):(l=null,c=i),St.includes(d.type)){const b=Zn(d);(e=b.dataType)!=null&&e.isObject()&&b.inputs.forEach(O=>{var P,$,L,U,F,Z;if(((P=O.declaration)==null?void 0:P.type)===o.Property&&O.declaration.static){let X=n?(($=d.getDefaultValue)==null?void 0:$.call(d))||null:c==null?void 0:c.readValue(O.declaration.id);X?!n&&X&&X.id===((L=O.declaration.getDefaultValue())==null?void 0:L.id)&&(X=Et(O.declaration.getDataType(null),O.declaration,p)):n?X=Zl(O.declaration.getDataType(null),O.declaration,p,l):X=Et(O.declaration.getDataType(null),O.declaration,p),X==null||X.metaSync({value:null},l),n||c==null||c.removeValue((U=O.declaration)==null?void 0:U.id)}else if(((F=O.declaration)==null?void 0:F.type)===o.Property){let X=n?((Z=d.getDefaultValue)==null?void 0:Z.call(d))||null:c==null?void 0:c.readValue(O.id);X&&X.metaSync({value:null},l),n||c==null||c.removeValue(O.id)}})}else d.type===o.InputMap?((y=d.declaration)==null?void 0:y.type)===o.Property&&d.declaration.static?yc(d.declaration,p,null,i):St.includes(d.parent.type)&&((T=d.declaration)==null?void 0:T.type)===o.Property&&$m(d,p,null,i):d.type===o.OutputMap?((v=d.declaration)==null?void 0:v.type)===o.Property&&d.declaration.static?yc(d.declaration,p,null,i):St.includes(d.parent.type)&&((E=d.declaration)==null?void 0:E.type)===o.Property&&$m(d,p,null,i):d.type===o.Property&&d.static&&yc(d,p,null,i);return l}function RPe(d,p,i,n){var y,T,v,E,b,O,P;let l=!1,c=null,e=null;if(n instanceof q?(l=!0,c=n,e=null):(c=null,e=n),St.includes(p.type)){const $=Zn(p);if((y=$.dataType)!=null&&y.isObject()){let L={};((v=(T=$.dataType)==null?void 0:T.entity)==null?void 0:v.type)===o.DefinitionEntity&&(L={...L,...$.dataType.entity.getActiveRawDefaultValue()});const U=mr(d)?d:L;$.inputs.forEach(F=>{var Z,X,se,Q,fe,de;if(((Z=F.declaration)==null?void 0:Z.type)===o.Property&&F.declaration.static){let ce=l?((X=p.getDefaultValue)==null?void 0:X.call(p))||null:e==null?void 0:e.readValue(F.declaration.id);ce?!l&&ce&&ce.id===((se=F.declaration.getDefaultValue())==null?void 0:se.id)&&(ce=Et(F.declaration.getDataType(null),F.declaration,i)):l?ce=Zl(F.declaration.getDataType(null),F.declaration,i,c):ce=Et(F.declaration.getDataType(null),F.declaration,i);const me=le(F,i),ae=F.codeName||((Q=F.declaration)==null?void 0:Q.codeName)||Wi(me),ye=U[ae];ce==null||ce.metaSync({value:ye},c),l||e==null||e.writeValue(F.declaration,ce)}else if(((fe=F.declaration)==null?void 0:fe.type)===o.Property){let ce=l?((de=p.getDefaultValue)==null?void 0:de.call(p))||null:e==null?void 0:e.readValue(F.id);ce&&ce.metaSync({value:null},c),l||e==null||e.removeValue(F.id)}})}}else p.type===o.InputMap?((E=p.declaration)==null?void 0:E.type)===o.Property&&p.declaration.static?yc(p.declaration,i,d,n):St.includes(p.parent.type)&&((b=p.declaration)==null?void 0:b.type)===o.Property&&$m(p,i,d,n):p.type===o.OutputMap?((O=p.declaration)==null?void 0:O.type)===o.Property&&p.declaration.static?yc(p.declaration,i,null,n):St.includes(p.parent.type)&&((P=p.declaration)==null?void 0:P.type)===o.Property&&$m(p,i,null,n):p.type===o.Property&&p.static&&yc(p,i,d,n);return c}function DPe(d,p,i){const n=yl(d,p);let l=!1,c=null,e=null;return i instanceof q?(l=!0,c=i,e=null):(c=null,e=i),n.forEach(y=>{var v,E,b;let T=l?((v=y.getDefaultValue)==null?void 0:v.call(y))||null:e==null?void 0:e.readValue(y.id);T?!l&&T&&T.id===((b=((E=y.getDefaultValue)==null?void 0:E.call(y))||null)==null?void 0:b.id)&&(T=Et(d.getDataType(null),d,d.project)):l?T=Zl(y.getDataType(null),y,p,c):T=Et(y.getDataType(null),y,p),T==null||T.metaSync({value:null},c),l||e==null||e.removeValue(y.id),IPe(y,p,i)}),c}function f$i(d,p,i,n){if(Fx(d))return DPe(p,i,n);const l=yl(p,i);let c=!1,e=null,y=null;n instanceof q?(c=!0,e=n,y=null):(e=null,y=n);const T=new Set([...i.getAllBuiltInIds(),...Yi()]);return T.has(p.id)||l.forEach(v=>{var b,O,P,$;if(T.has(v.id))return;let E=null;if(c){const L=((b=v.getDefaultValue)==null?void 0:b.call(v))||null;L&&(T.has(L.id)||((O=L.parent)==null?void 0:O.id)!==v.id?E=L.clone(e,v):E=L)}else E=y==null?void 0:y.readValue(v.id);E?!c&&E&&E.id===(($=(P=v.getDefaultValue)==null?void 0:P.call(v))==null?void 0:$.id)&&(E=Et(v.getDataType(null),v,i)):c?(E=Zl(v.getDataType(null),v,i,e),e==null||e.add(E,H.Added)):E=Et(v.getDataType(null),v,i),E==null||E.metaSync({value:d},e),c||y==null||y.writeValue(v,E),RPe(d,v,i,n)}),e}function hc(d,p,i,n){let l=!1,c=null,e=null;n instanceof q?(l=!0,c=n,e=null):(c=null,e=n);const y=d.parent;return p.getVariableDeclarations().forEach(v=>{var b,O,P,$,L,U;const E=v.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===y.id){let F=l?v.getDefaultValue():e==null?void 0:e.readValue(v.id);F?!l&&F&&F.id===((O=v.getDefaultValue())==null?void 0:O.id)&&(F=Et(v.getDataType(null),v,p)):l?F=Zl(v.getDataType(null),v,p,c):F=Et(v.getDataType(null),v,p);const Z=le(d,p),X=d.codeName||((P=d.extends)==null?void 0:P.codeName)||(($=d.implements[0])==null?void 0:$.codeName)||Wi(Z);let se={};((U=(L=v.dataType)==null?void 0:L.entity)==null?void 0:U.type)===o.DefinitionEntity&&(se={...se,...v.dataType.entity.getActiveRawDefaultValue()}),mr(F==null?void 0:F.value)&&(se={...se,...F.value}),Array.isArray(i)?se[X]=(i==null?void 0:i.map(Q=>Q.toShallowJSON()))||null:se[X]=(i==null?void 0:i.toShallowJSON())||null,F==null||F.metaSync({value:se},c),l||e==null||e.writeValue(v,F);return}}),c}function Lm(d,p,i,n){var P,$,L,U;let l=!1,c=null,e=null;n instanceof q?(l=!0,c=n,e=null):(c=null,e=n);const y=Zn(d.parent),T=y.getDataType(null);if(!(T!=null&&T.isObject()))return c;let v=l?y.getDefaultValue():e==null?void 0:e.readValue(y.id);v?!l&&v&&v.id===((P=y.getDefaultValue())==null?void 0:P.id)&&(v=Et(y.getDataType(null),y,p)):l?v=Zl(y.getDataType(null),y,p,c):v=Et(y.getDataType(null),y,p);const E=le(d,p),b=d.codeName||(($=d.declaration)==null?void 0:$.codeName)||Wi(E);let O={};if(((U=(L=y.dataType)==null?void 0:L.entity)==null?void 0:U.type)===o.DefinitionEntity&&(O={...O,...y.dataType.entity.getActiveRawDefaultValue()}),mr(v==null?void 0:v.value)&&(O={...O,...v.value}),Array.isArray(i)?O[b]=(i==null?void 0:i.map(F=>F.toShallowJSON()))||null:O[b]=(i==null?void 0:i.toShallowJSON())||null,v==null||v.metaSync({value:O},c),l||e==null||e.writeValue(y,v),i==null&&d.type===o.OutputMap){const F=y.inputs.find(Z=>{var X,se;return((X=Z.declaration)==null?void 0:X.id)===((se=d.declaration)==null?void 0:se.id)||le(Z,p)===E});if(F){let Z=l?F.getDefaultValue():e==null?void 0:e.readValue(F.id);Z&&(Array.isArray(i)?Z==null||Z.setValueAsTypeList(i,c):Z==null||Z.setValueAsTypeSingle(i,c)),l||e==null||e.removeValue(F.id)}}return c}function OPe(d,p,i){var n,l,c,e;return d.type===o.InputMap?((n=d.declaration)==null?void 0:n.type)===o.Property&&d.declaration.static?hc(d.declaration,p,null,i):St.includes(d.parent.type)&&((l=d.declaration)==null?void 0:l.type)===o.Property&&Lm(d,p,null,i):d.type===o.OutputMap?((c=d.declaration)==null?void 0:c.type)===o.Property&&d.declaration.static?hc(d.declaration,p,null,i):St.includes(d.parent.type)&&((e=d.declaration)==null?void 0:e.type)===o.Property&&Lm(d,p,null,i):d.type===o.Property&&d.static&&hc(d,p,null,i),i}function wPe(d,p,i,n){var l,c,e,y;return p.type===o.InputMap?((l=p.declaration)==null?void 0:l.type)===o.Property&&p.declaration.static?hc(p.declaration,i,d,n):St.includes(p.parent.type)&&((c=p.declaration)==null?void 0:c.type)===o.Property&&Lm(p,i,d,n):p.type===o.OutputMap?((e=p.declaration)==null?void 0:e.type)===o.Property&&p.declaration.static?hc(p.declaration,i,null,n):St.includes(p.parent.type)&&((y=p.declaration)==null?void 0:y.type)===o.Property&&Lm(p,i,null,n):p.type===o.Property&&p.static&&hc(p,i,d,n),n}function CPe(d,p,i){const n=yl(d,p);let l=!1,c=null,e=null;return i instanceof q?(l=!0,c=i,e=null):(c=null,e=i),n.forEach(y=>{var v,E,b;let T=l?(v=y.getDefaultValue)==null?void 0:v.call(y):e==null?void 0:e.readValue(y.id);T?!l&&T&&T.id===((b=(E=y.getDefaultValue)==null?void 0:E.call(y))==null?void 0:b.id)&&(T=Et(y.getDataType(null),y,y.project)):l?T=Zl(y.getDataType(null),y,p,c):T=Et(y.getDataType(null),y,p),T==null||T.setValueAsTypeSingle(null,c),T==null||T.setValueAsTypeList(null,c),l||e==null||e.removeValue(y.id),OPe(y,p,i)}),c}function y$i(d,p,i,n){if(d==null)return CPe(p,i,n);const l=yl(p,i);let c=!1,e=null,y=null;return n instanceof q?(c=!0,e=n,y=null):(e=null,y=n),l.forEach(T=>{var E,b,O;let v=c?(E=T.getDefaultValue)==null?void 0:E.call(T):y==null?void 0:y.readValue(T.id);v?!c&&v&&v.id===((O=(b=T.getDefaultValue)==null?void 0:b.call(T))==null?void 0:O.id)&&(v=Et(T.getDataType(null),T,T.project)):c?v=Zl(T.getDataType(null),T,i,e):v=Et(T.getDataType(null),T,i),Array.isArray(d)?v==null||v.setValueAsTypeList(d,e):v==null||v.setValueAsTypeSingle(d,e),c||y==null||y.writeValue(T,v),wPe(d,T,i,n)}),e}class FI{constructor(p,i){this.extensionsRegistry=p,this.contextType=i,this.off=this.extensionsRegistry.off.bind(this.extensionsRegistry),this.on=this.extensionsRegistry.on.bind(this.extensionsRegistry),this.emit=this.extensionsRegistry.emit.bind(this.extensionsRegistry),this.emitAsync=this.extensionsRegistry.emitAsync.bind(this.extensionsRegistry),this.emitAsyncAll=this.extensionsRegistry.emitAsyncAll.bind(this.extensionsRegistry),this.emitAsyncAllSettled=this.extensionsRegistry.emitAsyncAllSettled.bind(this.extensionsRegistry),this.emitAsyncSequentially=this.extensionsRegistry.emitAsyncSequentially.bind(this.extensionsRegistry),this.emitAsyncSequentiallyAll=this.extensionsRegistry.emitAsyncSequentiallyAll.bind(this.extensionsRegistry),this.emitAsyncSequentiallyAllSettled=this.extensionsRegistry.emitAsyncSequentiallyAllSettled.bind(this.extensionsRegistry)}on(p,i){this.extensionsRegistry.on(p,i)}emit(p,...i){this.extensionsRegistry.emit(p,...i)}off(p,i){this.extensionsRegistry.off(p,i)}emitAsync(p,...i){return this.extensionsRegistry.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.extensionsRegistry.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.extensionsRegistry.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.extensionsRegistry.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.extensionsRegistry.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled(p,...i)}}var Ee=(d=>(d[d.High=1]="High",d[d.Normal=5]="Normal",d[d.Low=10]="Low",d))(Ee||{}),J=(d=>(d.Logic="logic",d.EditorGUI="editor-gui",d.GUI="gui",d.Editor="editor",d.Compile="compile",d.PublicationRun="publication-run",d))(J||{}),be=(d=>(d.All="*",d.OnAll="on:*",d.EmitAll="emit:*",d.ReadAll="read:*",d.WriteAll="write:*",d.UpdateAll="update:*",d.DoAll="do:*",d.OnLogicAll="on:logic:*",d.EmitLogicAll="emit:logic:*",d.ReadLogicAll="read:logic:*",d.WriteLogicAll="write:logic:*",d.UpdateLogicAll="update:logic:*",d.DoLogicAll="do:logic:*",d.OnGUIAll="on:gui:*",d.EmitGUIAll="emit:gui:*",d.ReadGUIAll="read:gui:*",d.WriteGUIAll="write:gui:*",d.UpdateGUIAll="update:gui:*",d.DoGUIAll="do:gui:*",d.OnEditorAll="on:editor:*",d.EmitEditorAll="emit:editor:*",d.ReadEditorAll="read:editor:*",d.WriteEditorAll="write:editor:*",d.UpdateEditorAll="update:editor:*",d.DoEditorAll="do:editor:*",d.OnCompileBefore="on:compile:before:DefinitionEntity",d.OnCompileDefault="on:compile:default:DefinitionEntity",d.OnCompileAfter="on:compile:after:DefinitionEntity",d.EmitCompile="emit:compile:DefinitionEntity",d.DoEditorPublish="do:editor:publish",d.PostGUICanvasSlotNewToolbarButton="write:gui:canvas:slot:toolbar-button",d.ReadGUICanvasSlotToolbarButtons="read:gui:canvas:slot:toolbar-buttons",d.UpdateGUIGlobalTheme="update:gui:global:theme",d))(be||{});class _Pe{constructor(p){I(this,"state",new Map);p&&(this.state=new Map(Object.entries(p)))}get(p){return this.state.get(p)}set(p,i){this.state.set(p,i)}delete(p){this.state.delete(p)}}class PPe extends _Pe{constructor(p,i){super(i),this.parentExtension=p}}class ge{constructor(p,i){I(this,"manifest");I(this,"module");I(this,"state");this.extensionsRegistry=p,this.state=new PPe(this,i)}}class Pw extends FI{constructor(i,n){super(i,J.Logic);I(this,"id");this._project=n,this.id=n.id}get type(){return this._project.type}get name(){return this._project.name}get description(){return this._project.description}get version(){return this._project.version}get createdAt(){return this._project.createdAt}get previousVersion(){return this._project.previousVersion}get author(){return this._project.author}get deleted(){return this._project.deleted}get editable(){return this._project.editable}get deletable(){return this._project.deletable}get entities(){return[...this._project.entities]}get projects(){return[...this._project.projects]}get functions(){return[...this._project.functions]}get events(){return[...this._project.events]}get variableDeclarations(){return[...this._project.variableDeclarations]}get variableInstances(){return[...this._project.variableInstances]}get conditions(){return[...this._project.conditions]}get operations(){return[...this._project.operations]}get functionCalls(){return[...this._project.functionCalls]}get loops(){return[...this._project.loops]}get searches(){return[...this._project.searches]}get primitives(){return[...this._project.primitives]}get builtInBaseEntities(){return[...this._project.builtInBaseEntities]}get operationDeclarations(){return[...this._project.operationDeclarations]}get globalEventActionDescriptors(){return[...this._project.globalEventActionDescriptors]}get loopDeclarations(){return[...this._project.loopDeclarations]}get loopDeclarationsBodies(){return[...this._project.loopDeclarationsBodies]}get conditionDeclarations(){return[...this._project.conditionDeclarations]}get valueDescriptors(){return[...this._project.valueDescriptors]}get dataTypes(){return[...this._project.dataTypes]}get errors(){return[...this._project.errors]}get history(){return[...this._project.history]}get undoableStackValueIndex(){return this._project.undoableStackValueIndex}get knownVersions(){return this._project.knownVersions}get activeVersion(){return this._project.activeVersion}get initialized(){return this._project.initialized}get startedInitialization(){return this._project.startedInitialization}closePersistChangeSetsSequentially(){return this._project.closePersistChangeSetsSequentially()}persistChangeSetSequentially(i){return this._project.persistChangeSetSequentially(i)}toLatestChangeSet(i,n,l,c=!1,e="here-this"){return this._project.toLatestChangeSet(i,n,l,c,e)}addChangeSet(i){return this._project.addChangeSet(i)}discardChangeSet(i){return this._project.discardChangeSet(i)}subscribeDependents(i){return this._project.subscribeDependents(i)}unsubscribeDependents(i){return this._project.unsubscribeDependents(i)}syncDependents(i){return this._project.syncDependents(i)}onDetachedDependencyRemoved(i,n,l){return this._project.onDetachedDependencyRemoved(i,n,l)}onDetachedDependencyRestored(i,n,l){return this._project.onDetachedDependencyRestored(i,n,l)}increaseVersion(i){return this._project.increaseVersion(i)}captureVersion(){return this._project.captureVersion()}restoreVersion(i){return this._project.restoreVersion(i)}updateWithShallowTransfer(i,n){return this._project.updateWithShallowTransfer(i,n)}hydrateAncestors(){return this._project.hydrateAncestors()}afterAllChildrenInitialized(i=null){return this._project.afterAllChildrenInitialized(i)}addSelfToProject(i){return this._project.addSelfToProject(i)}get instancesList(){return[...this._project.instancesList]}isOperationDeclaration(i){return this._project.isOperationDeclaration(i)}isGlobalEventActionDescriptor(i){return this._project.isGlobalEventActionDescriptor(i)}isLoopDeclaration(i){return this._project.isLoopDeclaration(i)}isConditionDeclaration(i){return this._project.isConditionDeclaration(i)}findSubscribedBuiltInInstance(i){return this._project.findSubscribedBuiltInInstance(i)}get(i){return this._project.get(i)}getDeleted(i){return this._project.getDeleted(i)}getManaged(i){return this._project.getManaged(i)}getBuiltIn(i){return this._project.getBuiltIn(i)}findSubscribedInstanceFromReference(i){return this._project.findSubscribedInstanceFromReference(i)}findSubscribedBuiltInInstanceFromReference(i){return this._project.findSubscribedBuiltInInstanceFromReference(i)}metaSync(i,n){return this._project.metaSync(i,n)}getAllBuiltInIds(){return this._project.getAllBuiltInIds()}getAllBuiltIn(){return this._project.getAllBuiltIn()}toFlat(i){return this._project.toFlat(i)}toFlatIds(i){return this._project.toFlatIds(i)}toMeta(){return this._project.toMeta()}toJSON(i){return this._project.toJSON(i)}toJSONClone(i){return this._project.toJSONClone(i)}toReference(i){return this._project.toReference(i)}toShallowJSON(i){return this._project.toShallowJSON(i)}toFlatJSON(i){return this._project.toFlatJSON(i)}toGenerationTarget(){return this._project.toGenerationTarget()}toFlatGenerationTarget(i){return this._project.toFlatGenerationTarget(i)}clearErrors(){return this._project.clearErrors()}validate(){return this._project.validate()}validateChildren(){return this._project.validateChildren()}getErrors(){return this._project.getErrors()}getShallowErrors(){return this._project.getShallowErrors()}getDefinitionEntity(i){return this._project.getDefinitionEntity(i)}addDefinitionEntity(i){return this._project.addDefinitionEntity(i)}addFunctionDeclaration(i){return this._project.addFunctionDeclaration(i)}addFunctionCall(i){return this._project.addFunctionCall(i)}addVariableDeclaration(i){return this._project.addVariableDeclaration(i)}addVariableInstance(i){return this._project.addVariableInstance(i)}addInstalledProject(i){return this._project.addInstalledProject(i)}addGlobalEvent(i){return this._project.addGlobalEvent(i)}addCondition(i){return this._project.addCondition(i)}addOperation(i){return this._project.addOperation(i)}addLoop(i){return this._project.addLoop(i)}addSearch(i){return this._project.addSearch(i)}removeDefinitionEntity(i){return this._project.removeDefinitionEntity(i)}removeCondition(i){return this._project.removeCondition(i)}removeOperation(i){return this._project.removeOperation(i)}removeLoop(i){return this._project.removeLoop(i)}removeSearch(i){return this._project.removeSearch(i)}removeFunctionCall(i){return this._project.removeFunctionCall(i)}removeVariableInstance(i){return this._project.removeVariableInstance(i)}removeVariableDeclaration(i){return this._project.removeVariableDeclaration(i)}removeFunctionDeclaration(i){return this._project.removeFunctionDeclaration(i)}removeInstalledProject(i){return this._project.removeInstalledProject(i)}removeGlobalEvent(i){return this._project.removeGlobalEvent(i)}removeTopLevelVariableDeclaration(i){return this._project.removeTopLevelVariableDeclaration(i)}getEntryPoints(){return this._project.getEntryPoints()}getTerminationStatements(){return this._project.getTerminationStatements()}getFunctionDeclaration(i){return this._project.getFunctionDeclaration(i)}getConditions(){return this._project.getConditions()}getOperations(){return this._project.getOperations()}getVariables(){return this._project.getVariables()}getVariableInstances(){return this._project.getVariableInstances()}getVariableDeclarations(){return this._project.getVariableDeclarations()}getLoops(){return this._project.getLoops()}getSearches(){return this._project.getSearches()}getBuiltInPersistedEntity(){return this._project.getBuiltInPersistedEntity()}requestActiveDynamicValue(i,n=!1){return this._project.requestActiveDynamicValue(i,n)}undo(){return this._project.undo()}redo(){return this._project.redo()}applyExternalChangeSet(i){return this._project.applyExternalChangeSet(i)}toFullProjectTransfer(){return this._project.toFullProjectTransfer()}}function h$i(d,p){return p instanceof Pw?p:new Pw(d,p)}const ny="built-in-function-implementations__",we="operations-implementations__",Pa="conditions-implementations__",Ae={UUID:"uuid",SEARCH_NODE_IMPLEMENTATION:"search-node-implementation",BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION:ny+Mr.AbortExecution,BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY:ny+Mr.CreatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY:ny+Mr.UpdatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY:ny+Mr.DeletePersistedEntity,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY:we+Pt.Empty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY:we+Pt.NotEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL:we+Pt.PrimitiveEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL:we+Pt.PrimitiveNotEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST:we+Hn.HttpRequest,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY:we+Ce.Validate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL:we+Mi.Sequential,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL:we+Mi.Parallel,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT:we+Mi.Wait,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN:we+ie.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT:we+ie.Split,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS:we+ie.DeleteLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS:we+ie.DeleteFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX:we+ie.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX:we+ie.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS:we+ie.ReplaceFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS:we+ie.ReplaceLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL:we+ie.ReplaceAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX:we+ie.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM:we+ie.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST:we+ie.GetFirst,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST:we+ie.GetLast,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND:we+ie.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND:we+ie.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE:we+ie.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH:we+ie.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS:we+ie.GetFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS:we+ie.GetLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE:we+ie.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT:we+ie.Concat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF:we+ie.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF:we+ie.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE:we+ie.Unique,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN:we+ie.Flatten,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT:we+ie.Sort,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE:we+ie.Shuffle,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK:we+ie.Chunk,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START:we+ie.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END:we+ie.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT:we+ie.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH:we+S.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE:we+S.ToLowerCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE:we+S.ToUpperCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN:we+S.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS:we+ie.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL:we+ie.ContainsAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY:we+ie.ContainsAny,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX:we+S.SplitAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS:we+S.SplitAtAllSeparators,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR:we+S.SplitAtFirstSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR:we+S.SplitAtLastSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS:we+S.DeleteLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS:we+S.DeleteFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX:we+S.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX:we+S.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS:we+S.ReplaceFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS:we+S.ReplaceLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX:we+S.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH:we+S.ReplaceFirstMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH:we+S.ReplaceLastMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES:we+S.ReplaceAllMatches,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM:we+S.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS:we+S.GetFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS:we+S.GetLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF:we+S.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND:we+S.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND:we+S.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE:we+S.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM:we+S.Trim,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START:we+S.TrimStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END:we+S.TrimEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING:we+S.Substring,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE:we+S.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START:we+S.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END:we+S.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT:we+S.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF:we+S.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX:we+S.MatchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX:we+S.MatchAllRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX:we+S.SearchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX:we+S.ReplaceRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE:we+S.NormalizeUnicode,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS:we+S.RemoveDiacritics,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES:we+S.CountOccurrences,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX:we+S.EnsurePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX:we+S.EnsureSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX:we+S.RemovePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX:we+S.RemoveSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION:we+ee.Addition,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION:we+ee.Subtraction,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION:we+ee.Multiplication,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION:we+ee.Division,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER:we+ee.Remainder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION:we+ee.Exponentiation,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE:we+ee.Absolute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN:we+ee.Sign,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND:we+ee.Round,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE:we+ee.Negate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR:we+ee.Floor,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL:we+ee.Ceil,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP:we+ee.Clamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC:we+ee.Trunc,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS:we+ee.RoundToDecimals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP:we+ee.SnapToStep,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE:we+ee.MapRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE:we+ee.Average,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN:we+ee.Median,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF:we+ee.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF:we+ee.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT:we+ee.SquareRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT:we+ee.CubeRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT:we+ee.NthRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP:we+ee.Exp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL:we+ee.LogNatural,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10:we+ee.Log10,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN:we+ee.Sin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS:we+ee.Cos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN:we+ee.Tan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN:we+ee.Asin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS:we+ee.Acos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN:we+ee.Atan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2:we+ee.Atan2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS:we+ee.ToRadians,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES:we+ee.ToDegrees,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF:we+ee.PercentOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE:we+ee.PercentageChange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN:we+ee.MoreThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN:we+ee.LessThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL:we+ee.LessThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL:we+ee.MoreThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER:we+Xe.GenerateRandomInteger,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT:we+Xe.GenerateRandomFloat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL:we+Xe.GenerateRandomHexadecimal,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62:we+Xe.GenerateRandomBase62,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64:we+Xe.GenerateRandomBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC:we+Xe.GenerateRandomAlphanumeric,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER:we+Xe.GenerateIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4:we+Xe.GenerateRandomUUIDv4,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER:we+Xe.GenerateShortIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN:we+Xe.GenerateHexadecimalToken,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH:we+S.StartsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH:we+S.EndsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS:we+S.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX:we+S.MatchesRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP:we+k.GetCurrentTimestamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE:we+k.FormatDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE:we+k.ParseDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE:we+k.AddToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE:we+k.SubtractFromDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES:we+k.DifferenceBetweenDates,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE:we+k.ToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX:we+k.ToUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX:we+k.FromUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING:we+k.ToISOString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR:we+k.GetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH:we+k.GetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE:we+k.GetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR:we+k.GetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE:we+k.GetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND:we+k.GetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND:we+k.GetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY:we+k.GetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR:we+k.GetWeekOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER:we+k.GetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR:we+k.GetDayOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH:we+k.GetDaysInMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE:we+k.GetCurrentIanaTimeZone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR:we+k.SetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH:we+k.SetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE:we+k.SetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR:we+k.SetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE:we+k.SetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND:we+k.SetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND:we+k.SetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY:we+k.SetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER:we+k.SetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF:we+k.StartOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF:we+k.EndOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO:we+k.RoundTo,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE:Pa+k.IsBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER:Pa+k.IsAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME:Pa+k.IsSame,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE:Pa+k.IsSameOrBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER:Pa+k.IsSameOrAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN:Pa+k.IsBetween,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID:Pa+k.IsValid,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR:Pa+k.IsLeapYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE:we+k.ClampToRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF:we+k.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF:we+k.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW:we+k.FromNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW:we+k.ToNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF:we+k.HumanizeDiff,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS:we+k.AddBusinessDays,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY:we+k.NextWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY:we+k.PreviousWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC:we+k.ToUTC,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE:we+k.ConvertTimezone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET:we+k.GetTimezoneOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET:we+k.SetUTCOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY:we+Ce.ReadKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY:we+Ce.WriteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY:we+Ce.DeleteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY:we+Ce.ReadNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY:we+Ce.WriteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY:we+Ce.DeleteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY:we+Ce.WriteSafeNestedKeyRecursively,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY:Pa+Ce.HasKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY:Pa+Ce.HasNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS:Pa+Ce.KeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS:Pa+Ce.NestedKeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE:Pa+Ce.IsInstanceOfType,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE:we+Ce.Merge,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS:we+Ce.Keys,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES:we+Ce.Values,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES:we+Ce.Entries,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF:we+He.GetTypeOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH:we+ii.Hash,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC:we+ii.Hmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES:we+Xe.GenerateRandomBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL:we+ii.ConstantTimeEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2:we+ii.DeriveKeyPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2:we+Xr.HashPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2:we+Xr.VerifyPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC:we+zi.BuildJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC:we+zi.VerifyJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE:we+zi.DecodeJwt,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING:we+He.FromBytesToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES:we+He.ToBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER:we+He.ToNumber,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING:we+He.ToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64:we+He.EncodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64:we+He.DecodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL:we+He.EncodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL:we+He.DecodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX:we+He.EncodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX:we+He.DecodeHex,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE:we+Yr.Parse,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY:we+Yr.Stringify};class VPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION,version:"1.0.0",description:'Implementation for the built-in function "Abort Execution". It terminates the execution of the current entity being run.',initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null})})}}class NPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Delete Persisted Entity". It deletes the current entity as an entry in the persisted storage.',initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null})})}}class xPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Create Persisted Entity". It saves the current entity state to the persisted storage.',initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null})})}}class $Pe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Update Persisted Entity". It saves the current entity state to the persisted storage.',initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null})})}}class LPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.SEARCH_NODE_IMPLEMENTATION,version:"1.0.0",description:"Implementation for search nodes when they get executed and query data.",initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({data:null,error:"Search module not implemented"})})}}class MPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.UUID,version:"1.0.0",description:"UUID generation module, for all contexts and runtimes",initPriority:Ee.High,permissions:[be.All],contexts:[]});I(this,"module",lC)}}const BPe=d=>d.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class m$i extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY,version:"1.0.0",description:"Comparison: Empty (!value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Pt.Empty);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=BPe(n),c=!l;return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class T$i extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY,version:"1.0.0",description:"Comparison: NotEmpty (!!value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Pt.NotEmpty);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=BPe(n),c=!!l;return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}const EA=class EA extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveEqual (typed equality / deep JSON equality)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Pt.PrimitiveEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{var l,c,e,y,T,v;try{const E=(c=(l=n[0])==null?void 0:l.value)==null?void 0:c.name,b=(y=(e=n[0])==null?void 0:e.value)==null?void 0:y.value,O=(v=(T=n[1])==null?void 0:T.value)==null?void 0:v.value;let P=!1;return E&&EA.primitiveSet.has(E)?P=b===O:E===oe.Untyped||E===oe.KeyValue?P=JSON.stringify(b)===JSON.stringify(O):P=!1,{value:G.Success,error:null,result:P}}catch(E){return{value:G.UnhandledError,error:E,result:null}}}})}};I(EA,"primitiveSet",new Set([oe.String,oe.Number,oe.Boolean,oe.Null,oe.Enum,oe.Date,oe.UUID]));let Vw=EA;const bA=class bA extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveNotEqual (typed inequality / deep JSON inequality)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Pt.PrimitiveNotEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{var l,c,e,y,T,v;try{const E=(c=(l=n[0])==null?void 0:l.value)==null?void 0:c.name,b=(y=(e=n[0])==null?void 0:e.value)==null?void 0:y.value,O=(v=(T=n[1])==null?void 0:T.value)==null?void 0:v.value;let P=!1;return E&&bA.primitiveSet.has(E)?P=b!==O:E===oe.Untyped||E===oe.KeyValue?P=JSON.stringify(b)!==JSON.stringify(O):P=!1,{value:G.Success,error:null,result:P}}catch(E){return{value:G.UnhandledError,error:E,result:null}}}})}};I(bA,"primitiveSet",new Set([oe.String,oe.Number,oe.Boolean,oe.Null,oe.Enum,oe.Date,oe.UUID]));let Nw=bA;var GPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i="minute",n=/[+-]\d\d(?::?\d\d)?/g,l=/([+-]|\d\d)/g;return function(c,e,y){var T=e.prototype;y.utc=function(L){var U={date:L,utc:!0,args:arguments};return new e(U)},T.utc=function(L){var U=y(this.toDate(),{locale:this.$L,utc:!0});return L?U.add(this.utcOffset(),i):U},T.local=function(){return y(this.toDate(),{locale:this.$L,utc:!1})};var v=T.parse;T.parse=function(L){L.utc&&(this.$u=!0),this.$utils().u(L.$offset)||(this.$offset=L.$offset),v.call(this,L)};var E=T.init;T.init=function(){if(this.$u){var L=this.$d;this.$y=L.getUTCFullYear(),this.$M=L.getUTCMonth(),this.$D=L.getUTCDate(),this.$W=L.getUTCDay(),this.$H=L.getUTCHours(),this.$m=L.getUTCMinutes(),this.$s=L.getUTCSeconds(),this.$ms=L.getUTCMilliseconds()}else E.call(this)};var b=T.utcOffset;T.utcOffset=function(L,U){var F=this.$utils().u;if(F(L))return this.$u?0:F(this.$offset)?b.call(this):this.$offset;if(typeof L=="string"&&(L=function(Q){Q===void 0&&(Q="");var fe=Q.match(n);if(!fe)return null;var de=(""+fe[0]).match(l)||["-",0,0],ce=de[0],me=60*+de[1]+ +de[2];return me===0?0:ce==="+"?me:-me}(L),L===null))return this;var Z=Math.abs(L)<=16?60*L:L;if(Z===0)return this.utc(U);var X=this.clone();if(U)return X.$offset=Z,X.$u=!1,X;var se=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(X=this.local().add(Z+se,i)).$offset=Z,X.$x.$localOffset=se,X};var O=T.format;T.format=function(L){var U=L||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return O.call(this,U)},T.valueOf=function(){var L=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*L},T.isUTC=function(){return!!this.$u},T.toISOString=function(){return this.toDate().toISOString()},T.toString=function(){return this.toDate().toUTCString()};var P=T.toDate;T.toDate=function(L){return L==="s"&&this.$offset?y(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():P.call(this)};var $=T.diff;T.diff=function(L,U,F){if(L&&this.$u===L.$u)return $.call(this,L,U,F);var Z=this.local(),X=y(L).local();return $.call(Z,X,U,F)}}})})(GPe);var v$i=GPe.exports;const E$i=Za(v$i);var UPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i={year:0,month:1,day:2,hour:3,minute:4,second:5},n={};return function(l,c,e){var y,T=function(O,P,$){$===void 0&&($={});var L=new Date(O),U=function(F,Z){Z===void 0&&(Z={});var X=Z.timeZoneName||"short",se=F+"|"+X,Q=n[se];return Q||(Q=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:F,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:X}),n[se]=Q),Q}(P,$);return U.formatToParts(L)},v=function(O,P){for(var $=T(O,P),L=[],U=0;U<$.length;U+=1){var F=$[U],Z=F.type,X=F.value,se=i[Z];se>=0&&(L[se]=parseInt(X,10))}var Q=L[3],fe=Q===24?0:Q,de=L[0]+"-"+L[1]+"-"+L[2]+" "+fe+":"+L[4]+":"+L[5]+":000",ce=+O;return(e.utc(de).valueOf()-(ce-=ce%1e3))/6e4},E=c.prototype;E.tz=function(O,P){O===void 0&&(O=y);var $,L=this.utcOffset(),U=this.toDate(),F=U.toLocaleString("en-US",{timeZone:O}),Z=Math.round((U-new Date(F))/1e3/60),X=15*-Math.round(U.getTimezoneOffset()/15)-Z;if(!Number(X))$=this.utcOffset(0,P);else if($=e(F,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(X,!0),P){var se=$.utcOffset();$=$.add(L-se,"minute")}return $.$x.$timezone=O,$},E.offsetName=function(O){var P=this.$x.$timezone||e.tz.guess(),$=T(this.valueOf(),P,{timeZoneName:O}).find(function(L){return L.type.toLowerCase()==="timezonename"});return $&&$.value};var b=E.startOf;E.startOf=function(O,P){if(!this.$x||!this.$x.$timezone)return b.call(this,O,P);var $=e(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return b.call($,O,P).tz(this.$x.$timezone,!0)},e.tz=function(O,P,$){var L=$&&P,U=$||P||y,F=v(+e(),U);if(typeof O!="string")return e(O).tz(U);var Z=function(fe,de,ce){var me=fe-60*de*1e3,ae=v(me,ce);if(de===ae)return[me,de];var ye=v(me-=60*(ae-de)*1e3,ce);return ae===ye?[me,ae]:[fe-60*Math.min(ae,ye)*1e3,Math.max(ae,ye)]}(e.utc(O,L).valueOf(),F,U),X=Z[0],se=Z[1],Q=e(X).utcOffset(se);return Q.$x.$timezone=U,Q},e.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},e.tz.setDefault=function(O){y=O}}})})(UPe);var b$i=UPe.exports;const A$i=Za(b$i);var jPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n,l){n.prototype.isBetween=function(c,e,y,T){var v=l(c),E=l(e),b=(T=T||"()")[0]==="(",O=T[1]===")";return(b?this.isAfter(v,y):!this.isBefore(v,y))&&(O?this.isBefore(E,y):!this.isAfter(E,y))||(b?this.isBefore(v,y):!this.isAfter(v,y))&&(O?this.isAfter(E,y):!this.isBefore(E,y))}}})})(jPe);var g$i=jPe.exports;const I$i=Za(g$i);var kPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n){n.prototype.isSameOrAfter=function(l,c){return this.isSame(l,c)||this.isAfter(l,c)}}})})(kPe);var R$i=kPe.exports;const D$i=Za(R$i);var KPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n){n.prototype.isSameOrBefore=function(l,c){return this.isSame(l,c)||this.isBefore(l,c)}}})})(KPe);var O$i=KPe.exports;const w$i=Za(O$i);var FPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i="week",n="year";return function(l,c,e){var y=c.prototype;y.week=function(T){if(T===void 0&&(T=null),T!==null)return this.add(7*(T-this.week()),"day");var v=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var E=e(this).startOf(n).add(1,n).date(v),b=e(this).endOf(i);if(E.isBefore(b))return 1}var O=e(this).startOf(n).date(v).startOf(i).subtract(1,"millisecond"),P=this.diff(O,i,!0);return P<0?e(this).startOf("week").week():Math.ceil(P)},y.weeks=function(T){return T===void 0&&(T=null),this.week(T)}}})})(FPe);var C$i=FPe.exports;const _$i=Za(C$i);var SPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i="day";return function(n,l,c){var e=function(v){return v.add(4-v.isoWeekday(),i)},y=l.prototype;y.isoWeekYear=function(){return e(this).year()},y.isoWeek=function(v){if(!this.$utils().u(v))return this.add(7*(v-this.isoWeek()),i);var E,b,O,P,$=e(this),L=(E=this.isoWeekYear(),b=this.$u,O=(b?c.utc:c)().year(E).startOf("year"),P=4-O.isoWeekday(),O.isoWeekday()>4&&(P+=7),O.add(P,i));return $.diff(L,"week")+1},y.isoWeekday=function(v){return this.$utils().u(v)?this.day()||7:this.day(this.day()%7?v:v-7)};var T=y.startOf;y.startOf=function(v,E){var b=this.$utils(),O=!!b.u(E)||E;return b.p(v)==="isoweek"?O?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):T.bind(this)(v,E)}}})})(SPe);var P$i=SPe.exports;const V$i=Za(P$i);var qPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i="month",n="quarter";return function(l,c){var e=c.prototype;e.quarter=function(v){return this.$utils().u(v)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(v-1))};var y=e.add;e.add=function(v,E){return v=Number(v),this.$utils().p(E)===n?this.add(3*v,i):y.bind(this)(v,E)};var T=e.startOf;e.startOf=function(v,E){var b=this.$utils(),O=!!b.u(E)||E;if(b.p(v)===n){var P=this.quarter()-1;return O?this.month(3*P).startOf(i).startOf("day"):this.month(3*P+2).endOf(i).endOf("day")}return T.bind(this)(v,E)}}})})(qPe);var N$i=qPe.exports;const x$i=Za(N$i);var ZPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n,l){n.prototype.dayOfYear=function(c){var e=Math.round((l(this).startOf("day")-l(this).startOf("year"))/864e5)+1;return c==null?e:this.add(c-e,"day")}}})})(ZPe);var $$i=ZPe.exports;const L$i=Za($$i);var HPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n,l){i=i||{};var c=n.prototype,e={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function y(v,E,b,O){return c.fromToBase(v,E,b,O)}l.en.relativeTime=e,c.fromToBase=function(v,E,b,O,P){for(var $,L,U,F=b.$locale().relativeTime||e,Z=i.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],X=Z.length,se=0;se<X;se+=1){var Q=Z[se];Q.d&&($=O?l(v).diff(b,Q.d,!0):b.diff(v,Q.d,!0));var fe=(i.rounding||Math.round)(Math.abs($));if(U=$>0,fe<=Q.r||!Q.r){fe<=1&&se>0&&(Q=Z[se-1]);var de=F[Q.l];P&&(fe=P(""+fe)),L=typeof de=="string"?de.replace("%d",fe):de(fe,E,Q.l,U);break}}if(E)return L;var ce=U?F.future:F.past;return typeof ce=="function"?ce(L):ce.replace("%s",L)},c.to=function(v,E){return y(v,E,this,!0)},c.from=function(v,E){return y(v,E,this)};var T=function(v){return v.$u?l.utc():l()};c.toNow=function(v){return this.to(T(this),v)},c.fromNow=function(v){return this.from(T(this),v)}}})})(HPe);var M$i=HPe.exports;const B$i=Za(M$i);var WPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i,n,l=1e3,c=6e4,e=36e5,y=864e5,T=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v=31536e6,E=2628e6,b=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,O={years:v,months:E,days:y,hours:e,minutes:c,seconds:l,milliseconds:1,weeks:6048e5},P=function(fe){return fe instanceof se},$=function(fe,de,ce){return new se(fe,ce,de.$l)},L=function(fe){return n.p(fe)+"s"},U=function(fe){return fe<0},F=function(fe){return U(fe)?Math.ceil(fe):Math.floor(fe)},Z=function(fe){return Math.abs(fe)},X=function(fe,de){return fe?U(fe)?{negative:!0,format:""+Z(fe)+de}:{negative:!1,format:""+fe+de}:{negative:!1,format:""}},se=function(){function fe(ce,me,ae){var ye=this;if(this.$d={},this.$l=ae,ce===void 0&&(this.$ms=0,this.parseFromMilliseconds()),me)return $(ce*O[L(me)],this);if(typeof ce=="number")return this.$ms=ce,this.parseFromMilliseconds(),this;if(typeof ce=="object")return Object.keys(ce).forEach(function(Be){ye.$d[L(Be)]=ce[Be]}),this.calMilliseconds(),this;if(typeof ce=="string"){var _e=ce.match(b);if(_e){var Ve=_e.slice(2).map(function(Be){return Be!=null?Number(Be):0});return this.$d.years=Ve[0],this.$d.months=Ve[1],this.$d.weeks=Ve[2],this.$d.days=Ve[3],this.$d.hours=Ve[4],this.$d.minutes=Ve[5],this.$d.seconds=Ve[6],this.calMilliseconds(),this}}return this}var de=fe.prototype;return de.calMilliseconds=function(){var ce=this;this.$ms=Object.keys(this.$d).reduce(function(me,ae){return me+(ce.$d[ae]||0)*O[ae]},0)},de.parseFromMilliseconds=function(){var ce=this.$ms;this.$d.years=F(ce/v),ce%=v,this.$d.months=F(ce/E),ce%=E,this.$d.days=F(ce/y),ce%=y,this.$d.hours=F(ce/e),ce%=e,this.$d.minutes=F(ce/c),ce%=c,this.$d.seconds=F(ce/l),ce%=l,this.$d.milliseconds=ce},de.toISOString=function(){var ce=X(this.$d.years,"Y"),me=X(this.$d.months,"M"),ae=+this.$d.days||0;this.$d.weeks&&(ae+=7*this.$d.weeks);var ye=X(ae,"D"),_e=X(this.$d.hours,"H"),Ve=X(this.$d.minutes,"M"),Be=this.$d.seconds||0;this.$d.milliseconds&&(Be+=this.$d.milliseconds/1e3,Be=Math.round(1e3*Be)/1e3);var xe=X(Be,"S"),Me=ce.negative||me.negative||ye.negative||_e.negative||Ve.negative||xe.negative,We=_e.format||Ve.format||xe.format?"T":"",Fe=(Me?"-":"")+"P"+ce.format+me.format+ye.format+We+_e.format+Ve.format+xe.format;return Fe==="P"||Fe==="-P"?"P0D":Fe},de.toJSON=function(){return this.toISOString()},de.format=function(ce){var me=ce||"YYYY-MM-DDTHH:mm:ss",ae={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return me.replace(T,function(ye,_e){return _e||String(ae[ye])})},de.as=function(ce){return this.$ms/O[L(ce)]},de.get=function(ce){var me=this.$ms,ae=L(ce);return ae==="milliseconds"?me%=1e3:me=ae==="weeks"?F(me/O[ae]):this.$d[ae],me||0},de.add=function(ce,me,ae){var ye;return ye=me?ce*O[L(me)]:P(ce)?ce.$ms:$(ce,this).$ms,$(this.$ms+ye*(ae?-1:1),this)},de.subtract=function(ce,me){return this.add(ce,me,!0)},de.locale=function(ce){var me=this.clone();return me.$l=ce,me},de.clone=function(){return $(this.$ms,this)},de.humanize=function(ce){return i().add(this.$ms,"ms").locale(this.$l).fromNow(!ce)},de.valueOf=function(){return this.asMilliseconds()},de.milliseconds=function(){return this.get("milliseconds")},de.asMilliseconds=function(){return this.as("milliseconds")},de.seconds=function(){return this.get("seconds")},de.asSeconds=function(){return this.as("seconds")},de.minutes=function(){return this.get("minutes")},de.asMinutes=function(){return this.as("minutes")},de.hours=function(){return this.get("hours")},de.asHours=function(){return this.as("hours")},de.days=function(){return this.get("days")},de.asDays=function(){return this.as("days")},de.weeks=function(){return this.get("weeks")},de.asWeeks=function(){return this.as("weeks")},de.months=function(){return this.get("months")},de.asMonths=function(){return this.as("months")},de.years=function(){return this.get("years")},de.asYears=function(){return this.as("years")},fe}(),Q=function(fe,de,ce){return fe.add(de.years()*ce,"y").add(de.months()*ce,"M").add(de.days()*ce,"d").add(de.hours()*ce,"h").add(de.minutes()*ce,"m").add(de.seconds()*ce,"s").add(de.milliseconds()*ce,"ms")};return function(fe,de,ce){i=ce,n=ce().$utils(),ce.duration=function(ye,_e){var Ve=ce.locale();return $(ye,{$l:Ve},_e)},ce.isDuration=P;var me=de.prototype.add,ae=de.prototype.subtract;de.prototype.add=function(ye,_e){return P(ye)?Q(this,ye,1):me.bind(this)(ye,_e)},de.prototype.subtract=function(ye,_e){return P(ye)?Q(this,ye,-1):ae.bind(this)(ye,_e)}}})})(WPe);var G$i=WPe.exports;const U$i=Za(G$i);var zPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n){n.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(zPe);var j$i=zPe.exports;const k$i=Za(j$i);M.extend(E$i);M.extend(A$i);M.extend(I$i);M.extend(D$i);M.extend(w$i);M.extend(_$i);M.extend(V$i);M.extend(x$i);M.extend(L$i);M.extend(B$i);M.extend(U$i);M.extend(k$i);const At=d=>M(d),Xi=d=>d.toISOString();function JPe(){return Xi(M())}function YPe(d,p){return At(d).format(p)}function XPe(d){return Xi(M(d))}function QPe(d){if(d==null)throw new TypeError("ToDate expects a non-null value.");if(typeof d=="string"){const p=M(d);if(!p.isValid())throw new TypeError("Invalid date string.");return p.toISOString()}if(typeof d=="number"&&Number.isFinite(d)){const p=Math.abs(d)<1e12?M.unix(d):M(d);if(!p.isValid())throw new TypeError("Invalid numeric timestamp.");return p.toISOString()}if(d instanceof Date){const p=M(d);if(!p.isValid())throw new TypeError("Invalid Date object.");return p.toISOString()}throw new TypeError("Unsupported value type for ToDate. Provide a string, number, or Date.")}function eVe(d,p,i){return Xi(At(d).add(p,i))}function tVe(d,p,i){return Xi(At(d).subtract(p,i))}function iVe(d,p,i,n=!1){return At(d).diff(At(p),i,n)}function rVe(d){return At(d).unix()}function nVe(d){return Xi(M.unix(d))}function aVe(d){return Xi(At(d))}function sVe(d){return At(d).year()}function lVe(d){return At(d).month()}function oVe(d){return At(d).date()}function dVe(d){return At(d).hour()}function uVe(d){return At(d).minute()}function pVe(d){return At(d).second()}function cVe(d){return At(d).millisecond()}function fVe(d){return At(d).isoWeekday()}function yVe(d){return At(d).week()}function hVe(d){return At(d).quarter()}function mVe(d){return At(d).dayOfYear()}function TVe(d){return At(d).daysInMonth()}function vVe(d,p){return Xi(At(d).year(p))}function EVe(d,p){return Xi(At(d).month(p))}function bVe(d,p){return Xi(At(d).date(p))}function AVe(d,p){return Xi(At(d).hour(p))}function gVe(d,p){return Xi(At(d).minute(p))}function IVe(d,p){return Xi(At(d).second(p))}function RVe(d,p){return Xi(At(d).millisecond(p))}function DVe(d,p){return Xi(At(d).isoWeekday(p))}function OVe(d,p){return Xi(At(d).quarter(p))}function wVe(d,p){return Xi(At(d).startOf(p))}function CVe(d,p){return Xi(At(d).endOf(p))}function _Ve(d,p){const i=At(d),n=i.startOf(p),l=i.endOf(p),c=n.valueOf()+(l.valueOf()-n.valueOf())/2;return Xi(i.valueOf()<c?n:l)}function PVe(d,p,i){return At(d).isBefore(At(p),i)}function VVe(d,p,i){return At(d).isAfter(At(p),i)}function NVe(d,p,i){return At(d).isSame(At(p),i)}function xVe(d,p,i){return At(d).isSameOrBefore(At(p),i)}function $Ve(d,p,i){return At(d).isSameOrAfter(At(p),i)}function LVe(d,p,i,n,l="()"){return At(d).isBetween(At(p),At(i),n,l)}function MVe(d){return M(d).isValid()}function BVe(d){return At(d).isLeapYear()}function GVe(d,p,i){const n=At(d);return n.isBefore(p)?Xi(At(p)):n.isAfter(i)?Xi(At(i)):Xi(n)}function UVe(d){if(d.length===0)throw new Error("minOf requires at least one date");let p=At(d[0]);for(let i=1;i<d.length;i++){const n=At(d[i]);n.isBefore(p)&&(p=n)}return Xi(p)}function jVe(d){if(d.length===0)throw new Error("maxOf requires at least one date");let p=At(d[0]);for(let i=1;i<d.length;i++){const n=At(d[i]);n.isAfter(p)&&(p=n)}return Xi(p)}function kVe(d,p=!1){return At(d).fromNow(p)}function KVe(d,p=!1){return At(d).toNow(p)}function FVe(d,p,i=!0){const n=At(d).diff(At(p),"millisecond",!0),l=Math.abs(n),e=M.duration(l,"milliseconds").humanize();return i?n>=0?`in ${e}`:`${e} ago`:e}function SVe(d,p,i=["6","7"],n=[]){const l=v=>n.some(E=>At(E).isSame(v,"day")),c=v=>((v.day()+6)%7+1).toString();let e=At(d);const y=p>=0?1:-1;let T=Math.abs(p);for(;T>0;){e=e.add(y,"day");const v=c(e);!i.includes(v)&&!l(e)&&T--}return Xi(e)}function qVe(d,p){let i=At(d);const n=p;for(let l=0;l<7;l++)if(i=i.add(1,"day"),i.isoWeekday()===n)return Xi(i);return Xi(i)}function ZVe(d,p){let i=At(d);const n=p;for(let l=0;l<7;l++)if(i=i.subtract(1,"day"),i.isoWeekday()===n)return Xi(i);return Xi(i)}const HVe="Local";function XV(){try{const d=Intl.DateTimeFormat().resolvedOptions().timeZone;if(d&&typeof d=="string")return d}catch{}try{if(typeof process<"u"&&process.env&&process.env.TZ)return process.env.TZ}catch{}return null}function QV(){const d=XV();if(d)return d;throw new Error("Unable to detect current IANA timezone from host environment.")}function WVe(d,p,i=!1){let n=p;if(n===HVe){const e=XV();if(!e)throw new Error("Unable to detect current timezone from host environment.");n=e}const l=n?M.tz(d,n):At(d),c=i?l.utc(!0):l.utc();return Xi(c)}function zVe(d,p,i=!1){const n=At(d);return Xi(i?n.tz(p,!0):n.tz(p))}function JVe(d,p){const i=d===HVe?QV():d;return At(p).tz(i).utcOffset()}function YVe(d,p,i=!1){return Xi(At(d).utcOffset(p,i))}class XVe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP,version:"1.0.0",description:"Date get current timestamp operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetCurrentTimestamp);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=JPe();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class QVe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE,version:"1.0.0",description:"Date format operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.FormatDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=YPe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class eNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE,version:"1.0.0",description:"Date parse operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ParseDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=XPe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class tNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE,version:"1.0.0",description:"Date add-to-date operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.AddToDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=eVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class iNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE,version:"1.0.0",description:"Date subtract-from-date operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SubtractFromDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=tVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class rNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES,version:"1.0.0",description:"Date difference-between-dates operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.DifferenceBetweenDates);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)||((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2],T=l[3]??!1,v=iVe(c,e,y,T);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class K$i extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE,version:"1.0.0",description:"Date to-date operation implementation module (coerce to ISO 8601 string)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=QPe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class nNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX,version:"1.0.0",description:"Date to-unix operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToUnix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=rVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class aNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX,version:"1.0.0",description:"Date from-unix operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.FromUnix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=nVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class sNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING,version:"1.0.0",description:"Date to-iso-string operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToISOString);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=aVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class lNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR,version:"1.0.0",description:"Date get-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=sVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class oNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH,version:"1.0.0",description:"Date get-month (0-based) operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetMonth);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=lVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class dNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE,version:"1.0.0",description:"Date get-date (day of month) operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=oVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class uNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR,version:"1.0.0",description:"Date get-hour operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetHour);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=dVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class pNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE,version:"1.0.0",description:"Date get-minute operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetMinute);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=uVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class cNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND,version:"1.0.0",description:"Date get-second operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetSecond);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=pVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class fNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND,version:"1.0.0",description:"Date get-millisecond operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetMillisecond);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=cVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class yNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY,version:"1.0.0",description:"Date get-iso-weekday operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetIsoWeekday);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=fVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class hNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR,version:"1.0.0",description:"Date get-week-of-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetWeekOfYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=yVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class mNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER,version:"1.0.0",description:"Date get-quarter operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetQuarter);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=hVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class TNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR,version:"1.0.0",description:"Date get-day-of-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetDayOfYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=mVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class vNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH,version:"1.0.0",description:"Date get-days-in-month operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetDaysInMonth);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=TVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ENe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE,version:"1.0.0",description:"Date get-current-iana-timezone operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetCurrentIanaTimeZone);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=QV();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class bNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR,version:"1.0.0",description:"Date set-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=vVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ANe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH,version:"1.0.0",description:"Date set-month operation implementation module (0-based month)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetMonth);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=EVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class gNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE,version:"1.0.0",description:"Date set-date (day of month) operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=bVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class INe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR,version:"1.0.0",description:"Date set-hour operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetHour);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=AVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class RNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE,version:"1.0.0",description:"Date set-minute operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetMinute);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=gVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class DNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND,version:"1.0.0",description:"Date set-second operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetSecond);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=IVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ONe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND,version:"1.0.0",description:"Date set-millisecond operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetMillisecond);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=RVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class wNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY,version:"1.0.0",description:"Date set-iso-weekday operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetIsoWeekday);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=DVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class CNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER,version:"1.0.0",description:"Date set-quarter operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetQuarter);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=OVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class _Ne extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF,version:"1.0.0",description:"Date start-of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.StartOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=wVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class PNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF,version:"1.0.0",description:"Date end-of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.EndOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=CVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class VNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO,version:"1.0.0",description:"Date round-to operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.RoundTo);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=_Ve(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class NNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE,version:"1.0.0",description:"Date is-before operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsBefore);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=PVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class xNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER,version:"1.0.0",description:"Date is-after operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsAfter);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=VVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class $Ne extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME,version:"1.0.0",description:"Date is-same operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsSame);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=NVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class LNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE,version:"1.0.0",description:"Date is-same-or-before operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsSameOrBefore);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=xVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class MNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER,version:"1.0.0",description:"Date is-same-or-after operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsSameOrAfter);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=$Ve(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class BNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN,version:"1.0.0",description:"Date is-between operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsBetween);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(b=>{var O,P;return((O=b.value)==null?void 0:O.valueAsType)||((P=b.value)==null?void 0:P.value)}),c=l[0],e=l[1],y=l[2],T=l[3],v=l[4],E=LVe(c,e,y,T,v??void 0);return{value:G.Success,error:null,result:E}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class GNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID,version:"1.0.0",description:"Date is-valid operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsValid);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=MVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class UNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR,version:"1.0.0",description:"Date is-leap-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsLeapYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=BVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class jNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE,version:"1.0.0",description:"Date clamp-to-range operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ClampToRange);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=GVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class kNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF,version:"1.0.0",description:"Date min-of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.MinOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)}),c=l.length===1&&Array.isArray(l[0])?l[0]:l,e=UVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class KNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF,version:"1.0.0",description:"Date max-of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.MaxOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)}),c=l.length===1&&Array.isArray(l[0])?l[0]:l,e=jVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class FNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW,version:"1.0.0",description:"Date from-now operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.FromNow);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),y=kVe(l,c??!1);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class SNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW,version:"1.0.0",description:"Date to-now operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToNow);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),y=KVe(l,c??!1);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class qNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF,version:"1.0.0",description:"Date humanize-diff operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.HumanizeDiff);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),T=FVe(l,c,e??!0);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ZNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS,version:"1.1.0",description:"Date add-business-days operation implementation module (ISO-weekend strings)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.AddBusinessDays);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2]??void 0,T=l[3]??[],v=SVe(c,e,y,T);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class HNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY,version:"1.0.0",description:"Date next-weekday operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.NextWeekday);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)}),e=qVe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class WNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY,version:"1.0.0",description:"Date previous-weekday operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.PreviousWeekday);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)}),e=ZVe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class zNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC,version:"1.1.0",description:"Date to-utc operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToUTC);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1]||void 0,y=l[2]??!1,T=WVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class JNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE,version:"1.0.0",description:"Date convert-timezone operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ConvertTimezone);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),T=zVe(l,c,e??!1);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class YNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET,version:"1.0.0",description:"Date get-timezone-offset operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetTimezoneOffset);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),T=JVe(l,c);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class XNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET,version:"1.0.0",description:"Date set-utc-offset operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetUTCOffset);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),T=YVe(l,c,e??!1);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class QNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Mi.Parallel);l&&(l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(b=>{var O,P;return((O=b.value)==null?void 0:O.valueAsType)||((P=b.value)==null?void 0:P.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const y=this.extensionsRegistry.requestContexts(this,[J.Editor])[0],v=c.map(b=>{const O=new fu(y.logic,[b],b,null,this.extensionsRegistry);return O.inheritValuesFromContext(y),O}).map(b=>b.execute()),E=await Promise.all(v);return{value:G.Success,error:null,result:E}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class exe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Mi.Sequential);l&&(l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const e=[];for(let y=0;y<c.length;y++){const T=c[y],E=this.extensionsRegistry.requestContexts(this,[J.Editor])[0],b=new fu(E.logic,[T],T,null,this.extensionsRegistry);b.inheritValuesFromContext(E);const O=await b.execute();e.push(O)}return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class txe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Mi.Wait);l&&(l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)})[0];return typeof c!="number"||c<0?{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,c)),{value:G.Success,error:null,result:null})}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}function Yc(d){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const i=new Uint8Array(d);return crypto.getRandomValues(i),i}const{randomBytes:p}=require("crypto");return p(d)}function ixe(d,p){const i=p-d,n=SI()*i;return Math.floor(n)+d}function rxe(){const d=Yc(4);return d[0]<<24>>>0|d[1]<<16|d[2]<<8|d[3]}function SI(){return rxe()/2**32}function eN(d){const p=Yc(d);return Array.from(p).map(i=>i.toString(16).padStart(2,"0")).join("")}const xw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function tN(d){let p="";const i=Yc(d);for(let n=0;n<d;n++)p+=xw[i[n]%xw.length];return p}function nxe(d){const p=Yc(d);let i;if(typeof Buffer<"u")i=Buffer.from(p).toString("base64");else{const n=String.fromCharCode(...p);i=btoa(n)}return i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function iN(d){return tN(d)}function rN(d,p=xw){let i="";const n=Yc(d);for(let l=0;l<d;l++)i+=p[n[l]%p.length];return i}function hu(){const d=Yc(16);d[6]=d[6]&15|64,d[8]=d[8]&63|128;const p=Array.from(d).map(i=>i.toString(16).padStart(2,"0")).join("");return[p.substr(0,8),p.substr(8,4),p.substr(12,4),p.substr(16,4),p.substr(20,12)].join("-")}function axe(){return rN(6)}function sxe(){return eN(32)}const F$i=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,nN=d=>d===null||["string","number","boolean"].includes(typeof d);function wn(d,p="Input must be an array"){if(!Array.isArray(d))throw new TypeError(p);return d}function Hl(d){const p=wn(d,"Input must be an array");if(!p||p.length===0)throw new TypeError("No list provided or list is empty");return p}function aN(d){return Array.isArray(d)?d:[]}function ss(d){return Number(d)}function lxe(d){if(!d||d.length===0)throw new TypeError("No input lists provided");if(!d.every(n=>Array.isArray(n)))throw new TypeError("All inputs must be arrays");const[p,...i]=d;return i.reduce((n,l)=>n.concat(l),p)}function oxe(d,...p){if(!Array.isArray(d))throw new TypeError("First input must be an array");if(!p.every(i=>Array.isArray(i)))throw new TypeError("All subsequent inputs must be arrays");return d.concat(...p)}function dxe(d,p){const i=Hl(d),n=ss(p);return[i.slice(0,n),i.slice(n)]}function uxe(d){return Hl(d).slice().reverse()}function pxe(d){return Hl(d).slice(0,-1)}function cxe(d){return Hl(d).slice(1)}function fxe(d,p,i){const n=wn(d),l=ss(p);if(l<0||l>n.length)throw new TypeError("Index out of bounds");return[...n.slice(0,l),i,...n.slice(l)]}function yxe(d,p,i){const n=Hl(d),l=ss(p);if(l<0||l>=n.length)throw new TypeError("Index out of bounds");const c=[...n];return c[l]=i,c}function hxe(d,p,i){const n=Hl(d),l=n.indexOf(p);if(l===-1)return n;const c=[...n];return c[l]=i,c}function mxe(d,p,i){const n=Hl(d),l=n.lastIndexOf(p);if(l===-1)return n;const c=[...n];return c[l]=i,c}function Txe(d,p,i){return Hl(d).map(l=>l===p?i:l)}function vxe(d,p){const i=Hl(d),n=ss(p);if(n<0||n>=i.length)throw new TypeError("Index out of bounds");return i[n]}function Exe(d){return Hl(d)[0]}function bxe(d){const p=Hl(d);return p[p.length-1]}function Axe(d,p,...i){return[...wn(d),p,...i]}function gxe(d,p){const i=wn(d);return[p,...i]}function Ixe(d){return wn(d).length}function Rxe(d,p){const i=wn(d),n=ss(p);if(n<0||n>=i.length)throw new TypeError("Index out of bounds");return i.slice(0,n).concat(i.slice(n+1))}function Dxe(d,p){const i=wn(d),n=Math.max(0,ss(p)??0);return i.slice(0,n)}function Oxe(d,p){const i=wn(d),n=Math.max(0,ss(p)??0);return n===0?[]:i.slice(-n)}function wxe(d,p,i){const n=wn(d),l=p==null?void 0:ss(p),c=i==null?void 0:ss(i);return n.slice(l,c)}function Cxe(d,p){return wn(d).indexOf(p)}function _xe(d,p){return wn(d).lastIndexOf(p)}function Pxe(d){const p=wn(d),i=[],n=new Set;for(const l of p)n.has(l)||(n.add(l),i.push(l));return i}function Vxe(d){return wn(d).reduce((i,n)=>i.concat(n),[])}function Nxe(d){const p=wn(d);if(p.length<=1)return[...p];const i=p[0],n=typeof i=="number"&&p.every(e=>typeof e=="number"&&Number.isFinite(e)),l=typeof i=="string"&&p.every(e=>typeof e=="string");let c=null;if(n?c="number":l&&(c=p.every(y=>F$i.test(y)&&M(y).isValid())?"date":"string"),!c)throw new TypeError("All items must be of the same supported type: number, string, or ISO date string.");return c==="number"?[...p].sort((e,y)=>e-y):c==="string"?[...p].sort((e,y)=>e.localeCompare(y)):[...p].sort((e,y)=>M(e).valueOf()-M(y).valueOf())}function xxe(d){const i=[...wn(d)];for(let n=i.length-1;n>0;n--){const l=Math.floor(SI()*(n+1));[i[n],i[l]]=[i[l],i[n]]}return i}function $xe(d,p){const i=wn(d),n=Math.max(1,ss(p)||1),l=[];for(let c=0;c<i.length;c+=n)l.push(i.slice(c,c+n));return l}function Lxe(d,p,i){const n=wn(d),l=Math.max(0,ss(p)||0);if(n.length>=l)return[...n];const c=l-n.length;return Array(c).fill(i).concat(n)}function Mxe(d,p,i){const n=wn(d),l=Math.max(0,ss(p)||0);if(n.length>=l)return[...n];const c=l-n.length,e=Array(c).fill(i);return n.concat(e)}function Bxe(d,p){const i=wn(d),n=Math.max(0,ss(p)||0),l=[];for(let c=0;c<n;c++)l.push(...i);return l}function Gxe(d,p){if(!nN(p))throw new TypeError("Contains expects the needle to be a primitive (string | number | boolean | null).");return aN(d).some(n=>n===p)}function Uxe(d,p){const i=aN(d),n=Array.isArray(p)?p:[p];if(n.length===0)return!1;if(!n.every(nN))throw new TypeError("ContainsAll expects all needles to be primitives (string | number | boolean | null).");return n.every(l=>i.includes(l))}function jxe(d,p){const i=aN(d),n=Array.isArray(p)?p:[p];if(n.length===0)return!1;if(!n.every(nN))throw new TypeError("ContainsAny expects all needles to be primitives (string | number | boolean | null).");return n.some(l=>i.includes(l))}class kxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=lxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Kxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],[y,T]=dxe(c,e);return{value:G.Success,error:null,result:[y,T]}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Fxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=uxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Sxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS,version:"1.0.0",description:"List delete last operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.DeleteLastNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=pxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class qxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS,version:"1.0.0",description:"List delete first operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.DeleteFirstNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=cxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Zxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.AddAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=fxe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Hxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.ReplaceAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=yxe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Wxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS,version:"1.0.0",description:"List replace first operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.ReplaceFirstNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=hxe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class zxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS,version:"1.0.0",description:"List replace last operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.ReplaceLastNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=mxe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Jxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL,version:"1.0.0",description:"List replace all operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.ReplaceAll);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=Txe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Yxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=vxe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Xxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=Exe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Qxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=bxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class e$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l.slice(2),T=Axe(c,e,...y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class t$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=gxe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class i$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH,version:"1.0.0",description:"List get length",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetLength);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(c=>{var e,y;return((e=c.value)==null?void 0:e.valueAsType)??((y=c.value)==null?void 0:y.value)});return{value:G.Success,error:null,result:Ixe(l)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class r$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX,version:"1.0.0",description:"List delete one item at index (non-mutating)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.DeleteAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Rxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class n$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS,version:"1.0.0",description:"List get first N items",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetFirstNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Dxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class a$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS,version:"1.0.0",description:"List get last N items",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetLastNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Oxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class s$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE,version:"1.0.0",description:"List slice(start, end)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Slice);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=wxe(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class l$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT,version:"1.0.0",description:"List concat(base, ...others)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Concat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),[c,...e]=l,y=oxe(c,...e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class o$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF,version:"1.0.0",description:"List listGetIndexOf(value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Cxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class d$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF,version:"1.0.0",description:"List listGetLastIndexOf(value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetLastIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=_xe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class u$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE,version:"1.0.0",description:"List unique (stable, by reference/===)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Unique);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=Pxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class p$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN,version:"1.0.0",description:"List flatten one level",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Flatten);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=Vxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class c$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT,version:"1.0.0",description:"List sort (non-mutating). Supports lists of strings (alphabetic), numbers (numeric), or ISO date strings (chronological).",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Sort);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=Nxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class f$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE,version:"1.0.0",description:"List shuffle (Fisher–Yates, secure RNG helper)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Shuffle);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=xxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK,version:"1.0.0",description:"List chunk(size) -> list of lists",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Chunk);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=$xe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class h$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START,version:"1.0.0",description:"List padStart(targetLength, padValue)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.PadStart);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=Lxe(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class m$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END,version:"1.0.0",description:"List padEnd(targetLength, padValue)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.PadEnd);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=Mxe(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class T$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT,version:"1.0.0",description:"List repeat(count)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Repeat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Bxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class v$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS,version:"1.0.0",description:"List contains (primitive needles)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Contains);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Gxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class E$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL,version:"1.0.0",description:"List contains all (primitive needles)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.ContainsAll);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Uxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class b$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY,version:"1.0.0",description:"List contains any (primitive needles)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.ContainsAny);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=jxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class S$i extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH,version:"1.0.0",description:"Returns the number of characters in a string",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.GetLength);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=l.length;return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class A$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{var l,c,e;try{const y=n.find(U=>{var F;return((F=U.valueOwner)==null?void 0:F.id)===Y.operation[S.Join].inputs.separator.id}),T=((l=y==null?void 0:y.value)==null?void 0:l.value)||"",v=n.find(U=>{var F;return((F=U.valueOwner)==null?void 0:F.id)===Y.operation[S.Join].inputs.first.id}),E=((c=v==null?void 0:v.value)==null?void 0:c.value)||"",b=n.find(U=>{var F;return((F=U.valueOwner)==null?void 0:F.id)===Y.operation[S.Join].inputs.second.id}),O=((e=b==null?void 0:b.value)==null?void 0:e.value)||"",$=n.filter(U=>{var F;return((F=U.valueOwner)==null?void 0:F.id)===Y.operation[S.Join].inputs.dynamicString.id}).map(U=>{var F,Z;return((F=U.value)==null?void 0:F.valueAsType)||((Z=U.value)==null?void 0:Z.value)||""}),L=[E,O,...$].join(T);return{value:G.Success,error:null,result:L}}catch(y){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:y,result:null}}}})}}class g$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX,version:"1.0.0",description:"String split at index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.SplitAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y={firstPart:c.slice(0,e),secondPart:c.slice(e)};return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class I$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS,version:"1.0.0",description:"String split at all the occurrences of separators operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.SplitAtAllSeparators);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=c.split(e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class R$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR,version:"1.0.0",description:"String split at the first occurrence of a separator operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.SplitAtFirstSeparator);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=c.indexOf(e),T={firstPart:c.slice(0,y),secondPart:c.slice(y+e.length)};return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class D$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR,version:"1.0.0",description:"String split at the last occurrence of a separator operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.SplitAtLastSeparator);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=c.lastIndexOf(e),T={firstPart:c.slice(0,y),secondPart:c.slice(y+e.length)};return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class O$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS,version:"1.0.0",description:"String delete last number of characters operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.DeleteLastNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.slice(0,-e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class w$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS,version:"1.0.0",description:"String delete first number of characters operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.DeleteFirstNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.slice(0,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class C$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const e=c.split("").reverse().join("");return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class _$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ToLowerCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const e=c.toLowerCase();return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class P$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ToUpperCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const e=c.toUpperCase();return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class V$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.DeleteAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)||((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=Math.min(y,c.length-e),v=c.slice(0,e)+c.slice(e+T);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class N$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.AddAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.slice(0,e)+y+c.slice(e);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class x$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS,version:"1.0.0",description:"String replace first operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceFirstNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1]??1,y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=y+c.slice(e);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class $$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS,version:"1.0.0",description:"String replace last operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceLastNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1]??1,y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.slice(0,-e)+y;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class L$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)||((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2]??1,T=l[3];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const v=(c.slice(0,e)||"")+T+(c.slice(e+y)||"");return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class M$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceFirstMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.replace(e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class B$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceLastMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)||((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.lastIndexOf(e),v=T===-1?c:c.substring(0,T)+y+c.substring(T+e.length);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class G$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceAllMatches);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.split(e).join(y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class U$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.charAt(e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class j$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS,version:"1.0.0",description:"String get last N chars operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.GetLastNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.slice(-e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class k$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS,version:"1.0.0",description:"String get first N chars operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.GetFirstNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.slice(0,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class K$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No search value provided",result:null};const y=c.indexOf(e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class F$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No value to append provided",result:null};const y=l.slice(2);if(!y.every(v=>typeof v=="string"))return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"All values to append must be strings",result:null};const T=[c,e,...y].join("");return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class S$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=e+c;return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM,version:"1.0.0",description:"String trim implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Trim);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=l.trim();return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START,version:"1.0.0",description:"String trimStart implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.TrimStart);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=l.trimStart();return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class H$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END,version:"1.0.0",description:"String trimEnd implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.TrimEnd);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=l.trimEnd();return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class W$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING,version:"1.0.0",description:"String substring(start, end?) implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Substring);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.substring(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE,version:"1.0.0",description:"String slice(start, end?) implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Slice);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.slice(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class J$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF,version:"1.0.0",description:"String lastIndexOf(search, fromIndex?) implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.GetLastIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.lastIndexOf(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START,version:"1.0.0",description:"String padStart(targetLength, padString?) implementation",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.PadStart);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.padStart(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class X$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END,version:"1.0.0",description:"String padEnd(targetLength, padString?) implementation",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.PadEnd);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.padEnd(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT,version:"1.0.0",description:"String repeat(count) implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Repeat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=l.repeat(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class eLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX,version:"1.0.0",description:"String match(regex) -> first match array or null",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.MatchRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),y=new RegExp(String(c??""),e?String(e):void 0),T=String(l??"").match(y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class tLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX,version:"1.0.0",description:"String matchAll(regex) -> array of matches",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.MatchAllRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(b=>{var O,P;return((O=b.value)==null?void 0:O.valueAsType)??((P=b.value)==null?void 0:P.value)}),y=e?String(e):"",T=y.includes("g")?y:y+"g",v=new RegExp(String(c??""),T),E=Array.from(String(l??"").matchAll(v),b=>Array.from(b));return{value:G.Success,error:null,result:E}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class iLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX,version:"1.0.0",description:"String search(regex) -> index or -1",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.SearchRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)});let y=-1;try{const T=new RegExp(String(c??""),e?String(e):void 0);y=String(l??"").search(T)}catch{y=-1}return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class rLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX,version:"1.0.0",description:"String replace using RegExp (pattern, replacement, flags?)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.ReplaceRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y]=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)});let T=String(l??"");const v=new RegExp(String(c??""),y?String(y):void 0);return T=T.replace(v,String(e??"")),{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class nLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE,version:"1.0.0",description:"String normalize(form?) implementation module (NFC by default)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.NormalizeUnicode);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=l.normalize(c||"NFC");return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}const AA=class AA extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS,version:"1.0.0",description:"Remove diacritics via NFD decomposition + strip combining marks",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.RemoveDiacritics);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=String(l??"").normalize("NFD").replace(AA.COMBINING_MARKS,"");return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}};I(AA,"COMBINING_MARKS",/[\u0300-\u036f]/g);let Xb=AA;class aLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES,version:"1.0.0",description:"Count literal substring occurrences in a string",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.CountOccurrences);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=y===""?0:e.split(y).length-1;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class sLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX,version:"1.0.0",description:"Ensure string starts with given prefix (add if missing)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.EnsurePrefix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=e.startsWith(y)?e:y+e;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class lLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX,version:"1.0.0",description:"Ensure string ends with given suffix (add if missing)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.EnsureSuffix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=e.endsWith(y)?e:e+y;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class oLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX,version:"1.0.0",description:"Remove prefix if present",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.RemovePrefix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=e.startsWith(y)?e.slice(y.length):e;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class dLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX,version:"1.0.0",description:"Remove suffix if present",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.RemoveSuffix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=e.endsWith(y)?e.slice(0,-y.length):e;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class uLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH,version:"1.0.0",description:"String startsWith(needle) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.StartsWith);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)});if(typeof l!="string"||typeof c!="string")throw new TypeError("StartsWith expects two strings.");const e=l.startsWith(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class pLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH,version:"1.0.0",description:"String endsWith(needle) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.EndsWith);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)});if(typeof l!="string"||typeof c!="string")throw new TypeError("EndsWith expects two strings.");const e=l.endsWith(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class cLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS,version:"1.0.0",description:"String includes(needle) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Contains);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)});if(typeof l!="string"||typeof c!="string")throw new TypeError("Contains expects two strings.");const e=l.includes(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class fLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX,version:"1.0.0",description:"Regex test: new RegExp(pattern, flags?).test(src) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.MatchesRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)});if(typeof l!="string"||typeof c!="string")throw new TypeError("MatchesRegex expects source and pattern to be strings.");if(!(e===void 0||typeof e=="string"))throw new TypeError("MatchesRegex flags must be a string if provided.");let y=!1;return y=new RegExp(c,e).test(l),{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}function yLe(d,p){const i=Number(d),l=10**Math.max(0,Number(p)||0);return Math.round(i*l)/l}function hLe(d,p){const i=Number(d),n=Math.abs(Number(p)||0);return n===0?i:Math.round(i/n)*n}function mLe(d,p,i){const n=Number(d),l=Number(p),c=Number(i);return Math.min(Math.max(n,l),c)}function TLe(d,p,i,n,l){const c=Number(d),e=Number(p),y=Number(i),T=Number(n),v=Number(l);if(e===y)throw new Error("Input range cannot be zero");const E=(c-e)/(y-e);return T+E*(v-T)}function vLe(...d){const p=d.map(n=>Number(n));return p.length===0?0:p.reduce((n,l)=>n+l,0)/p.length}function ELe(...d){const p=d.map(n=>Number(n)).sort((n,l)=>n-l);if(p.length===0)return 0;const i=Math.floor(p.length/2);return p.length%2?p[i]:(p[i-1]+p[i])/2}function bLe(d,p){const i=Number(d),n=Number(p);return n===0?NaN:i<0&&n%2===1?-Math.pow(-i,1/n):Math.pow(i,1/n)}function ALe(d,p){const i=Number(d),n=Number(p);return i===0?1/0:(n-i)/i*100}const ri=d=>d.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class gLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Addition);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=ri(n).reduce((e,y)=>e+y,0);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ILe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Subtraction);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=ri(n).reduce((e,y)=>e-y,0);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class RLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Multiplication);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=ri(n).reduce((e,y)=>e*y,1);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class DLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Division);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ri(n);if(c===0)throw new Error("Division by zero is not allowed");const e=l/c;return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class OLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Remainder);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ri(n);if(c===0)throw new Error("Division by zero is not allowed");const e=l%c;return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class wLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Exponentiation);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ri(n),e=Math.pow(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class CLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE,version:"1.0.0",description:"Number negate (unary -x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Negate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:-l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class _Le extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE,version:"1.0.0",description:"Number absolute (|x|)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Absolute);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.abs(Number(l))}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class PLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN,version:"1.0.0",description:"Number sign (-1 | 0 | 1)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Sign);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.sign(Number(l))}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class VLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND,version:"1.0.0",description:"Number round to nearest integer",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Round);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.round(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class NLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR,version:"1.0.0",description:"Number floor (⌊x⌋)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Floor);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.floor(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class xLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL,version:"1.0.0",description:"Number ceil (⌈x⌉)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Ceil);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.ceil(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class $Le extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC,version:"1.0.0",description:"Number truncation (drop fractional part)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Trunc);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.trunc(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class LLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS,version:"1.0.0",description:"Round to N decimals",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.RoundToDecimals);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=yLe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class MLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP,version:"1.0.0",description:"Snap a number to the nearest multiple of step (>=0 step)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.SnapToStep);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=hLe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class BLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP,version:"1.0.0",description:"Clamp value to [min, max]",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Clamp);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=ri(n),y=mLe(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class GLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE,version:"1.0.0",description:"Map value from [inMin,inMax] to [outMin,outMax]",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MapRange);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T]=ri(n),v=TLe(l,c,e,y,T);return{value:G.Success,error:null,result:v}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class ULe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE,version:"1.0.0",description:"Average(numbers...)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Average);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ri(n),c=vLe(...l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class jLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN,version:"1.0.0",description:"Median(numbers...)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Median);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ri(n),c=ELe(...l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class kLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF,version:"1.0.0",description:"Min(numbers...)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MinOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ri(n).map(Number),c=l.length?Math.min(...l):1/0;return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class KLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF,version:"1.0.0",description:"Max(numbers...)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MaxOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ri(n).map(Number),c=l.length?Math.max(...l):-1/0;return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class FLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT,version:"1.0.0",description:"Square root",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.SquareRoot);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.sqrt(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class SLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT,version:"1.0.0",description:"Cube root",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.CubeRoot);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.cbrt(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class qLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT,version:"1.0.0",description:"Nth root (value, n)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.NthRoot);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=bLe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class ZLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP,version:"1.0.0",description:"e^x",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Exp);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.exp(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class HLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL,version:"1.0.0",description:"Natural log ln(x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.LogNatural);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.log(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class WLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10,version:"1.0.0",description:"Log base 10",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Log10);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n),c=Number(l),e=Math.log10?Math.log10(c):Math.log(c)/Math.LN10;return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class zLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN,version:"1.0.0",description:"sin(x in radians)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Sin);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.sin(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class JLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS,version:"1.0.0",description:"cos(x in radians)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Cos);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.cos(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class YLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN,version:"1.0.0",description:"tan(x in radians)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Tan);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.tan(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class XLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN,version:"1.0.0",description:"asin(x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Asin);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.asin(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class QLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS,version:"1.0.0",description:"acos(x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Acos);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.acos(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class e2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN,version:"1.0.0",description:"atan(x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Atan);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.atan(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class t2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2,version:"1.0.0",description:"atan2(y, x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Atan2);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:Math.atan2(Number(l),Number(c))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class i2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS,version:"1.0.0",description:"deg → rad",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.ToRadians);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Number(l)*Math.PI/180}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class r2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES,version:"1.0.0",description:"rad → deg",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.ToDegrees);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Number(l)*180/Math.PI}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class n2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF,version:"1.0.0",description:"x percent of y",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.PercentOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=Number(l)/100*Number(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class $w extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE,version:"1.0.0",description:"((new-old)/old)*100",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.PercentageChange);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=ALe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class a2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN,version:"1.0.0",description:"a < b",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.LessThan);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:l<c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class s2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN,version:"1.0.0",description:"a > b",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MoreThan);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:l>c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class l2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL,version:"1.0.0",description:"a <= b",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.LessThanOrEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:l<=c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class o2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL,version:"1.0.0",description:"a >= b",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MoreThanOrEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:l>=c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}function d2e(d,p){return function(){return d.apply(p,arguments)}}const{toString:q$i}=Object.prototype,{getPrototypeOf:sN}=Object,{iterator:qI,toStringTag:u2e}=Symbol,ZI=(d=>p=>{const i=q$i.call(p);return d[i]||(d[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),Wl=d=>(d=d.toLowerCase(),p=>ZI(p)===d),HI=d=>p=>typeof p===d,{isArray:xh}=Array,vy=HI("undefined");function ov(d){return d!==null&&!vy(d)&&d.constructor!==null&&!vy(d.constructor)&&$a(d.constructor.isBuffer)&&d.constructor.isBuffer(d)}const p2e=Wl("ArrayBuffer");function Z$i(d){let p;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?p=ArrayBuffer.isView(d):p=d&&d.buffer&&p2e(d.buffer),p}const H$i=HI("string"),$a=HI("function"),c2e=HI("number"),dv=d=>d!==null&&typeof d=="object",W$i=d=>d===!0||d===!1,Cb=d=>{if(ZI(d)!=="object")return!1;const p=sN(d);return(p===null||p===Object.prototype||Object.getPrototypeOf(p)===null)&&!(u2e in d)&&!(qI in d)},z$i=d=>{if(!dv(d)||ov(d))return!1;try{return Object.keys(d).length===0&&Object.getPrototypeOf(d)===Object.prototype}catch{return!1}},J$i=Wl("Date"),Y$i=Wl("File"),X$i=Wl("Blob"),Q$i=Wl("FileList"),eLi=d=>dv(d)&&$a(d.pipe),tLi=d=>{let p;return d&&(typeof FormData=="function"&&d instanceof FormData||$a(d.append)&&((p=ZI(d))==="formdata"||p==="object"&&$a(d.toString)&&d.toString()==="[object FormData]"))},iLi=Wl("URLSearchParams"),[rLi,nLi,aLi,sLi]=["ReadableStream","Request","Response","Headers"].map(Wl),lLi=d=>d.trim?d.trim():d.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function uv(d,p,{allOwnKeys:i=!1}={}){if(d===null||typeof d>"u")return;let n,l;if(typeof d!="object"&&(d=[d]),xh(d))for(n=0,l=d.length;n<l;n++)p.call(null,d[n],n,d);else{if(ov(d))return;const c=i?Object.getOwnPropertyNames(d):Object.keys(d),e=c.length;let y;for(n=0;n<e;n++)y=c[n],p.call(null,d[y],y,d)}}function f2e(d,p){if(ov(d))return null;p=p.toLowerCase();const i=Object.keys(d);let n=i.length,l;for(;n-- >0;)if(l=i[n],p===l.toLowerCase())return l;return null}const pc=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),y2e=d=>!vy(d)&&d!==pc;function Lw(){const{caseless:d,skipUndefined:p}=y2e(this)&&this||{},i={},n=(l,c)=>{const e=d&&f2e(i,c)||c;Cb(i[e])&&Cb(l)?i[e]=Lw(i[e],l):Cb(l)?i[e]=Lw({},l):xh(l)?i[e]=l.slice():(!p||!vy(l))&&(i[e]=l)};for(let l=0,c=arguments.length;l<c;l++)arguments[l]&&uv(arguments[l],n);return i}const oLi=(d,p,i,{allOwnKeys:n}={})=>(uv(p,(l,c)=>{i&&$a(l)?d[c]=d2e(l,i):d[c]=l},{allOwnKeys:n}),d),dLi=d=>(d.charCodeAt(0)===65279&&(d=d.slice(1)),d),uLi=(d,p,i,n)=>{d.prototype=Object.create(p.prototype,n),d.prototype.constructor=d,Object.defineProperty(d,"super",{value:p.prototype}),i&&Object.assign(d.prototype,i)},pLi=(d,p,i,n)=>{let l,c,e;const y={};if(p=p||{},d==null)return p;do{for(l=Object.getOwnPropertyNames(d),c=l.length;c-- >0;)e=l[c],(!n||n(e,d,p))&&!y[e]&&(p[e]=d[e],y[e]=!0);d=i!==!1&&sN(d)}while(d&&(!i||i(d,p))&&d!==Object.prototype);return p},cLi=(d,p,i)=>{d=String(d),(i===void 0||i>d.length)&&(i=d.length),i-=p.length;const n=d.indexOf(p,i);return n!==-1&&n===i},fLi=d=>{if(!d)return null;if(xh(d))return d;let p=d.length;if(!c2e(p))return null;const i=new Array(p);for(;p-- >0;)i[p]=d[p];return i},yLi=(d=>p=>d&&p instanceof d)(typeof Uint8Array<"u"&&sN(Uint8Array)),hLi=(d,p)=>{const n=(d&&d[qI]).call(d);let l;for(;(l=n.next())&&!l.done;){const c=l.value;p.call(d,c[0],c[1])}},mLi=(d,p)=>{let i;const n=[];for(;(i=d.exec(p))!==null;)n.push(i);return n},TLi=Wl("HTMLFormElement"),vLi=d=>d.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,n,l){return n.toUpperCase()+l}),N4=(({hasOwnProperty:d})=>(p,i)=>d.call(p,i))(Object.prototype),ELi=Wl("RegExp"),h2e=(d,p)=>{const i=Object.getOwnPropertyDescriptors(d),n={};uv(i,(l,c)=>{let e;(e=p(l,c,d))!==!1&&(n[c]=e||l)}),Object.defineProperties(d,n)},bLi=d=>{h2e(d,(p,i)=>{if($a(d)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const n=d[i];if($a(n)){if(p.enumerable=!1,"writable"in p){p.writable=!1;return}p.set||(p.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},ALi=(d,p)=>{const i={},n=l=>{l.forEach(c=>{i[c]=!0})};return xh(d)?n(d):n(String(d).split(p)),i},gLi=()=>{},ILi=(d,p)=>d!=null&&Number.isFinite(d=+d)?d:p;function RLi(d){return!!(d&&$a(d.append)&&d[u2e]==="FormData"&&d[qI])}const DLi=d=>{const p=new Array(10),i=(n,l)=>{if(dv(n)){if(p.indexOf(n)>=0)return;if(ov(n))return n;if(!("toJSON"in n)){p[l]=n;const c=xh(n)?[]:{};return uv(n,(e,y)=>{const T=i(e,l+1);!vy(T)&&(c[y]=T)}),p[l]=void 0,c}}return n};return i(d,0)},OLi=Wl("AsyncFunction"),wLi=d=>d&&(dv(d)||$a(d))&&$a(d.then)&&$a(d.catch),m2e=((d,p)=>d?setImmediate:p?((i,n)=>(pc.addEventListener("message",({source:l,data:c})=>{l===pc&&c===i&&n.length&&n.shift()()},!1),l=>{n.push(l),pc.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",$a(pc.postMessage)),CLi=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||m2e,_Li=d=>d!=null&&$a(d[qI]),Ue={isArray:xh,isArrayBuffer:p2e,isBuffer:ov,isFormData:tLi,isArrayBufferView:Z$i,isString:H$i,isNumber:c2e,isBoolean:W$i,isObject:dv,isPlainObject:Cb,isEmptyObject:z$i,isReadableStream:rLi,isRequest:nLi,isResponse:aLi,isHeaders:sLi,isUndefined:vy,isDate:J$i,isFile:Y$i,isBlob:X$i,isRegExp:ELi,isFunction:$a,isStream:eLi,isURLSearchParams:iLi,isTypedArray:yLi,isFileList:Q$i,forEach:uv,merge:Lw,extend:oLi,trim:lLi,stripBOM:dLi,inherits:uLi,toFlatObject:pLi,kindOf:ZI,kindOfTest:Wl,endsWith:cLi,toArray:fLi,forEachEntry:hLi,matchAll:mLi,isHTMLForm:TLi,hasOwnProperty:N4,hasOwnProp:N4,reduceDescriptors:h2e,freezeMethods:bLi,toObjectSet:ALi,toCamelCase:vLi,noop:gLi,toFiniteNumber:ILi,findKey:f2e,global:pc,isContextDefined:y2e,isSpecCompliantForm:RLi,toJSONObject:DLi,isAsyncFn:OLi,isThenable:wLi,setImmediate:m2e,asap:CLi,isIterable:_Li};function ti(d,p,i,n,l){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=d,this.name="AxiosError",p&&(this.code=p),i&&(this.config=i),n&&(this.request=n),l&&(this.response=l,this.status=l.status?l.status:null)}Ue.inherits(ti,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ue.toJSONObject(this.config),code:this.code,status:this.status}}});const T2e=ti.prototype,v2e={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(d=>{v2e[d]={value:d}});Object.defineProperties(ti,v2e);Object.defineProperty(T2e,"isAxiosError",{value:!0});ti.from=(d,p,i,n,l,c)=>{const e=Object.create(T2e);Ue.toFlatObject(d,e,function(E){return E!==Error.prototype},v=>v!=="isAxiosError");const y=d&&d.message?d.message:"Error",T=p==null&&d?d.code:p;return ti.call(e,y,T,i,n,l),d&&e.cause==null&&Object.defineProperty(e,"cause",{value:d,configurable:!0}),e.name=d&&d.name||"Error",c&&Object.assign(e,c),e};const PLi=null;function Mw(d){return Ue.isPlainObject(d)||Ue.isArray(d)}function E2e(d){return Ue.endsWith(d,"[]")?d.slice(0,-2):d}function x4(d,p,i){return d?d.concat(p).map(function(l,c){return l=E2e(l),!i&&c?"["+l+"]":l}).join(i?".":""):p}function VLi(d){return Ue.isArray(d)&&!d.some(Mw)}const NLi=Ue.toFlatObject(Ue,{},null,function(p){return/^is[A-Z]/.test(p)});function WI(d,p,i){if(!Ue.isObject(d))throw new TypeError("target must be an object");p=p||new FormData,i=Ue.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(L,U){return!Ue.isUndefined(U[L])});const n=i.metaTokens,l=i.visitor||E,c=i.dots,e=i.indexes,T=(i.Blob||typeof Blob<"u"&&Blob)&&Ue.isSpecCompliantForm(p);if(!Ue.isFunction(l))throw new TypeError("visitor must be a function");function v($){if($===null)return"";if(Ue.isDate($))return $.toISOString();if(Ue.isBoolean($))return $.toString();if(!T&&Ue.isBlob($))throw new ti("Blob is not supported. Use a Buffer instead.");return Ue.isArrayBuffer($)||Ue.isTypedArray($)?T&&typeof Blob=="function"?new Blob([$]):Buffer.from($):$}function E($,L,U){let F=$;if($&&!U&&typeof $=="object"){if(Ue.endsWith(L,"{}"))L=n?L:L.slice(0,-2),$=JSON.stringify($);else if(Ue.isArray($)&&VLi($)||(Ue.isFileList($)||Ue.endsWith(L,"[]"))&&(F=Ue.toArray($)))return L=E2e(L),F.forEach(function(X,se){!(Ue.isUndefined(X)||X===null)&&p.append(e===!0?x4([L],se,c):e===null?L:L+"[]",v(X))}),!1}return Mw($)?!0:(p.append(x4(U,L,c),v($)),!1)}const b=[],O=Object.assign(NLi,{defaultVisitor:E,convertValue:v,isVisitable:Mw});function P($,L){if(!Ue.isUndefined($)){if(b.indexOf($)!==-1)throw Error("Circular reference detected in "+L.join("."));b.push($),Ue.forEach($,function(F,Z){(!(Ue.isUndefined(F)||F===null)&&l.call(p,F,Ue.isString(Z)?Z.trim():Z,L,O))===!0&&P(F,L?L.concat(Z):[Z])}),b.pop()}}if(!Ue.isObject(d))throw new TypeError("data must be an object");return P(d),p}function $4(d){const p={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(d).replace(/[!'()~]|%20|%00/g,function(n){return p[n]})}function lN(d,p){this._pairs=[],d&&WI(d,this,p)}const b2e=lN.prototype;b2e.append=function(p,i){this._pairs.push([p,i])};b2e.toString=function(p){const i=p?function(n){return p.call(this,n,$4)}:$4;return this._pairs.map(function(l){return i(l[0])+"="+i(l[1])},"").join("&")};function xLi(d){return encodeURIComponent(d).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function A2e(d,p,i){if(!p)return d;const n=i&&i.encode||xLi;Ue.isFunction(i)&&(i={serialize:i});const l=i&&i.serialize;let c;if(l?c=l(p,i):c=Ue.isURLSearchParams(p)?p.toString():new lN(p,i).toString(n),c){const e=d.indexOf("#");e!==-1&&(d=d.slice(0,e)),d+=(d.indexOf("?")===-1?"?":"&")+c}return d}class $Li{constructor(){this.handlers=[]}use(p,i,n){return this.handlers.push({fulfilled:p,rejected:i,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(p){this.handlers[p]&&(this.handlers[p]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(p){Ue.forEach(this.handlers,function(n){n!==null&&p(n)})}}const L4=$Li,g2e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},LLi=typeof URLSearchParams<"u"?URLSearchParams:lN,MLi=typeof FormData<"u"?FormData:null,BLi=typeof Blob<"u"?Blob:null,GLi={isBrowser:!0,classes:{URLSearchParams:LLi,FormData:MLi,Blob:BLi},protocols:["http","https","file","blob","url","data"]},oN=typeof window<"u"&&typeof document<"u",Bw=typeof navigator=="object"&&navigator||void 0,ULi=oN&&(!Bw||["ReactNative","NativeScript","NS"].indexOf(Bw.product)<0),jLi=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),kLi=oN&&window.location.href||"http://localhost",KLi=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:oN,hasStandardBrowserEnv:ULi,hasStandardBrowserWebWorkerEnv:jLi,navigator:Bw,origin:kLi},Symbol.toStringTag,{value:"Module"})),Qn={...KLi,...GLi};function FLi(d,p){return WI(d,new Qn.classes.URLSearchParams,{visitor:function(i,n,l,c){return Qn.isNode&&Ue.isBuffer(i)?(this.append(n,i.toString("base64")),!1):c.defaultVisitor.apply(this,arguments)},...p})}function SLi(d){return Ue.matchAll(/\w+|\[(\w*)]/g,d).map(p=>p[0]==="[]"?"":p[1]||p[0])}function qLi(d){const p={},i=Object.keys(d);let n;const l=i.length;let c;for(n=0;n<l;n++)c=i[n],p[c]=d[c];return p}function I2e(d){function p(i,n,l,c){let e=i[c++];if(e==="__proto__")return!0;const y=Number.isFinite(+e),T=c>=i.length;return e=!e&&Ue.isArray(l)?l.length:e,T?(Ue.hasOwnProp(l,e)?l[e]=[l[e],n]:l[e]=n,!y):((!l[e]||!Ue.isObject(l[e]))&&(l[e]=[]),p(i,n,l[e],c)&&Ue.isArray(l[e])&&(l[e]=qLi(l[e])),!y)}if(Ue.isFormData(d)&&Ue.isFunction(d.entries)){const i={};return Ue.forEachEntry(d,(n,l)=>{p(SLi(n),l,i,0)}),i}return null}function ZLi(d,p,i){if(Ue.isString(d))try{return(p||JSON.parse)(d),Ue.trim(d)}catch(n){if(n.name!=="SyntaxError")throw n}return(i||JSON.stringify)(d)}const dN={transitional:g2e,adapter:["xhr","http","fetch"],transformRequest:[function(p,i){const n=i.getContentType()||"",l=n.indexOf("application/json")>-1,c=Ue.isObject(p);if(c&&Ue.isHTMLForm(p)&&(p=new FormData(p)),Ue.isFormData(p))return l?JSON.stringify(I2e(p)):p;if(Ue.isArrayBuffer(p)||Ue.isBuffer(p)||Ue.isStream(p)||Ue.isFile(p)||Ue.isBlob(p)||Ue.isReadableStream(p))return p;if(Ue.isArrayBufferView(p))return p.buffer;if(Ue.isURLSearchParams(p))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),p.toString();let y;if(c){if(n.indexOf("application/x-www-form-urlencoded")>-1)return FLi(p,this.formSerializer).toString();if((y=Ue.isFileList(p))||n.indexOf("multipart/form-data")>-1){const T=this.env&&this.env.FormData;return WI(y?{"files[]":p}:p,T&&new T,this.formSerializer)}}return c||l?(i.setContentType("application/json",!1),ZLi(p)):p}],transformResponse:[function(p){const i=this.transitional||dN.transitional,n=i&&i.forcedJSONParsing,l=this.responseType==="json";if(Ue.isResponse(p)||Ue.isReadableStream(p))return p;if(p&&Ue.isString(p)&&(n&&!this.responseType||l)){const e=!(i&&i.silentJSONParsing)&&l;try{return JSON.parse(p,this.parseReviver)}catch(y){if(e)throw y.name==="SyntaxError"?ti.from(y,ti.ERR_BAD_RESPONSE,this,null,this.response):y}}return p}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Qn.classes.FormData,Blob:Qn.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ue.forEach(["delete","get","head","post","put","patch"],d=>{dN.headers[d]={}});const uN=dN,HLi=Ue.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),WLi=d=>{const p={};let i,n,l;return d&&d.split(`
50
+ If an entity is called by another, they must be in the same scope, which means they have the same parent.`})),{errors:n,modifiedData:i}}subscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-dependents"))){const n=[],l=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const T=y.entity.afterAllChildrenInitialized(i);n.push(...T.updated),l.push(...T.added),c.push(...T.removed),e.push(...T.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}onDetachedDependencyRemoved(i,n,l){const c=[],e=[],y=[],T=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.remove({ignoreUpstream:!1},l);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}onDetachedDependencyRestored(i,n,l){const c=[],e=[],y=[],T=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.restore({},l);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}unsubscribeFromDependencies(){return this.parent.unsubscribeDependents([{entity:this,field:"parent"}]),this}subscribeToDependencies(){var i;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),this}increaseVersion(i){if(i&&!M(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&M(i).isSame(M(this.createdAt))?this:(this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=M(i).toISOString()||M().toISOString(),this)}captureVersion(){var n;const i=((n=this.knownVersions)==null?void 0:n.get(this.version))||new Ai(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.declaration=this.declaration,i.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,i.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const n=[],l=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);n.push(this.parent,...y.updated),l.push(...y.added),c.push(...y.removed)}return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}async restoreVersion(i){var T;const n=[],l=[],c=[],e=[];if(this.version===i)return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this};if(!this.knownVersions){const v=new Map;for(const[E,b]of this.knownVersions||new Map){if(v.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[O,P]of b.knownVersions)v.set(O,P);b.knownVersions=null}}let y=(T=this.knownVersions)==null?void 0:T.get(i);if(!y){const v=await this.APILoadVersion({},i);if(!v)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Ai(v,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.declaration=y.declaration,this.andChildrenGroup=y.andChildrenGroup,this.orChildrenGroup=y.orChildrenGroup,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.parent=y.parent,{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}updateWithShallowTransfer(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.UpdateWithShallowTransfer))){var l,c;if(!this.checkCanEdit(this,n))return te.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,n),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,i.parent){const e=re(i.parent),y=this.project.get(e),T=this.parent;if(T&&T.id!==(y==null?void 0:y.id)&&this.removeFromParent(n),y)this.setParent(y,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const e=re(i.declaration),y=this.project.get(e);y&&this.setDeclaration(y)}return(l=i.andChildrenGroup)==null||l.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addToAndGroup(T,n),T.setParent(this,n))}),[...this.andChildrenGroup||[]].forEach(e=>{var T;((T=i.andChildrenGroup)==null?void 0:T.find(v=>re(v)===e.id))||(this.removeChildGroup(e,n),e.removeFromParent(n))}),(c=i.orChildrenGroup)==null||c.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addToOrGroup(T,n),T.setParent(this,n))}),[...this.orChildrenGroup||[]].forEach(e=>{var T;((T=i.orChildrenGroup)==null?void 0:T.find(v=>re(v)===e.id))||(this.removeChildGroup(e,n),e.removeFromParent(n))}),i.calledByEntry.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addEntryCaller(T,n),T.addCall(this,n))}),[...this.calledByEntry].forEach(e=>{i.calledByEntry.find(T=>re(T)===e.id)||(this.removeCaller(e,n),e.removeCall(this,n))}),i.calledBySuccess.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addSuccessCaller(T,n),T.addSuccessCall(this,n))}),[...this.calledBySuccess].forEach(e=>{i.calledBySuccess.find(T=>re(T)===e.id)||(this.removeCaller(e,n),e.removeCall(this,n))}),i.calledByError.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addErrorCaller(T,n),T.addErrorCall(this,n))}),[...this.calledBySuccess].forEach(e=>{i.calledBySuccess.find(T=>re(T)===e.id)||(this.removeCaller(e,n),e.removeCall(this,n))}),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],n=[],l=[],c=[];if(this.initialData.parent){const e=re(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' 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 e=re(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.addEntryCaller(T,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.addSuccessCaller(T,null)}),this.initialData.calledByError.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.addErrorCaller(T,null)}),{updated:D(i),added:D(n),removed:D(l),affected:D(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AfterAllChildrenInitialized))){var E,b;if(!this.checkCanEdit(this,i))return te.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];if(this.initialized=!0,this.parent.type===o.Condition){let O=this.index||0;const P=(this.parent.declaration.id===sr.And?this.parent.andChildrenGroup||[]:this.parent.orChildrenGroup||[]).filter(L=>!L.deleted&&L.id!==this.id);P.length&&(O>P.length+1?O=P.length:O<0&&(O=0)),P.find(L=>(L.index||0)===O&&!L.deleted)&&P.filter(L=>(L.index||0)>=O&&!L.deleted).forEach(L=>{L.metaSync({index:(L.index||0)+1},i),i==null||i.add(L,H.Updated),n.push(L)}),this.metaSync({index:O},i)}(E=this.andChildrenGroup)!=null&&E.length&&this.andChildrenGroup.sort((O,P)=>(O.index||0)-(P.index||0)),(b=this.orChildrenGroup)!=null&&b.length&&this.orChildrenGroup.sort((O,P)=>(O.index||0)-(P.index||0)),this.inputs.sort((O,P)=>{var $,L;return(O.index??(($=O.declaration)==null?void 0:$.index))-(P.index??((L=P.declaration)==null?void 0:L.index))});const{updated:y,added:T,removed:v}=this.syncInputs(i);return n.push(...y),l.push(...T),c.push(...v),this.captureVersion(),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-self-to-project"))){const n=[this],l=[],c=[],e=[];return this.parent===this.project?this.project.addCondition(this):this.parent.type===o.Condition&&(this.parent.declaration.id===sr.And?this.parent.addToAndGroup(this,i):this.parent.declaration.id===sr.Or&&this.parent.addToOrGroup(this,i)),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),n.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),n.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),n.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),n.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),n.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveInput))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this;const l=this.inputs.findIndex(c=>c.id===i.id);return l>-1&&(this.inputs.splice(l,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this}addInput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddInput))){return this.checkCanEdit(this,n)?this.inputs.includes(i)?(n==null||n.attemptAutoclose(_.AddInput,this.id),this):(this.inputs.push(i),n==null||n.add(this,H.Affected),n==null||n.attemptAutoclose(_.AddInput,this.id),this):(te.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.AddInput,this.id),this)}addOutput(i){return this}removeOutput(i){return this}addSuccessCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddSuccessCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCaller,n)?(this.calledBySuccess.find(c=>c.id===i.id)||(this.calledBySuccess.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddSuccessCaller,this.id),this):this}addErrorCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddErrorCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCaller,n)?(this.calledByError.find(c=>c.id===i.id)||(this.calledByError.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddErrorCaller,this.id),this):this}addEntryCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddEntryCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddEntryCaller,n)?(this.calledByEntry.find(c=>c.id===i.id)||(this.calledByEntry.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddEntryCaller,this.id),this):this}addErrorCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddErrorCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCall,n)?(this.errorCalls.find(c=>c.id===i.id)||(this.errorCalls.push(i),l&&ht(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddErrorCall,this.id),this):this}addSuccessCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddSuccessCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCall,n)?(this.successCalls.find(c=>c.id===i.id)||(this.successCalls.push(i),l&&ht(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddSuccessCall,this.id),this):this}removeCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveCall)),l=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCall,n))return this;const c=this.successCalls.findIndex(y=>y.id===i.id);c>-1&&(this.successCalls.splice(c,1),n==null||n.add(this,H.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),n==null||n.add(this,H.Affected)),l&&ht(this,n),n==null||n.attemptAutoclose(_.RemoveCall,this.id),this}removeCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCaller,n)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),l&&ht(this,n),n==null||n.attemptAutoclose(_.RemoveCaller,this.id),this):this}setParent(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetParent,n)?(((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetParent,this.id),this):this}removeChildGroup(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveChildGroup))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[removeChildGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.RemoveChildGroup,this.id),this;if(this.andChildrenGroup){const l=this.andChildrenGroup.findIndex(c=>c.id===i.id);l!==-1&&(this.andChildrenGroup.splice(l,1),n==null||n.add(this,H.Updated))}if(this.orChildrenGroup){const l=this.orChildrenGroup.findIndex(c=>c.id===i.id);l!==-1&&(this.orChildrenGroup.splice(l,1),n==null||n.add(this,H.Updated))}return n==null||n.attemptAutoclose(_.RemoveChildGroup,this.id),this}setDeclaration(i){return this.declaration=i,this}initChildren(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.declaration=he(this.initialData.declaration,this.project),this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(n=>{const l=he(n,this.project);return l.setParent(this,null),l.initChildren(i),l})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(n=>{const l=he(n,this.project);return l.setParent(this,null),l.initChildren(i),l})),this.successCalls=this.initialData.successCalls.map(n=>{const l=he(n,this.project);if(l.addSuccessCaller(this,null),[o.BreakStatement,o.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===o.ReturnStatement){const c=en(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==o.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.errorCalls=this.initialData.errorCalls.map(n=>{const l=he(n,this.project);if(l.addErrorCaller(this,null),[o.BreakStatement,o.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===o.ReturnStatement){const c=en(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==o.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.inputs=this.initialData.inputs.map(n=>{const l=he(n,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"meta-sync"))){const l=$r(this,i,n),c=xr(this,l),e=this.toMeta();return this.x=l.x!==void 0?l.x:e.x,this.y=l.y!==void 0?l.y:e.y,this.index=l.index!==void 0?l.index:e.index,super.baseMetaSync(l,this,n),l.deleted===!0&&!e.deleted?n==null||n.add(this,H.Removed):l.deleted===!1&&e.deleted?n==null||n.add(this,H.Added):c&&(n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ge,...n){return await Ai.repository.APILoad(this.id,...n),this}async APICreate(i=Ge,...n){return await Ai.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(i=Ge,...n){return await Ai.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(i=Ge,...n){return await Ai.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(i=Ge,...n){return await Ai.repository.APIClone(this.id,...n),this}async APILoadVersion(i=Ge,n,...l){return await Ai.repository.APILoadVersion(this.id,n,...l)}removeFromParent(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveFromParent))){var y;if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.parent.type===o.Project?(this.parent.removeCondition(this),e.push(this.parent)):((y=this.parent)==null?void 0:y.type)===o.Condition?this.parent.removeChildGroup(this):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:D(c),updated:D(n),removed:D(l),affected:D(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveEntity))){var T;if(!this.checkCanDelete(this,n))return te.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${_.RemoveEntity}-${this.id}`,action:_.RemoveEntity,owner:this,errorReason:tr.ActionOwnerEntityNonDeletable,rootAction:((T=n==null?void 0:n.self)==null?void 0:T.id)===this.id&&(n==null?void 0:n.autoCloseActionName)===_.RemoveEntity}),n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[],c=[],e=[],y=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:O}=v.entity.onDetachedDependencyRemoved(this,v.field,n);l.push(...E),c.push(...b),e.push(...O)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},n);c.push(...E),l.push(...b)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(v=>{const{removed:E,updated:b}=v.remove({ignoreUpstream:!0},n);c.push(...E),l.push(...b)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);l.push(...E),c.push(...b)}),this.successCalls.forEach(v=>{l.push(v),v.removeCaller(this,n)}),this.errorCalls.forEach(v=>{l.push(v),v.removeCaller(this,n)}),!i){const v=this.removeFromParent(n);e.push(...v.added),l.push(...v.updated),c.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{l.push(E),E.removeCall(this,n)})}return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:D(e),updated:D(l),removed:D(c),affected:D(y),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RestoreEntity))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:T,removed:v,added:E}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...T),c.push(...v),n.push(...E)}),this.andChildrenGroup&&this.andChildrenGroup.forEach(y=>{const{updated:T,added:v}=y.restore({},i);l.push(...T),n.push(...v)}),this.orChildrenGroup&&this.orChildrenGroup.forEach(y=>{const{updated:T,added:v}=y.restore({},i);l.push(...T),n.push(...v)}),this.inputs.forEach(y=>{const{updated:T}=y.restore({},i);l.push(...T)}),this.successCalls.forEach(y=>{l.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{l.push(y),y.addErrorCaller(this,i)}),this.calledBySuccess.forEach(y=>{l.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{l.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{l.push(y),y.addCall(this,i)}),this.parent.type===o.Project&&this.project.addCondition(this),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this})}toFlat(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((l=this.andChildrenGroup)==null?void 0:l.flatMap(e=>e.toFlat(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlat(i)))||[],...this.inputs.flatMap(e=>e.toFlat(i)),...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.calledBy.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((l=this.andChildrenGroup)==null?void 0:l.flatMap(e=>e.toFlatIds(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlatIds(i)))||[],...this.inputs.flatMap(e=>e.toFlatIds(i)),...this.successCalls.flatMap(e=>e.toFlatIds(i)),...this.errorCalls.flatMap(e=>e.toFlatIds(i)),...this.calledBy.flatMap(e=>e.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,index:this.index,x:this.x,y:this.y,type:this.type,editable:this.editable,deletable:this.deletable}}toJSON(i=new Set){var n,l;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(i),andChildrenGroup:((n=this.andChildrenGroup)==null?void 0:n.map(c=>c.toJSON(i)))||null,orChildrenGroup:((l=this.orChildrenGroup)==null?void 0:l.map(c=>c.toJSON(i)))||null,successCalls:this.successCalls.map(c=>c.toJSON(i)),errorCalls:this.errorCalls.map(c=>c.toJSON(i)),calledBySuccess:this.calledBySuccess.map(c=>c.toReference()),calledByError:this.calledByError.map(c=>c.toReference()),calledByEntry:this.calledByEntry.map(c=>c.toReference()),inputs:this.inputs.map(c=>c.toJSON(i)),parent:this.parent.toReference()})}toJSONClone(i=pt){var l,c,e,y,T,v,E;let n;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?n=i.seenEntityMaps.get(this.id):(n=i.newId||jr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,n)),(c=i.seenEntities)!=null&&c.has(n)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(n),(T=i.seenEntities)==null||T.add(this.id),{id:n,version:x.UUID.uuid(),createdAt:i.timestamp||M().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toJSON(),andChildrenGroup:((v=this.andChildrenGroup)==null?void 0:v.map(b=>b.toJSONClone({...i,newId:null})))||null,orChildrenGroup:((E=this.orChildrenGroup)==null?void 0:E.map(b=>b.toJSONClone({...i,newId:null})))||null,successCalls:this.successCalls.map(b=>b.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(b=>b.toJSONClone({...i,newId:null})),calledBySuccess:this.calledBySuccess.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(b=>b.toReference({seenEntityMaps:i.seenEntityMaps})),inputs:this.inputs.map(b=>b.toJSONClone({...i,newId:null})),parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=pt){var l;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n+"--"+x.UUID.uuid()+"--ref",type:o.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(i=pt){var l,c,e;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,index:this.index,x:this.x,y:this.y,declaration:this.declaration.toReference(i),andChildrenGroup:((c=this.andChildrenGroup)==null?void 0:c.map(y=>y.toReference(i)))||null,orChildrenGroup:((e=this.orChildrenGroup)==null?void 0:e.map(y=>y.toReference(i)))||null,inputs:this.inputs.map(y=>y.toReference(i)),successCalls:this.successCalls.map(y=>y.toReference(i)),errorCalls:this.errorCalls.map(y=>y.toReference(i)),calledBySuccess:this.calledBySuccess.map(y=>y.toReference(i)),calledByError:this.calledByError.map(y=>y.toReference(i)),calledByEntry:this.calledByEntry.map(y=>y.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((l=this.andChildrenGroup)==null?void 0:l.flatMap(e=>e.toFlatJSON(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlatJSON(i)))||[],...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(){const i=this.parent.type===o.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(n=>n.id),calledBySuccess:this.calledBySuccess.map(n=>n.id),calledByError:this.calledByError.map(n=>n.id),parent:i}}toFlatGenerationTarget(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((l=this.andChildrenGroup)==null?void 0:l.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...((c=this.orChildrenGroup)==null?void 0:c.flatMap(e=>e.toFlatGenerationTarget(i)))||[],...this.inputs.flatMap(e=>e.toFlatGenerationTarget(i)),...this.successCalls.flatMap(e=>e.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(e=>e.toFlatGenerationTarget(i))])}clearErrors(){var i,n;return this.errors=[],(i=this.andChildrenGroup)==null||i.forEach(l=>l.clearErrors()),(n=this.orChildrenGroup)==null||n.forEach(l=>l.clearErrors()),this.inputs.forEach(l=>l.clearErrors()),this.successCalls.forEach(l=>l.clearErrors()),this.errorCalls.forEach(l=>l.clearErrors()),this}validate(){const i=oPe(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors,...this.inputs.flatMap(n=>n.getErrors())]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.CloneEntity)),n=null,l=null,c=!0){var L,U,F;const e=Pr(n,this),y=this.toJSON(),T=l||x.UUID.uuid();y.inputs=[];const v=T.split("-id"),E=v[v.length-1||0]||T;y.id=T,y.version=x.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||M().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.deletable=!0,y.editable=!0;const b=Gi(y,e);n?b.setParent(n,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,H.Added);const O=(L=this.andChildrenGroup)==null?void 0:L.map(Z=>Z.clone(i,b,x.UUID.uuid(),c)),P=(U=this.orChildrenGroup)==null?void 0:U.map(Z=>Z.clone(i,b,x.UUID.uuid(),c));b.andChildrenGroup=O||null,b.orChildrenGroup=P||null;const $=(F=this.inputs)==null?void 0:F.map((Z,X)=>Z.clone(i,b,E+"-input-map-"+X+"-id",c));return b.inputs=$,i==null||i.attemptAutoclose(_.CloneEntity,this.id),b}addToAndGroup(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddToAndGroup))){return this.checkCanEdit(this,n)?(this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(i)||(this.andChildrenGroup.push(i),n==null||n.add(i,H.Affected)),n==null||n.attemptAutoclose(_.AddToAndGroup,this.id),this):(te.Logger.warn(`[addToAndGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.AddToAndGroup,this.id),this)}addToOrGroup(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddToOrGroup))){return this.checkCanEdit(this,n)?(this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(i)||(this.orChildrenGroup.push(i),n==null||n.add(i,H.Affected)),n==null||n.attemptAutoclose(_.AddToOrGroup,this.id),this):(te.Logger.warn(`[addToOrGroup] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.AddToOrGroup,this.id),this)}removeUnrecognizedInputs(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.inputs.forEach(T=>{if(!this.declaration.inputs.find(E=>{var b;return E.id===((b=T.declaration)==null?void 0:b.id)})){const E=T.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated)}}),this.inputs.filter((T,v)=>{const E=this.inputs.findIndex(O=>O.declaration===T.declaration&&O!==T);if(E===-1)return!1;const b=this.inputs[E];return M(b==null?void 0:b.createdAt).isSame(M(T.createdAt))?v>E:!!M(b==null?void 0:b.createdAt).isAfter(T.createdAt)}).forEach(T=>{const v=T.remove({ignoreUpstream:!1},i);c.push(...v.removed),n.push(...v.updated)}),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}syncInputs(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SyncInputs))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[syncInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.SyncInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[],y=this.declaration.inputs.filter(b=>b.parentRelationType===B.FixedArguments&&!this.inputs.find(O=>O.declaration.id===b.id));this.inputs.sort((b,O)=>b.index-O.index),y.forEach(b=>{this.inputs.forEach($=>{$.index>=b.index&&$.metaSync({index:$.index+1},i)});const O={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.InputMap,parentRelationType:null,declaration:b.toJSON(),readsValue:null,defaultValue:null,index:b.index,name:null,codeName:null,description:null,parent:this.toReference()},P=he(O,this.project);P.setParent(this,i),P.initChildren(i),i==null||i.add(P,H.Added),P.addSelfToProject(i)}),this.inputs.sort((b,O)=>b.index-O.index);const{updated:T,added:v,removed:E}=this.removeUnrecognizedInputs(i);return n.push(...T),l.push(...v),c.push(...E),i==null||i.attemptAutoclose(_.SyncInputs,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return[]}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return[]}getDataType(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"get-data-type"))){var l;const n=((l=this.declaration)==null?void 0:l.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),n}};I(Ai,"repository",{APICreate:async(i,...n)=>i,APIUpdate:async(i,...n)=>i,APIDelete:async(i,...n)=>i,APIClone:async(i,...n)=>{},APILoad:async(i,...n)=>null,APILoadVersion:async(i,n,...l)=>null}),I(Ai,"type",o.Condition),I(Ai,"USER_MANAGED_PARENT_TYPES",[...yr,o.Project,o.Condition]),I(Ai,"PARENT_TYPES",[...Ai.USER_MANAGED_PARENT_TYPES]),I(Ai,"MUTABLE_BASE_PROPERTIES",["operator"]),I(Ai,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion","index"]),I(Ai,"BASE_PROPERTIES",[...Ai.MUTABLE_BASE_PROPERTIES,...Ai.INMUTABLE_BASE_PROPERTIES]),I(Ai,"MUTABLE_META_PROPERTIES",["x","y"]),I(Ai,"INMUTABLE_META_PROPERTIES",[...Ai.INMUTABLE_BASE_PROPERTIES]),I(Ai,"META_PROPERTIES",[...Ai.MUTABLE_META_PROPERTIES,...Ai.INMUTABLE_META_PROPERTIES]),I(Ai,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),I(Ai,"INMUTABLE_UPSTREAM_PROPERTIES",[]),I(Ai,"UPSTREAM_PROPERTIES",[...Ai.MUTABLE_UPSTREAM_PROPERTIES,...Ai.INMUTABLE_UPSTREAM_PROPERTIES]),I(Ai,"MUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup","successCalls","errorCalls","inputsDeclarations","inputs"]),I(Ai,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),I(Ai,"DOWNSTREAM_PROPERTIES",[...Ai.MUTABLE_DOWNSTREAM_PROPERTIES,...Ai.INMUTABLE_DOWNSTREAM_PROPERTIES]),I(Ai,"PROPERTIES",[...Ai.META_PROPERTIES,...Ai.UPSTREAM_PROPERTIES,...Ai.DOWNSTREAM_PROPERTIES]);let Iu=Ai;var $e=(d=>(d.Inherited="inherited",d.DefaultValue="default-value",d.Missing="missing",d.Empty="empty",d.AutoCalculated="auto-calculated",d.QueuedAutocalculation="queued-autocalculation",d.External="external",d.Testing="testing",d.ExecutionResult="execution-result",d))($e||{});const uPe={initialized:!1,id:"",project:null,values:{},onWriteCallback:()=>{},onRemoveCallback:()=>{},onWrite:()=>{},onRemove:()=>{},init:()=>{},toJSON:()=>({}),writeValue:()=>{},readValue:()=>null,removeValue:()=>{},clear:()=>{}};function o$i(d,p){return{...uPe,id:d,project:p}}class Am{constructor(p,i){I(this,"initialized",!1);I(this,"id");I(this,"project");I(this,"values",{});I(this,"onWriteCallback",()=>{});I(this,"onRemoveCallback",()=>{});this.id=p,this.project=i,this.init()}onWrite(p){this.onWriteCallback=p}onRemove(p){this.onRemoveCallback=p}init(){var n;if(!((n=this.project)!=null&&n.id)||this.initialized)return;const p={},i={};Object.keys(p).forEach(l=>{const c=p[l],e=new Jr(c,this.project);try{if(c.parent){const v=this.project.findSubscribedInstanceFromReference(c.parent);if(!v)return;e.setParent(v,null),e.hydrateAncestors(),e.initChildren(null)}else if(c.standaloneParent){const v=this.project.findSubscribedInstanceFromReference(c.standaloneParent);if(!v)return;e.standalone=!0,e.setStandaloneParent(v,null),e.hydrateAncestors(),e.initChildren(null)}i[l]=e;const y=e.parent||e.standaloneParent,T=fPe(e,y,this.project);T?i[l]=T:delete p[l]}catch(y){te.Logger.error("Error hydrating ancestors: ",y),delete p[l]}}),this.values={...this.values,...i},this.initialized=!0}toJSON(){const p={};return Object.keys(this.values).forEach(i=>{p[i]=this.values[i].toJSON()}),p}writeValue(p,i){if(!p)throw new Error("The value owner entity is required when writing a value to a value store");let l=this.values[p.id];if(!l)if(i instanceof Jr)l=i;else if(i)l=Gi(i,this.project);else{const c={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:null,deletable:!0,editable:!0,type:o.LiteralValue,standaloneParent:p.toReference(),parent:null,valueAsTypeSingle:null,valueAsTypeList:null,autogeneration:null,name:oc(p.getDataType(null))};l=Gi(c,this.project)}l.standalone=!0,l.initialData.standaloneParent||te.Logger.warn("instance.initialData: ",l.initialData),l.setStandaloneParent(p,null),l.hydrateAncestors(),l.initChildren(null),i&&(l.metaSync({...i},null),l.setValueAsType(i.valueAsType,null)),this.values[p.id]=l,this.onWriteCallback(p,l)}readValue(p){return this.values[p]||null}removeValue(p){if(!this.values[p])return;delete this.values[p];const i=this.project.get(p);i&&this.onRemoveCallback(i)}clear(){this.values={}}}function mr(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)}function pPe(d){if(Array.isArray(d))return d.map(T=>typeof T=="number"?T:e(T)?Number(T):String(T));const p=[];let i=0,n="",l=!1,c=null;for(;i<d.length;){const T=d[i];if(T==="."&&!l){n.length&&(p.push(y(n)),n=""),i++;continue}if(T==="["&&!l){n.length&&(p.push(y(n)),n=""),l=!0,i++;continue}if(l){if(!c&&(T==='"'||T==="'")){c=T,i++;continue}if(c){if(T==="\\"&&i+1<d.length){n+=d[i+1],i+=2;continue}if(T===c){c=null,i++;continue}n+=T,i++;continue}if(T==="]"){p.push(y(n)),n="",l=!1,i++;continue}if(/\s/.test(T)&&!c){i++;continue}n+=T,i++;continue}n+=T,i++}return n.length&&p.push(y(n)),p;function e(T){return/^[0-9]+$/.test(T)}function y(T){const v=T.trim();return e(v)?Number(v):v}}function HV(d,p,i){if(d==null)return i;const n=pPe(p);let l=d;for(let c=0;c<n.length;c++){const e=n[c];if(l==null)return i;if(Array.isArray(l)&&typeof e=="number"){if(!(e in l))return i;l=l[e]}else{if(!Object.prototype.hasOwnProperty.call(l,e))return i;l=l[e]}}return l}const d$i=new Set(["__proto__","prototype","constructor"]);function u$i(d){return typeof d=="string"&&d$i.has(d)}function cPe(d,p,i,n){const{createMissing:l=!0,coerce:c=!0}=n??{};if(d==null||typeof d!="object")throw new TypeError("set(...) expects a non-null object as target.");const e=pPe(p);if(e.length===0)throw new Error("set(...) path must not be empty.");let y=d;for(let T=0;T<e.length;T++){const v=e[T];if(u$i(v))throw new Error(`Refusing to set unsafe key "${String(v)}" on object.`);const E=T===e.length-1,O=typeof e[T+1]=="number",P=Array.isArray(y)&&typeof v=="number";if(E){if(P&&y[v]==null&&!l)throw new Error(`set(...) missing array index "${String(v)}" (createMissing=false).`);return y[v]=i,d}else{if(!Object.prototype.hasOwnProperty.call(y,v)||y[v]==null){if(!l)throw new Error(`set(...) missing parent at segment "${String(v)}" (createMissing=false).`);y[v]=O?[]:{}}else{const $=y[v],L=$!==null&&typeof $=="object",U=Array.isArray($);if(O){if(!U){if(!c)throw new Error(`set(...) expected an array at "${String(v)}" but found non-array (coerce=false).`);y[v]=[]}}else if(!L||U){if(!c)throw new Error(`set(...) expected an object at "${String(v)}" but found non-object (coerce=false).`);y[v]={}}}y=y[v]}}return d}function av(d){return globalThis.structuredClone?structuredClone(d):JSON.parse(JSON.stringify(d))}function p$i(d){if(Array.isArray(d))return d.slice();const p=[];let i="",n=0;for(;n<d.length;){const l=d[n];if(l==="."||l==="["||l==="]"){if(i.length){const c=Number(i);p.push(!Number.isNaN(c)&&/^\d+$/.test(i)?c:i),i=""}if(l==="["){n++;let c="";for(;n<d.length&&d[n]!=="]";)c+=d[n++];const e=Number(c);p.push(!Number.isNaN(e)&&/^\d+$/.test(c)?e:c)}n++;continue}i+=l,n++}if(i.length){const l=Number(i);p.push(!Number.isNaN(l)&&/^\d+$/.test(i)?l:i)}return p}function WV(d,p,i){const n=p$i(p);if(n.length===0)throw new Error("Path must not be empty.");const l=n[n.length-1];let c=d;for(let e=0;e<n.length-1;e++){const y=n[e],T=typeof n[e+1]=="number",v=c==null?void 0:c[y];if(v==null){if(!i)throw new Error(`Missing parent at segment "${String(y)}" for path "${Array.isArray(p)?JSON.stringify(p):p}".`);c[y]=T?[]:{}}else if(typeof v!="object"||v!==null&&Array.isArray(v)!==T&&typeof n[e+1]=="number"){if(!i)throw new Error(`Parent at "${String(y)}" is not a container suitable for continuing the path.`);c[y]=T?[]:{}}c=c[y]}return{target:c,lastKey:l}}function Zl(d,p,i,n){var y;let l;if(((y=d==null?void 0:d.entity)==null?void 0:y.type)===o.PrimitiveEntity)switch(d.entity.name){case oe.EntityTemplate:l=oe.EntityTemplate;break;case oe.String:l=oe.String;break;case oe.Number:l=oe.Number;break;case oe.Boolean:l=oe.Boolean;break;case oe.Null:l=oe.Null;break;case oe.Enum:l=oe.Enum;break;case oe.KeyValue:l=oe.KeyValue;break;case oe.Untyped:l=oe.Untyped;break;case oe.KeyValue:l=oe.KeyValue;break;case oe.Date:l=oe.Date;break;case oe.UUID:l=oe.UUID;break;case oe.File:l=oe.File;break;case oe.Void:l=oe.Void;break;case oe.ActionDescriptor:l=oe.ActionDescriptor;break;case oe.Bytes:l=oe.Bytes;break;default:throw new Error(`Primitive type ${le(d.entity,i)} is not supported`)}else l=oe.Untyped;const c=Jr.new(n);c.name=l,c.parent=p.toReference();const e=he(c,i);return e.hydrateAncestors(),n==null||n.add(e,H.Added),e.addSelfToProject(n),e.initChildren(n),e}function yl(d,p,i=new Set){var n,l,c;if(i.has(d.id))return[];if(i.add(d.id),St.includes(d.type)){const e=Zn(d);return D([e,...[e].flatMap(y=>yl(y,p,i))])}else if(d.type===o.OutputMap){if(St.includes(d.parent.type)&&((n=d.declaration)==null?void 0:n.type)===o.Property&&d.declaration.static)return D([d,d.declaration,...[d,d.declaration].flatMap(e=>yl(e,p,i))])}else if(d.type===o.InputMap){if(St.includes(d.parent.type)&&((l=d.declaration)==null?void 0:l.type)===o.Property&&((c=d.declaration)!=null&&c.static))return D([d.declaration,...[d.declaration].flatMap(e=>yl(e,p,i))]);if(kt.includes(d.parent.type)){const e=[d,...d.getCounterparts()];return D([...e,...e.flatMap(y=>yl(y,p,i))])}}return[d]}function fPe(d,p,i){return d}function Nh(d,p,i=!1){const n=d.readsValue;let l=null;const c=Ru(n,p,i);if(c){const e={sources:[c],target:d};l={value:c.value,valueOwner:d,type:$e.Inherited,inheritanceLink:e}}return l}function Et(d,p,i){var y;if(!p)return null;let n;if(((y=d==null?void 0:d.entity)==null?void 0:y.type)===o.PrimitiveEntity)switch(d.entity.name){case oe.EntityTemplate:n=oe.EntityTemplate;break;case oe.String:n=oe.String;break;case oe.Number:n=oe.Number;break;case oe.Boolean:n=oe.Boolean;break;case oe.Null:n=oe.Null;break;case oe.Enum:n=oe.Enum;break;case oe.KeyValue:n=oe.KeyValue;break;case oe.Untyped:n=oe.Untyped;break;case oe.KeyValue:n=oe.KeyValue;break;case oe.Date:n=oe.Date;break;case oe.UUID:n=oe.UUID;break;case oe.File:n=oe.File;break;case oe.Void:n=oe.Void;break;case oe.ActionDescriptor:n=oe.ActionDescriptor;break;default:throw new Error(`Primitive type ${le(d.entity,i)} is not supported`)}else n=oe.Untyped;if(!i.get(p.id))return null;const c=Jr.new(null);c.name=n,c.standaloneParent=p.toReference();let e=new Jr(c,i);return e.hydrateAncestors(),e.standalone=!0,e.setStandaloneParent(p),e.initChildren(null),e}function yPe(d,p,i=!1){var c,e;if(p.execution&&p.execution.hasEntity(d)&&!i){const y=(c=p.lastExecutionResults)==null?void 0:c.readValue(d.id);if(y)return{value:y,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(e=p.localTestValues)==null?void 0:e.readValue(d.id),l=p.getValueTypePreference(d.id);return n&&!i&&(l===null||l!==$e.DefaultValue)?{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null}:null}function wb(d,p,i,n=!1){var e,y;const l={...d},c=p.inputs;if(!c)return l;for(const T of c){if(!Nv(T))continue;const v=xm(T,i,n);if(v&&v.value){const E=le(T,i.project),b=T.codeName||((e=T.declaration)==null?void 0:e.codeName)||Wi(E);l[b]=qn((v==null?void 0:v.value)||null)?l[b]:(y=v==null?void 0:v.value)==null?void 0:y.value}}return l}function gm(d,p,i,n=!1){var e,y;const l={...d},c=p.inputs;if(!c)return l;for(const T of c){if(!Nv(T))continue;const v=lv(T,i,n);if(v&&v.value){const E=le(T,i.project),b=T.codeName||((e=T.declaration)==null?void 0:e.codeName)||Wi(E);l[b]=(y=v==null?void 0:v.value)==null?void 0:y.value}}return l}function hPe(d,p,i=!1){var E,b,O,P,$,L,U;let n={};if(((b=(E=d.dataType)==null?void 0:E.entity)==null?void 0:b.type)===o.DefinitionEntity&&(n={...n,...d.dataType.entity.getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(d)&&!i){const F=(O=p.lastExecutionResults)==null?void 0:O.readValue(d.id);if(F){if(mr(F.value)){const X={...n,...F.value},se={...gm(X,d,p,i)};F.metaSync({value:se},null)}return{value:F,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}}const l=!!((P=p.execution)!=null&&P.entities.length),c=($=p.execution)==null?void 0:$.hasEntity(d),e=d.readsValue;let y=null;if(e){const F=(L=p.execution)==null?void 0:L.hasEntity(e);if((!l||l&&F&&c||l&&!F&&!c)&&(y=Nh(d,p,i),y&&y.value&&mr(y.value.value))){const X={...n,...y.value.value},se={...gm(X,d,p,i)};y.value.metaSync({value:se},null)}}const T=d.getDefaultValue(),v=p.getValueTypePreference(d.id);if(!y&&T){const F=T;if(F&&F.value===null&&F.autogeneration){const Z=OI(F);if(F.metaSync({value:Z},null),mr(Z)){const X={...gm(Z,d,p,i)};F.metaSync({value:X},null)}}(i||v===null||v!==$e.Testing)&&(y={value:F,valueOwner:d,type:(F==null?void 0:F.value)===null?$e.Empty:$e.DefaultValue,inheritanceLink:null})}if(!y||y.type===$e.DefaultValue&&!i||v===null||v!==$e.DefaultValue){const F=(U=p.localTestValues)==null?void 0:U.readValue(d.id);if(F){if(mr(F.value)){const Z={...n,...F.value},X={...gm(Z,d,p,i)};F.metaSync({value:X},null)}return{value:F,valueOwner:d,type:$e.Testing,inheritanceLink:null}}}return y||{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}}function mPe(d,p,i=!1){var e,y,T,v,E;let n={};if(((y=(e=d.dataType)==null?void 0:e.entity)==null?void 0:y.type)===o.DefinitionEntity&&(n={...n,...d.dataType.entity.getActiveRawDefaultValue()}),p.execution&&p.execution.hasEntity(d)&&!i){const b=(T=p.lastExecutionResults)==null?void 0:T.readValue(d.id);if(b){if(mr(b.value)){const P={...n,...b.value},$=wb(P,d,p,i);b==null||b.metaSync({value:$},null)}return{value:b,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}}const l=(v=p.localTestValues)==null?void 0:v.readValue(d.id),c=p.getValueTypePreference(d.id);if(l&&!i&&(c===null||c!==$e.DefaultValue)){if(mr(l.value)){const O={...n,...l.value},P=wb(O,d,p,i);l.metaSync({value:P},null)}return{value:l,valueOwner:d,type:$e.Testing,inheritanceLink:null}}if((E=d.dataType)!=null&&E.entity&&d.dataType.entity.type===o.DefinitionEntity&&d.dataType.isObject()){const b=Et(d.dataType,d,p.project);return b==null||b.metaSync({value:wb(n,d,p,i)},null),{value:b,valueOwner:d,type:$e.DefaultValue,inheritanceLink:null}}return null}function sv(d,p,i=!1){var E,b,O,P,$;if((E=d.dataType)!=null&&E.isObject())return hPe(d,p,i);const n=ki(d),l=!!((b=p.execution)!=null&&b.entities.length),c=(O=p.execution)==null?void 0:O.hasEntity(n),e=d.readsValue;let y=null;if(e){const L=(P=p.execution)==null?void 0:P.hasEntity(e);(!l||l&&L&&c||l&&!L&&!c)&&(y=Nh(d,p,i))}const T=d.getDefaultValue(),v=p.getValueTypePreference(d.id);if(!y&&T){const L=T;if(L&&L.value===null&&L.autogeneration){const U=OI(L);L.metaSync({value:U},null)}(i||v===null||v!==$e.Testing)&&(y={value:L,valueOwner:d,type:(L==null?void 0:L.value)===null?$e.Empty:$e.DefaultValue,inheritanceLink:null})}if(!y||y.type===$e.DefaultValue&&!i||v===null||v!==$e.DefaultValue){const L=($=p.localTestValues)==null?void 0:$.readValue(d.id);if(L)return{value:L,valueOwner:d,type:$e.Testing,inheritanceLink:null}}return y||{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}}function zV(d,p,i=!1){var e,y,T;if((e=d.dataType)!=null&&e.isObject())return mPe(d,p);if(p.execution&&p.execution.hasEntity(d)&&!i){const v=(y=p.lastExecutionResults)==null?void 0:y.readValue(d.id);if(v)return{value:v,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(T=p.localTestValues)==null?void 0:T.readValue(d.id),l=p.getValueTypePreference(d.id);return n&&!i&&(l===null||l!==$e.DefaultValue)?{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null}:sv(d,p,i)}function JV(d,p,i=!1){var b,O,P,$;const n=!!((b=p.execution)!=null&&b.entities.length),l=(O=p.execution)==null?void 0:O.hasEntity(d);let c=null;const e=d.readsValue;if(e){const L=(P=p.execution)==null?void 0:P.hasEntity(e);(!n||n&&L&&l||n&&!L&&!l)&&(c=Nh(d,p,i))}const y=d.declaration;if(!c&&y){const L=sv(y,p);L&&L.value&&(c=L)}const T=p.getValueTypePreference(d.id);if(!c||c.type===$e.DefaultValue&&!i||T===null||T!==$e.DefaultValue){const L=($=p.localTestValues)==null?void 0:$.readValue(d.id);if(L)return{value:L,valueOwner:d,type:$e.Testing,inheritanceLink:null}}const v=Hd(d);return v&&l&&!c?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:l&&!v&&!c?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:c||{value:null,valueOwner:d,type:$e.External,inheritanceLink:null}}function TPe(d,p,i=!1){return zV(d.declaration,p,i)}function vPe(d,p,i=!1){var b,O,P,$;if(!i&&p.execution&&p.execution.hasEntity(d)){const L=(b=p.lastExecutionResults)==null?void 0:b.readValue(d.id);if(L)return{value:L,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=ki(d),l=d.parent.type===o.FunctionDeclaration&&d.parent.parent.type===o.Loop?d.parent:null,c=!!((O=p.execution)!=null&&O.hasEntity(n))||!!l&&!!((P=p.execution)!=null&&P.hasEntity(l));let e=null;const y=d.getDefaultValue(),T=p.getValueTypePreference(d.id);if(y){const L=y||null;if(L&&L.value===null&&L.autogeneration){const U=OI(L);L.metaSync({value:U},null)}(i||T===null||T!==$e.Testing)&&(e={value:L,valueOwner:d,type:(L==null?void 0:L.value)===null?$e.Empty:$e.DefaultValue,inheritanceLink:null})}if(!e||e.type===$e.DefaultValue&&!i||T===null||T!==$e.DefaultValue){const L=($=p.localTestValues)==null?void 0:$.readValue(d.id),U=p.getValueTypePreference(d.id);if(L&&!i&&(U===null||U!==$e.DefaultValue))return{value:L,valueOwner:d,type:$e.Testing,inheritanceLink:null}}const v=Hd(d);let E=v&&c&&!e;return n.type===o.Loop&&c&&(E=!1),E?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:c&&!v&&!e?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:e||{value:null,valueOwner:d,type:$e.External,inheritanceLink:null}}function YV(d,p,i=!1){var O,P,$,L,U;if(p.execution&&p.execution.hasEntity(d)&&!i){const F=(O=p.lastExecutionResults)==null?void 0:O.readValue(d.id);if(F)return{value:F,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=ki(d),l=!!((P=p.execution)!=null&&P.entities.length),c=($=p.execution)==null?void 0:$.hasEntity(n),e=d.readsValue;let y=null;if(e){const F=(L=p.execution)==null?void 0:L.hasEntity(e);(!l||l&&F&&c||l&&!F&&!c)&&(y=Nh(d,p,i))}const T=d.getDefaultValue(),v=p.getValueTypePreference(d.id);if(!y&&T){const F=T;(i||v===null||v!==$e.Testing)&&(y={value:F,valueOwner:d,type:$e.DefaultValue,inheritanceLink:null})}if(!y||y.type===$e.DefaultValue&&!i||v===null||v!==$e.DefaultValue){const F=(U=p.localTestValues)==null?void 0:U.readValue(d.id);if(F)return{value:F,valueOwner:d,type:$e.Testing,inheritanceLink:null}}const E=Hd(d);return E&&!y?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:!E&&!y?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:y}function EPe(d,p,i=!1){var y,T,v,E,b,O,P,$,L,U,F,Z,X;if(p.execution&&p.execution.hasEntity(d)&&!i){const se=(y=p.lastExecutionResults)==null?void 0:y.readValue(d.id);if(se)return{value:se,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=Fm(d);if(py.includes(n.type)){const se=Ru(n,p,i),Q=d.codeName||((T=d.declaration)==null?void 0:T.codeName)||Wi(le(d,p.project));if(se!=null&&se.value&&mr(se.value.value)){const fe=se.value.value[Q],de=Et(d.getDataType(null),d,p.project);return de==null||de.metaSync({value:fe},null),{value:de,valueOwner:d,type:se.type,inheritanceLink:{sources:[se],target:d}}}return null}const l=(v=p.execution)==null?void 0:v.hasEntity(n),c=((E=p.execution)==null?void 0:E.state)===mN.Running;if((b=p.persistedExecutionResults)!=null&&b.values[d.id]&&!l&&!c&&!i){const se=(O=p.persistedExecutionResults)==null?void 0:O.readValue(d.id);if((se==null?void 0:se.value)!==null||(se==null?void 0:se.valueAsType)!==null)return{value:se,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const e=d.parent;if(!e)throw new Error(`Couldn't find the parent that generates the output ${d.id}`);switch(e.type){case o.VariableInstance:{const Q=JV(e,p,i);if(Q&&Q.value){const de=d.declaration;if(mr(Q.value.value)){const ce=Q.value.value[de.name],me=Et(((P=d.declaration)==null?void 0:P.dataType)||null,d,p.project);return me==null||me.metaSync({value:ce},null),{value:me,valueOwner:d,type:$e.Inherited,inheritanceLink:{sources:[Q],target:d}}}}const fe=Et((($=d.declaration)==null?void 0:$.dataType)||null,d,p.project);return fe==null||fe.metaSync({value:null},null),{value:fe,valueOwner:d,type:$e.Inherited,inheritanceLink:{sources:Q?[Q]:[],target:d}}}case o.VariableDeclaration:{const Q=sv(e,p,i);if(Q&&Q.value){const de=d.declaration;if(mr(Q.value.value)){const ce=Q.value.value[de.name],me=Et(((L=d.declaration)==null?void 0:L.dataType)||null,d,p.project);return me==null||me.metaSync({value:ce},null),{value:me,valueOwner:d,type:$e.Inherited,inheritanceLink:{sources:[Q],target:d}}}}const fe=Et(((U=d.declaration)==null?void 0:U.dataType)||null,d,p.project);return fe==null||fe.metaSync({value:null},null),{value:fe,valueOwner:d,type:$e.Inherited,inheritanceLink:{sources:Q?[Q]:[],target:d}}}case o.Operation:{const se=e.outputs.map(fe=>{var de,ce;if((de=p.persistedExecutionResults)!=null&&de.values[fe.id]){const me=(ce=p.persistedExecutionResults)==null?void 0:ce.values[fe.id];if(me.value!==null||me.valueAsType!==null)return{value:me,valueOwner:fe,type:$e.ExecutionResult,inheritanceLink:null}}}).filter(fe=>!!fe),Q=Et(((F=d.declaration)==null?void 0:F.dataType)||null,d,p.project);return Q==null||Q.metaSync({value:null},null),{value:Q,valueOwner:d,type:$e.QueuedAutocalculation,inheritanceLink:se.length?{sources:se,target:d}:null}}case o.FunctionCall:{const se=e.inputs.map(fe=>Yb(fe,p,i)).filter(fe=>!!fe),Q=Et(((Z=d.declaration)==null?void 0:Z.dataType)||null,d,p.project);return Q==null||Q.metaSync({value:null},null),{value:Q,valueOwner:d,type:$e.QueuedAutocalculation,inheritanceLink:se.length?{sources:se,target:d}:null}}case o.Loop:{const se=e.inputs.map(fe=>Yb(fe,p,i)).filter(fe=>!!fe),Q=Et(((X=d.declaration)==null?void 0:X.dataType)||null,d,p.project);return Q==null||Q.metaSync({value:null},null),{value:Q,valueOwner:d,type:$e.QueuedAutocalculation,inheritanceLink:se.length?{sources:se,target:d}:null}}case o.Search:return{value:null,valueOwner:d,type:$e.QueuedAutocalculation,inheritanceLink:null}}return null}function Cw(d,p,i=!1){var b,O,P;if(![...kt,...St].includes(d.parent.type)||!Nv(d))return null;if(((b=d.declaration)==null?void 0:b.type)===o.Property&&d.declaration.static)return Ru(d.declaration,p);const n=lv(d,p,i);if(n&&n.type!==$e.Empty&&n.type!==$e.Missing)return n;const l=Zn(d.parent),c=ho(l,p,i),e=d.codeName||((O=d.declaration)==null?void 0:O.codeName)||Wi(le(d,p.project)),y=Et(d.getDataType(null),d,p.project),T=Hd(d),v=(P=c==null?void 0:c.value)==null?void 0:P.value;if(v&&mr(v)){let $=v[e];return v[e]===void 0&&($=null),y==null||y.metaSync({value:$},null),T&&qn(y)?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:{value:y,valueOwner:d,type:c.type,inheritanceLink:{sources:c?[c]:[],target:d}}}return T?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}}function _w(d,p,i=!1){var b,O,P,$,L,U,F;if(![...kt,...St].includes(d.parent.type)||!Nv(d))return null;if(((b=d.declaration)==null?void 0:b.type)===o.Property&&d.declaration.static)return Ru(d.declaration,p,i);const n=Zn(d.parent),l=Ru(n,p,i),c=d.parent===n?d:n.inputs.find(Z=>{var X,se;return((X=Z.declaration)==null?void 0:X.id)===((se=d.declaration)==null?void 0:se.id)}),e=xm(c,p,i),y=d.codeName||((O=d.declaration)==null?void 0:O.codeName)||Wi(le(d,p.project)),T=Et(d.getDataType(null),d,p.project),v=Hd(d),E=(P=l==null?void 0:l.value)==null?void 0:P.value;if(((l==null?void 0:l.type)===$e.ExecutionResult||(l==null?void 0:l.type)===$e.Testing)&&!i&&E&&mr(E)){let Z=E[y];return E[y]===void 0&&(Z=null),T==null||T.metaSync({value:Z},null),{value:T,valueOwner:d,type:l.type,inheritanceLink:{sources:l?[l]:[],target:d}}}if(e&&e.type!==$e.Empty&&e.type!==$e.Missing)return e;if(E&&mr(E)){let Z=E[y];E[y]===void 0&&(Z=null),T==null||T.metaSync({value:Z},null);const X=v&&qn(T),se=!!(($=p.execution)!=null&&$.entities.length),Q=(L=p.execution)==null?void 0:L.hasEntity(n),fe=n.readsValue;if(fe){const de=(U=p.execution)==null?void 0:U.hasEntity(fe);if(X&&(!se||se&&de&&Q||se&&!de&&!Q))return{value:null,valueOwner:d,type:$e.Inherited,inheritanceLink:null}}if(d.readsValue){const de=(F=p.execution)==null?void 0:F.hasEntity(d.readsValue);if(X&&(!se||se&&de&&Q||se&&!de&&!Q))return{value:null,valueOwner:d,type:$e.Inherited,inheritanceLink:null}}return X?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:{value:T,valueOwner:d,type:l.type,inheritanceLink:{sources:l?[l]:[],target:d}}}return xm(d,p,i)}function lv(d,p,i=!1){var O,P,$,L,U,F;const n=ki(d),l=!!((O=p.execution)!=null&&O.entities.length),c=(P=p.execution)==null?void 0:P.hasEntity(n),e=d.readsValue;let y=null;if(e){const Z=($=p.execution)==null?void 0:$.hasEntity(e);(!l||l&&Z&&c||l&&!Z&&!c)&&(y=Nh(d,p,i))}const T=d.getDefaultValue(),v=p.getValueTypePreference(d.id);if(!y&&T&&(i||v===null||v!==$e.Testing)&&(y={value:T,valueOwner:d,type:qn(T)?$e.Empty:$e.DefaultValue,inheritanceLink:null}),!y&&d.declaration){const Z=Ru(d.declaration,p,i);Z&&Z.value&&(i||v===null||v!==$e.Testing)&&(y={...Z,valueOwner:d,type:$e.DefaultValue})}if(!y||y.type===$e.DefaultValue||(y==null?void 0:y.type)===$e.Empty){const Z=(L=p.persistedExecutionResults)==null?void 0:L.readValue(d.id);if(Z&&!i)return{value:Z,valueOwner:d,type:$e.Testing,inheritanceLink:null};const X=(U=p.localTestValues)==null?void 0:U.readValue(d.id);if(X&&!i&&(v===null||v!==$e.DefaultValue))return{value:X,valueOwner:d,type:$e.Testing,inheritanceLink:null}}const E=Hd(d),b=E&&(!y||(y==null?void 0:y.type)===$e.Empty);if(d.readsValue){const Z=(F=p.execution)==null?void 0:F.hasEntity(d.readsValue);if(b&&(!l||l&&Z&&c||l&&!Z&&!c))return{value:null,valueOwner:d,type:$e.Inherited,inheritanceLink:null}}return b?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:(y==null?void 0:y.inheritanceLink)||null}:!E&&(!y||y.type===$e.Inherited)&&!(y!=null&&y.inheritanceLink)?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:y}function xm(d,p,i=!1){var e,y;if(p.execution&&p.execution.hasEntity(d)&&!i){const T=(e=p.lastExecutionResults)==null?void 0:e.readValue(d.id);if(T)return{value:T,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(y=p.localTestValues)==null?void 0:y.readValue(d.id),l=p.getValueTypePreference(d.id);return n&&!i&&(l===null||l!==$e.DefaultValue)?{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null}:lv(d,p,i)}function Yb(d,p,i=!1){var n,l;return St.includes(d.parent.type)&&(n=Zn(d.parent).dataType)!=null&&n.isObject()||kt.includes(d.parent.type)&&(l=d.parent.getDataType(null))!=null&&l.isObject()?Cw(d,p,i):lv(d,p,i)}function bPe(d,p,i=!1){var n,l;return St.includes(d.parent.type)&&(n=Zn(d.parent).dataType)!=null&&n.isObject()||kt.includes(d.parent.type)&&(l=d.parent.getDataType(null))!=null&&l.isObject()?_w(d,p,i):xm(d,p,i)}function APe(d,p,i=!1){var v,E;if(!d.static)return null;if(p.execution){const b=(v=p.lastExecutionResults)==null?void 0:v.readValue(d.id);if(b&&!i)return{value:b,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(E=p.localTestValues)==null?void 0:E.readValue(d.id),l=p.getValueTypePreference(d.id);if(n&&!i&&(l===null||l!==$e.DefaultValue))return{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null};const c=d.getDefaultValue();let e=null;return c&&(i||l===null||l!==$e.Testing)&&(e={value:c,valueOwner:d,type:$e.DefaultValue,inheritanceLink:null}),Hd(d)&&qn(e==null?void 0:e.value)?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:qn(e==null?void 0:e.value)?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:e}function gPe(d,p,i=!1){var v,E;if(p.execution&&p.execution.hasEntity(d)&&!i){const b=(v=p.lastExecutionResults)==null?void 0:v.readValue(d.id);if(b)return{value:b,valueOwner:d,type:$e.ExecutionResult,inheritanceLink:null}}const n=(E=p.localTestValues)==null?void 0:E.readValue(d.id),l=p.getValueTypePreference(d.id);if(n&&!i&&(l===null||l!==$e.DefaultValue))return{value:n,valueOwner:d,type:$e.Testing,inheritanceLink:null};const c=d.getDefaultValue();let e=null;return c&&(i||l===null||l!==$e.Testing)&&(e={value:c,valueOwner:d,type:$e.DefaultValue,inheritanceLink:null}),Hd(d)&&qn((e==null?void 0:e.value)||null)?{value:null,valueOwner:d,type:$e.Missing,inheritanceLink:null}:qn((e==null?void 0:e.value)||null)?{value:null,valueOwner:d,type:$e.Empty,inheritanceLink:null}:e}function Ru(d,p,i=!1){switch(d.type){case o.ArgumentDeclaration:return vPe(d,p,i);case o.InputMap:return bPe(d,p,i);case o.VariableDeclaration:return zV(d,p,i);case o.VariableInstance:return TPe(d,p,i);case o.OutputMap:return EPe(d,p,i);case o.ReturnStatement:case o.BreakStatement:case o.ContinueStatement:return YV(d,p,i);case o.Property:return APe(d,p,i);case o.ValueDescriptor:return gPe(d,p,i);case o.Operation:case o.FunctionCall:case o.InternalCall:case o.Search:return yPe(d,p,i);default:return null}}function ho(d,p,i=!1){switch(d.type){case o.InputMap:return Yb(d,p,i);case o.VariableDeclaration:return sv(d,p,i);case o.VariableInstance:return JV(d,p,i);case o.ReturnStatement:case o.BreakStatement:case o.ContinueStatement:return YV(d,p,i);default:return null}}function c$i(d){var p;if(d&&d.type===$e.DefaultValue&&d.value&&d.valueOwner&&(!RA.includes(d.valueOwner.type)||((p=d.valueOwner.getDefaultValue())==null?void 0:p.id)===d.value.id)){const i=Et(d.valueOwner.getDataType(null),d.valueOwner,d.valueOwner.project);return{type:$e.DefaultValue,value:i,valueOwner:d.valueOwner,inheritanceLink:null}}return d}function yc(d,p,i,n){let l=!1,c=null,e=null;n instanceof q?(l=!0,c=n,e=null):(c=null,e=n);const y=d.parent;return p.getVariableDeclarations().forEach(v=>{var b,O,P,$,L,U;const E=v.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===y.id){let F=l?v.getDefaultValue():e==null?void 0:e.readValue(v.id);F?!l&&F&&F.id===((O=v.getDefaultValue())==null?void 0:O.id)&&(F=Et(v.getDataType(null),v,p)):l?F=Zl(v.getDataType(null),v,p,c):F=Et(v.getDataType(null),v,p);const Z=le(d,p),X=d.codeName||((P=d.extends)==null?void 0:P.codeName)||(($=d.implements[0])==null?void 0:$.codeName)||Wi(Z);let se={};((U=(L=v.dataType)==null?void 0:L.entity)==null?void 0:U.type)===o.DefinitionEntity&&(se={...se,...v.dataType.entity.getActiveRawDefaultValue()}),mr(F==null?void 0:F.value)&&(se={...se,...F.value}),se[X]=i,F==null||F.metaSync({value:se},c),l||e==null||e.writeValue(v,F);return}}),c}function $m(d,p,i,n){var P,$,L,U;let l=!1,c=null,e=null;n instanceof q?(l=!0,c=n,e=null):(c=null,e=n);const y=Zn(d.parent),T=y.getDataType(null);if(!(T!=null&&T.isObject()))return c;let v=l?y.getDefaultValue():e==null?void 0:e.readValue(y.id);v?!l&&v&&v.id===((P=y.getDefaultValue())==null?void 0:P.id)&&(v=Et(y.getDataType(null),y,p)):l?v=Zl(y.getDataType(null),y,p,c):v=Et(y.getDataType(null),y,p);const E=le(d,p),b=d.codeName||(($=d.declaration)==null?void 0:$.codeName)||Wi(E);let O={};if(((U=(L=y.dataType)==null?void 0:L.entity)==null?void 0:U.type)===o.DefinitionEntity&&(O={...O,...y.dataType.entity.getActiveRawDefaultValue()}),mr(v==null?void 0:v.value)&&(O={...O,...v.value}),O[b]=i,v==null||v.metaSync({value:O},c),l||e==null||e.writeValue(y,v),(i===""||i===null||i===void 0)&&d.type===o.OutputMap){const F=y.inputs.find(Z=>{var X,se;return((X=Z.declaration)==null?void 0:X.id)===((se=d.declaration)==null?void 0:se.id)||le(Z,p)===E});if(F){let Z=l?F.getDefaultValue():e==null?void 0:e.readValue(F.id);Z&&Z.metaSync({value:null},c),l||e==null||e.removeValue(F.id)}}return c}function IPe(d,p,i){var e,y,T,v,E;let n=!1,l=null,c=null;if(i instanceof q?(n=!0,l=i,c=null):(l=null,c=i),St.includes(d.type)){const b=Zn(d);(e=b.dataType)!=null&&e.isObject()&&b.inputs.forEach(O=>{var P,$,L,U,F,Z;if(((P=O.declaration)==null?void 0:P.type)===o.Property&&O.declaration.static){let X=n?(($=d.getDefaultValue)==null?void 0:$.call(d))||null:c==null?void 0:c.readValue(O.declaration.id);X?!n&&X&&X.id===((L=O.declaration.getDefaultValue())==null?void 0:L.id)&&(X=Et(O.declaration.getDataType(null),O.declaration,p)):n?X=Zl(O.declaration.getDataType(null),O.declaration,p,l):X=Et(O.declaration.getDataType(null),O.declaration,p),X==null||X.metaSync({value:null},l),n||c==null||c.removeValue((U=O.declaration)==null?void 0:U.id)}else if(((F=O.declaration)==null?void 0:F.type)===o.Property){let X=n?((Z=d.getDefaultValue)==null?void 0:Z.call(d))||null:c==null?void 0:c.readValue(O.id);X&&X.metaSync({value:null},l),n||c==null||c.removeValue(O.id)}})}else d.type===o.InputMap?((y=d.declaration)==null?void 0:y.type)===o.Property&&d.declaration.static?yc(d.declaration,p,null,i):St.includes(d.parent.type)&&((T=d.declaration)==null?void 0:T.type)===o.Property&&$m(d,p,null,i):d.type===o.OutputMap?((v=d.declaration)==null?void 0:v.type)===o.Property&&d.declaration.static?yc(d.declaration,p,null,i):St.includes(d.parent.type)&&((E=d.declaration)==null?void 0:E.type)===o.Property&&$m(d,p,null,i):d.type===o.Property&&d.static&&yc(d,p,null,i);return l}function RPe(d,p,i,n){var y,T,v,E,b,O,P;let l=!1,c=null,e=null;if(n instanceof q?(l=!0,c=n,e=null):(c=null,e=n),St.includes(p.type)){const $=Zn(p);if((y=$.dataType)!=null&&y.isObject()){let L={};((v=(T=$.dataType)==null?void 0:T.entity)==null?void 0:v.type)===o.DefinitionEntity&&(L={...L,...$.dataType.entity.getActiveRawDefaultValue()});const U=mr(d)?d:L;$.inputs.forEach(F=>{var Z,X,se,Q,fe,de;if(((Z=F.declaration)==null?void 0:Z.type)===o.Property&&F.declaration.static){let ce=l?((X=p.getDefaultValue)==null?void 0:X.call(p))||null:e==null?void 0:e.readValue(F.declaration.id);ce?!l&&ce&&ce.id===((se=F.declaration.getDefaultValue())==null?void 0:se.id)&&(ce=Et(F.declaration.getDataType(null),F.declaration,i)):l?ce=Zl(F.declaration.getDataType(null),F.declaration,i,c):ce=Et(F.declaration.getDataType(null),F.declaration,i);const me=le(F,i),ae=F.codeName||((Q=F.declaration)==null?void 0:Q.codeName)||Wi(me),ye=U[ae];ce==null||ce.metaSync({value:ye},c),l||e==null||e.writeValue(F.declaration,ce)}else if(((fe=F.declaration)==null?void 0:fe.type)===o.Property){let ce=l?((de=p.getDefaultValue)==null?void 0:de.call(p))||null:e==null?void 0:e.readValue(F.id);ce&&ce.metaSync({value:null},c),l||e==null||e.removeValue(F.id)}})}}else p.type===o.InputMap?((E=p.declaration)==null?void 0:E.type)===o.Property&&p.declaration.static?yc(p.declaration,i,d,n):St.includes(p.parent.type)&&((b=p.declaration)==null?void 0:b.type)===o.Property&&$m(p,i,d,n):p.type===o.OutputMap?((O=p.declaration)==null?void 0:O.type)===o.Property&&p.declaration.static?yc(p.declaration,i,null,n):St.includes(p.parent.type)&&((P=p.declaration)==null?void 0:P.type)===o.Property&&$m(p,i,null,n):p.type===o.Property&&p.static&&yc(p,i,d,n);return c}function DPe(d,p,i){const n=yl(d,p);let l=!1,c=null,e=null;return i instanceof q?(l=!0,c=i,e=null):(c=null,e=i),n.forEach(y=>{var v,E,b;let T=l?((v=y.getDefaultValue)==null?void 0:v.call(y))||null:e==null?void 0:e.readValue(y.id);T?!l&&T&&T.id===((b=((E=y.getDefaultValue)==null?void 0:E.call(y))||null)==null?void 0:b.id)&&(T=Et(d.getDataType(null),d,d.project)):l?T=Zl(y.getDataType(null),y,p,c):T=Et(y.getDataType(null),y,p),T==null||T.metaSync({value:null},c),l||e==null||e.removeValue(y.id),IPe(y,p,i)}),c}function f$i(d,p,i,n){if(Fx(d))return DPe(p,i,n);const l=yl(p,i);let c=!1,e=null,y=null;n instanceof q?(c=!0,e=n,y=null):(e=null,y=n);const T=new Set([...i.getAllBuiltInIds(),...Yi()]);return T.has(p.id)||l.forEach(v=>{var b,O,P,$;if(T.has(v.id))return;let E=null;if(c){const L=((b=v.getDefaultValue)==null?void 0:b.call(v))||null;L&&(T.has(L.id)||((O=L.parent)==null?void 0:O.id)!==v.id?E=L.clone(e,v):E=L)}else E=y==null?void 0:y.readValue(v.id);E?!c&&E&&E.id===(($=(P=v.getDefaultValue)==null?void 0:P.call(v))==null?void 0:$.id)&&(E=Et(v.getDataType(null),v,i)):c?(E=Zl(v.getDataType(null),v,i,e),e==null||e.add(E,H.Added)):E=Et(v.getDataType(null),v,i),E==null||E.metaSync({value:d},e),c||y==null||y.writeValue(v,E),RPe(d,v,i,n)}),e}function hc(d,p,i,n){let l=!1,c=null,e=null;n instanceof q?(l=!0,c=n,e=null):(c=null,e=n);const y=d.parent;return p.getVariableDeclarations().forEach(v=>{var b,O,P,$,L,U;const E=v.getDataType(null);if(((b=E==null?void 0:E.entity)==null?void 0:b.id)===y.id){let F=l?v.getDefaultValue():e==null?void 0:e.readValue(v.id);F?!l&&F&&F.id===((O=v.getDefaultValue())==null?void 0:O.id)&&(F=Et(v.getDataType(null),v,p)):l?F=Zl(v.getDataType(null),v,p,c):F=Et(v.getDataType(null),v,p);const Z=le(d,p),X=d.codeName||((P=d.extends)==null?void 0:P.codeName)||(($=d.implements[0])==null?void 0:$.codeName)||Wi(Z);let se={};((U=(L=v.dataType)==null?void 0:L.entity)==null?void 0:U.type)===o.DefinitionEntity&&(se={...se,...v.dataType.entity.getActiveRawDefaultValue()}),mr(F==null?void 0:F.value)&&(se={...se,...F.value}),Array.isArray(i)?se[X]=(i==null?void 0:i.map(Q=>Q.toShallowJSON()))||null:se[X]=(i==null?void 0:i.toShallowJSON())||null,F==null||F.metaSync({value:se},c),l||e==null||e.writeValue(v,F);return}}),c}function Lm(d,p,i,n){var P,$,L,U;let l=!1,c=null,e=null;n instanceof q?(l=!0,c=n,e=null):(c=null,e=n);const y=Zn(d.parent),T=y.getDataType(null);if(!(T!=null&&T.isObject()))return c;let v=l?y.getDefaultValue():e==null?void 0:e.readValue(y.id);v?!l&&v&&v.id===((P=y.getDefaultValue())==null?void 0:P.id)&&(v=Et(y.getDataType(null),y,p)):l?v=Zl(y.getDataType(null),y,p,c):v=Et(y.getDataType(null),y,p);const E=le(d,p),b=d.codeName||(($=d.declaration)==null?void 0:$.codeName)||Wi(E);let O={};if(((U=(L=y.dataType)==null?void 0:L.entity)==null?void 0:U.type)===o.DefinitionEntity&&(O={...O,...y.dataType.entity.getActiveRawDefaultValue()}),mr(v==null?void 0:v.value)&&(O={...O,...v.value}),Array.isArray(i)?O[b]=(i==null?void 0:i.map(F=>F.toShallowJSON()))||null:O[b]=(i==null?void 0:i.toShallowJSON())||null,v==null||v.metaSync({value:O},c),l||e==null||e.writeValue(y,v),i==null&&d.type===o.OutputMap){const F=y.inputs.find(Z=>{var X,se;return((X=Z.declaration)==null?void 0:X.id)===((se=d.declaration)==null?void 0:se.id)||le(Z,p)===E});if(F){let Z=l?F.getDefaultValue():e==null?void 0:e.readValue(F.id);Z&&(Array.isArray(i)?Z==null||Z.setValueAsTypeList(i,c):Z==null||Z.setValueAsTypeSingle(i,c)),l||e==null||e.removeValue(F.id)}}return c}function OPe(d,p,i){var n,l,c,e;return d.type===o.InputMap?((n=d.declaration)==null?void 0:n.type)===o.Property&&d.declaration.static?hc(d.declaration,p,null,i):St.includes(d.parent.type)&&((l=d.declaration)==null?void 0:l.type)===o.Property&&Lm(d,p,null,i):d.type===o.OutputMap?((c=d.declaration)==null?void 0:c.type)===o.Property&&d.declaration.static?hc(d.declaration,p,null,i):St.includes(d.parent.type)&&((e=d.declaration)==null?void 0:e.type)===o.Property&&Lm(d,p,null,i):d.type===o.Property&&d.static&&hc(d,p,null,i),i}function wPe(d,p,i,n){var l,c,e,y;return p.type===o.InputMap?((l=p.declaration)==null?void 0:l.type)===o.Property&&p.declaration.static?hc(p.declaration,i,d,n):St.includes(p.parent.type)&&((c=p.declaration)==null?void 0:c.type)===o.Property&&Lm(p,i,d,n):p.type===o.OutputMap?((e=p.declaration)==null?void 0:e.type)===o.Property&&p.declaration.static?hc(p.declaration,i,null,n):St.includes(p.parent.type)&&((y=p.declaration)==null?void 0:y.type)===o.Property&&Lm(p,i,null,n):p.type===o.Property&&p.static&&hc(p,i,d,n),n}function CPe(d,p,i){const n=yl(d,p);let l=!1,c=null,e=null;return i instanceof q?(l=!0,c=i,e=null):(c=null,e=i),n.forEach(y=>{var v,E,b;let T=l?(v=y.getDefaultValue)==null?void 0:v.call(y):e==null?void 0:e.readValue(y.id);T?!l&&T&&T.id===((b=(E=y.getDefaultValue)==null?void 0:E.call(y))==null?void 0:b.id)&&(T=Et(y.getDataType(null),y,y.project)):l?T=Zl(y.getDataType(null),y,p,c):T=Et(y.getDataType(null),y,p),T==null||T.setValueAsTypeSingle(null,c),T==null||T.setValueAsTypeList(null,c),l||e==null||e.removeValue(y.id),OPe(y,p,i)}),c}function y$i(d,p,i,n){if(d==null)return CPe(p,i,n);const l=yl(p,i);let c=!1,e=null,y=null;return n instanceof q?(c=!0,e=n,y=null):(e=null,y=n),l.forEach(T=>{var E,b,O;let v=c?(E=T.getDefaultValue)==null?void 0:E.call(T):y==null?void 0:y.readValue(T.id);v?!c&&v&&v.id===((O=(b=T.getDefaultValue)==null?void 0:b.call(T))==null?void 0:O.id)&&(v=Et(T.getDataType(null),T,T.project)):c?v=Zl(T.getDataType(null),T,i,e):v=Et(T.getDataType(null),T,i),Array.isArray(d)?v==null||v.setValueAsTypeList(d,e):v==null||v.setValueAsTypeSingle(d,e),c||y==null||y.writeValue(T,v),wPe(d,T,i,n)}),e}class FI{constructor(p,i){this.extensionsRegistry=p,this.contextType=i,this.off=this.extensionsRegistry.off.bind(this.extensionsRegistry),this.on=this.extensionsRegistry.on.bind(this.extensionsRegistry),this.emit=this.extensionsRegistry.emit.bind(this.extensionsRegistry),this.emitAsync=this.extensionsRegistry.emitAsync.bind(this.extensionsRegistry),this.emitAsyncAll=this.extensionsRegistry.emitAsyncAll.bind(this.extensionsRegistry),this.emitAsyncAllSettled=this.extensionsRegistry.emitAsyncAllSettled.bind(this.extensionsRegistry),this.emitAsyncSequentially=this.extensionsRegistry.emitAsyncSequentially.bind(this.extensionsRegistry),this.emitAsyncSequentiallyAll=this.extensionsRegistry.emitAsyncSequentiallyAll.bind(this.extensionsRegistry),this.emitAsyncSequentiallyAllSettled=this.extensionsRegistry.emitAsyncSequentiallyAllSettled.bind(this.extensionsRegistry)}on(p,i){this.extensionsRegistry.on(p,i)}emit(p,...i){this.extensionsRegistry.emit(p,...i)}off(p,i){this.extensionsRegistry.off(p,i)}emitAsync(p,...i){return this.extensionsRegistry.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.extensionsRegistry.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.extensionsRegistry.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.extensionsRegistry.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.extensionsRegistry.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled(p,...i)}}var Ee=(d=>(d[d.High=1]="High",d[d.Normal=5]="Normal",d[d.Low=10]="Low",d))(Ee||{}),J=(d=>(d.Logic="logic",d.EditorGUI="editor-gui",d.GUI="gui",d.Editor="editor",d.Compile="compile",d.PublicationRun="publication-run",d))(J||{}),be=(d=>(d.All="*",d.OnAll="on:*",d.EmitAll="emit:*",d.ReadAll="read:*",d.WriteAll="write:*",d.UpdateAll="update:*",d.DoAll="do:*",d.OnLogicAll="on:logic:*",d.EmitLogicAll="emit:logic:*",d.ReadLogicAll="read:logic:*",d.WriteLogicAll="write:logic:*",d.UpdateLogicAll="update:logic:*",d.DoLogicAll="do:logic:*",d.OnGUIAll="on:gui:*",d.EmitGUIAll="emit:gui:*",d.ReadGUIAll="read:gui:*",d.WriteGUIAll="write:gui:*",d.UpdateGUIAll="update:gui:*",d.DoGUIAll="do:gui:*",d.OnEditorAll="on:editor:*",d.EmitEditorAll="emit:editor:*",d.ReadEditorAll="read:editor:*",d.WriteEditorAll="write:editor:*",d.UpdateEditorAll="update:editor:*",d.DoEditorAll="do:editor:*",d.OnCompileBefore="on:compile:before:DefinitionEntity",d.OnCompileDefault="on:compile:default:DefinitionEntity",d.OnCompileAfter="on:compile:after:DefinitionEntity",d.EmitCompile="emit:compile:DefinitionEntity",d.DoEditorPublish="do:editor:publish",d.PostGUICanvasSlotNewToolbarButton="write:gui:canvas:slot:toolbar-button",d.ReadGUICanvasSlotToolbarButtons="read:gui:canvas:slot:toolbar-buttons",d.UpdateGUIGlobalTheme="update:gui:global:theme",d))(be||{});class _Pe{constructor(p){I(this,"state",new Map);p&&(this.state=new Map(Object.entries(p)))}get(p){return this.state.get(p)}set(p,i){this.state.set(p,i)}delete(p){this.state.delete(p)}}class PPe extends _Pe{constructor(p,i){super(i),this.parentExtension=p}}class ge{constructor(p,i){I(this,"manifest");I(this,"module");I(this,"state");this.extensionsRegistry=p,this.state=new PPe(this,i)}}class Pw extends FI{constructor(i,n){super(i,J.Logic);I(this,"id");this._project=n,this.id=n.id}get type(){return this._project.type}get name(){return this._project.name}get description(){return this._project.description}get version(){return this._project.version}get createdAt(){return this._project.createdAt}get previousVersion(){return this._project.previousVersion}get author(){return this._project.author}get deleted(){return this._project.deleted}get editable(){return this._project.editable}get deletable(){return this._project.deletable}get entities(){return[...this._project.entities]}get projects(){return[...this._project.projects]}get functions(){return[...this._project.functions]}get events(){return[...this._project.events]}get variableDeclarations(){return[...this._project.variableDeclarations]}get variableInstances(){return[...this._project.variableInstances]}get conditions(){return[...this._project.conditions]}get operations(){return[...this._project.operations]}get functionCalls(){return[...this._project.functionCalls]}get loops(){return[...this._project.loops]}get searches(){return[...this._project.searches]}get primitives(){return[...this._project.primitives]}get builtInBaseEntities(){return[...this._project.builtInBaseEntities]}get operationDeclarations(){return[...this._project.operationDeclarations]}get globalEventActionDescriptors(){return[...this._project.globalEventActionDescriptors]}get loopDeclarations(){return[...this._project.loopDeclarations]}get loopDeclarationsBodies(){return[...this._project.loopDeclarationsBodies]}get conditionDeclarations(){return[...this._project.conditionDeclarations]}get valueDescriptors(){return[...this._project.valueDescriptors]}get dataTypes(){return[...this._project.dataTypes]}get errors(){return[...this._project.errors]}get history(){return[...this._project.history]}get undoableStackValueIndex(){return this._project.undoableStackValueIndex}get knownVersions(){return this._project.knownVersions}get activeVersion(){return this._project.activeVersion}get initialized(){return this._project.initialized}get startedInitialization(){return this._project.startedInitialization}closePersistChangeSetsSequentially(){return this._project.closePersistChangeSetsSequentially()}persistChangeSetSequentially(i){return this._project.persistChangeSetSequentially(i)}toLatestChangeSet(i,n,l,c=!1,e="here-this"){return this._project.toLatestChangeSet(i,n,l,c,e)}addChangeSet(i){return this._project.addChangeSet(i)}discardChangeSet(i){return this._project.discardChangeSet(i)}subscribeDependents(i){return this._project.subscribeDependents(i)}unsubscribeDependents(i){return this._project.unsubscribeDependents(i)}syncDependents(i){return this._project.syncDependents(i)}onDetachedDependencyRemoved(i,n,l){return this._project.onDetachedDependencyRemoved(i,n,l)}onDetachedDependencyRestored(i,n,l){return this._project.onDetachedDependencyRestored(i,n,l)}increaseVersion(i){return this._project.increaseVersion(i)}captureVersion(){return this._project.captureVersion()}restoreVersion(i){return this._project.restoreVersion(i)}updateWithShallowTransfer(i,n){return this._project.updateWithShallowTransfer(i,n)}hydrateAncestors(){return this._project.hydrateAncestors()}afterAllChildrenInitialized(i=null){return this._project.afterAllChildrenInitialized(i)}addSelfToProject(i){return this._project.addSelfToProject(i)}get instancesList(){return[...this._project.instancesList]}isOperationDeclaration(i){return this._project.isOperationDeclaration(i)}isGlobalEventActionDescriptor(i){return this._project.isGlobalEventActionDescriptor(i)}isLoopDeclaration(i){return this._project.isLoopDeclaration(i)}isConditionDeclaration(i){return this._project.isConditionDeclaration(i)}findSubscribedBuiltInInstance(i){return this._project.findSubscribedBuiltInInstance(i)}get(i){return this._project.get(i)}getDeleted(i){return this._project.getDeleted(i)}getManaged(i){return this._project.getManaged(i)}getBuiltIn(i){return this._project.getBuiltIn(i)}findSubscribedInstanceFromReference(i){return this._project.findSubscribedInstanceFromReference(i)}findSubscribedBuiltInInstanceFromReference(i){return this._project.findSubscribedBuiltInInstanceFromReference(i)}metaSync(i,n){return this._project.metaSync(i,n)}getAllBuiltInIds(){return this._project.getAllBuiltInIds()}getAllBuiltIn(){return this._project.getAllBuiltIn()}toFlat(i){return this._project.toFlat(i)}toFlatIds(i){return this._project.toFlatIds(i)}toMeta(){return this._project.toMeta()}toJSON(i){return this._project.toJSON(i)}toJSONClone(i){return this._project.toJSONClone(i)}toReference(i){return this._project.toReference(i)}toShallowJSON(i){return this._project.toShallowJSON(i)}toFlatJSON(i){return this._project.toFlatJSON(i)}toGenerationTarget(){return this._project.toGenerationTarget()}toFlatGenerationTarget(i){return this._project.toFlatGenerationTarget(i)}clearErrors(){return this._project.clearErrors()}validate(){return this._project.validate()}validateChildren(){return this._project.validateChildren()}getErrors(){return this._project.getErrors()}getShallowErrors(){return this._project.getShallowErrors()}getDefinitionEntity(i){return this._project.getDefinitionEntity(i)}addDefinitionEntity(i){return this._project.addDefinitionEntity(i)}addFunctionDeclaration(i){return this._project.addFunctionDeclaration(i)}addFunctionCall(i){return this._project.addFunctionCall(i)}addVariableDeclaration(i){return this._project.addVariableDeclaration(i)}addVariableInstance(i){return this._project.addVariableInstance(i)}addInstalledProject(i){return this._project.addInstalledProject(i)}addGlobalEvent(i){return this._project.addGlobalEvent(i)}addCondition(i){return this._project.addCondition(i)}addOperation(i){return this._project.addOperation(i)}addLoop(i){return this._project.addLoop(i)}addSearch(i){return this._project.addSearch(i)}removeDefinitionEntity(i){return this._project.removeDefinitionEntity(i)}removeCondition(i){return this._project.removeCondition(i)}removeOperation(i){return this._project.removeOperation(i)}removeLoop(i){return this._project.removeLoop(i)}removeSearch(i){return this._project.removeSearch(i)}removeFunctionCall(i){return this._project.removeFunctionCall(i)}removeVariableInstance(i){return this._project.removeVariableInstance(i)}removeVariableDeclaration(i){return this._project.removeVariableDeclaration(i)}removeFunctionDeclaration(i){return this._project.removeFunctionDeclaration(i)}removeInstalledProject(i){return this._project.removeInstalledProject(i)}removeGlobalEvent(i){return this._project.removeGlobalEvent(i)}removeTopLevelVariableDeclaration(i){return this._project.removeTopLevelVariableDeclaration(i)}getEntryPoints(){return this._project.getEntryPoints()}getTerminationStatements(){return this._project.getTerminationStatements()}getFunctionDeclaration(i){return this._project.getFunctionDeclaration(i)}getConditions(){return this._project.getConditions()}getOperations(){return this._project.getOperations()}getVariables(){return this._project.getVariables()}getVariableInstances(){return this._project.getVariableInstances()}getVariableDeclarations(){return this._project.getVariableDeclarations()}getLoops(){return this._project.getLoops()}getSearches(){return this._project.getSearches()}getBuiltInPersistedEntity(){return this._project.getBuiltInPersistedEntity()}requestActiveDynamicValue(i,n=!1){return this._project.requestActiveDynamicValue(i,n)}undo(){return this._project.undo()}redo(){return this._project.redo()}applyExternalChangeSet(i){return this._project.applyExternalChangeSet(i)}toFullProjectTransfer(){return this._project.toFullProjectTransfer()}}function h$i(d,p){return p instanceof Pw?p:new Pw(d,p)}const ny="built-in-function-implementations__",we="operations-implementations__",Pa="conditions-implementations__",Ae={UUID:"uuid",SEARCH_NODE_IMPLEMENTATION:"search-node-implementation",BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION:ny+Mr.AbortExecution,BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY:ny+Mr.CreatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY:ny+Mr.UpdatePersistedEntity,BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY:ny+Mr.DeletePersistedEntity,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY:we+Pt.Empty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY:we+Pt.NotEmpty,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL:we+Pt.PrimitiveEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL:we+Pt.PrimitiveNotEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST:we+Hn.HttpRequest,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY:we+Ce.Validate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL:we+Mi.Sequential,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL:we+Mi.Parallel,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT:we+Mi.Wait,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN:we+ie.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT:we+ie.Split,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS:we+ie.DeleteLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS:we+ie.DeleteFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX:we+ie.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX:we+ie.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS:we+ie.ReplaceFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS:we+ie.ReplaceLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL:we+ie.ReplaceAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX:we+ie.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM:we+ie.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST:we+ie.GetFirst,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST:we+ie.GetLast,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND:we+ie.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND:we+ie.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE:we+ie.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH:we+ie.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS:we+ie.GetFirstNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS:we+ie.GetLastNItems,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE:we+ie.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT:we+ie.Concat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF:we+ie.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF:we+ie.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE:we+ie.Unique,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN:we+ie.Flatten,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT:we+ie.Sort,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE:we+ie.Shuffle,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK:we+ie.Chunk,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START:we+ie.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END:we+ie.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT:we+ie.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH:we+S.GetLength,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE:we+S.ToLowerCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE:we+S.ToUpperCase,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN:we+S.Join,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS:we+ie.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL:we+ie.ContainsAll,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY:we+ie.ContainsAny,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX:we+S.SplitAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS:we+S.SplitAtAllSeparators,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR:we+S.SplitAtFirstSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR:we+S.SplitAtLastSeparator,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS:we+S.DeleteLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS:we+S.DeleteFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX:we+S.DeleteAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX:we+S.AddAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS:we+S.ReplaceFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS:we+S.ReplaceLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX:we+S.ReplaceAtIndex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH:we+S.ReplaceFirstMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH:we+S.ReplaceLastMatch,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES:we+S.ReplaceAllMatches,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM:we+S.GetIndexItem,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS:we+S.GetFirstNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS:we+S.GetLastNChars,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF:we+S.GetIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND:we+S.Append,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND:we+S.Prepend,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE:we+S.Reverse,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM:we+S.Trim,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START:we+S.TrimStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END:we+S.TrimEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING:we+S.Substring,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE:we+S.Slice,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START:we+S.PadStart,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END:we+S.PadEnd,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT:we+S.Repeat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF:we+S.GetLastIndexOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX:we+S.MatchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX:we+S.MatchAllRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX:we+S.SearchRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX:we+S.ReplaceRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE:we+S.NormalizeUnicode,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS:we+S.RemoveDiacritics,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES:we+S.CountOccurrences,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX:we+S.EnsurePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX:we+S.EnsureSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX:we+S.RemovePrefix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX:we+S.RemoveSuffix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION:we+ee.Addition,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION:we+ee.Subtraction,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION:we+ee.Multiplication,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION:we+ee.Division,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER:we+ee.Remainder,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION:we+ee.Exponentiation,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE:we+ee.Absolute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN:we+ee.Sign,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND:we+ee.Round,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE:we+ee.Negate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR:we+ee.Floor,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL:we+ee.Ceil,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP:we+ee.Clamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC:we+ee.Trunc,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS:we+ee.RoundToDecimals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP:we+ee.SnapToStep,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE:we+ee.MapRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE:we+ee.Average,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN:we+ee.Median,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF:we+ee.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF:we+ee.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT:we+ee.SquareRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT:we+ee.CubeRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT:we+ee.NthRoot,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP:we+ee.Exp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL:we+ee.LogNatural,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10:we+ee.Log10,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN:we+ee.Sin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS:we+ee.Cos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN:we+ee.Tan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN:we+ee.Asin,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS:we+ee.Acos,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN:we+ee.Atan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2:we+ee.Atan2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS:we+ee.ToRadians,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES:we+ee.ToDegrees,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF:we+ee.PercentOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE:we+ee.PercentageChange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN:we+ee.MoreThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN:we+ee.LessThan,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL:we+ee.LessThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL:we+ee.MoreThanOrEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER:we+Xe.GenerateRandomInteger,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT:we+Xe.GenerateRandomFloat,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL:we+Xe.GenerateRandomHexadecimal,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62:we+Xe.GenerateRandomBase62,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64:we+Xe.GenerateRandomBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC:we+Xe.GenerateRandomAlphanumeric,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER:we+Xe.GenerateIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4:we+Xe.GenerateRandomUUIDv4,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER:we+Xe.GenerateShortIdentifier,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN:we+Xe.GenerateHexadecimalToken,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH:we+S.StartsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH:we+S.EndsWith,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS:we+S.Contains,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX:we+S.MatchesRegex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP:we+k.GetCurrentTimestamp,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE:we+k.FormatDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE:we+k.ParseDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE:we+k.AddToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE:we+k.SubtractFromDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES:we+k.DifferenceBetweenDates,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE:we+k.ToDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX:we+k.ToUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX:we+k.FromUnix,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING:we+k.ToISOString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR:we+k.GetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH:we+k.GetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE:we+k.GetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR:we+k.GetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE:we+k.GetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND:we+k.GetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND:we+k.GetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY:we+k.GetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR:we+k.GetWeekOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER:we+k.GetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR:we+k.GetDayOfYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH:we+k.GetDaysInMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE:we+k.GetCurrentIanaTimeZone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR:we+k.SetYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH:we+k.SetMonth,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE:we+k.SetDate,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR:we+k.SetHour,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE:we+k.SetMinute,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND:we+k.SetSecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND:we+k.SetMillisecond,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY:we+k.SetIsoWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER:we+k.SetQuarter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF:we+k.StartOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF:we+k.EndOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO:we+k.RoundTo,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE:Pa+k.IsBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER:Pa+k.IsAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME:Pa+k.IsSame,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE:Pa+k.IsSameOrBefore,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER:Pa+k.IsSameOrAfter,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN:Pa+k.IsBetween,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID:Pa+k.IsValid,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR:Pa+k.IsLeapYear,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE:we+k.ClampToRange,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF:we+k.MinOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF:we+k.MaxOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW:we+k.FromNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW:we+k.ToNow,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF:we+k.HumanizeDiff,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS:we+k.AddBusinessDays,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY:we+k.NextWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY:we+k.PreviousWeekday,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC:we+k.ToUTC,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE:we+k.ConvertTimezone,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET:we+k.GetTimezoneOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET:we+k.SetUTCOffset,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY:we+Ce.ReadKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY:we+Ce.WriteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY:we+Ce.DeleteKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY:we+Ce.ReadNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY:we+Ce.WriteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY:we+Ce.DeleteNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY:we+Ce.WriteSafeNestedKeyRecursively,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY:Pa+Ce.HasKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY:Pa+Ce.HasNestedKey,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS:Pa+Ce.KeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS:Pa+Ce.NestedKeyValueEquals,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE:Pa+Ce.IsInstanceOfType,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE:we+Ce.Merge,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS:we+Ce.Keys,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES:we+Ce.Values,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES:we+Ce.Entries,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF:we+He.GetTypeOf,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH:we+ii.Hash,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC:we+ii.Hmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES:we+Xe.GenerateRandomBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL:we+ii.ConstantTimeEqual,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2:we+ii.DeriveKeyPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2:we+Xr.HashPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2:we+Xr.VerifyPasswordPBKDF2,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC:we+zi.BuildJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC:we+zi.VerifyJwtHmac,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE:we+zi.DecodeJwt,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING:we+He.FromBytesToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES:we+He.ToBytes,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER:we+He.ToNumber,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING:we+He.ToString,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64:we+He.EncodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64:we+He.DecodeBase64,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL:we+He.EncodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL:we+He.DecodeBase64Url,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX:we+He.EncodeHex,BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX:we+He.DecodeHex,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE:we+Yr.Parse,BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY:we+Yr.Stringify};class VPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_FUNCTION_IMPLEMENTATIONS__ABORT_EXECUTION,version:"1.0.0",description:'Implementation for the built-in function "Abort Execution". It terminates the execution of the current entity being run.',initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null})})}}class NPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_FUNCTION_IMPLEMENTATIONS__DELETE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Delete Persisted Entity". It deletes the current entity as an entry in the persisted storage.',initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null})})}}class xPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_FUNCTION_IMPLEMENTATIONS__CREATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Create Persisted Entity". It saves the current entity state to the persisted storage.',initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null})})}}class $Pe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_FUNCTION_IMPLEMENTATIONS__UPDATE_PERSISTED_ENTITY,version:"1.0.0",description:'Implementation for the built-in function "Update Persisted Entity". It saves the current entity state to the persisted storage.',initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null})})}}class LPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.SEARCH_NODE_IMPLEMENTATION,version:"1.0.0",description:"Implementation for search nodes when they get executed and query data.",initPriority:Ee.High,permissions:[be.All],contexts:[J.Editor]});I(this,"module",{main:async(i,n)=>({data:null,error:"Search module not implemented"})})}}class MPe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.UUID,version:"1.0.0",description:"UUID generation module, for all contexts and runtimes",initPriority:Ee.High,permissions:[be.All],contexts:[]});I(this,"module",lC)}}const BPe=d=>d.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class m$i extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_EMPTY,version:"1.0.0",description:"Comparison: Empty (!value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Pt.Empty);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=BPe(n),c=!l;return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class T$i extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_NOT_EMPTY,version:"1.0.0",description:"Comparison: NotEmpty (!!value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Pt.NotEmpty);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=BPe(n),c=!!l;return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}const EA=class EA extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveEqual (typed equality / deep JSON equality)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Pt.PrimitiveEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{var l,c,e,y,T,v;try{const E=(c=(l=n[0])==null?void 0:l.value)==null?void 0:c.name,b=(y=(e=n[0])==null?void 0:e.value)==null?void 0:y.value,O=(v=(T=n[1])==null?void 0:T.value)==null?void 0:v.value;let P=!1;return E&&EA.primitiveSet.has(E)?P=b===O:E===oe.Untyped||E===oe.KeyValue?P=JSON.stringify(b)===JSON.stringify(O):P=!1,{value:G.Success,error:null,result:P}}catch(E){return{value:G.UnhandledError,error:E,result:null}}}})}};I(EA,"primitiveSet",new Set([oe.String,oe.Number,oe.Boolean,oe.Null,oe.Enum,oe.Date,oe.UUID]));let Vw=EA;const bA=class bA extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__COMPARISON_PRIMITIVE_NOT_EQUAL,version:"1.0.0",description:"Comparison: PrimitiveNotEqual (typed inequality / deep JSON inequality)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Pt.PrimitiveNotEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{var l,c,e,y,T,v;try{const E=(c=(l=n[0])==null?void 0:l.value)==null?void 0:c.name,b=(y=(e=n[0])==null?void 0:e.value)==null?void 0:y.value,O=(v=(T=n[1])==null?void 0:T.value)==null?void 0:v.value;let P=!1;return E&&bA.primitiveSet.has(E)?P=b!==O:E===oe.Untyped||E===oe.KeyValue?P=JSON.stringify(b)!==JSON.stringify(O):P=!1,{value:G.Success,error:null,result:P}}catch(E){return{value:G.UnhandledError,error:E,result:null}}}})}};I(bA,"primitiveSet",new Set([oe.String,oe.Number,oe.Boolean,oe.Null,oe.Enum,oe.Date,oe.UUID]));let Nw=bA;var GPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i="minute",n=/[+-]\d\d(?::?\d\d)?/g,l=/([+-]|\d\d)/g;return function(c,e,y){var T=e.prototype;y.utc=function(L){var U={date:L,utc:!0,args:arguments};return new e(U)},T.utc=function(L){var U=y(this.toDate(),{locale:this.$L,utc:!0});return L?U.add(this.utcOffset(),i):U},T.local=function(){return y(this.toDate(),{locale:this.$L,utc:!1})};var v=T.parse;T.parse=function(L){L.utc&&(this.$u=!0),this.$utils().u(L.$offset)||(this.$offset=L.$offset),v.call(this,L)};var E=T.init;T.init=function(){if(this.$u){var L=this.$d;this.$y=L.getUTCFullYear(),this.$M=L.getUTCMonth(),this.$D=L.getUTCDate(),this.$W=L.getUTCDay(),this.$H=L.getUTCHours(),this.$m=L.getUTCMinutes(),this.$s=L.getUTCSeconds(),this.$ms=L.getUTCMilliseconds()}else E.call(this)};var b=T.utcOffset;T.utcOffset=function(L,U){var F=this.$utils().u;if(F(L))return this.$u?0:F(this.$offset)?b.call(this):this.$offset;if(typeof L=="string"&&(L=function(Q){Q===void 0&&(Q="");var fe=Q.match(n);if(!fe)return null;var de=(""+fe[0]).match(l)||["-",0,0],ce=de[0],me=60*+de[1]+ +de[2];return me===0?0:ce==="+"?me:-me}(L),L===null))return this;var Z=Math.abs(L)<=16?60*L:L;if(Z===0)return this.utc(U);var X=this.clone();if(U)return X.$offset=Z,X.$u=!1,X;var se=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(X=this.local().add(Z+se,i)).$offset=Z,X.$x.$localOffset=se,X};var O=T.format;T.format=function(L){var U=L||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return O.call(this,U)},T.valueOf=function(){var L=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*L},T.isUTC=function(){return!!this.$u},T.toISOString=function(){return this.toDate().toISOString()},T.toString=function(){return this.toDate().toUTCString()};var P=T.toDate;T.toDate=function(L){return L==="s"&&this.$offset?y(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():P.call(this)};var $=T.diff;T.diff=function(L,U,F){if(L&&this.$u===L.$u)return $.call(this,L,U,F);var Z=this.local(),X=y(L).local();return $.call(Z,X,U,F)}}})})(GPe);var v$i=GPe.exports;const E$i=Za(v$i);var UPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i={year:0,month:1,day:2,hour:3,minute:4,second:5},n={};return function(l,c,e){var y,T=function(O,P,$){$===void 0&&($={});var L=new Date(O),U=function(F,Z){Z===void 0&&(Z={});var X=Z.timeZoneName||"short",se=F+"|"+X,Q=n[se];return Q||(Q=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:F,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:X}),n[se]=Q),Q}(P,$);return U.formatToParts(L)},v=function(O,P){for(var $=T(O,P),L=[],U=0;U<$.length;U+=1){var F=$[U],Z=F.type,X=F.value,se=i[Z];se>=0&&(L[se]=parseInt(X,10))}var Q=L[3],fe=Q===24?0:Q,de=L[0]+"-"+L[1]+"-"+L[2]+" "+fe+":"+L[4]+":"+L[5]+":000",ce=+O;return(e.utc(de).valueOf()-(ce-=ce%1e3))/6e4},E=c.prototype;E.tz=function(O,P){O===void 0&&(O=y);var $,L=this.utcOffset(),U=this.toDate(),F=U.toLocaleString("en-US",{timeZone:O}),Z=Math.round((U-new Date(F))/1e3/60),X=15*-Math.round(U.getTimezoneOffset()/15)-Z;if(!Number(X))$=this.utcOffset(0,P);else if($=e(F,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(X,!0),P){var se=$.utcOffset();$=$.add(L-se,"minute")}return $.$x.$timezone=O,$},E.offsetName=function(O){var P=this.$x.$timezone||e.tz.guess(),$=T(this.valueOf(),P,{timeZoneName:O}).find(function(L){return L.type.toLowerCase()==="timezonename"});return $&&$.value};var b=E.startOf;E.startOf=function(O,P){if(!this.$x||!this.$x.$timezone)return b.call(this,O,P);var $=e(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return b.call($,O,P).tz(this.$x.$timezone,!0)},e.tz=function(O,P,$){var L=$&&P,U=$||P||y,F=v(+e(),U);if(typeof O!="string")return e(O).tz(U);var Z=function(fe,de,ce){var me=fe-60*de*1e3,ae=v(me,ce);if(de===ae)return[me,de];var ye=v(me-=60*(ae-de)*1e3,ce);return ae===ye?[me,ae]:[fe-60*Math.min(ae,ye)*1e3,Math.max(ae,ye)]}(e.utc(O,L).valueOf(),F,U),X=Z[0],se=Z[1],Q=e(X).utcOffset(se);return Q.$x.$timezone=U,Q},e.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},e.tz.setDefault=function(O){y=O}}})})(UPe);var b$i=UPe.exports;const A$i=Za(b$i);var jPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n,l){n.prototype.isBetween=function(c,e,y,T){var v=l(c),E=l(e),b=(T=T||"()")[0]==="(",O=T[1]===")";return(b?this.isAfter(v,y):!this.isBefore(v,y))&&(O?this.isBefore(E,y):!this.isAfter(E,y))||(b?this.isBefore(v,y):!this.isAfter(v,y))&&(O?this.isAfter(E,y):!this.isBefore(E,y))}}})})(jPe);var g$i=jPe.exports;const I$i=Za(g$i);var kPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n){n.prototype.isSameOrAfter=function(l,c){return this.isSame(l,c)||this.isAfter(l,c)}}})})(kPe);var R$i=kPe.exports;const D$i=Za(R$i);var KPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n){n.prototype.isSameOrBefore=function(l,c){return this.isSame(l,c)||this.isBefore(l,c)}}})})(KPe);var O$i=KPe.exports;const w$i=Za(O$i);var FPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i="week",n="year";return function(l,c,e){var y=c.prototype;y.week=function(T){if(T===void 0&&(T=null),T!==null)return this.add(7*(T-this.week()),"day");var v=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var E=e(this).startOf(n).add(1,n).date(v),b=e(this).endOf(i);if(E.isBefore(b))return 1}var O=e(this).startOf(n).date(v).startOf(i).subtract(1,"millisecond"),P=this.diff(O,i,!0);return P<0?e(this).startOf("week").week():Math.ceil(P)},y.weeks=function(T){return T===void 0&&(T=null),this.week(T)}}})})(FPe);var C$i=FPe.exports;const _$i=Za(C$i);var SPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i="day";return function(n,l,c){var e=function(v){return v.add(4-v.isoWeekday(),i)},y=l.prototype;y.isoWeekYear=function(){return e(this).year()},y.isoWeek=function(v){if(!this.$utils().u(v))return this.add(7*(v-this.isoWeek()),i);var E,b,O,P,$=e(this),L=(E=this.isoWeekYear(),b=this.$u,O=(b?c.utc:c)().year(E).startOf("year"),P=4-O.isoWeekday(),O.isoWeekday()>4&&(P+=7),O.add(P,i));return $.diff(L,"week")+1},y.isoWeekday=function(v){return this.$utils().u(v)?this.day()||7:this.day(this.day()%7?v:v-7)};var T=y.startOf;y.startOf=function(v,E){var b=this.$utils(),O=!!b.u(E)||E;return b.p(v)==="isoweek"?O?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):T.bind(this)(v,E)}}})})(SPe);var P$i=SPe.exports;const V$i=Za(P$i);var qPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i="month",n="quarter";return function(l,c){var e=c.prototype;e.quarter=function(v){return this.$utils().u(v)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(v-1))};var y=e.add;e.add=function(v,E){return v=Number(v),this.$utils().p(E)===n?this.add(3*v,i):y.bind(this)(v,E)};var T=e.startOf;e.startOf=function(v,E){var b=this.$utils(),O=!!b.u(E)||E;if(b.p(v)===n){var P=this.quarter()-1;return O?this.month(3*P).startOf(i).startOf("day"):this.month(3*P+2).endOf(i).endOf("day")}return T.bind(this)(v,E)}}})})(qPe);var N$i=qPe.exports;const x$i=Za(N$i);var ZPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n,l){n.prototype.dayOfYear=function(c){var e=Math.round((l(this).startOf("day")-l(this).startOf("year"))/864e5)+1;return c==null?e:this.add(c-e,"day")}}})})(ZPe);var $$i=ZPe.exports;const L$i=Za($$i);var HPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n,l){i=i||{};var c=n.prototype,e={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function y(v,E,b,O){return c.fromToBase(v,E,b,O)}l.en.relativeTime=e,c.fromToBase=function(v,E,b,O,P){for(var $,L,U,F=b.$locale().relativeTime||e,Z=i.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],X=Z.length,se=0;se<X;se+=1){var Q=Z[se];Q.d&&($=O?l(v).diff(b,Q.d,!0):b.diff(v,Q.d,!0));var fe=(i.rounding||Math.round)(Math.abs($));if(U=$>0,fe<=Q.r||!Q.r){fe<=1&&se>0&&(Q=Z[se-1]);var de=F[Q.l];P&&(fe=P(""+fe)),L=typeof de=="string"?de.replace("%d",fe):de(fe,E,Q.l,U);break}}if(E)return L;var ce=U?F.future:F.past;return typeof ce=="function"?ce(L):ce.replace("%s",L)},c.to=function(v,E){return y(v,E,this,!0)},c.from=function(v,E){return y(v,E,this)};var T=function(v){return v.$u?l.utc():l()};c.toNow=function(v){return this.to(T(this),v)},c.fromNow=function(v){return this.from(T(this),v)}}})})(HPe);var M$i=HPe.exports;const B$i=Za(M$i);var WPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){var i,n,l=1e3,c=6e4,e=36e5,y=864e5,T=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v=31536e6,E=2628e6,b=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,O={years:v,months:E,days:y,hours:e,minutes:c,seconds:l,milliseconds:1,weeks:6048e5},P=function(fe){return fe instanceof se},$=function(fe,de,ce){return new se(fe,ce,de.$l)},L=function(fe){return n.p(fe)+"s"},U=function(fe){return fe<0},F=function(fe){return U(fe)?Math.ceil(fe):Math.floor(fe)},Z=function(fe){return Math.abs(fe)},X=function(fe,de){return fe?U(fe)?{negative:!0,format:""+Z(fe)+de}:{negative:!1,format:""+fe+de}:{negative:!1,format:""}},se=function(){function fe(ce,me,ae){var ye=this;if(this.$d={},this.$l=ae,ce===void 0&&(this.$ms=0,this.parseFromMilliseconds()),me)return $(ce*O[L(me)],this);if(typeof ce=="number")return this.$ms=ce,this.parseFromMilliseconds(),this;if(typeof ce=="object")return Object.keys(ce).forEach(function(Be){ye.$d[L(Be)]=ce[Be]}),this.calMilliseconds(),this;if(typeof ce=="string"){var _e=ce.match(b);if(_e){var Ve=_e.slice(2).map(function(Be){return Be!=null?Number(Be):0});return this.$d.years=Ve[0],this.$d.months=Ve[1],this.$d.weeks=Ve[2],this.$d.days=Ve[3],this.$d.hours=Ve[4],this.$d.minutes=Ve[5],this.$d.seconds=Ve[6],this.calMilliseconds(),this}}return this}var de=fe.prototype;return de.calMilliseconds=function(){var ce=this;this.$ms=Object.keys(this.$d).reduce(function(me,ae){return me+(ce.$d[ae]||0)*O[ae]},0)},de.parseFromMilliseconds=function(){var ce=this.$ms;this.$d.years=F(ce/v),ce%=v,this.$d.months=F(ce/E),ce%=E,this.$d.days=F(ce/y),ce%=y,this.$d.hours=F(ce/e),ce%=e,this.$d.minutes=F(ce/c),ce%=c,this.$d.seconds=F(ce/l),ce%=l,this.$d.milliseconds=ce},de.toISOString=function(){var ce=X(this.$d.years,"Y"),me=X(this.$d.months,"M"),ae=+this.$d.days||0;this.$d.weeks&&(ae+=7*this.$d.weeks);var ye=X(ae,"D"),_e=X(this.$d.hours,"H"),Ve=X(this.$d.minutes,"M"),Be=this.$d.seconds||0;this.$d.milliseconds&&(Be+=this.$d.milliseconds/1e3,Be=Math.round(1e3*Be)/1e3);var xe=X(Be,"S"),Me=ce.negative||me.negative||ye.negative||_e.negative||Ve.negative||xe.negative,We=_e.format||Ve.format||xe.format?"T":"",Fe=(Me?"-":"")+"P"+ce.format+me.format+ye.format+We+_e.format+Ve.format+xe.format;return Fe==="P"||Fe==="-P"?"P0D":Fe},de.toJSON=function(){return this.toISOString()},de.format=function(ce){var me=ce||"YYYY-MM-DDTHH:mm:ss",ae={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return me.replace(T,function(ye,_e){return _e||String(ae[ye])})},de.as=function(ce){return this.$ms/O[L(ce)]},de.get=function(ce){var me=this.$ms,ae=L(ce);return ae==="milliseconds"?me%=1e3:me=ae==="weeks"?F(me/O[ae]):this.$d[ae],me||0},de.add=function(ce,me,ae){var ye;return ye=me?ce*O[L(me)]:P(ce)?ce.$ms:$(ce,this).$ms,$(this.$ms+ye*(ae?-1:1),this)},de.subtract=function(ce,me){return this.add(ce,me,!0)},de.locale=function(ce){var me=this.clone();return me.$l=ce,me},de.clone=function(){return $(this.$ms,this)},de.humanize=function(ce){return i().add(this.$ms,"ms").locale(this.$l).fromNow(!ce)},de.valueOf=function(){return this.asMilliseconds()},de.milliseconds=function(){return this.get("milliseconds")},de.asMilliseconds=function(){return this.as("milliseconds")},de.seconds=function(){return this.get("seconds")},de.asSeconds=function(){return this.as("seconds")},de.minutes=function(){return this.get("minutes")},de.asMinutes=function(){return this.as("minutes")},de.hours=function(){return this.get("hours")},de.asHours=function(){return this.as("hours")},de.days=function(){return this.get("days")},de.asDays=function(){return this.as("days")},de.weeks=function(){return this.get("weeks")},de.asWeeks=function(){return this.as("weeks")},de.months=function(){return this.get("months")},de.asMonths=function(){return this.as("months")},de.years=function(){return this.get("years")},de.asYears=function(){return this.as("years")},fe}(),Q=function(fe,de,ce){return fe.add(de.years()*ce,"y").add(de.months()*ce,"M").add(de.days()*ce,"d").add(de.hours()*ce,"h").add(de.minutes()*ce,"m").add(de.seconds()*ce,"s").add(de.milliseconds()*ce,"ms")};return function(fe,de,ce){i=ce,n=ce().$utils(),ce.duration=function(ye,_e){var Ve=ce.locale();return $(ye,{$l:Ve},_e)},ce.isDuration=P;var me=de.prototype.add,ae=de.prototype.subtract;de.prototype.add=function(ye,_e){return P(ye)?Q(this,ye,1):me.bind(this)(ye,_e)},de.prototype.subtract=function(ye,_e){return P(ye)?Q(this,ye,-1):ae.bind(this)(ye,_e)}}})})(WPe);var G$i=WPe.exports;const U$i=Za(G$i);var zPe={exports:{}};(function(d,p){(function(i,n){d.exports=n()})(_r,function(){return function(i,n){n.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(zPe);var j$i=zPe.exports;const k$i=Za(j$i);M.extend(E$i);M.extend(A$i);M.extend(I$i);M.extend(D$i);M.extend(w$i);M.extend(_$i);M.extend(V$i);M.extend(x$i);M.extend(L$i);M.extend(B$i);M.extend(U$i);M.extend(k$i);const At=d=>M(d),Xi=d=>d.toISOString();function JPe(){return Xi(M())}function YPe(d,p){return At(d).format(p)}function XPe(d){return Xi(M(d))}function QPe(d){if(d==null)throw new TypeError("ToDate expects a non-null value.");if(typeof d=="string"){const p=M(d);if(!p.isValid())throw new TypeError("Invalid date string.");return p.toISOString()}if(typeof d=="number"&&Number.isFinite(d)){const p=Math.abs(d)<1e12?M.unix(d):M(d);if(!p.isValid())throw new TypeError("Invalid numeric timestamp.");return p.toISOString()}if(d instanceof Date){const p=M(d);if(!p.isValid())throw new TypeError("Invalid Date object.");return p.toISOString()}throw new TypeError("Unsupported value type for ToDate. Provide a string, number, or Date.")}function eVe(d,p,i){return Xi(At(d).add(p,i))}function tVe(d,p,i){return Xi(At(d).subtract(p,i))}function iVe(d,p,i,n=!1){return At(d).diff(At(p),i,n)}function rVe(d){return At(d).unix()}function nVe(d){return Xi(M.unix(d))}function aVe(d){return Xi(At(d))}function sVe(d){return At(d).year()}function lVe(d){return At(d).month()}function oVe(d){return At(d).date()}function dVe(d){return At(d).hour()}function uVe(d){return At(d).minute()}function pVe(d){return At(d).second()}function cVe(d){return At(d).millisecond()}function fVe(d){return At(d).isoWeekday()}function yVe(d){return At(d).week()}function hVe(d){return At(d).quarter()}function mVe(d){return At(d).dayOfYear()}function TVe(d){return At(d).daysInMonth()}function vVe(d,p){return Xi(At(d).year(p))}function EVe(d,p){return Xi(At(d).month(p))}function bVe(d,p){return Xi(At(d).date(p))}function AVe(d,p){return Xi(At(d).hour(p))}function gVe(d,p){return Xi(At(d).minute(p))}function IVe(d,p){return Xi(At(d).second(p))}function RVe(d,p){return Xi(At(d).millisecond(p))}function DVe(d,p){return Xi(At(d).isoWeekday(p))}function OVe(d,p){return Xi(At(d).quarter(p))}function wVe(d,p){return Xi(At(d).startOf(p))}function CVe(d,p){return Xi(At(d).endOf(p))}function _Ve(d,p){const i=At(d),n=i.startOf(p),l=i.endOf(p),c=n.valueOf()+(l.valueOf()-n.valueOf())/2;return Xi(i.valueOf()<c?n:l)}function PVe(d,p,i){return At(d).isBefore(At(p),i)}function VVe(d,p,i){return At(d).isAfter(At(p),i)}function NVe(d,p,i){return At(d).isSame(At(p),i)}function xVe(d,p,i){return At(d).isSameOrBefore(At(p),i)}function $Ve(d,p,i){return At(d).isSameOrAfter(At(p),i)}function LVe(d,p,i,n,l="()"){return At(d).isBetween(At(p),At(i),n,l)}function MVe(d){return M(d).isValid()}function BVe(d){return At(d).isLeapYear()}function GVe(d,p,i){const n=At(d);return n.isBefore(p)?Xi(At(p)):n.isAfter(i)?Xi(At(i)):Xi(n)}function UVe(d){if(d.length===0)throw new Error("minOf requires at least one date");let p=At(d[0]);for(let i=1;i<d.length;i++){const n=At(d[i]);n.isBefore(p)&&(p=n)}return Xi(p)}function jVe(d){if(d.length===0)throw new Error("maxOf requires at least one date");let p=At(d[0]);for(let i=1;i<d.length;i++){const n=At(d[i]);n.isAfter(p)&&(p=n)}return Xi(p)}function kVe(d,p=!1){return At(d).fromNow(p)}function KVe(d,p=!1){return At(d).toNow(p)}function FVe(d,p,i=!0){const n=At(d).diff(At(p),"millisecond",!0),l=Math.abs(n),e=M.duration(l,"milliseconds").humanize();return i?n>=0?`in ${e}`:`${e} ago`:e}function SVe(d,p,i=["6","7"],n=[]){const l=v=>n.some(E=>At(E).isSame(v,"day")),c=v=>((v.day()+6)%7+1).toString();let e=At(d);const y=p>=0?1:-1;let T=Math.abs(p);for(;T>0;){e=e.add(y,"day");const v=c(e);!i.includes(v)&&!l(e)&&T--}return Xi(e)}function qVe(d,p){let i=At(d);const n=p;for(let l=0;l<7;l++)if(i=i.add(1,"day"),i.isoWeekday()===n)return Xi(i);return Xi(i)}function ZVe(d,p){let i=At(d);const n=p;for(let l=0;l<7;l++)if(i=i.subtract(1,"day"),i.isoWeekday()===n)return Xi(i);return Xi(i)}const HVe="Local";function XV(){try{const d=Intl.DateTimeFormat().resolvedOptions().timeZone;if(d&&typeof d=="string")return d}catch{}try{if(typeof process<"u"&&process.env&&process.env.TZ)return process.env.TZ}catch{}return null}function QV(){const d=XV();if(d)return d;throw new Error("Unable to detect current IANA timezone from host environment.")}function WVe(d,p,i=!1){let n=p;if(n===HVe){const e=XV();if(!e)throw new Error("Unable to detect current timezone from host environment.");n=e}const l=n?M.tz(d,n):At(d),c=i?l.utc(!0):l.utc();return Xi(c)}function zVe(d,p,i=!1){const n=At(d);return Xi(i?n.tz(p,!0):n.tz(p))}function JVe(d,p){const i=d===HVe?QV():d;return At(p).tz(i).utcOffset()}function YVe(d,p,i=!1){return Xi(At(d).utcOffset(p,i))}class XVe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_TIMESTAMP,version:"1.0.0",description:"Date get current timestamp operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetCurrentTimestamp);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=JPe();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class QVe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FORMAT_DATE,version:"1.0.0",description:"Date format operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.FormatDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=YPe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class eNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PARSE_DATE,version:"1.0.0",description:"Date parse operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ParseDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=XPe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class tNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_TO_DATE,version:"1.0.0",description:"Date add-to-date operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.AddToDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=eVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class iNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SUBTRACT_FROM_DATE,version:"1.0.0",description:"Date subtract-from-date operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SubtractFromDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=tVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class rNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_DIFFERENCE_BETWEEN_DATES,version:"1.0.0",description:"Date difference-between-dates operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.DifferenceBetweenDates);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)||((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2],T=l[3]??!1,v=iVe(c,e,y,T);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class K$i extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_DATE,version:"1.0.0",description:"Date to-date operation implementation module (coerce to ISO 8601 string)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=QPe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class nNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UNIX,version:"1.0.0",description:"Date to-unix operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToUnix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=rVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class aNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_UNIX,version:"1.0.0",description:"Date from-unix operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.FromUnix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=nVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class sNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_ISO_STRING,version:"1.0.0",description:"Date to-iso-string operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToISOString);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=aVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class lNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_YEAR,version:"1.0.0",description:"Date get-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=sVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class oNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MONTH,version:"1.0.0",description:"Date get-month (0-based) operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetMonth);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=lVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class dNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DATE,version:"1.0.0",description:"Date get-date (day of month) operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=oVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class uNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_HOUR,version:"1.0.0",description:"Date get-hour operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetHour);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=dVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class pNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MINUTE,version:"1.0.0",description:"Date get-minute operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetMinute);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=uVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class cNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_SECOND,version:"1.0.0",description:"Date get-second operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetSecond);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=pVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class fNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_MILLISECOND,version:"1.0.0",description:"Date get-millisecond operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetMillisecond);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=cVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class yNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_ISO_WEEKDAY,version:"1.0.0",description:"Date get-iso-weekday operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetIsoWeekday);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=fVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class hNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_WEEK_OF_YEAR,version:"1.0.0",description:"Date get-week-of-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetWeekOfYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=yVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class mNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_QUARTER,version:"1.0.0",description:"Date get-quarter operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetQuarter);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=hVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class TNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAY_OF_YEAR,version:"1.0.0",description:"Date get-day-of-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetDayOfYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=mVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class vNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_DAYS_IN_MONTH,version:"1.0.0",description:"Date get-days-in-month operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetDaysInMonth);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=TVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ENe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_CURRENT_IANA_TIMEZONE,version:"1.0.0",description:"Date get-current-iana-timezone operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetCurrentIanaTimeZone);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=QV();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class bNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_YEAR,version:"1.0.0",description:"Date set-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=vVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ANe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MONTH,version:"1.0.0",description:"Date set-month operation implementation module (0-based month)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetMonth);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=EVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class gNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_DATE,version:"1.0.0",description:"Date set-date (day of month) operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetDate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=bVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class INe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_HOUR,version:"1.0.0",description:"Date set-hour operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetHour);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=AVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class RNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MINUTE,version:"1.0.0",description:"Date set-minute operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetMinute);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=gVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class DNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_SECOND,version:"1.0.0",description:"Date set-second operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetSecond);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=IVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ONe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_MILLISECOND,version:"1.0.0",description:"Date set-millisecond operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetMillisecond);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=RVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class wNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_ISO_WEEKDAY,version:"1.0.0",description:"Date set-iso-weekday operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetIsoWeekday);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=DVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class CNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_QUARTER,version:"1.0.0",description:"Date set-quarter operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetQuarter);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=OVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class _Ne extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_START_OF,version:"1.0.0",description:"Date start-of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.StartOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=wVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class PNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_END_OF,version:"1.0.0",description:"Date end-of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.EndOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=CVe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class VNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ROUND_TO,version:"1.0.0",description:"Date round-to operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.RoundTo);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=_Ve(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class NNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BEFORE,version:"1.0.0",description:"Date is-before operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsBefore);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=PVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class xNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_AFTER,version:"1.0.0",description:"Date is-after operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsAfter);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=VVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class $Ne extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME,version:"1.0.0",description:"Date is-same operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsSame);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=NVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class LNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_BEFORE,version:"1.0.0",description:"Date is-same-or-before operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsSameOrBefore);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=xVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class MNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_SAME_OR_AFTER,version:"1.0.0",description:"Date is-same-or-after operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsSameOrAfter);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=$Ve(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class BNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_BETWEEN,version:"1.0.0",description:"Date is-between operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsBetween);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(b=>{var O,P;return((O=b.value)==null?void 0:O.valueAsType)||((P=b.value)==null?void 0:P.value)}),c=l[0],e=l[1],y=l[2],T=l[3],v=l[4],E=LVe(c,e,y,T,v??void 0);return{value:G.Success,error:null,result:E}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class GNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_VALID,version:"1.0.0",description:"Date is-valid operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsValid);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=MVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class UNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_IS_LEAP_YEAR,version:"1.0.0",description:"Date is-leap-year operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.IsLeapYear);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)}),c=BVe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class jNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CLAMP_TO_RANGE,version:"1.0.0",description:"Date clamp-to-range operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ClampToRange);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=GVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class kNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MIN_OF,version:"1.0.0",description:"Date min-of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.MinOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)}),c=l.length===1&&Array.isArray(l[0])?l[0]:l,e=UVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class KNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_MAX_OF,version:"1.0.0",description:"Date max-of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.MaxOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)}),c=l.length===1&&Array.isArray(l[0])?l[0]:l,e=jVe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class FNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_FROM_NOW,version:"1.0.0",description:"Date from-now operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.FromNow);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),y=kVe(l,c??!1);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class SNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_NOW,version:"1.0.0",description:"Date to-now operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToNow);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),y=KVe(l,c??!1);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class qNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_HUMANIZE_DIFF,version:"1.0.0",description:"Date humanize-diff operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.HumanizeDiff);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),T=FVe(l,c,e??!0);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ZNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_ADD_BUSINESS_DAYS,version:"1.1.0",description:"Date add-business-days operation implementation module (ISO-weekend strings)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.AddBusinessDays);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2]??void 0,T=l[3]??[],v=SVe(c,e,y,T);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class HNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_NEXT_WEEKDAY,version:"1.0.0",description:"Date next-weekday operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.NextWeekday);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)}),e=qVe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class WNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_PREVIOUS_WEEKDAY,version:"1.0.0",description:"Date previous-weekday operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.PreviousWeekday);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)}),e=ZVe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class zNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_TO_UTC,version:"1.1.0",description:"Date to-utc operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ToUTC);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1]||void 0,y=l[2]??!1,T=WVe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class JNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_CONVERT_TIMEZONE,version:"1.0.0",description:"Date convert-timezone operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.ConvertTimezone);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),T=zVe(l,c,e??!1);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class YNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_GET_TIMEZONE_OFFSET,version:"1.0.0",description:"Date get-timezone-offset operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.GetTimezoneOffset);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),T=JVe(l,c);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class XNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATE_SET_UTC_OFFSET,version:"1.0.0",description:"Date set-utc-offset operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(k.SetUTCOffset);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),T=YVe(l,c,e??!1);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class QNe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_PARALLEL,version:"1.0.0",description:"Execution parallel operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Mi.Parallel);l&&(l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(b=>{var O,P;return((O=b.value)==null?void 0:O.valueAsType)||((P=b.value)==null?void 0:P.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const y=this.extensionsRegistry.requestContexts(this,[J.Editor])[0],v=c.map(b=>{const O=new fu(y.logic,[b],b,null,this.extensionsRegistry);return O.inheritValuesFromContext(y),O}).map(b=>b.execute()),E=await Promise.all(v);return{value:G.Success,error:null,result:E}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class exe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_SEQUENTIAL,version:"1.0.0",description:"Execution sequential operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Mi.Sequential);l&&(l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0];if(!c)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No list of action entities provided",result:null};if(!Array.isArray(c))return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"Invalid input value. Expected a list of action entities",result:null};const e=[];for(let y=0;y<c.length;y++){const T=c[y],E=this.extensionsRegistry.requestContexts(this,[J.Editor])[0],b=new fu(E.logic,[T],T,null,this.extensionsRegistry);b.inheritValuesFromContext(E);const O=await b.execute();e.push(O)}return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class txe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__EXECUTE_WAIT,version:"1.0.0",description:"Execution wait operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Mi.Wait);l&&(l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)})[0];return typeof c!="number"||c<0?{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"Invalid wait time provided",result:null}:(await new Promise(e=>setTimeout(e,c)),{value:G.Success,error:null,result:null})}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}function Yc(d){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const i=new Uint8Array(d);return crypto.getRandomValues(i),i}const{randomBytes:p}=require("crypto");return p(d)}function ixe(d,p){const i=p-d,n=SI()*i;return Math.floor(n)+d}function rxe(){const d=Yc(4);return d[0]<<24>>>0|d[1]<<16|d[2]<<8|d[3]}function SI(){return rxe()/2**32}function eN(d){const p=Yc(d);return Array.from(p).map(i=>i.toString(16).padStart(2,"0")).join("")}const xw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function tN(d){let p="";const i=Yc(d);for(let n=0;n<d;n++)p+=xw[i[n]%xw.length];return p}function nxe(d){const p=Yc(d);let i;if(typeof Buffer<"u")i=Buffer.from(p).toString("base64");else{const n=String.fromCharCode(...p);i=btoa(n)}return i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function iN(d){return tN(d)}function rN(d,p=xw){let i="";const n=Yc(d);for(let l=0;l<d;l++)i+=p[n[l]%p.length];return i}function hu(){const d=Yc(16);d[6]=d[6]&15|64,d[8]=d[8]&63|128;const p=Array.from(d).map(i=>i.toString(16).padStart(2,"0")).join("");return[p.substr(0,8),p.substr(8,4),p.substr(12,4),p.substr(16,4),p.substr(20,12)].join("-")}function axe(){return rN(6)}function sxe(){return eN(32)}const F$i=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,nN=d=>d===null||["string","number","boolean"].includes(typeof d);function wn(d,p="Input must be an array"){if(!Array.isArray(d))throw new TypeError(p);return d}function Hl(d){const p=wn(d,"Input must be an array");if(!p||p.length===0)throw new TypeError("No list provided or list is empty");return p}function aN(d){return Array.isArray(d)?d:[]}function ss(d){return Number(d)}function lxe(d){if(!d||d.length===0)throw new TypeError("No input lists provided");if(!d.every(n=>Array.isArray(n)))throw new TypeError("All inputs must be arrays");const[p,...i]=d;return i.reduce((n,l)=>n.concat(l),p)}function oxe(d,...p){if(!Array.isArray(d))throw new TypeError("First input must be an array");if(!p.every(i=>Array.isArray(i)))throw new TypeError("All subsequent inputs must be arrays");return d.concat(...p)}function dxe(d,p){const i=Hl(d),n=ss(p);return[i.slice(0,n),i.slice(n)]}function uxe(d){return Hl(d).slice().reverse()}function pxe(d){return Hl(d).slice(0,-1)}function cxe(d){return Hl(d).slice(1)}function fxe(d,p,i){const n=wn(d),l=ss(p);if(l<0||l>n.length)throw new TypeError("Index out of bounds");return[...n.slice(0,l),i,...n.slice(l)]}function yxe(d,p,i){const n=Hl(d),l=ss(p);if(l<0||l>=n.length)throw new TypeError("Index out of bounds");const c=[...n];return c[l]=i,c}function hxe(d,p,i){const n=Hl(d),l=n.indexOf(p);if(l===-1)return n;const c=[...n];return c[l]=i,c}function mxe(d,p,i){const n=Hl(d),l=n.lastIndexOf(p);if(l===-1)return n;const c=[...n];return c[l]=i,c}function Txe(d,p,i){return Hl(d).map(l=>l===p?i:l)}function vxe(d,p){const i=Hl(d),n=ss(p);if(n<0||n>=i.length)throw new TypeError("Index out of bounds");return i[n]}function Exe(d){return Hl(d)[0]}function bxe(d){const p=Hl(d);return p[p.length-1]}function Axe(d,p,...i){return[...wn(d),p,...i]}function gxe(d,p){const i=wn(d);return[p,...i]}function Ixe(d){return wn(d).length}function Rxe(d,p){const i=wn(d),n=ss(p);if(n<0||n>=i.length)throw new TypeError("Index out of bounds");return i.slice(0,n).concat(i.slice(n+1))}function Dxe(d,p){const i=wn(d),n=Math.max(0,ss(p)??0);return i.slice(0,n)}function Oxe(d,p){const i=wn(d),n=Math.max(0,ss(p)??0);return n===0?[]:i.slice(-n)}function wxe(d,p,i){const n=wn(d),l=p==null?void 0:ss(p),c=i==null?void 0:ss(i);return n.slice(l,c)}function Cxe(d,p){return wn(d).indexOf(p)}function _xe(d,p){return wn(d).lastIndexOf(p)}function Pxe(d){const p=wn(d),i=[],n=new Set;for(const l of p)n.has(l)||(n.add(l),i.push(l));return i}function Vxe(d){return wn(d).reduce((i,n)=>i.concat(n),[])}function Nxe(d){const p=wn(d);if(p.length<=1)return[...p];const i=p[0],n=typeof i=="number"&&p.every(e=>typeof e=="number"&&Number.isFinite(e)),l=typeof i=="string"&&p.every(e=>typeof e=="string");let c=null;if(n?c="number":l&&(c=p.every(y=>F$i.test(y)&&M(y).isValid())?"date":"string"),!c)throw new TypeError("All items must be of the same supported type: number, string, or ISO date string.");return c==="number"?[...p].sort((e,y)=>e-y):c==="string"?[...p].sort((e,y)=>e.localeCompare(y)):[...p].sort((e,y)=>M(e).valueOf()-M(y).valueOf())}function xxe(d){const i=[...wn(d)];for(let n=i.length-1;n>0;n--){const l=Math.floor(SI()*(n+1));[i[n],i[l]]=[i[l],i[n]]}return i}function $xe(d,p){const i=wn(d),n=Math.max(1,ss(p)||1),l=[];for(let c=0;c<i.length;c+=n)l.push(i.slice(c,c+n));return l}function Lxe(d,p,i){const n=wn(d),l=Math.max(0,ss(p)||0);if(n.length>=l)return[...n];const c=l-n.length;return Array(c).fill(i).concat(n)}function Mxe(d,p,i){const n=wn(d),l=Math.max(0,ss(p)||0);if(n.length>=l)return[...n];const c=l-n.length,e=Array(c).fill(i);return n.concat(e)}function Bxe(d,p){const i=wn(d),n=Math.max(0,ss(p)||0),l=[];for(let c=0;c<n;c++)l.push(...i);return l}function Gxe(d,p){if(!nN(p))throw new TypeError("Contains expects the needle to be a primitive (string | number | boolean | null).");return aN(d).some(n=>n===p)}function Uxe(d,p){const i=aN(d),n=Array.isArray(p)?p:[p];if(n.length===0)return!1;if(!n.every(nN))throw new TypeError("ContainsAll expects all needles to be primitives (string | number | boolean | null).");return n.every(l=>i.includes(l))}function jxe(d,p){const i=aN(d),n=Array.isArray(p)?p:[p];if(n.length===0)return!1;if(!n.every(nN))throw new TypeError("ContainsAny expects all needles to be primitives (string | number | boolean | null).");return n.some(l=>i.includes(l))}class kxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_JOIN,version:"1.0.0",description:"List join operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=lxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Kxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SPLIT,version:"1.0.0",description:"List split operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Split);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],[y,T]=dxe(c,e);return{value:G.Success,error:null,result:[y,T]}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Fxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REVERSE,version:"1.0.0",description:"List reverse operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=uxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Sxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_LAST_N_ITEMS,version:"1.0.0",description:"List delete last operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.DeleteLastNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=pxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class qxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_FIRST_N_ITEMS,version:"1.0.0",description:"List delete first operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.DeleteFirstNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=cxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Zxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_ADD_AT_INDEX,version:"1.0.0",description:"List add index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.AddAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=fxe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Hxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_AT_INDEX,version:"1.0.0",description:"List replace index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.ReplaceAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=yxe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Wxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_FIRST_N_ITEMS,version:"1.0.0",description:"List replace first operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.ReplaceFirstNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=hxe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class zxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_LAST_N_ITEMS,version:"1.0.0",description:"List replace last operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.ReplaceLastNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=mxe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Jxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPLACE_ALL,version:"1.0.0",description:"List replace all operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.ReplaceAll);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2],T=Txe(c,e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Yxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_ITEM,version:"1.0.0",description:"List get index item operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=vxe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Xxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST,version:"1.0.0",description:"List get first operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.GetFirst);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=Exe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Qxe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST,version:"1.0.0",description:"List get last operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.GetLast);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=bxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class e$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_APPEND,version:"1.0.0",description:"List append operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l.slice(2),T=Axe(c,e,...y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class t$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PREPEND,version:"1.0.0",description:"List prepend operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ie.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=gxe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class i$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LENGTH,version:"1.0.0",description:"List get length",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetLength);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(c=>{var e,y;return((e=c.value)==null?void 0:e.valueAsType)??((y=c.value)==null?void 0:y.value)});return{value:G.Success,error:null,result:Ixe(l)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class r$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_DELETE_AT_INDEX,version:"1.0.0",description:"List delete one item at index (non-mutating)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.DeleteAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Rxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class n$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_FIRST_N_ITEMS,version:"1.0.0",description:"List get first N items",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetFirstNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Dxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class a$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_N_ITEMS,version:"1.0.0",description:"List get last N items",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetLastNItems);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Oxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class s$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SLICE,version:"1.0.0",description:"List slice(start, end)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Slice);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=wxe(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class l$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONCAT,version:"1.0.0",description:"List concat(base, ...others)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Concat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),[c,...e]=l,y=oxe(c,...e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class o$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_INDEX_OF,version:"1.0.0",description:"List listGetIndexOf(value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Cxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class d$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_GET_LAST_INDEX_OF,version:"1.0.0",description:"List listGetLastIndexOf(value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.GetLastIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=_xe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class u$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_UNIQUE,version:"1.0.0",description:"List unique (stable, by reference/===)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Unique);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=Pxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class p$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_FLATTEN,version:"1.0.0",description:"List flatten one level",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Flatten);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=Vxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class c$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SORT,version:"1.0.0",description:"List sort (non-mutating). Supports lists of strings (alphabetic), numbers (numeric), or ISO date strings (chronological).",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Sort);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=Nxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class f$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_SHUFFLE,version:"1.0.0",description:"List shuffle (Fisher–Yates, secure RNG helper)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Shuffle);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=xxe(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CHUNK,version:"1.0.0",description:"List chunk(size) -> list of lists",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Chunk);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=$xe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class h$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_START,version:"1.0.0",description:"List padStart(targetLength, padValue)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.PadStart);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=Lxe(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class m$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_PAD_END,version:"1.0.0",description:"List padEnd(targetLength, padValue)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.PadEnd);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=Mxe(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class T$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_REPEAT,version:"1.0.0",description:"List repeat(count)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Repeat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Bxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class v$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS,version:"1.0.0",description:"List contains (primitive needles)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.Contains);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Gxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class E$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ALL,version:"1.0.0",description:"List contains all (primitive needles)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.ContainsAll);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Uxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class b$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__LIST_CONTAINS_ANY,version:"1.0.0",description:"List contains any (primitive needles)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ie.ContainsAny);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=jxe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class S$i extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LENGTH,version:"1.0.0",description:"Returns the number of characters in a string",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.GetLength);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=l.length;return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class A$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_JOIN,version:"1.0.0",description:"String join operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.Join);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{var l,c,e;try{const y=n.find(U=>{var F;return((F=U.valueOwner)==null?void 0:F.id)===Y.operation[S.Join].inputs.separator.id}),T=((l=y==null?void 0:y.value)==null?void 0:l.value)||"",v=n.find(U=>{var F;return((F=U.valueOwner)==null?void 0:F.id)===Y.operation[S.Join].inputs.first.id}),E=((c=v==null?void 0:v.value)==null?void 0:c.value)||"",b=n.find(U=>{var F;return((F=U.valueOwner)==null?void 0:F.id)===Y.operation[S.Join].inputs.second.id}),O=((e=b==null?void 0:b.value)==null?void 0:e.value)||"",$=n.filter(U=>{var F;return((F=U.valueOwner)==null?void 0:F.id)===Y.operation[S.Join].inputs.dynamicString.id}).map(U=>{var F,Z;return((F=U.value)==null?void 0:F.valueAsType)||((Z=U.value)==null?void 0:Z.value)||""}),L=[E,O,...$].join(T);return{value:G.Success,error:null,result:L}}catch(y){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:y,result:null}}}})}}class g$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_INDEX,version:"1.0.0",description:"String split at index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.SplitAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y={firstPart:c.slice(0,e),secondPart:c.slice(e)};return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class I$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_ALL_SEPARATORS,version:"1.0.0",description:"String split at all the occurrences of separators operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.SplitAtAllSeparators);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=c.split(e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class R$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_FIRST_SEPARATOR,version:"1.0.0",description:"String split at the first occurrence of a separator operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.SplitAtFirstSeparator);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=c.indexOf(e),T={firstPart:c.slice(0,y),secondPart:c.slice(y+e.length)};return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class D$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SPLIT_AT_LAST_SEPARATOR,version:"1.0.0",description:"String split at the last occurrence of a separator operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.SplitAtLastSeparator);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=c.lastIndexOf(e),T={firstPart:c.slice(0,y),secondPart:c.slice(y+e.length)};return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class O$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_LAST_N_CHARS,version:"1.0.0",description:"String delete last number of characters operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.DeleteLastNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.slice(0,-e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class w$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_FIRST_N_CHARS,version:"1.0.0",description:"String delete first number of characters operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.DeleteFirstNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.slice(0,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class C$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REVERSE,version:"1.0.0",description:"String reverse operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.Reverse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const e=c.split("").reverse().join("");return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class _$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_LOWER_CASE,version:"1.0.0",description:"String to lower case operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ToLowerCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const e=c.toLowerCase();return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class P$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TO_UPPER_CASE,version:"1.0.0",description:"String to upper case operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ToUpperCase);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const e=c.toUpperCase();return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class V$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_DELETE_AT_INDEX,version:"1.0.0",description:"String delete index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.DeleteAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)||((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2]??1;if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=Math.min(y,c.length-e),v=c.slice(0,e)+c.slice(e+T);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class N$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ADD_AT_INDEX,version:"1.0.0",description:"String add index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.AddAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.slice(0,e)+y+c.slice(e);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class x$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_N_CHARS,version:"1.0.0",description:"String replace first operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceFirstNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1]??1,y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=y+c.slice(e);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class $$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_N_CHARS,version:"1.0.0",description:"String replace last operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceLastNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1]??1,y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.slice(0,-e)+y;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class L$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_AT_INDEX,version:"1.0.0",description:"String replace index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceAtIndex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)||((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2]??1,T=l[3];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const v=(c.slice(0,e)||"")+T+(c.slice(e+y)||"");return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class M$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_FIRST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceFirstMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.replace(e,y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class B$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_LAST_MATCH,version:"1.0.0",description:"String replace single match operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceLastMatch);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)||((O=E.value)==null?void 0:O.value)}),c=l[0],e=l[1],y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.lastIndexOf(e),v=T===-1?c:c.substring(0,T)+y+c.substring(T+e.length);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class G$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_ALL_MATCHES,version:"1.0.0",description:"String replace all matches operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.ReplaceAllMatches);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1],y=l[2];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const T=c.split(e).join(y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class U$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_ITEM,version:"1.0.0",description:"String get index operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.GetIndexItem);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.charAt(e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class j$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_N_CHARS,version:"1.0.0",description:"String get last N chars operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.GetLastNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.slice(-e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class k$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_FIRST_N_CHARS,version:"1.0.0",description:"String get first N chars operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.GetFirstNChars);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=c.slice(0,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class K$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_INDEX_OF,version:"1.0.0",description:"String get index of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.GetIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No search value provided",result:null};const y=c.indexOf(e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class F$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_APPEND,version:"1.0.0",description:"String append operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.Append);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)||((b=v.value)==null?void 0:b.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};if(typeof e!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No value to append provided",result:null};const y=l.slice(2);if(!y.every(v=>typeof v=="string"))return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"All values to append must be strings",result:null};const T=[c,e,...y].join("");return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class S$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PREPEND,version:"1.0.0",description:"String prepend operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(S.Prepend);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1];if(typeof c!="string")return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:"No string provided",result:null};const y=e+c;return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM,version:"1.0.0",description:"String trim implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Trim);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=l.trim();return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_START,version:"1.0.0",description:"String trimStart implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.TrimStart);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=l.trimStart();return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class H$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_TRIM_END,version:"1.0.0",description:"String trimEnd implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.TrimEnd);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=l.trimEnd();return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class W$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SUBSTRING,version:"1.0.0",description:"String substring(start, end?) implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Substring);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.substring(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class z$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SLICE,version:"1.0.0",description:"String slice(start, end?) implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Slice);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.slice(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class J$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_GET_LAST_INDEX_OF,version:"1.0.0",description:"String lastIndexOf(search, fromIndex?) implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.GetLastIndexOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.lastIndexOf(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Y$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_START,version:"1.0.0",description:"String padStart(targetLength, padString?) implementation",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.PadStart);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.padStart(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class X$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_PAD_END,version:"1.0.0",description:"String padEnd(targetLength, padString?) implementation",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.PadEnd);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=l.padEnd(c,e??void 0);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Q$e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPEAT,version:"1.0.0",description:"String repeat(count) implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Repeat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=l.repeat(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class eLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_REGEX,version:"1.0.0",description:"String match(regex) -> first match array or null",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.MatchRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),y=new RegExp(String(c??""),e?String(e):void 0),T=String(l??"").match(y);return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class tLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCH_ALL_REGEX,version:"1.0.0",description:"String matchAll(regex) -> array of matches",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.MatchAllRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(b=>{var O,P;return((O=b.value)==null?void 0:O.valueAsType)??((P=b.value)==null?void 0:P.value)}),y=e?String(e):"",T=y.includes("g")?y:y+"g",v=new RegExp(String(c??""),T),E=Array.from(String(l??"").matchAll(v),b=>Array.from(b));return{value:G.Success,error:null,result:E}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class iLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_SEARCH_REGEX,version:"1.0.0",description:"String search(regex) -> index or -1",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.SearchRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)});let y=-1;try{const T=new RegExp(String(c??""),e?String(e):void 0);y=String(l??"").search(T)}catch{y=-1}return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class rLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REPLACE_REGEX,version:"1.0.0",description:"String replace using RegExp (pattern, replacement, flags?)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.ReplaceRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y]=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)});let T=String(l??"");const v=new RegExp(String(c??""),y?String(y):void 0);return T=T.replace(v,String(e??"")),{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class nLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_NORMALIZE_UNICODE,version:"1.0.0",description:"String normalize(form?) implementation module (NFC by default)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.NormalizeUnicode);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=l.normalize(c||"NFC");return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}const AA=class AA extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_DIACRITICS,version:"1.0.0",description:"Remove diacritics via NFD decomposition + strip combining marks",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.RemoveDiacritics);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=String(l??"").normalize("NFD").replace(AA.COMBINING_MARKS,"");return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}};I(AA,"COMBINING_MARKS",/[\u0300-\u036f]/g);let Xb=AA;class aLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_COUNT_OCCURRENCES,version:"1.0.0",description:"Count literal substring occurrences in a string",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.CountOccurrences);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=y===""?0:e.split(y).length-1;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class sLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_PREFIX,version:"1.0.0",description:"Ensure string starts with given prefix (add if missing)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.EnsurePrefix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=e.startsWith(y)?e:y+e;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class lLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENSURE_SUFFIX,version:"1.0.0",description:"Ensure string ends with given suffix (add if missing)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.EnsureSuffix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=e.endsWith(y)?e:e+y;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class oLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_PREFIX,version:"1.0.0",description:"Remove prefix if present",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.RemovePrefix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=e.startsWith(y)?e.slice(y.length):e;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class dLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_REMOVE_SUFFIX,version:"1.0.0",description:"Remove suffix if present",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.RemoveSuffix);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)}),e=String(l??""),y=String(c??""),T=e.endsWith(y)?e.slice(0,-y.length):e;return{value:G.Success,error:null,result:T}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class uLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_STARTS_WITH,version:"1.0.0",description:"String startsWith(needle) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.StartsWith);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)});if(typeof l!="string"||typeof c!="string")throw new TypeError("StartsWith expects two strings.");const e=l.startsWith(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class pLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_ENDS_WITH,version:"1.0.0",description:"String endsWith(needle) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.EndsWith);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)});if(typeof l!="string"||typeof c!="string")throw new TypeError("EndsWith expects two strings.");const e=l.endsWith(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class cLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_CONTAINS,version:"1.0.0",description:"String includes(needle) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.Contains);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)});if(typeof l!="string"||typeof c!="string")throw new TypeError("Contains expects two strings.");const e=l.includes(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class fLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__STRING_MATCHES_REGEX,version:"1.0.0",description:"Regex test: new RegExp(pattern, flags?).test(src) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(S.MatchesRegex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=n.map(v=>{var E,b;return((E=v.value)==null?void 0:E.valueAsType)??((b=v.value)==null?void 0:b.value)});if(typeof l!="string"||typeof c!="string")throw new TypeError("MatchesRegex expects source and pattern to be strings.");if(!(e===void 0||typeof e=="string"))throw new TypeError("MatchesRegex flags must be a string if provided.");let y=!1;return y=new RegExp(c,e).test(l),{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}function yLe(d,p){const i=Number(d),l=10**Math.max(0,Number(p)||0);return Math.round(i*l)/l}function hLe(d,p){const i=Number(d),n=Math.abs(Number(p)||0);return n===0?i:Math.round(i/n)*n}function mLe(d,p,i){const n=Number(d),l=Number(p),c=Number(i);return Math.min(Math.max(n,l),c)}function TLe(d,p,i,n,l){const c=Number(d),e=Number(p),y=Number(i),T=Number(n),v=Number(l);if(e===y)throw new Error("Input range cannot be zero");const E=(c-e)/(y-e);return T+E*(v-T)}function vLe(...d){const p=d.map(n=>Number(n));return p.length===0?0:p.reduce((n,l)=>n+l,0)/p.length}function ELe(...d){const p=d.map(n=>Number(n)).sort((n,l)=>n-l);if(p.length===0)return 0;const i=Math.floor(p.length/2);return p.length%2?p[i]:(p[i-1]+p[i])/2}function bLe(d,p){const i=Number(d),n=Number(p);return n===0?NaN:i<0&&n%2===1?-Math.pow(-i,1/n):Math.pow(i,1/n)}function ALe(d,p){const i=Number(d),n=Number(p);return i===0?1/0:(n-i)/i*100}const ri=d=>d.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class gLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ADDITION,version:"1.0.0",description:"Number addition operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Addition);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=ri(n).reduce((e,y)=>e+y,0);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ILe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SUBTRACTION,version:"1.0.0",description:"Number subtraction operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Subtraction);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=ri(n).reduce((e,y)=>e-y,0);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class RLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MULTIPLICATION,version:"1.0.0",description:"Number multiplication operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Multiplication);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=ri(n).reduce((e,y)=>e*y,1);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class DLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_DIVISION,version:"1.0.0",description:"Number division operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Division);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ri(n);if(c===0)throw new Error("Division by zero is not allowed");const e=l/c;return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class OLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_REMAINDER,version:"1.0.0",description:"Number remainder operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Remainder);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ri(n);if(c===0)throw new Error("Division by zero is not allowed");const e=l%c;return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class wLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXPONENTIATION,version:"1.0.0",description:"Number exponentiation operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(ee.Exponentiation);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ri(n),e=Math.pow(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class CLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NEGATE,version:"1.0.0",description:"Number negate (unary -x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Negate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:-l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class _Le extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ABSOLUTE,version:"1.0.0",description:"Number absolute (|x|)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Absolute);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.abs(Number(l))}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class PLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIGN,version:"1.0.0",description:"Number sign (-1 | 0 | 1)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Sign);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.sign(Number(l))}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class VLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND,version:"1.0.0",description:"Number round to nearest integer",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Round);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.round(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class NLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_FLOOR,version:"1.0.0",description:"Number floor (⌊x⌋)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Floor);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.floor(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class xLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CEIL,version:"1.0.0",description:"Number ceil (⌈x⌉)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Ceil);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.ceil(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class $Le extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TRUNC,version:"1.0.0",description:"Number truncation (drop fractional part)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Trunc);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.trunc(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class LLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ROUND_TO_DECIMALS,version:"1.0.0",description:"Round to N decimals",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.RoundToDecimals);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=yLe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class MLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SNAP_TO_STEP,version:"1.0.0",description:"Snap a number to the nearest multiple of step (>=0 step)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.SnapToStep);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=hLe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class BLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CLAMP,version:"1.0.0",description:"Clamp value to [min, max]",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Clamp);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=ri(n),y=mLe(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class GLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAP_RANGE,version:"1.0.0",description:"Map value from [inMin,inMax] to [outMin,outMax]",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MapRange);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T]=ri(n),v=TLe(l,c,e,y,T);return{value:G.Success,error:null,result:v}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class ULe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_AVERAGE,version:"1.0.0",description:"Average(numbers...)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Average);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ri(n),c=vLe(...l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class jLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MEDIAN,version:"1.0.0",description:"Median(numbers...)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Median);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ri(n),c=ELe(...l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class kLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MIN_OF,version:"1.0.0",description:"Min(numbers...)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MinOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ri(n).map(Number),c=l.length?Math.min(...l):1/0;return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class KLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MAX_OF,version:"1.0.0",description:"Max(numbers...)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MaxOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ri(n).map(Number),c=l.length?Math.max(...l):-1/0;return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class FLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SQUARE_ROOT,version:"1.0.0",description:"Square root",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.SquareRoot);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.sqrt(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class SLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_CUBE_ROOT,version:"1.0.0",description:"Cube root",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.CubeRoot);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.cbrt(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class qLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_NTH_ROOT,version:"1.0.0",description:"Nth root (value, n)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.NthRoot);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=bLe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class ZLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_EXP,version:"1.0.0",description:"e^x",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Exp);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.exp(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class HLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG_NATURAL,version:"1.0.0",description:"Natural log ln(x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.LogNatural);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.log(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class WLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LOG10,version:"1.0.0",description:"Log base 10",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Log10);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n),c=Number(l),e=Math.log10?Math.log10(c):Math.log(c)/Math.LN10;return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class zLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_SIN,version:"1.0.0",description:"sin(x in radians)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Sin);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.sin(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class JLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_COS,version:"1.0.0",description:"cos(x in radians)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Cos);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.cos(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class YLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TAN,version:"1.0.0",description:"tan(x in radians)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Tan);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.tan(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class XLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ASIN,version:"1.0.0",description:"asin(x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Asin);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.asin(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class QLe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ACOS,version:"1.0.0",description:"acos(x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Acos);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.acos(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class e2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN,version:"1.0.0",description:"atan(x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Atan);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Math.atan(Number(l))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class t2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_ATAN2,version:"1.0.0",description:"atan2(y, x)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.Atan2);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:Math.atan2(Number(l),Number(c))}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class i2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_RADIANS,version:"1.0.0",description:"deg → rad",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.ToRadians);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Number(l)*Math.PI/180}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class r2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_TO_DEGREES,version:"1.0.0",description:"rad → deg",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.ToDegrees);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ri(n);return{value:G.Success,error:null,result:Number(l)*180/Math.PI}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class n2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENT_OF,version:"1.0.0",description:"x percent of y",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.PercentOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=Number(l)/100*Number(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class $w extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_PERCENTAGE_CHANGE,version:"1.0.0",description:"((new-old)/old)*100",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.PercentageChange);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n),e=ALe(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class a2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN,version:"1.0.0",description:"a < b",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.LessThan);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:l<c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class s2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN,version:"1.0.0",description:"a > b",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MoreThan);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:l>c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class l2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_LESS_THAN_OR_EQUAL,version:"1.0.0",description:"a <= b",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.LessThanOrEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:l<=c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class o2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__NUMBER_MORE_THAN_OR_EQUAL,version:"1.0.0",description:"a >= b",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ee.MoreThanOrEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ri(n);return{value:G.Success,error:null,result:l>=c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}function d2e(d,p){return function(){return d.apply(p,arguments)}}const{toString:q$i}=Object.prototype,{getPrototypeOf:sN}=Object,{iterator:qI,toStringTag:u2e}=Symbol,ZI=(d=>p=>{const i=q$i.call(p);return d[i]||(d[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),Wl=d=>(d=d.toLowerCase(),p=>ZI(p)===d),HI=d=>p=>typeof p===d,{isArray:xh}=Array,vy=HI("undefined");function ov(d){return d!==null&&!vy(d)&&d.constructor!==null&&!vy(d.constructor)&&$a(d.constructor.isBuffer)&&d.constructor.isBuffer(d)}const p2e=Wl("ArrayBuffer");function Z$i(d){let p;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?p=ArrayBuffer.isView(d):p=d&&d.buffer&&p2e(d.buffer),p}const H$i=HI("string"),$a=HI("function"),c2e=HI("number"),dv=d=>d!==null&&typeof d=="object",W$i=d=>d===!0||d===!1,Cb=d=>{if(ZI(d)!=="object")return!1;const p=sN(d);return(p===null||p===Object.prototype||Object.getPrototypeOf(p)===null)&&!(u2e in d)&&!(qI in d)},z$i=d=>{if(!dv(d)||ov(d))return!1;try{return Object.keys(d).length===0&&Object.getPrototypeOf(d)===Object.prototype}catch{return!1}},J$i=Wl("Date"),Y$i=Wl("File"),X$i=Wl("Blob"),Q$i=Wl("FileList"),eLi=d=>dv(d)&&$a(d.pipe),tLi=d=>{let p;return d&&(typeof FormData=="function"&&d instanceof FormData||$a(d.append)&&((p=ZI(d))==="formdata"||p==="object"&&$a(d.toString)&&d.toString()==="[object FormData]"))},iLi=Wl("URLSearchParams"),[rLi,nLi,aLi,sLi]=["ReadableStream","Request","Response","Headers"].map(Wl),lLi=d=>d.trim?d.trim():d.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function uv(d,p,{allOwnKeys:i=!1}={}){if(d===null||typeof d>"u")return;let n,l;if(typeof d!="object"&&(d=[d]),xh(d))for(n=0,l=d.length;n<l;n++)p.call(null,d[n],n,d);else{if(ov(d))return;const c=i?Object.getOwnPropertyNames(d):Object.keys(d),e=c.length;let y;for(n=0;n<e;n++)y=c[n],p.call(null,d[y],y,d)}}function f2e(d,p){if(ov(d))return null;p=p.toLowerCase();const i=Object.keys(d);let n=i.length,l;for(;n-- >0;)if(l=i[n],p===l.toLowerCase())return l;return null}const pc=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),y2e=d=>!vy(d)&&d!==pc;function Lw(){const{caseless:d,skipUndefined:p}=y2e(this)&&this||{},i={},n=(l,c)=>{const e=d&&f2e(i,c)||c;Cb(i[e])&&Cb(l)?i[e]=Lw(i[e],l):Cb(l)?i[e]=Lw({},l):xh(l)?i[e]=l.slice():(!p||!vy(l))&&(i[e]=l)};for(let l=0,c=arguments.length;l<c;l++)arguments[l]&&uv(arguments[l],n);return i}const oLi=(d,p,i,{allOwnKeys:n}={})=>(uv(p,(l,c)=>{i&&$a(l)?d[c]=d2e(l,i):d[c]=l},{allOwnKeys:n}),d),dLi=d=>(d.charCodeAt(0)===65279&&(d=d.slice(1)),d),uLi=(d,p,i,n)=>{d.prototype=Object.create(p.prototype,n),d.prototype.constructor=d,Object.defineProperty(d,"super",{value:p.prototype}),i&&Object.assign(d.prototype,i)},pLi=(d,p,i,n)=>{let l,c,e;const y={};if(p=p||{},d==null)return p;do{for(l=Object.getOwnPropertyNames(d),c=l.length;c-- >0;)e=l[c],(!n||n(e,d,p))&&!y[e]&&(p[e]=d[e],y[e]=!0);d=i!==!1&&sN(d)}while(d&&(!i||i(d,p))&&d!==Object.prototype);return p},cLi=(d,p,i)=>{d=String(d),(i===void 0||i>d.length)&&(i=d.length),i-=p.length;const n=d.indexOf(p,i);return n!==-1&&n===i},fLi=d=>{if(!d)return null;if(xh(d))return d;let p=d.length;if(!c2e(p))return null;const i=new Array(p);for(;p-- >0;)i[p]=d[p];return i},yLi=(d=>p=>d&&p instanceof d)(typeof Uint8Array<"u"&&sN(Uint8Array)),hLi=(d,p)=>{const n=(d&&d[qI]).call(d);let l;for(;(l=n.next())&&!l.done;){const c=l.value;p.call(d,c[0],c[1])}},mLi=(d,p)=>{let i;const n=[];for(;(i=d.exec(p))!==null;)n.push(i);return n},TLi=Wl("HTMLFormElement"),vLi=d=>d.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,n,l){return n.toUpperCase()+l}),N4=(({hasOwnProperty:d})=>(p,i)=>d.call(p,i))(Object.prototype),ELi=Wl("RegExp"),h2e=(d,p)=>{const i=Object.getOwnPropertyDescriptors(d),n={};uv(i,(l,c)=>{let e;(e=p(l,c,d))!==!1&&(n[c]=e||l)}),Object.defineProperties(d,n)},bLi=d=>{h2e(d,(p,i)=>{if($a(d)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const n=d[i];if($a(n)){if(p.enumerable=!1,"writable"in p){p.writable=!1;return}p.set||(p.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},ALi=(d,p)=>{const i={},n=l=>{l.forEach(c=>{i[c]=!0})};return xh(d)?n(d):n(String(d).split(p)),i},gLi=()=>{},ILi=(d,p)=>d!=null&&Number.isFinite(d=+d)?d:p;function RLi(d){return!!(d&&$a(d.append)&&d[u2e]==="FormData"&&d[qI])}const DLi=d=>{const p=new Array(10),i=(n,l)=>{if(dv(n)){if(p.indexOf(n)>=0)return;if(ov(n))return n;if(!("toJSON"in n)){p[l]=n;const c=xh(n)?[]:{};return uv(n,(e,y)=>{const T=i(e,l+1);!vy(T)&&(c[y]=T)}),p[l]=void 0,c}}return n};return i(d,0)},OLi=Wl("AsyncFunction"),wLi=d=>d&&(dv(d)||$a(d))&&$a(d.then)&&$a(d.catch),m2e=((d,p)=>d?setImmediate:p?((i,n)=>(pc.addEventListener("message",({source:l,data:c})=>{l===pc&&c===i&&n.length&&n.shift()()},!1),l=>{n.push(l),pc.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",$a(pc.postMessage)),CLi=typeof queueMicrotask<"u"?queueMicrotask.bind(pc):typeof process<"u"&&process.nextTick||m2e,_Li=d=>d!=null&&$a(d[qI]),Ue={isArray:xh,isArrayBuffer:p2e,isBuffer:ov,isFormData:tLi,isArrayBufferView:Z$i,isString:H$i,isNumber:c2e,isBoolean:W$i,isObject:dv,isPlainObject:Cb,isEmptyObject:z$i,isReadableStream:rLi,isRequest:nLi,isResponse:aLi,isHeaders:sLi,isUndefined:vy,isDate:J$i,isFile:Y$i,isBlob:X$i,isRegExp:ELi,isFunction:$a,isStream:eLi,isURLSearchParams:iLi,isTypedArray:yLi,isFileList:Q$i,forEach:uv,merge:Lw,extend:oLi,trim:lLi,stripBOM:dLi,inherits:uLi,toFlatObject:pLi,kindOf:ZI,kindOfTest:Wl,endsWith:cLi,toArray:fLi,forEachEntry:hLi,matchAll:mLi,isHTMLForm:TLi,hasOwnProperty:N4,hasOwnProp:N4,reduceDescriptors:h2e,freezeMethods:bLi,toObjectSet:ALi,toCamelCase:vLi,noop:gLi,toFiniteNumber:ILi,findKey:f2e,global:pc,isContextDefined:y2e,isSpecCompliantForm:RLi,toJSONObject:DLi,isAsyncFn:OLi,isThenable:wLi,setImmediate:m2e,asap:CLi,isIterable:_Li};function ti(d,p,i,n,l){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=d,this.name="AxiosError",p&&(this.code=p),i&&(this.config=i),n&&(this.request=n),l&&(this.response=l,this.status=l.status?l.status:null)}Ue.inherits(ti,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ue.toJSONObject(this.config),code:this.code,status:this.status}}});const T2e=ti.prototype,v2e={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(d=>{v2e[d]={value:d}});Object.defineProperties(ti,v2e);Object.defineProperty(T2e,"isAxiosError",{value:!0});ti.from=(d,p,i,n,l,c)=>{const e=Object.create(T2e);Ue.toFlatObject(d,e,function(E){return E!==Error.prototype},v=>v!=="isAxiosError");const y=d&&d.message?d.message:"Error",T=p==null&&d?d.code:p;return ti.call(e,y,T,i,n,l),d&&e.cause==null&&Object.defineProperty(e,"cause",{value:d,configurable:!0}),e.name=d&&d.name||"Error",c&&Object.assign(e,c),e};const PLi=null;function Mw(d){return Ue.isPlainObject(d)||Ue.isArray(d)}function E2e(d){return Ue.endsWith(d,"[]")?d.slice(0,-2):d}function x4(d,p,i){return d?d.concat(p).map(function(l,c){return l=E2e(l),!i&&c?"["+l+"]":l}).join(i?".":""):p}function VLi(d){return Ue.isArray(d)&&!d.some(Mw)}const NLi=Ue.toFlatObject(Ue,{},null,function(p){return/^is[A-Z]/.test(p)});function WI(d,p,i){if(!Ue.isObject(d))throw new TypeError("target must be an object");p=p||new FormData,i=Ue.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(L,U){return!Ue.isUndefined(U[L])});const n=i.metaTokens,l=i.visitor||E,c=i.dots,e=i.indexes,T=(i.Blob||typeof Blob<"u"&&Blob)&&Ue.isSpecCompliantForm(p);if(!Ue.isFunction(l))throw new TypeError("visitor must be a function");function v($){if($===null)return"";if(Ue.isDate($))return $.toISOString();if(Ue.isBoolean($))return $.toString();if(!T&&Ue.isBlob($))throw new ti("Blob is not supported. Use a Buffer instead.");return Ue.isArrayBuffer($)||Ue.isTypedArray($)?T&&typeof Blob=="function"?new Blob([$]):Buffer.from($):$}function E($,L,U){let F=$;if($&&!U&&typeof $=="object"){if(Ue.endsWith(L,"{}"))L=n?L:L.slice(0,-2),$=JSON.stringify($);else if(Ue.isArray($)&&VLi($)||(Ue.isFileList($)||Ue.endsWith(L,"[]"))&&(F=Ue.toArray($)))return L=E2e(L),F.forEach(function(X,se){!(Ue.isUndefined(X)||X===null)&&p.append(e===!0?x4([L],se,c):e===null?L:L+"[]",v(X))}),!1}return Mw($)?!0:(p.append(x4(U,L,c),v($)),!1)}const b=[],O=Object.assign(NLi,{defaultVisitor:E,convertValue:v,isVisitable:Mw});function P($,L){if(!Ue.isUndefined($)){if(b.indexOf($)!==-1)throw Error("Circular reference detected in "+L.join("."));b.push($),Ue.forEach($,function(F,Z){(!(Ue.isUndefined(F)||F===null)&&l.call(p,F,Ue.isString(Z)?Z.trim():Z,L,O))===!0&&P(F,L?L.concat(Z):[Z])}),b.pop()}}if(!Ue.isObject(d))throw new TypeError("data must be an object");return P(d),p}function $4(d){const p={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(d).replace(/[!'()~]|%20|%00/g,function(n){return p[n]})}function lN(d,p){this._pairs=[],d&&WI(d,this,p)}const b2e=lN.prototype;b2e.append=function(p,i){this._pairs.push([p,i])};b2e.toString=function(p){const i=p?function(n){return p.call(this,n,$4)}:$4;return this._pairs.map(function(l){return i(l[0])+"="+i(l[1])},"").join("&")};function xLi(d){return encodeURIComponent(d).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function A2e(d,p,i){if(!p)return d;const n=i&&i.encode||xLi;Ue.isFunction(i)&&(i={serialize:i});const l=i&&i.serialize;let c;if(l?c=l(p,i):c=Ue.isURLSearchParams(p)?p.toString():new lN(p,i).toString(n),c){const e=d.indexOf("#");e!==-1&&(d=d.slice(0,e)),d+=(d.indexOf("?")===-1?"?":"&")+c}return d}class $Li{constructor(){this.handlers=[]}use(p,i,n){return this.handlers.push({fulfilled:p,rejected:i,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(p){this.handlers[p]&&(this.handlers[p]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(p){Ue.forEach(this.handlers,function(n){n!==null&&p(n)})}}const L4=$Li,g2e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},LLi=typeof URLSearchParams<"u"?URLSearchParams:lN,MLi=typeof FormData<"u"?FormData:null,BLi=typeof Blob<"u"?Blob:null,GLi={isBrowser:!0,classes:{URLSearchParams:LLi,FormData:MLi,Blob:BLi},protocols:["http","https","file","blob","url","data"]},oN=typeof window<"u"&&typeof document<"u",Bw=typeof navigator=="object"&&navigator||void 0,ULi=oN&&(!Bw||["ReactNative","NativeScript","NS"].indexOf(Bw.product)<0),jLi=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),kLi=oN&&window.location.href||"http://localhost",KLi=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:oN,hasStandardBrowserEnv:ULi,hasStandardBrowserWebWorkerEnv:jLi,navigator:Bw,origin:kLi},Symbol.toStringTag,{value:"Module"})),Qn={...KLi,...GLi};function FLi(d,p){return WI(d,new Qn.classes.URLSearchParams,{visitor:function(i,n,l,c){return Qn.isNode&&Ue.isBuffer(i)?(this.append(n,i.toString("base64")),!1):c.defaultVisitor.apply(this,arguments)},...p})}function SLi(d){return Ue.matchAll(/\w+|\[(\w*)]/g,d).map(p=>p[0]==="[]"?"":p[1]||p[0])}function qLi(d){const p={},i=Object.keys(d);let n;const l=i.length;let c;for(n=0;n<l;n++)c=i[n],p[c]=d[c];return p}function I2e(d){function p(i,n,l,c){let e=i[c++];if(e==="__proto__")return!0;const y=Number.isFinite(+e),T=c>=i.length;return e=!e&&Ue.isArray(l)?l.length:e,T?(Ue.hasOwnProp(l,e)?l[e]=[l[e],n]:l[e]=n,!y):((!l[e]||!Ue.isObject(l[e]))&&(l[e]=[]),p(i,n,l[e],c)&&Ue.isArray(l[e])&&(l[e]=qLi(l[e])),!y)}if(Ue.isFormData(d)&&Ue.isFunction(d.entries)){const i={};return Ue.forEachEntry(d,(n,l)=>{p(SLi(n),l,i,0)}),i}return null}function ZLi(d,p,i){if(Ue.isString(d))try{return(p||JSON.parse)(d),Ue.trim(d)}catch(n){if(n.name!=="SyntaxError")throw n}return(i||JSON.stringify)(d)}const dN={transitional:g2e,adapter:["xhr","http","fetch"],transformRequest:[function(p,i){const n=i.getContentType()||"",l=n.indexOf("application/json")>-1,c=Ue.isObject(p);if(c&&Ue.isHTMLForm(p)&&(p=new FormData(p)),Ue.isFormData(p))return l?JSON.stringify(I2e(p)):p;if(Ue.isArrayBuffer(p)||Ue.isBuffer(p)||Ue.isStream(p)||Ue.isFile(p)||Ue.isBlob(p)||Ue.isReadableStream(p))return p;if(Ue.isArrayBufferView(p))return p.buffer;if(Ue.isURLSearchParams(p))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),p.toString();let y;if(c){if(n.indexOf("application/x-www-form-urlencoded")>-1)return FLi(p,this.formSerializer).toString();if((y=Ue.isFileList(p))||n.indexOf("multipart/form-data")>-1){const T=this.env&&this.env.FormData;return WI(y?{"files[]":p}:p,T&&new T,this.formSerializer)}}return c||l?(i.setContentType("application/json",!1),ZLi(p)):p}],transformResponse:[function(p){const i=this.transitional||dN.transitional,n=i&&i.forcedJSONParsing,l=this.responseType==="json";if(Ue.isResponse(p)||Ue.isReadableStream(p))return p;if(p&&Ue.isString(p)&&(n&&!this.responseType||l)){const e=!(i&&i.silentJSONParsing)&&l;try{return JSON.parse(p,this.parseReviver)}catch(y){if(e)throw y.name==="SyntaxError"?ti.from(y,ti.ERR_BAD_RESPONSE,this,null,this.response):y}}return p}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Qn.classes.FormData,Blob:Qn.classes.Blob},validateStatus:function(p){return p>=200&&p<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ue.forEach(["delete","get","head","post","put","patch"],d=>{dN.headers[d]={}});const uN=dN,HLi=Ue.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),WLi=d=>{const p={};let i,n,l;return d&&d.split(`
51
51
  `).forEach(function(e){l=e.indexOf(":"),i=e.substring(0,l).trim().toLowerCase(),n=e.substring(l+1).trim(),!(!i||p[i]&&HLi[i])&&(i==="set-cookie"?p[i]?p[i].push(n):p[i]=[n]:p[i]=p[i]?p[i]+", "+n:n)}),p},M4=Symbol("internals");function N0(d){return d&&String(d).trim().toLowerCase()}function _b(d){return d===!1||d==null?d:Ue.isArray(d)?d.map(_b):String(d)}function zLi(d){const p=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=i.exec(d);)p[n[1]]=n[2];return p}const JLi=d=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(d.trim());function ew(d,p,i,n,l){if(Ue.isFunction(n))return n.call(this,p,i);if(l&&(p=i),!!Ue.isString(p)){if(Ue.isString(n))return p.indexOf(n)!==-1;if(Ue.isRegExp(n))return n.test(p)}}function YLi(d){return d.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(p,i,n)=>i.toUpperCase()+n)}function XLi(d,p){const i=Ue.toCamelCase(" "+p);["get","set","has"].forEach(n=>{Object.defineProperty(d,n+i,{value:function(l,c,e){return this[n].call(this,p,l,c,e)},configurable:!0})})}class zI{constructor(p){p&&this.set(p)}set(p,i,n){const l=this;function c(y,T,v){const E=N0(T);if(!E)throw new Error("header name must be a non-empty string");const b=Ue.findKey(l,E);(!b||l[b]===void 0||v===!0||v===void 0&&l[b]!==!1)&&(l[b||T]=_b(y))}const e=(y,T)=>Ue.forEach(y,(v,E)=>c(v,E,T));if(Ue.isPlainObject(p)||p instanceof this.constructor)e(p,i);else if(Ue.isString(p)&&(p=p.trim())&&!JLi(p))e(WLi(p),i);else if(Ue.isObject(p)&&Ue.isIterable(p)){let y={},T,v;for(const E of p){if(!Ue.isArray(E))throw TypeError("Object iterator must return a key-value pair");y[v=E[0]]=(T=y[v])?Ue.isArray(T)?[...T,E[1]]:[T,E[1]]:E[1]}e(y,i)}else p!=null&&c(i,p,n);return this}get(p,i){if(p=N0(p),p){const n=Ue.findKey(this,p);if(n){const l=this[n];if(!i)return l;if(i===!0)return zLi(l);if(Ue.isFunction(i))return i.call(this,l,n);if(Ue.isRegExp(i))return i.exec(l);throw new TypeError("parser must be boolean|regexp|function")}}}has(p,i){if(p=N0(p),p){const n=Ue.findKey(this,p);return!!(n&&this[n]!==void 0&&(!i||ew(this,this[n],n,i)))}return!1}delete(p,i){const n=this;let l=!1;function c(e){if(e=N0(e),e){const y=Ue.findKey(n,e);y&&(!i||ew(n,n[y],y,i))&&(delete n[y],l=!0)}}return Ue.isArray(p)?p.forEach(c):c(p),l}clear(p){const i=Object.keys(this);let n=i.length,l=!1;for(;n--;){const c=i[n];(!p||ew(this,this[c],c,p,!0))&&(delete this[c],l=!0)}return l}normalize(p){const i=this,n={};return Ue.forEach(this,(l,c)=>{const e=Ue.findKey(n,c);if(e){i[e]=_b(l),delete i[c];return}const y=p?YLi(c):String(c).trim();y!==c&&delete i[c],i[y]=_b(l),n[y]=!0}),this}concat(...p){return this.constructor.concat(this,...p)}toJSON(p){const i=Object.create(null);return Ue.forEach(this,(n,l)=>{n!=null&&n!==!1&&(i[l]=p&&Ue.isArray(n)?n.join(", "):n)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([p,i])=>p+": "+i).join(`
52
52
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(p){return p instanceof this?p:new this(p)}static concat(p,...i){const n=new this(p);return i.forEach(l=>n.set(l)),n}static accessor(p){const n=(this[M4]=this[M4]={accessors:{}}).accessors,l=this.prototype;function c(e){const y=N0(e);n[y]||(XLi(l,e),n[y]=!0)}return Ue.isArray(p)?p.forEach(c):c(p),this}}zI.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ue.reduceDescriptors(zI.prototype,({value:d},p)=>{let i=p[0].toUpperCase()+p.slice(1);return{get:()=>d,set(n){this[i]=n}}});Ue.freezeMethods(zI);const hl=zI;function tw(d,p){const i=this||uN,n=p||i,l=hl.from(n.headers);let c=n.data;return Ue.forEach(d,function(y){c=y.call(i,c,l.normalize(),p?p.status:void 0)}),l.normalize(),c}function R2e(d){return!!(d&&d.__CANCEL__)}function $h(d,p,i){ti.call(this,d??"canceled",ti.ERR_CANCELED,p,i),this.name="CanceledError"}Ue.inherits($h,ti,{__CANCEL__:!0});function D2e(d,p,i){const n=i.config.validateStatus;!i.status||!n||n(i.status)?d(i):p(new ti("Request failed with status code "+i.status,[ti.ERR_BAD_REQUEST,ti.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function QLi(d){const p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(d);return p&&p[1]||""}function e2i(d,p){d=d||10;const i=new Array(d),n=new Array(d);let l=0,c=0,e;return p=p!==void 0?p:1e3,function(T){const v=Date.now(),E=n[c];e||(e=v),i[l]=T,n[l]=v;let b=c,O=0;for(;b!==l;)O+=i[b++],b=b%d;if(l=(l+1)%d,l===c&&(c=(c+1)%d),v-e<p)return;const P=E&&v-E;return P?Math.round(O*1e3/P):void 0}}function t2i(d,p){let i=0,n=1e3/p,l,c;const e=(v,E=Date.now())=>{i=E,l=null,c&&(clearTimeout(c),c=null),d(...v)};return[(...v)=>{const E=Date.now(),b=E-i;b>=n?e(v,E):(l=v,c||(c=setTimeout(()=>{c=null,e(l)},n-b)))},()=>l&&e(l)]}const Qb=(d,p,i=3)=>{let n=0;const l=e2i(50,250);return t2i(c=>{const e=c.loaded,y=c.lengthComputable?c.total:void 0,T=e-n,v=l(T),E=e<=y;n=e;const b={loaded:e,total:y,progress:y?e/y:void 0,bytes:T,rate:v||void 0,estimated:v&&y&&E?(y-e)/v:void 0,event:c,lengthComputable:y!=null,[p?"download":"upload"]:!0};d(b)},i)},B4=(d,p)=>{const i=d!=null;return[n=>p[0]({lengthComputable:i,total:d,loaded:n}),p[1]]},G4=d=>(...p)=>Ue.asap(()=>d(...p)),i2i=Qn.hasStandardBrowserEnv?((d,p)=>i=>(i=new URL(i,Qn.origin),d.protocol===i.protocol&&d.host===i.host&&(p||d.port===i.port)))(new URL(Qn.origin),Qn.navigator&&/(msie|trident)/i.test(Qn.navigator.userAgent)):()=>!0,r2i=Qn.hasStandardBrowserEnv?{write(d,p,i,n,l,c,e){if(typeof document>"u")return;const y=[`${d}=${encodeURIComponent(p)}`];Ue.isNumber(i)&&y.push(`expires=${new Date(i).toUTCString()}`),Ue.isString(n)&&y.push(`path=${n}`),Ue.isString(l)&&y.push(`domain=${l}`),c===!0&&y.push("secure"),Ue.isString(e)&&y.push(`SameSite=${e}`),document.cookie=y.join("; ")},read(d){if(typeof document>"u")return null;const p=document.cookie.match(new RegExp("(?:^|; )"+d+"=([^;]*)"));return p?decodeURIComponent(p[1]):null},remove(d){this.write(d,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function n2i(d){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(d)}function a2i(d,p){return p?d.replace(/\/?\/$/,"")+"/"+p.replace(/^\/+/,""):d}function O2e(d,p,i){let n=!n2i(p);return d&&(n||i==!1)?a2i(d,p):p}const U4=d=>d instanceof hl?{...d}:d;function Tc(d,p){p=p||{};const i={};function n(v,E,b,O){return Ue.isPlainObject(v)&&Ue.isPlainObject(E)?Ue.merge.call({caseless:O},v,E):Ue.isPlainObject(E)?Ue.merge({},E):Ue.isArray(E)?E.slice():E}function l(v,E,b,O){if(Ue.isUndefined(E)){if(!Ue.isUndefined(v))return n(void 0,v,b,O)}else return n(v,E,b,O)}function c(v,E){if(!Ue.isUndefined(E))return n(void 0,E)}function e(v,E){if(Ue.isUndefined(E)){if(!Ue.isUndefined(v))return n(void 0,v)}else return n(void 0,E)}function y(v,E,b){if(b in p)return n(v,E);if(b in d)return n(void 0,v)}const T={url:c,method:c,data:c,baseURL:e,transformRequest:e,transformResponse:e,paramsSerializer:e,timeout:e,timeoutMessage:e,withCredentials:e,withXSRFToken:e,adapter:e,responseType:e,xsrfCookieName:e,xsrfHeaderName:e,onUploadProgress:e,onDownloadProgress:e,decompress:e,maxContentLength:e,maxBodyLength:e,beforeRedirect:e,transport:e,httpAgent:e,httpsAgent:e,cancelToken:e,socketPath:e,responseEncoding:e,validateStatus:y,headers:(v,E,b)=>l(U4(v),U4(E),b,!0)};return Ue.forEach(Object.keys({...d,...p}),function(E){const b=T[E]||l,O=b(d[E],p[E],E);Ue.isUndefined(O)&&b!==y||(i[E]=O)}),i}const w2e=d=>{const p=Tc({},d);let{data:i,withXSRFToken:n,xsrfHeaderName:l,xsrfCookieName:c,headers:e,auth:y}=p;if(p.headers=e=hl.from(e),p.url=A2e(O2e(p.baseURL,p.url,p.allowAbsoluteUrls),d.params,d.paramsSerializer),y&&e.set("Authorization","Basic "+btoa((y.username||"")+":"+(y.password?unescape(encodeURIComponent(y.password)):""))),Ue.isFormData(i)){if(Qn.hasStandardBrowserEnv||Qn.hasStandardBrowserWebWorkerEnv)e.setContentType(void 0);else if(Ue.isFunction(i.getHeaders)){const T=i.getHeaders(),v=["content-type","content-length"];Object.entries(T).forEach(([E,b])=>{v.includes(E.toLowerCase())&&e.set(E,b)})}}if(Qn.hasStandardBrowserEnv&&(n&&Ue.isFunction(n)&&(n=n(p)),n||n!==!1&&i2i(p.url))){const T=l&&c&&r2i.read(c);T&&e.set(l,T)}return p},s2i=typeof XMLHttpRequest<"u",l2i=s2i&&function(d){return new Promise(function(i,n){const l=w2e(d);let c=l.data;const e=hl.from(l.headers).normalize();let{responseType:y,onUploadProgress:T,onDownloadProgress:v}=l,E,b,O,P,$;function L(){P&&P(),$&&$(),l.cancelToken&&l.cancelToken.unsubscribe(E),l.signal&&l.signal.removeEventListener("abort",E)}let U=new XMLHttpRequest;U.open(l.method.toUpperCase(),l.url,!0),U.timeout=l.timeout;function F(){if(!U)return;const X=hl.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),Q={data:!y||y==="text"||y==="json"?U.responseText:U.response,status:U.status,statusText:U.statusText,headers:X,config:d,request:U};D2e(function(de){i(de),L()},function(de){n(de),L()},Q),U=null}"onloadend"in U?U.onloadend=F:U.onreadystatechange=function(){!U||U.readyState!==4||U.status===0&&!(U.responseURL&&U.responseURL.indexOf("file:")===0)||setTimeout(F)},U.onabort=function(){U&&(n(new ti("Request aborted",ti.ECONNABORTED,d,U)),U=null)},U.onerror=function(se){const Q=se&&se.message?se.message:"Network Error",fe=new ti(Q,ti.ERR_NETWORK,d,U);fe.event=se||null,n(fe),U=null},U.ontimeout=function(){let se=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded";const Q=l.transitional||g2e;l.timeoutErrorMessage&&(se=l.timeoutErrorMessage),n(new ti(se,Q.clarifyTimeoutError?ti.ETIMEDOUT:ti.ECONNABORTED,d,U)),U=null},c===void 0&&e.setContentType(null),"setRequestHeader"in U&&Ue.forEach(e.toJSON(),function(se,Q){U.setRequestHeader(Q,se)}),Ue.isUndefined(l.withCredentials)||(U.withCredentials=!!l.withCredentials),y&&y!=="json"&&(U.responseType=l.responseType),v&&([O,$]=Qb(v,!0),U.addEventListener("progress",O)),T&&U.upload&&([b,P]=Qb(T),U.upload.addEventListener("progress",b),U.upload.addEventListener("loadend",P)),(l.cancelToken||l.signal)&&(E=X=>{U&&(n(!X||X.type?new $h(null,d,U):X),U.abort(),U=null)},l.cancelToken&&l.cancelToken.subscribe(E),l.signal&&(l.signal.aborted?E():l.signal.addEventListener("abort",E)));const Z=QLi(l.url);if(Z&&Qn.protocols.indexOf(Z)===-1){n(new ti("Unsupported protocol "+Z+":",ti.ERR_BAD_REQUEST,d));return}U.send(c||null)})},o2i=(d,p)=>{const{length:i}=d=d?d.filter(Boolean):[];if(p||i){let n=new AbortController,l;const c=function(v){if(!l){l=!0,y();const E=v instanceof Error?v:this.reason;n.abort(E instanceof ti?E:new $h(E instanceof Error?E.message:E))}};let e=p&&setTimeout(()=>{e=null,c(new ti(`timeout ${p} of ms exceeded`,ti.ETIMEDOUT))},p);const y=()=>{d&&(e&&clearTimeout(e),e=null,d.forEach(v=>{v.unsubscribe?v.unsubscribe(c):v.removeEventListener("abort",c)}),d=null)};d.forEach(v=>v.addEventListener("abort",c));const{signal:T}=n;return T.unsubscribe=()=>Ue.asap(y),T}},d2i=o2i,u2i=function*(d,p){let i=d.byteLength;if(!p||i<p){yield d;return}let n=0,l;for(;n<i;)l=n+p,yield d.slice(n,l),n=l},p2i=async function*(d,p){for await(const i of c2i(d))yield*u2i(i,p)},c2i=async function*(d){if(d[Symbol.asyncIterator]){yield*d;return}const p=d.getReader();try{for(;;){const{done:i,value:n}=await p.read();if(i)break;yield n}}finally{await p.cancel()}},j4=(d,p,i,n)=>{const l=p2i(d,p);let c=0,e,y=T=>{e||(e=!0,n&&n(T))};return new ReadableStream({async pull(T){try{const{done:v,value:E}=await l.next();if(v){y(),T.close();return}let b=E.byteLength;if(i){let O=c+=b;i(O)}T.enqueue(new Uint8Array(E))}catch(v){throw y(v),v}},cancel(T){return y(T),l.return()}},{highWaterMark:2})},k4=64*1024,{isFunction:Ib}=Ue,f2i=(({Request:d,Response:p})=>({Request:d,Response:p}))(Ue.global),{ReadableStream:K4,TextEncoder:F4}=Ue.global,S4=(d,...p)=>{try{return!!d(...p)}catch{return!1}},y2i=d=>{d=Ue.merge.call({skipUndefined:!0},f2i,d);const{fetch:p,Request:i,Response:n}=d,l=p?Ib(p):typeof fetch=="function",c=Ib(i),e=Ib(n);if(!l)return!1;const y=l&&Ib(K4),T=l&&(typeof F4=="function"?($=>L=>$.encode(L))(new F4):async $=>new Uint8Array(await new i($).arrayBuffer())),v=c&&y&&S4(()=>{let $=!1;const L=new i(Qn.origin,{body:new K4,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type");return $&&!L}),E=e&&y&&S4(()=>Ue.isReadableStream(new n("").body)),b={stream:E&&($=>$.body)};l&&["text","arrayBuffer","blob","formData","stream"].forEach($=>{!b[$]&&(b[$]=(L,U)=>{let F=L&&L[$];if(F)return F.call(L);throw new ti(`Response type '${$}' is not supported`,ti.ERR_NOT_SUPPORT,U)})});const O=async $=>{if($==null)return 0;if(Ue.isBlob($))return $.size;if(Ue.isSpecCompliantForm($))return(await new i(Qn.origin,{method:"POST",body:$}).arrayBuffer()).byteLength;if(Ue.isArrayBufferView($)||Ue.isArrayBuffer($))return $.byteLength;if(Ue.isURLSearchParams($)&&($=$+""),Ue.isString($))return(await T($)).byteLength},P=async($,L)=>{const U=Ue.toFiniteNumber($.getContentLength());return U??O(L)};return async $=>{let{url:L,method:U,data:F,signal:Z,cancelToken:X,timeout:se,onDownloadProgress:Q,onUploadProgress:fe,responseType:de,headers:ce,withCredentials:me="same-origin",fetchOptions:ae}=w2e($),ye=p||fetch;de=de?(de+"").toLowerCase():"text";let _e=d2i([Z,X&&X.toAbortSignal()],se),Ve=null;const Be=_e&&_e.unsubscribe&&(()=>{_e.unsubscribe()});let xe;try{if(fe&&v&&U!=="get"&&U!=="head"&&(xe=await P(ce,F))!==0){let ot=new i(L,{method:"POST",body:F,duplex:"half"}),dt;if(Ue.isFormData(F)&&(dt=ot.headers.get("content-type"))&&ce.setContentType(dt),ot.body){const[Ft,wt]=B4(xe,Qb(G4(fe)));F=j4(ot.body,k4,Ft,wt)}}Ue.isString(me)||(me=me?"include":"omit");const Me=c&&"credentials"in i.prototype,We={...ae,signal:_e,method:U.toUpperCase(),headers:ce.normalize().toJSON(),body:F,duplex:"half",credentials:Me?me:void 0};Ve=c&&new i(L,We);let Fe=await(c?ye(Ve,ae):ye(L,We));const qe=E&&(de==="stream"||de==="response");if(E&&(Q||qe&&Be)){const ot={};["status","statusText","headers"].forEach(Ei=>{ot[Ei]=Fe[Ei]});const dt=Ue.toFiniteNumber(Fe.headers.get("content-length")),[Ft,wt]=Q&&B4(dt,Qb(G4(Q),!0))||[];Fe=new n(j4(Fe.body,k4,Ft,()=>{wt&&wt(),Be&&Be()}),ot)}de=de||"text";let et=await b[Ue.findKey(b,de)||"text"](Fe,$);return!qe&&Be&&Be(),await new Promise((ot,dt)=>{D2e(ot,dt,{data:et,headers:hl.from(Fe.headers),status:Fe.status,statusText:Fe.statusText,config:$,request:Ve})})}catch(Me){throw Be&&Be(),Me&&Me.name==="TypeError"&&/Load failed|fetch/i.test(Me.message)?Object.assign(new ti("Network Error",ti.ERR_NETWORK,$,Ve),{cause:Me.cause||Me}):ti.from(Me,Me&&Me.code,$,Ve)}}},h2i=new Map,C2e=d=>{let p=d&&d.env||{};const{fetch:i,Request:n,Response:l}=p,c=[n,l,i];let e=c.length,y=e,T,v,E=h2i;for(;y--;)T=c[y],v=E.get(T),v===void 0&&E.set(T,v=y?new Map:y2i(p)),E=v;return v};C2e();const pN={http:PLi,xhr:l2i,fetch:{get:C2e}};Ue.forEach(pN,(d,p)=>{if(d){try{Object.defineProperty(d,"name",{value:p})}catch{}Object.defineProperty(d,"adapterName",{value:p})}});const q4=d=>`- ${d}`,m2i=d=>Ue.isFunction(d)||d===null||d===!1;function T2i(d,p){d=Ue.isArray(d)?d:[d];const{length:i}=d;let n,l;const c={};for(let e=0;e<i;e++){n=d[e];let y;if(l=n,!m2i(n)&&(l=pN[(y=String(n)).toLowerCase()],l===void 0))throw new ti(`Unknown adapter '${y}'`);if(l&&(Ue.isFunction(l)||(l=l.get(p))))break;c[y||"#"+e]=l}if(!l){const e=Object.entries(c).map(([T,v])=>`adapter ${T} `+(v===!1?"is not supported by the environment":"is not available in the build"));let y=i?e.length>1?`since :
53
53
  `+e.map(q4).join(`
54
54
  `):" "+q4(e[0]):"as no adapter specified";throw new ti("There is no suitable adapter to dispatch the request "+y,"ERR_NOT_SUPPORT")}return l}const _2e={getAdapter:T2i,adapters:pN};function iw(d){if(d.cancelToken&&d.cancelToken.throwIfRequested(),d.signal&&d.signal.aborted)throw new $h(null,d)}function Z4(d){return iw(d),d.headers=hl.from(d.headers),d.data=tw.call(d,d.transformRequest),["post","put","patch"].indexOf(d.method)!==-1&&d.headers.setContentType("application/x-www-form-urlencoded",!1),_2e.getAdapter(d.adapter||uN.adapter,d)(d).then(function(n){return iw(d),n.data=tw.call(d,d.transformResponse,n),n.headers=hl.from(n.headers),n},function(n){return R2e(n)||(iw(d),n&&n.response&&(n.response.data=tw.call(d,d.transformResponse,n.response),n.response.headers=hl.from(n.response.headers))),Promise.reject(n)})}const P2e="1.13.2",JI={};["object","boolean","number","function","string","symbol"].forEach((d,p)=>{JI[d]=function(n){return typeof n===d||"a"+(p<1?"n ":" ")+d}});const H4={};JI.transitional=function(p,i,n){function l(c,e){return"[Axios v"+P2e+"] Transitional option '"+c+"'"+e+(n?". "+n:"")}return(c,e,y)=>{if(p===!1)throw new ti(l(e," has been removed"+(i?" in "+i:"")),ti.ERR_DEPRECATED);return i&&!H4[e]&&(H4[e]=!0,console.warn(l(e," has been deprecated since v"+i+" and will be removed in the near future"))),p?p(c,e,y):!0}};JI.spelling=function(p){return(i,n)=>(console.warn(`${n} is likely a misspelling of ${p}`),!0)};function v2i(d,p,i){if(typeof d!="object")throw new ti("options must be an object",ti.ERR_BAD_OPTION_VALUE);const n=Object.keys(d);let l=n.length;for(;l-- >0;){const c=n[l],e=p[c];if(e){const y=d[c],T=y===void 0||e(y,c,d);if(T!==!0)throw new ti("option "+c+" must be "+T,ti.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new ti("Unknown option "+c,ti.ERR_BAD_OPTION)}}const Pb={assertOptions:v2i,validators:JI},fo=Pb.validators;class eA{constructor(p){this.defaults=p||{},this.interceptors={request:new L4,response:new L4}}async request(p,i){try{return await this._request(p,i)}catch(n){if(n instanceof Error){let l={};Error.captureStackTrace?Error.captureStackTrace(l):l=new Error;const c=l.stack?l.stack.replace(/^.+\n/,""):"";try{n.stack?c&&!String(n.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(n.stack+=`
55
- `+c):n.stack=c}catch{}}throw n}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=Tc(this.defaults,i);const{transitional:n,paramsSerializer:l,headers:c}=i;n!==void 0&&Pb.assertOptions(n,{silentJSONParsing:fo.transitional(fo.boolean),forcedJSONParsing:fo.transitional(fo.boolean),clarifyTimeoutError:fo.transitional(fo.boolean)},!1),l!=null&&(Ue.isFunction(l)?i.paramsSerializer={serialize:l}:Pb.assertOptions(l,{encode:fo.function,serialize:fo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Pb.assertOptions(i,{baseUrl:fo.spelling("baseURL"),withXsrfToken:fo.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&Ue.merge(c.common,c[i.method]);c&&Ue.forEach(["delete","get","head","post","put","patch","common"],$=>{delete c[$]}),i.headers=hl.concat(e,c);const y=[];let T=!0;this.interceptors.request.forEach(function(L){typeof L.runWhen=="function"&&L.runWhen(i)===!1||(T=T&&L.synchronous,y.unshift(L.fulfilled,L.rejected))});const v=[];this.interceptors.response.forEach(function(L){v.push(L.fulfilled,L.rejected)});let E,b=0,O;if(!T){const $=[Z4.bind(this),void 0];for($.unshift(...y),$.push(...v),O=$.length,E=Promise.resolve(i);b<O;)E=E.then($[b++],$[b++]);return E}O=y.length;let P=i;for(;b<O;){const $=y[b++],L=y[b++];try{P=$(P)}catch(U){L.call(this,U);break}}try{E=Z4.call(this,P)}catch($){return Promise.reject($)}for(b=0,O=v.length;b<O;)E=E.then(v[b++],v[b++]);return E}getUri(p){p=Tc(this.defaults,p);const i=O2e(p.baseURL,p.url,p.allowAbsoluteUrls);return A2e(i,p.params,p.paramsSerializer)}}Ue.forEach(["delete","get","head","options"],function(p){eA.prototype[p]=function(i,n){return this.request(Tc(n||{},{method:p,url:i,data:(n||{}).data}))}});Ue.forEach(["post","put","patch"],function(p){function i(n){return function(c,e,y){return this.request(Tc(y||{},{method:p,headers:n?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}eA.prototype[p]=i(),eA.prototype[p+"Form"]=i(!0)});const Vb=eA;class cN{constructor(p){if(typeof p!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const n=this;this.promise.then(l=>{if(!n._listeners)return;let c=n._listeners.length;for(;c-- >0;)n._listeners[c](l);n._listeners=null}),this.promise.then=l=>{let c;const e=new Promise(y=>{n.subscribe(y),c=y}).then(l);return e.cancel=function(){n.unsubscribe(c)},e},p(function(c,e,y){n.reason||(n.reason=new $h(c,e,y),i(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(p){if(this.reason){p(this.reason);return}this._listeners?this._listeners.push(p):this._listeners=[p]}unsubscribe(p){if(!this._listeners)return;const i=this._listeners.indexOf(p);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const p=new AbortController,i=n=>{p.abort(n)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new cN(function(l){p=l}),cancel:p}}}const E2i=cN;function b2i(d){return function(i){return d.apply(null,i)}}function A2i(d){return Ue.isObject(d)&&d.isAxiosError===!0}const Gw={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Gw).forEach(([d,p])=>{Gw[p]=d});const g2i=Gw;function V2e(d){const p=new Vb(d),i=d2e(Vb.prototype.request,p);return Ue.extend(i,Vb.prototype,p,{allOwnKeys:!0}),Ue.extend(i,p,null,{allOwnKeys:!0}),i.create=function(l){return V2e(Tc(d,l))},i}const mn=V2e(uN);mn.Axios=Vb;mn.CanceledError=$h;mn.CancelToken=E2i;mn.isCancel=R2e;mn.VERSION=P2e;mn.toFormData=WI;mn.AxiosError=ti;mn.Cancel=mn.CanceledError;mn.all=function(p){return Promise.all(p)};mn.spread=b2i;mn.isAxiosError=A2i;mn.mergeConfig=Tc;mn.AxiosHeaders=hl;mn.formToJSON=d=>I2e(Ue.isHTMLForm(d)?new FormData(d):d);mn.getAdapter=_2e.getAdapter;mn.HttpStatusCode=g2i;mn.default=mn;const I2i=mn;class N2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Hn.HttpRequest);l&&(l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[3]||{},e={method:l[0],url:l[1],params:l[2],headers:c,data:l[4]};te.Logger.log("Axios request config: ",e);const y=await I2i(e);return{value:G.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}const W4=Symbol("missing"),R2i=d=>d!=null&&typeof d=="object";function pv(d,p){if(typeof d!="string")throw new TypeError(`${p} expects the key to be a string.`);return d}function Lh(d,p){if(typeof d!="string"&&!Array.isArray(d))throw new TypeError(`${p} expects the path to be string or array.`);return d}function Xc(d,p){if(!mr(d))throw new TypeError(`${p} expects the first argument to be an object.`);return d??{}}function x2e(d,p){const i=pv(p,"ReadKey");return(d??{})[i]}function $2e(d,p,i){const n=pv(p,"WriteKey"),l=av(d??{});return l[n]=i,l}function L2e(d,p){const i=pv(p,"DeleteKey"),n=av(d??{});return delete n[i],n}function M2e(d,p,i){const n=Xc(d,"ReadNestedKey"),l=Lh(p,"ReadNestedKey");return HV(n,l,i)}function B2e(d,p,i){const n=Xc(d,"WriteNestedKey"),l=Lh(p,"WriteNestedKey"),c=av(n);return WV(c,l,!1),cPe(c,l,i,{createMissing:!1})}function G2e(d,p,i){const n=Xc(d,"WriteSafeNestedKeyRecursively"),l=Lh(p,"WriteSafeNestedKeyRecursively"),c=av(n);return WV(c,l,!0),cPe(c,l,i,{createMissing:!0})}function U2e(d,p){const i=Xc(d,"DeleteNestedKey"),n=Lh(p,"DeleteNestedKey"),l=av(i),{target:c,lastKey:e}=WV(l,n,!1);return delete c[e],l}function j2e(d,p){const i=pv(p,"HasKey"),n=d;return n!=null&&R2i(n)&&Object.prototype.hasOwnProperty.call(n,i)}function k2e(d,p,i){const n=pv(p,"KeyValueEquals");return d==null||typeof d!="object"?!1:d[n]===i}function K2e(d,p){const i=d,n=Lh(p,"HasNestedKey");return HV(i,n,W4)!==W4}function F2e(d,p,i){const n=Lh(p,"NestedKeyValueEquals");return HV(d,n)===i}function S2e(...d){const p={};for(let i=0;i<d.length;i++){const n=d[i];if(n!=null){if(!mr(n))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,n)}}return p}function q2e(d){const p=Xc(d,"ObjectKeys");return Object.keys(p)}function Z2e(d){const p=Xc(d,"ObjectValues");return Object.values(p)}function H2e(d){const p=Xc(d,"ObjectEntries");return Object.entries(p)}class W2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.Validate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)});te.Logger.log("Inputs for entity validation: ",l);const e=DI(l[1]).safeParse(l[0]);return e.success?{value:G.Success,error:null,result:{data:l[0]}}:{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e.error.errors,result:null}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}const ga=d=>d.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class z2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.ReadKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ga(n),e=x2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class J2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.WriteKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=$2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class Y2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.DeleteKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ga(n),e=L2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class X2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.ReadNestedKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=M2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class Q2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY,version:"1.0.0",description:"Entity write-nested-key operation implementation module (immutable, no auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.WriteNestedKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=B2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class eMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY,version:"1.0.0",description:"Entity write-safe-nested-key-recursively operation implementation module (immutable, auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.WriteSafeNestedKeyRecursively);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=G2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class tMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.DeleteNestedKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ga(n),e=U2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class iMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.HasKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ga(n),e=j2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class rMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.KeyValueEquals);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=k2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class nMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.HasNestedKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ga(n),e=K2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class aMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.NestedKeyValueEquals);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=F2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class sMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.IsInstanceOfType);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{var l,c,e,y,T,v,E,b,O,P;try{const $=((c=(l=n[0])==null?void 0:l.value)==null?void 0:c.parent)||((y=(e=n[0])==null?void 0:e.value)==null?void 0:y.standaloneParent),L=(v=(T=n[0])==null?void 0:T.value)==null?void 0:v.value,U=(b=(E=n[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!L)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!U)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(U.type!==o.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const F=$.getDataType(null);if(((O=F==null?void 0:F.entity)==null?void 0:O.type)!==o.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let Z=!1;return((P=F==null?void 0:F.entity)==null?void 0:P.id)!==(U==null?void 0:U.id)?Z=!1:DI(F==null?void 0:F.entity).safeParse(L).success?Z=!0:Z=!1,{value:G.Success,error:null,result:Z}}catch($){return{value:G.UnhandledError,error:$,result:null}}}})}}class lMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Ce.Merge);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ga(n),c=S2e(...l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class oMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Ce.Keys);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ga(n),c=q2e(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class dMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Ce.Values);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ga(n),c=Z2e(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class uMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Ce.Entries);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ga(n),c=H2e(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}let ns=null;try{ns=require("crypto")}catch{}const Om=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:ns&&ns.webcrypto?ns.webcrypto:null,mu=Om?Om.subtle:null;function Mm(d){const p=new ArrayBuffer(d.byteLength);return new Uint8Array(p).set(d),p}function qr(d,p="utf8"){if(d instanceof Uint8Array)return d;const i=String(d);if(p==="utf8"){if(typeof TextEncoder<"u")return new TextEncoder().encode(i);if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"utf8"))}else if(p==="hex"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"hex"))}else if(p==="base64"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"base64"))}else if(p==="base64url"){const n=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(n,"base64"));const l=typeof atob=="function"?atob(n):"",c=new Uint8Array(l.length);for(let e=0;e<l.length;e++)c[e]=l.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function zl(d,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(d);if(typeof Buffer<"u")return Buffer.from(d).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(d).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(d).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(d).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const pMe=d=>qr(d,"base64"),cMe=(d,p)=>{const i=d instanceof Uint8Array?d:qr(String(d),p||"utf8");return zl(i,"base64")},Ey=(d,p)=>{const i=d instanceof Uint8Array?d:qr(String(d),p||"utf8");return zl(i,"base64url")},vc=d=>qr(d,"base64url"),fMe=(d,p)=>{const i=d instanceof Uint8Array?d:qr(String(d),p||"utf8");return zl(i,"hex")},yMe=d=>qr(d,"hex");function fN(d){if(Om&&Om.getRandomValues){const p=new Uint8Array(d);return Om.getRandomValues(p),p}if(ns&&ns.randomBytes)return new Uint8Array(ns.randomBytes(d));throw new Error("Secure random not available")}function YI(d,p){if(!(d instanceof Uint8Array)||!(p instanceof Uint8Array)||d.length!==p.length)return!1;let i=0;for(let n=0;n<d.length;n++)i|=d[n]^p[n];return i===0}function hMe(d,p,i,n){if((typeof d!="string"||typeof p!="string")&&typeof d!="string"&&typeof p!="string")throw new Error("Invalid input types");const l=i??"utf8",c=n??"utf8",e=qr(d??"",l),y=qr(p??"",c);return YI(e,y)}async function mMe(d,p){if(mu){const i=await mu.digest({name:d},Mm(p));return new Uint8Array(i)}if(ns){const i=d.replace("SHA-","sha"),n=ns.createHash(i);return n.update(Buffer.from(p)),new Uint8Array(n.digest())}throw new Error("Hash not available")}async function TMe(d,p,i,n){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const l=String(d??"SHA-256"),c=i??"utf8",e=n??"base64url",y=qr(p??"",c),T=await mMe(l,y);return zl(T,e)}async function XI(d,p,i){if(mu){const n=await mu.importKey("raw",Mm(p),{name:"HMAC",hash:{name:d}},!1,["sign"]),l=await mu.sign("HMAC",n,Mm(i));return new Uint8Array(l)}if(ns){const n=`sha${d.split("-")[1]}`,l=ns.createHmac(n,Buffer.from(p));return l.update(Buffer.from(i)),new Uint8Array(l.digest())}throw new Error("HMAC not available")}async function vMe(d,p,i,n,l,c){if(typeof d!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),y=n??"utf8",T=l??"utf8",v=c??"base64url",E=qr(d??"",y),b=qr(p??"",T),O=await XI(e,E,b);return zl(O,v)}async function QI(d,p,{iterations:i,length:n,hashAlg:l="SHA-256"}){if(mu){const c=await mu.importKey("raw",Mm(d),"PBKDF2",!1,["deriveBits"]),e=await mu.deriveBits({name:"PBKDF2",salt:Mm(p),iterations:i,hash:l},c,n*8);return new Uint8Array(e)}if(ns){const c=l==="SHA-512"?"sha512":"sha256";return await new Promise((e,y)=>{ns.pbkdf2(Buffer.from(d),Buffer.from(p),i,n,c,(T,v)=>{T?y(T):e(new Uint8Array(v))})})}throw new Error("PBKDF2 not available")}async function EMe(d,p,i,n,l,c,e,y){if(typeof d!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const T=c??"utf8",v=e??"utf8",E=y??"base64url",b=Math.max(1,Number(i)||21e4),O=Math.max(1,Number(n)||32),P=l??"SHA-256",$=qr(d??"",T),L=qr(p??"",v),U=await QI($,L,{iterations:b,length:O,hashAlg:P});return zl(U,E)}async function bMe(d,p=fN(16),i=21e4,n=32,l="SHA-256"){const c=qr(d,"utf8"),e=await QI(c,p,{iterations:i,length:n,hashAlg:l}),y=Ey(p),T=Ey(e);return`pbkdf2$${l.toLowerCase()}$${i}$${y}$${T}`}async function AMe(d,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const n=i[1].toLowerCase(),l=parseInt(i[2],10),c=vc(i[3]),e=vc(i[4]),y=n.includes("512")?"SHA-512":"SHA-256",T=await QI(qr(d,"utf8"),c,{iterations:l,length:e.length,hashAlg:y});return YI(T,e)}async function gMe(d,p,i,n,l,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,y=i!=null?Math.max(1,Number(i)||0):void 0,T=n??void 0,v=c??"base64url",E=l!=null?qr(l,v):void 0;return await bMe(String(d??""),E,e,y,T)}function z4(d){return Ey(qr(JSON.stringify(d),"utf8"))}function tA(d){try{return JSON.parse(zl(vc(d),"utf8"))}catch{return null}}async function IMe(d,p,{alg:i="HS256",includeIat:n=!0,expiresInSeconds:l,notBeforeSeconds:c,issuer:e,subject:y,audience:T,jwtid:v,header:E={}}={}){const b={alg:i,typ:"JWT",...E},O=Math.floor(Date.now()/1e3),P={...d||{}};n&&(P.iat=O),typeof l=="number"&&(P.exp=O+l),typeof c=="number"&&(P.nbf=O+c),e&&(P.iss=e),y&&(P.sub=y),T&&(P.aud=T),v&&(P.jti=v);const $=z4(b),L=z4(P),U=qr(`${$}.${L}`,"utf8"),Z=await XI(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,U),X=Ey(Z);return`${$}.${L}.${X}`}async function RMe(d,p,i,n,l,c,e,y,T,v,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(d!=null&&typeof d!="object")throw new Error("Invalid input type for payload; expected object");if(E!=null&&typeof E!="object")throw new Error("Invalid input type for header; expected object");if(v!=null&&typeof v!="string")throw new Error("Invalid input type for jwtid; expected string");if(e!=null&&typeof e!="string")throw new Error("Invalid input type for issuer; expected string");if(y!=null&&typeof y!="string")throw new Error("Invalid input type for subject; expected string");if(T!=null&&typeof T!="string"&&!Array.isArray(T))throw new Error("Invalid input type for audience; expected string or string[]");const P=qr(p??"",b??"utf8");return await IMe(d??{},P,{alg:i??"HS256",includeIat:n==null?!0:!!n,expiresInSeconds:l!=null?Number(l):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:y??void 0,audience:T??void 0,jwtid:v??void 0,header:E??void 0})}async function DMe(d,p,{alg:i="HS256",issuer:n,audience:l,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[y,T,v]=String(d).split(".");if(!y||!T||!v)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=tA(y),b=tA(T);if(!E||!b)return{valid:!1,header:E,payload:b,reason:"Bad base64/json"};if(E.alg!==i)return{valid:!1,header:E,payload:b,reason:"Alg mismatch"};const O=qr(`${y}.${T}`,"utf8"),$=await XI(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,O),L=vc(v);if(!YI($,L))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const U=Math.floor(Date.now()/1e3),F=Math.max(0,Number(e)||0);if(b.nbf!=null&&U+F<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&U-F>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(n&&b.iss!==n)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(l){const Z=b.aud;if(!(Array.isArray(Z)?Z.includes(l):Z===l))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&U-Number(b.iat)>Number(c)+F?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(y){return{valid:!1,header:null,payload:null,reason:String((y==null?void 0:y.message)??y)}}}async function OMe(d,p,i,n,l,c,e,y){if(typeof d!="string")throw new Error("Invalid input type for token; expected string");if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(typeof n!="string")throw new Error("Invalid input type for issuer; expected string");if(l!=null&&typeof l!="string")throw new Error("Invalid input type for audience; expected string");const v=qr(p??"",y??"utf8");return await DMe(String(d??""),v,{alg:i??"HS256",issuer:n??void 0,audience:l??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function wMe(d){const[p,i,n]=String(d).split(".");return{header:p?tA(p):null,payload:i?tA(i):null,signature:n?vc(n):new Uint8Array}}function CMe(d,p){if(!d)throw new Error("Token is required for decoding");if(typeof d!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:n,payload:l,signature:c}=wMe(String(d??"")),e=zl(c,i);return{header:n,payload:l,signature:e}}class _Me extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Xe.GenerateRandomBytes);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)}),e=Math.max(0,Number(l)||0),y=c??"base64url",T=fN(e),v=zl(T,y);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class PMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomInteger);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=ixe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class VMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomFloat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=SI();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class NMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomHexadecimal);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=eN(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class xMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomBase62);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=tN(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class $Me extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=nxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class LMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomAlphanumeric);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=iN(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class MMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateIdentifier);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=rN(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class BMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomUUIDv4);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=hu();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class GMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{te.Logger.log("Initializing Random Generate Short Identifier Module");const n=i.find(l=>l.contextType===J.Logic);if(n){te.Logger.log("Project state found, setting up operation");const l=n.get(Xe.GenerateShortIdentifier);l?(te.Logger.log("Operation found, setting autoexecutable and implementation"),l.autoexecutable=!0,l.implementation=this.module.main):te.Logger.warn("Operation generate-short-identifier not found in project state")}else te.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,n)=>{try{const l=axe();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class UMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateHexadecimalToken);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=sxe();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}function D2i(d){let p;if(d===null?p="null":Array.isArray(d)?p="array":p=typeof d,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class jMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(He.GetTypeOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)})[0];return{value:G.Success,error:null,result:D2i(c)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class kMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.ToString);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=String(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class KMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.ToNumber);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=Number(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class FMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.ToBytes);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=qr(l,c||"utf8");return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class SMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.FromBytesToString);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=zl(l,c||"utf8");return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class qMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.EncodeBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)});return{value:G.Success,error:null,result:cMe(l,c)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ZMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.DecodeBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=pMe(String(l));return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class HMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.EncodeBase64Url);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Ey(l,c||"utf8");return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class WMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.DecodeBase64Url);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=vc(String(l));return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class zMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.EncodeHex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=fMe(l,c||"utf8");return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class JMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.DecodeHex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=yMe(String(l));return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class YMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ii.Hash);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:TMe(l,c,e,y)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class XMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ii.Hmac);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v]=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)});return{value:G.Success,error:null,result:vMe(c,e,l,y,T,v)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class QMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ii.ConstantTimeEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:hMe(l,c,e,y)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class eBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ii.DeriveKeyPBKDF2);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v,E,b]=n.map(O=>{var P,$;return((P=O.value)==null?void 0:P.valueAsType)??(($=O.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:EMe(l,c,e,y,T,v,E,b)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class tBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Yr.Parse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{var l;try{const c=(l=n[0].value)==null?void 0:l.value;if(typeof c!="string")throw new Error(`Invalid input type for JSON.parse operation: expected string, got ${typeof c}`);const e=JSON.parse(c);return{value:G.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:c,result:null}}}})}}class iBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Yr.Stringify);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{var l,c;try{const e=(l=n[0].value)==null?void 0:l.value,y=(c=n[1].value)==null?void 0:c.value;if(!e||typeof e!="object"&&!Array.isArray(e))throw new Error(`Invalid input type for JSON.stringify operation: expected object or array, got ${typeof e}`);if(!y&&y!==0){const v=JSON.stringify(e);return{value:G.Success,error:null,result:v}}const T=JSON.stringify(e,null,y);return{value:G.Success,error:null,result:T}}catch(e){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e,result:null}}}})}}class rBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(zi.BuildJwtHmac);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v,E,b,O,P,$,L]=n.map(U=>{var F,Z;return((F=U.value)==null?void 0:F.valueAsType)??((Z=U.value)==null?void 0:Z.value)});return{value:G.Success,error:null,result:await RMe(l,c,e,y,T,v,E,b,O,P,$,L)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class nBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(zi.VerifyJwtHmac);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v,E,b]=n.map(O=>{var P,$;return((P=O.value)==null?void 0:P.valueAsType)??(($=O.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:await OMe(l,c,e,y,T,v,E,b)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class aBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(zi.DecodeJwt);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)});return{value:G.Success,error:null,result:CMe(l,c)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class sBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Xr.HashPasswordPBKDF2);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v]=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)});return{value:G.Success,error:null,result:await gMe(l,c,e,y,T,v)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class lBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Xr.VerifyPasswordPBKDF2);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=await AMe(String(l??""),String(c??""));return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Uw extends FI{constructor(p,i,n=i.projectId){super(p,J.Editor),this._editor=i,this.id=n}get ready(){return this._editor.ready}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branch(){return this._editor.branch}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,i){return this._editor.initTest(p,i)}removeTest(){return this._editor.removeTest()}async copyEntities(p){return this._editor.copyEntities(p)}resolveInitialChildrenPositions(p,i,n){return this._editor.resolveInitialChildrenPositions(p,i,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}requestActiveDynamicValue(p,i=!1){return this._editor.requestActiveDynamicValue(p,i)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,i){return this._editor.setValueTypePreference(p,i)}}function O2i(d,p){return p instanceof Uw?p:new Uw(d,p)}class jw extends FI{constructor(p,i){super(p,J.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function w2i(d,p){return p instanceof jw?p:new jw(d,p)}function C2i(d){d.register(new MPe(d)),d.register(new LPe(d)),d.register(new VPe(d)),d.register(new xPe(d)),d.register(new $Pe(d)),d.register(new NPe(d)),d.register(new gLe(d)),d.register(new ILe(d)),d.register(new RLe(d)),d.register(new OLe(d)),d.register(new DLe(d)),d.register(new wLe(d)),d.register(new PMe(d)),d.register(new VMe(d)),d.register(new NMe(d)),d.register(new xMe(d)),d.register(new $Me(d)),d.register(new LMe(d)),d.register(new MMe(d)),d.register(new BMe(d)),d.register(new GMe(d)),d.register(new UMe(d)),d.register(new A$e(d)),d.register(new g$e(d)),d.register(new I$e(d)),d.register(new R$e(d)),d.register(new D$e(d)),d.register(new O$e(d)),d.register(new w$e(d)),d.register(new C$e(d)),d.register(new _$e(d)),d.register(new P$e(d)),d.register(new V$e(d)),d.register(new N$e(d)),d.register(new x$e(d)),d.register(new $$e(d)),d.register(new L$e(d)),d.register(new M$e(d)),d.register(new B$e(d)),d.register(new G$e(d)),d.register(new U$e(d)),d.register(new K$e(d)),d.register(new F$e(d)),d.register(new S$e(d)),d.register(new kxe(d)),d.register(new Kxe(d)),d.register(new Fxe(d)),d.register(new Sxe(d)),d.register(new qxe(d)),d.register(new Zxe(d)),d.register(new Hxe(d)),d.register(new Wxe(d)),d.register(new zxe(d)),d.register(new Yxe(d)),d.register(new Xxe(d)),d.register(new Qxe(d)),d.register(new e$e(d)),d.register(new t$e(d)),d.register(new QNe(d)),d.register(new exe(d)),d.register(new txe(d)),d.register(new W2e(d)),d.register(new N2e(d)),d.register(new XVe(d)),d.register(new QVe(d)),d.register(new eNe(d)),d.register(new tNe(d)),d.register(new iNe(d)),d.register(new rNe(d)),d.register(new nNe(d)),d.register(new aNe(d)),d.register(new sNe(d)),d.register(new ENe(d)),d.register(new JNe(d)),d.register(new YNe(d)),d.register(new XNe(d)),d.register(new lNe(d)),d.register(new oNe(d)),d.register(new dNe(d)),d.register(new uNe(d)),d.register(new pNe(d)),d.register(new cNe(d)),d.register(new fNe(d)),d.register(new yNe(d)),d.register(new hNe(d)),d.register(new mNe(d)),d.register(new TNe(d)),d.register(new vNe(d)),d.register(new bNe(d)),d.register(new ANe(d)),d.register(new gNe(d)),d.register(new INe(d)),d.register(new RNe(d)),d.register(new DNe(d)),d.register(new ONe(d)),d.register(new wNe(d)),d.register(new CNe(d)),d.register(new _Ne(d)),d.register(new PNe(d)),d.register(new VNe(d)),d.register(new jNe(d)),d.register(new kNe(d)),d.register(new KNe(d)),d.register(new NNe(d)),d.register(new xNe(d)),d.register(new $Ne(d)),d.register(new LNe(d)),d.register(new MNe(d)),d.register(new BNe(d)),d.register(new GNe(d)),d.register(new UNe(d)),d.register(new X2e(d)),d.register(new Q2e(d)),d.register(new eMe(d)),d.register(new tMe(d)),d.register(new z2e(d)),d.register(new J2e(d)),d.register(new Y2e(d)),d.register(new iMe(d)),d.register(new nMe(d)),d.register(new sMe(d)),d.register(new rMe(d)),d.register(new aMe(d)),d.register(new lMe(d)),d.register(new uMe(d)),d.register(new oMe(d)),d.register(new dMe(d)),d.register(new i$e(d)),d.register(new s$e(d)),d.register(new l$e(d)),d.register(new u$e(d)),d.register(new p$e(d)),d.register(new c$e(d)),d.register(new f$e(d)),d.register(new y$e(d)),d.register(new h$e(d)),d.register(new m$e(d)),d.register(new T$e(d)),d.register(new o$e(d)),d.register(new d$e(d)),d.register(new n$e(d)),d.register(new a$e(d)),d.register(new r$e(d)),d.register(new Jxe(d)),d.register(new E$e(d)),d.register(new b$e(d)),d.register(new v$e(d)),d.register(new _Le(d)),d.register(new QLe(d)),d.register(new XLe(d)),d.register(new e2e(d)),d.register(new t2e(d)),d.register(new NLe(d)),d.register(new xLe(d)),d.register(new ULe(d)),d.register(new BLe(d)),d.register(new JLe(d)),d.register(new SLe(d)),d.register(new ZLe(d)),d.register(new WLe(d)),d.register(new HLe(d)),d.register(new GLe(d)),d.register(new kLe(d)),d.register(new KLe(d)),d.register(new jLe(d)),d.register(new CLe(d)),d.register(new $Le(d)),d.register(new qLe(d)),d.register(new n2e(d)),d.register(new $w(d)),d.register(new VLe(d)),d.register(new LLe(d)),d.register(new PLe(d)),d.register(new zLe(d)),d.register(new MLe(d)),d.register(new FLe(d)),d.register(new YLe(d)),d.register(new r2e(d)),d.register(new i2e(d)),d.register(new a2e(d)),d.register(new $w(d)),d.register(new l2e(d)),d.register(new s2e(d)),d.register(new o2e(d)),d.register(new aLe(d)),d.register(new sLe(d)),d.register(new lLe(d)),d.register(new Z$e(d)),d.register(new k$e(d)),d.register(new J$e(d)),d.register(new eLe(d)),d.register(new j$e(d)),d.register(new tLe(d)),d.register(new nLe(d)),d.register(new X$e(d)),d.register(new Y$e(d)),d.register(new Xb(d)),d.register(new oLe(d)),d.register(new dLe(d)),d.register(new Q$e(d)),d.register(new rLe(d)),d.register(new iLe(d)),d.register(new z$e(d)),d.register(new W$e(d)),d.register(new H$e(d)),d.register(new q$e(d)),d.register(new cLe(d)),d.register(new pLe(d)),d.register(new fLe(d)),d.register(new uLe(d)),d.register(new ZNe(d)),d.register(new FNe(d)),d.register(new qNe(d)),d.register(new HNe(d)),d.register(new WNe(d)),d.register(new SNe(d)),d.register(new zNe(d)),d.register(new jMe(d)),d.register(new ZMe(d)),d.register(new WMe(d)),d.register(new JMe(d)),d.register(new qMe(d)),d.register(new HMe(d)),d.register(new zMe(d)),d.register(new SMe(d)),d.register(new FMe(d)),d.register(new KMe(d)),d.register(new kMe(d)),d.register(new tBe(d)),d.register(new iBe(d)),d.register(new QMe(d)),d.register(new eBe(d)),d.register(new _Me(d)),d.register(new YMe(d)),d.register(new XMe(d)),d.register(new nBe(d)),d.register(new rBe(d)),d.register(new aBe(d)),d.register(new sBe(d)),d.register(new lBe(d))}class yN{constructor(p=new te.Events("extensions-registry-fallback-events")){I(this,"extensionsRegistry",new Map);I(this,"initialized",new Set);I(this,"initializedContexts",new Set);I(this,"onResolveEditorContextCallback",()=>null);I(this,"onResolveProjectLogicContextCallback",()=>null);I(this,"onResolveEditorGUIContextCallback",()=>null);I(this,"onResolveGUIContextCallback",()=>null);I(this,"onResolveCompileContextCallback",()=>null);I(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,i)=>(p.manifest.initPriority||Ee.Normal)-(i.manifest.initPriority||Ee.Normal))}async setup(){C2i(this),te.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case J.Editor:return this.onResolveEditorContextCallback();case J.Logic:return this.onResolveProjectLogicContextCallback();case J.EditorGUI:return this.onResolveEditorGUIContextCallback();case J.Compile:return this.onResolveCompileContextCallback();case J.PublicationRun:return this.onResolvePublicationRunContextCallback();case J.GUI:return this.onResolveGUIContextCallback();case J.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const n=[];i.length===0&&(i=p.manifest.contexts);for(const l of i){const c=this.requestContext(l);c&&n.push(c)}return n}requestExtension(p){const i=this.extensionsRegistry.get(p);if(i)return i;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){var p,i;for(const n of this.extensionInOrder)if(n.module.init&&!this.initialized.has(n.manifest.id)){const l=n.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);l.length&&(await((i=(p=n.module).init)==null?void 0:i.call(p,l)),this.initialized.add(n.manifest.id))}else!n.module.init&&!this.initialized.has(n.manifest.id)&&this.initialized.add(n.manifest.id)}async initForReady(){te.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){te.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(l=>!!i.find(c=>c.contextType===l))?(await p.module.init(i),this.initialized.add(p.manifest.id)):te.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(l=>l.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(te.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):te.Logger.log(`Skipping initialization of ${p.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,i){this.events.on(p,i)}emit(p,...i){this.events.emit(p,...i)}off(p,i){this.events.off(p,i)}emitAsync(p,...i){return this.events.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.events.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.events.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.events.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.events.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.events.emitAsyncSequentiallyAllSettled(p,...i)}async contextAvailable(p){if(this.initializedContexts.has(p)){te.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case J.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case J.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}te.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,i){window.localStorage.setItem("dynamic-value-type-preference--"+p,(i==null?void 0:i.toString())||""),this.emit(p,{})}}let Rb=null;const hN={requestExtension:d=>(Rb||(Rb=new yN,Rb.setup()),Rb.requestExtension(d))},du={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var mN=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(mN||{});const oBe={...hN,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class fu extends te.Events{constructor(i,n,l,c=null,e=oBe){super("exec-inst-super-events");I(this,"project");I(this,"entryPoint");I(this,"state","not-started");I(this,"events",new te.Events("execution-instance-events"));I(this,"entities",[]);I(this,"parentExecution",null);I(this,"executing",[]);I(this,"executed",[]);I(this,"skipped",[]);I(this,"scheduled",[]);I(this,"localTestValues");I(this,"resolvedValues");I(this,"persistedExecutionResults");I(this,"lastExecutionResults");I(this,"onAddToSkippedListCallback",null);I(this,"onRemoveFromSkippedListCallback",null);I(this,"onAddEntityCallback",null);I(this,"onRemoveEntityCallback",null);I(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=l,this.project=i,this.parentExecution=c,this.localTestValues=new Am(x.UUID.uuid(),this.project),this.resolvedValues=new Am(x.UUID.uuid(),this.project),this.persistedExecutionResults=new Am(x.UUID.uuid(),this.project),this.lastExecutionResults=new Am(x.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Sr.includes(i.type)&&Rt(i).forEach(n=>this.skip(n))))}async schedule(i,n,l){if(this.hasExecuted(i))return null;if(zt.includes(i.type))return this.executeBranch(i,l,n);if(zr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,l,n);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,n){const l=[];return[...Vi,...zt].includes(n.type)?l.push(...n.inputs):kt.includes(n.type)&&l.push(...n.outputs),l.map(e=>{var T;let y=i.find(v=>v.valueOwner.id===e.id);if(y)return y;if(!y&&zt.includes(n.type)&&(y=i.find(v=>{var E;return((E=v.valueOwner.declaration)==null?void 0:E.id)===e.id})),y){const v=(T=y.value)==null?void 0:T.clone(null);return v==null||v.setStandaloneParent(e),{...y,valueOwner:e,value:v||null,inheritanceLink:{sources:[y],target:e}}}return rs.includes(e.type)?ho(e,this.valueResolutionContext):Ru(e,this.valueResolutionContext)}).reduce((e,y)=>{const T=yl(y==null?void 0:y.valueOwner,this.project),v=y?[y]:[];return T.forEach(E=>{var P,$,L;if(E.id===(y==null?void 0:y.valueOwner.id))return;const b=Et(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(P=y==null?void 0:y.value)==null?void 0:P.value},null),b==null||b.setValueAsTypeList((($=y==null?void 0:y.value)==null?void 0:$.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((L=y==null?void 0:y.value)==null?void 0:L.valueAsTypeSingle)||null);const O={...y,valueOwner:E,value:b};v.push(O)}),[...e,...v]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,n,l,c={}){var y,T;const e={...du,...c};try{let v={value:G.Success,error:null,result:null};if(n.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Mr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(ny+i.declaration.id).module.main;E?v=await E(i,n):te.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{v=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,l,e);let E=null;if(v.error){te.Logger.warn("Raw error executing entity: ",v.error);const b=(y=i.error)==null?void 0:y.getDataType(null),O=Et(b||null,i.error,l);b!=null&&b.asType?O==null||O.setValueAsTypeSingle(v.error):O==null||O.metaSync({value:v.error},null),E={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:O}}return{value:v.value,entity:i,error:E,result:{value:v.result||null,valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null}}}return{...v,entity:i}}catch(v){te.Logger.warn("Internal call execution error: ",v);let E=null;if(i.error){const b=(T=i.error)==null?void 0:T.getDataType(null),O=Et(b,i.error,l);b!=null&&b.asType?O==null||O.setValueAsTypeSingle(v):O==null||O.metaSync({value:v},null),E={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:O}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,n,l){var c,e;try{let y={value:G.Success,error:null,result:null};n.sort((b,O)=>b.valueOwner.index-O.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,n));let T=null;if(y.error&&i.error){te.Logger.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,O=Et(b,i.error,l);b!=null&&b.asType?O==null||O.setValueAsTypeSingle(y.error):O==null||O.metaSync({value:y.error},null),T={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:O}}const v=i==null?void 0:i.getDataType(null),E=Et(v,i,l);return v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y.result):E==null||E.metaSync({value:y.result},null),{value:y.value,entity:i,error:T,result:{value:E||null,valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null}}}catch(y){te.Logger.warn("Operation execution error: ",y);let T=null;if(i.error){const v=(e=i.error)==null?void 0:e.getDataType(null),E=Et(v,i.error,l);v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y):E==null||E.metaSync({value:y},null),T={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:T,result:null}}}async executeSearch(i,n,l){var c;try{let e={value:G.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(Ae.SEARCH_NODE_IMPLEMENTATION)).module.main(i,n),T=i==null?void 0:i.getDataType(null),v=Et(T,i,l);return v==null||v.metaSync({value:{data:y.data}},null),y.error?{value:G.UnhandledError,entity:i,error:{valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null,value:v},result:null}:{value:e.value,entity:i,error:null,result:{value:v,valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null}}}catch(e){if(te.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),T=Et(y,i.error,l);return T==null||T.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:T},result:null}}}async executeLoop(i,n,l,c={}){var y,T,v,E,b,O;const e={...du,...c};try{let P={value:G.Success,error:null,result:null};const $=n.map(se=>{var Q,fe;return((Q=se==null?void 0:se.value)==null?void 0:Q.valueAsType)||((fe=se==null?void 0:se.value)==null?void 0:fe.value)});let L={};i.getUniqueInputMaps().forEach(se=>{const Q=i.body.inputs.find(me=>le(me,l)===le(se,l)),fe=se==null?void 0:se.getDataType(null),de=Et(fe,Q,l);fe!=null&&fe.asType?de==null||de.setValueAsTypeList([]):de==null||de.metaSync({value:[]},null),this.lastExecutionResults.writeValue(Q,de);const ce={value:de,valueOwner:Q,type:$e.ExecutionResult,inheritanceLink:null};L[Q.id]=ce});let F={value:G.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case Y.loop["counted-loop"].id:{const se=$[0];let Q=1;for(;Q<=se&&Q<=50;){const fe=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=oc(ce),ae=this.lastExecutionResults.readValue(de.id);if(ae){ae.metaSync({value:Q},null),this.lastExecutionResults.writeValue(de,ae);const Be={value:ae,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null};return L[de.id]=Be,Be}const ye={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:Q,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:de.toReference()},_e=Gi(ye,l);this.lastExecutionResults.writeValue(de,_e);const Ve={value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null};return L[de.id]=Ve,Ve}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(F.results||[]).forEach(de=>{var ye,_e,Ve,Be;if(de.valueOwner.type!==o.InputMap||kt.includes(de.valueOwner.parent.type))return;const ce=i.body.inputs.find(xe=>le(xe,l)===le(de.valueOwner,l)),ae=[...((_e=(ye=L==null?void 0:L[ce.id])==null?void 0:ye.value)==null?void 0:_e.value)||[],((Ve=de==null?void 0:de.value)==null?void 0:Ve.value)||null];(Be=L[ce.id].value)==null||Be.metaSync({value:ae},null),this.lastExecutionResults.writeValue(ce,L[ce.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}case Y.loop["manual-flow-loop"].id:{let se=1;for(;se<=50;){const Q=i.body.inputs.map(fe=>{if(fe===i.currentIterationNumberArgumentDeclaration){const de=this.lastExecutionResults.readValue(fe.id);if(de){de.metaSync({value:se},null),this.lastExecutionResults.writeValue(fe,de);const ye={value:de,valueOwner:fe,type:$e.ExecutionResult,inheritanceLink:null};return L[fe.id]=ye,ye}const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=Et(ce,fe,l);return me==null||me.metaSync({value:se},null),this.lastExecutionResults.writeValue(fe,me),{value:me,valueOwner:fe,type:$e.ExecutionResult,inheritanceLink:null}}else return L[fe.id]}).filter(fe=>!!fe);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Q,e),(F.results||[]).forEach(fe=>{var ae,ye,_e;if(fe.valueOwner.type!==o.InputMap||kt.includes(fe.valueOwner.parent.type))return;const de=i.body.inputs.find(Ve=>le(Ve,l)===le(fe.valueOwner,l)),me=[...(ae=L[de.id].value)==null?void 0:ae.value,((ye=fe.value)==null?void 0:ye.value)||null];(_e=L[de.id].value)==null||_e.metaSync({value:me},null),this.lastExecutionResults.writeValue(de,L[de.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;se++}break}case Y.loop["list-loop"].id:{const se=$[0];let Q=1;const fe=se;for(let de=0;de<fe.length;de++){const ce=fe[de],me=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ae.id);if(ye)return ye.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,ye),{value:ye,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=Et(_e,ae,l);return Ve==null||Ve.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else if(ae===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=oc(ye),Ve=this.lastExecutionResults.readValue(ae.id);if(Ve)return Ve.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const Be={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:ae.toReference()},xe=Gi(Be,l);return this.lastExecutionResults.writeValue(ae,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else return L[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(F.results||[]).forEach(ae=>{var Be,xe,Me;if(ae.valueOwner.type!==o.InputMap||kt.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(We=>le(We,l)===le(ae.valueOwner,l)),Ve=[...(Be=L[ye.id].value)==null?void 0:Be.value,((xe=ae.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Ve},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}case Y.loop["object-keys-loop"].id:{const se=$[0];let Q=1;const fe=se?Object.keys(se):[];for(let de=0;de<fe.length;de++){const ce=fe[de],me=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ae.id);if(ye)return ye.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,ye),{value:ye,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=Et(_e,ae,l);return Ve==null||Ve.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else if(ae===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=oc(ye),Ve=this.lastExecutionResults.readValue(ae.id);if(Ve)return Ve.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const Be={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:ae.toReference()},xe=Gi(Be,l);return this.lastExecutionResults.writeValue(ae,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else return L[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(F.results||[]).forEach(ae=>{var Be,xe,Me;if(ae.valueOwner.type!==o.InputMap||kt.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(We=>le(We,l)===le(ae.valueOwner,l)),Ve=[...(Be=L[ye.id].value)==null?void 0:Be.value,((xe=ae.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Ve},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}case Y.loop["object-values-loop"].id:{const se=$[0];let Q=1;const fe=se?Object.values(se):[];for(let de=0;de<fe.length;de++){const ce=fe[de],me=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ae.id);if(ye)return ye.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,ye),{value:ye,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=Et(_e,ae,l);return Ve==null||Ve.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else if(ae===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=oc(ye),Ve=this.lastExecutionResults.readValue(ae.id);if(Ve)return Ve.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const Be={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:ae.toReference()},xe=Gi(Be,l);return this.lastExecutionResults.writeValue(ae,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else return L[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(F.results||[]).forEach(ae=>{var Be,xe,Me;if(ae.valueOwner.type!==o.InputMap||kt.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(We=>le(We,l)===le(ae.valueOwner,l)),Ve=[...(Be=L[ye.id].value)==null?void 0:Be.value,((xe=ae.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Ve},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}case Y.loop["string-loop"].id:{const se=$[0];let Q=1;const fe=se.split("");for(let de=0;de<fe.length;de++){const ce=fe[de],me=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ae.id);if(ye)return ye.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,ye),{value:ye,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=Et(_e,ae,l);return Ve==null||Ve.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else if(ae===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=oc(ye),Ve=this.lastExecutionResults.readValue(ae.id);if(Ve)return Ve.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const Be={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:ae.toReference()},xe=Gi(Be,l);return this.lastExecutionResults.writeValue(ae,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else return L[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(F.results||[]).forEach(ae=>{var Be,xe,Me;if(ae.valueOwner.type!==o.InputMap||kt.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(We=>le(We,l)===le(ae.valueOwner,l)),Ve=[...(Be=L[ye.id].value)==null?void 0:Be.value,((xe=ae.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Ve},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}}if(P={value:[G.CaughtError,G.Return].includes(F.value)?F.value:G.Success,error:((T=(y=F.error)==null?void 0:y.value)==null?void 0:T.value)||null,result:((E=(v=F==null?void 0:F.result)==null?void 0:v.value)==null?void 0:E.value)||null},P.error&&i.error){const se=(b=i.error)==null?void 0:b.getDataType(null),Q=Et(se||null,i.error,l);se!=null&&se.asType?Q==null||Q.setValueAsTypeSingle(P.error):Q==null||Q.metaSync({value:P.error},null);const fe={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:Q};return{value:P.value,entity:i,error:fe,result:null}}const Z=i==null?void 0:i.getDataType(null),X=Et(Z,i,l);return Z!=null&&Z.asType?X==null||X.setValueAsTypeSingle(P.result):X==null||X.metaSync({value:P.result},null),{value:P.value,entity:i,error:null,result:{value:X||null,valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null}}}catch(P){if(te.Logger.warn("Error executing loop: ",P),i.error){const $=(O=i.error)==null?void 0:O.getDataType(null),L=Et($,i.error,l);return $!=null&&$.asType?L==null||L.setValueAsTypeSingle(P):L==null||L.metaSync({value:P},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:L},result:null}}else return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,n,l,c={}){var y,T;const e={...du,...c};try{let v={value:G.Success,error:null,result:null};v=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,l,e);let E=null;if(v.error&&i.error){te.Logger.warn("Raw error executing entity: ",v.error);const b=(y=i.error)==null?void 0:y.getDataType(null),O=Et(b||null,i.error,l);b!=null&&b.asType?O==null||O.setValueAsTypeSingle(v.error):O==null||O.metaSync({value:v.error},null),E={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:O}}return{value:v.value,entity:i,error:E,result:v.result}}catch(v){if(!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const E=(T=i.error)==null?void 0:T.getDataType(null),b=Et(E,i.error,l);return E!=null&&E.asType?b==null||b.setValueAsTypeSingle(v):b==null||b.metaSync({value:v},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:b},result:null}}}async executeCondition(i,n){var c,e,y,T;let l=!1;switch(i.declaration.id){case Qr.BooleanIsTrue:{const v=(e=(c=n[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof v!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");l=v===!0;break}case Qr.BooleanIsFalse:{const v=(T=(y=n[0])==null?void 0:y.value)==null?void 0:T.value;if(typeof v!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");l=v===!1;break}case sr.And:{l=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).every(E=>E);break}case sr.Or:{l=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:l?G.Success:G.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,n,l,c={}){const e={...du,...c,onBeforeEntityExecution:(v,E,b)=>{var O;return((O=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:O.call(c,v,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(v,E,b)=>{var O;return((O=c==null?void 0:c.onEntityExecuted)==null?void 0:O.call(c,v,E,{...b,detached:!0}))||Promise.resolve()}},y=new fu(l,[i,...hA(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,n)}async executeFullFunctionDeclarationLogic(i,n,l={}){const c={...du,...l},e=hA(i);e.forEach(v=>{this.addEntity(v)}),e.reduce((v,E)=>kt.includes(E.type)?[...v,...E.outputs]:Vi.includes(E.type)&&E.type!==o.Condition?[...v,...E.outputs,...E.inputs]:E.type===o.Condition?[...v,...E.inputs]:v,[]).forEach(v=>{this.lastExecutionResults.removeValue(v.id)});const T=await this.executeBranch(i,c,n);return{...T||{},value:(T==null?void 0:T.value)||G.Success,entity:i,error:(T==null?void 0:T.error)||null,result:(T==null?void 0:T.result)||null}}static async executeEntryPointEntity(i,n){return{value:G.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,n){var y,T,v,E,b,O,P;if((y=i.throws)!=null&&y.readsValue){const $=ho(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:$e.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let l=ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((T=c==null?void 0:c.entity)==null?void 0:T.type)===o.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)mr((v=l==null?void 0:l.value)==null?void 0:v.value)&&($={...$,...(E=l==null?void 0:l.value)==null?void 0:E.value}),l==null||l.value.metaSync({value:$},null);else{const L=Et(c,i,this.project);L==null||L.metaSync({value:$},null),l={valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(L=>{var U,F;if(((U=L.declaration)==null?void 0:U.type)===o.Property&&L.declaration.static){const Z=this.lastExecutionResults.readValue(L.declaration.id),X=le(L,this.project),se=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||Wi(X);if(Z)Z.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Z);else{const Q=Et(L.getDataType(null),L,this.project);Q==null||Q.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Q)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&mr((O=l.value)==null?void 0:O.value)?((P=l.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var Z;const L=$.codeName||((Z=$.declaration)==null?void 0:Z.codeName)||Wi(le($,this.project)),U=e[L],F=Et($.getDataType(null),$,this.project);F==null||F.metaSync({value:U},null),$e.ExecutionResult}),l.type=$e.ExecutionResult,{value:G.Return,entity:i,error:null,result:l}}async executeContinueStatement(i,n){var y,T,v,E,b,O,P;if((y=i.throws)!=null&&y.readsValue){const $=ho(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:$e.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let l=ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((T=c==null?void 0:c.entity)==null?void 0:T.type)===o.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)mr((v=l==null?void 0:l.value)==null?void 0:v.value)&&($={...$,...(E=l==null?void 0:l.value)==null?void 0:E.value}),l==null||l.value.metaSync({value:$},null);else{const L=Et(c,i,this.project);L==null||L.metaSync({value:$},null),l={valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(L=>{var U,F;if(((U=L.declaration)==null?void 0:U.type)===o.Property&&L.declaration.static){const Z=this.lastExecutionResults.readValue(L.declaration.id),X=le(L,this.project),se=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||Wi(X);if(Z)Z.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Z);else{const Q=Et(L.getDataType(null),L,this.project);Q==null||Q.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Q)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&mr((O=l.value)==null?void 0:O.value)?((P=l.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var Z;const L=$.codeName||((Z=$.declaration)==null?void 0:Z.codeName)||Wi(le($,this.project)),U=e[L],F=Et($.getDataType(null),$,this.project);F==null||F.metaSync({value:U},null),$e.ExecutionResult}),l.type=$e.ExecutionResult,{value:G.Continue,entity:i,error:null,result:l}}async executeBreakStatement(i,n){var y,T,v,E,b,O,P;if((y=i.throws)!=null&&y.readsValue){const $=ho(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:$e.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let l=ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((T=c==null?void 0:c.entity)==null?void 0:T.type)===o.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)mr((v=l==null?void 0:l.value)==null?void 0:v.value)&&($={...$,...(E=l==null?void 0:l.value)==null?void 0:E.value}),l==null||l.value.metaSync({value:$},null);else{const L=Et(c,i,this.project);L==null||L.metaSync({value:$},null),l={valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(L=>{var U,F;if(((U=L.declaration)==null?void 0:U.type)===o.Property&&L.declaration.static){const Z=this.lastExecutionResults.readValue(L.declaration.id),X=le(L,this.project),se=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||Wi(X);if(Z)Z.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Z);else{const Q=Et(L.getDataType(null),L,this.project);Q==null||Q.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Q)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&mr((O=l.value)==null?void 0:O.value)?((P=l.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var Z;const L=$.codeName||((Z=$.declaration)==null?void 0:Z.codeName)||Wi(le($,this.project)),U=e[L],F=Et($.getDataType(null),$,this.project);F==null||F.metaSync({value:U},null),$e.ExecutionResult}),l.type=$e.ExecutionResult,{value:G.Break,entity:i,error:null,result:l}}async executeVariable(i,n){var T,v,E,b,O,P;let l=ho(i,this.valueResolutionContext);const c=Zn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let $={};if(((T=e==null?void 0:e.entity)==null?void 0:T.type)===o.DefinitionEntity&&($={...$,...e.entity.getActiveRawDefaultValue()}),l!=null&&l.value)mr((v=l==null?void 0:l.value)==null?void 0:v.value)&&($={...$,...(E=l==null?void 0:l.value)==null?void 0:E.value}),l==null||l.value.metaSync({value:$},null);else{const L=Et(e,i,this.project);L==null||L.metaSync({value:$},null),l={valueOwner:c,type:$e.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(c,l.value),c.inputs.forEach(L=>{var U,F;if(((U=L.declaration)==null?void 0:U.type)===o.Property&&L.declaration.static){const Z=this.lastExecutionResults.readValue(L.declaration.id),X=le(L,this.project),se=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||Wi(X);if(Z)Z.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Z);else{const Q=Et(L.getDataType(null),L,this.project);Q==null||Q.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Q)}}})}else this.lastExecutionResults.writeValue(c,l==null?void 0:l.value);const y=(b=l==null?void 0:l.value)!=null&&b.value&&mr((O=l.value)==null?void 0:O.value)?((P=l.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var Z;const L=$.codeName||((Z=$.declaration)==null?void 0:Z.codeName)||Wi(le($,this.project)),U=y[L],F=Et($.getDataType(null),$,this.project);F==null||F.metaSync({value:U},null),$e.ExecutionResult}),l.type=$e.ExecutionResult,{value:G.Success,entity:i,error:null,result:l}}mergeValues(i,n){const l=[];for(let c=0;c<n.length;c++)i!=null&&i[c]?l.push(i[c]):l.push(n[c]);return l}async executeEntity(i,n=[],l={}){var y,T,v,E,b,O,P,$,L,U,F;const c={...du,...l},e={detached:!1};switch(i.type){case o.Condition:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,Z,e)),this.executeCondition(i,Z)}case o.InternalCall:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((T=c.onBeforeEntityExecution)==null?void 0:T.call(c,i,Z,e)),this.executeInternalCall(i,Z,this.project)}case o.Operation:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,Z,e)),fu.executeOperation(i,Z,this.project)}case o.VariableInstance:case o.VariableDeclaration:return this.executeVariable(i,n);case o.FunctionCall:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,Z,e)),this.executeFunctionCall(i,Z,this.project)}case o.FunctionDeclaration:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,Z,e)),fu.executeEntryPointEntity(i,Z)}case o.Search:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((O=c.onBeforeEntityExecution)==null?void 0:O.call(c,i,Z,e)),this.executeSearch(i,Z,this.project)}case o.Loop:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.call(c,i,Z,e)),this.executeLoop(i,Z,this.project,c)}case o.ReturnStatement:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await(($=c.onBeforeEntityExecution)==null?void 0:$.call(c,i,Z,e)),this.executeReturnStatement(i,Z)}case o.ContinueStatement:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((L=c.onBeforeEntityExecution)==null?void 0:L.call(c,i,Z,e)),this.executeContinueStatement(i,Z)}case o.BreakStatement:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((U=c.onBeforeEntityExecution)==null?void 0:U.call(c,i,Z,e)),this.executeBreakStatement(i,Z)}case o.GlobalEvent:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((F=c.onBeforeEntityExecution)==null?void 0:F.call(c,i,Z,e)),fu.executeEntryPointEntity(i,Z)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var l,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((l=i.result)!=null&&l.valueOwner))return;const n=yl((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?n.forEach(y=>{var T;this.lastExecutionResults.writeValue(y,(T=i.result)==null?void 0:T.value)}):n.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,n={},l=[]){var v;const c={...du,...n},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const T=await this.executeEntity(i,l,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(T),await((v=c.onEntityExecuted)==null?void 0:v.call(c,i,T,e)),T.value===G.Success){const E=(i.successCalls||i.calls||[]).filter(L=>this.hasEntity(L));(i.errorCalls||[]).forEach(L=>{this.skip(L)});let O=[];const P=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=P.filter(L=>!!L).find(L=>L.value===G.CaughtError||L.value===G.Return||L.value===G.Break||L.value===G.Continue);return $||(O=[...O,...P],T)}else if(T.value===G.CaughtError||T.value===G.ConditionNotMet){const E=(i.errorCalls||[]).filter(L=>this.hasEntity(L));(i.successCalls||i.calls||[]).forEach(L=>{this.skip(L)});let O=[];const P=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=P.filter(L=>!!L).find(L=>L.value===G.CaughtError||L.value===G.UnhandledError||L.value===G.Return||L.value===G.Break||L.value===G.Continue);return $||(O=[...O,...P],T)}else{if(T.value===G.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Sr.includes(T.entity.type)&&Rt(T.entity).forEach(E=>{this.skip(E)}),T;if(T.value===G.Return)return T;if(T.value===G.Break)return T;if(T.value===G.Continue)return T}return T}async execute(i={},n=[]){const l={...du,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,l,n);return this.state="finished-success",c}addEntity(i){var n;this.entities.includes(i)||(this.entities.push(i),(n=this.onAddEntityCallback)==null||n.call(this,i))}addEntities(i){i.forEach(n=>this.addEntity(n))}removeEntity(i){var n;if(i!==this.entryPoint){const l=this.entities.indexOf(i);l>-1&&(this.entities.splice(l,1),(n=this.onRemoveEntityCallback)==null||n.call(this,i))}}hasEntity(i){var c,e,y;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===o.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===o.DefinitionEntity)return this.entities.includes(i.parent);const n=ki(i);if(!n)return!1;const l=n.type===o.Loop&&i.parent===n.body?n.body:null;return l?this.entities.includes(l)||this.entities.includes(n):this.entities.includes(n)}removeScheduled(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const n=this.project.get(i);return n?this.hasEntity(n):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}removeFromExecutingList(i){var l;const n=this.executing.indexOf(i);n>-1&&(this.executing.splice(n,1),(l=this.onAbortExecutionCallback)==null||l.call(this,i))}removeFromAlreadyExecutedList(i){const n=this.executed.indexOf(i);n>-1&&this.executed.splice(n,1)}removeFromSkippedList(i){var l;const n=this.skipped.indexOf(i);n>-1&&(this.skipped.splice(n,1),(l=this.onRemoveFromSkippedListCallback)==null||l.call(this,i))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var n;this.skipped.includes(i)||(this.skipped.push(i),(n=this.onAddToSkippedListCallback)==null||n.call(this,i))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,n){this.parentContext.setValueTypePreference(i,n),this.emit(i,{})}}function _2i(d){var p,i;if(d.isList)return"list";if(((p=d.entity)==null?void 0:p.type)===o.DefinitionEntity)return"definition-entity";switch((i=d.entity)==null?void 0:i.name){case oe.Number:return"number";case oe.String:return"text";case oe.Boolean:return"boolean";case oe.UUID:return"uuid";case oe.Date:return"date-time";default:return"definition-entity"}}const is={[o.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[o.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[o.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[o.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[o.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[o.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[o.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[o.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[o.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[o.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[o.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[o.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[o.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[o.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[o.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[o.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[o.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[o.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[o.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[o.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[o.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[o.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[o.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[o.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[o.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[o.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function TN(d){const p=_1(d);if(!p){const n=Ry(d);if(n.includes(Re.HTTP_ENDPOINT))return"HTTP endpoint";if(n.includes(Re.PERSISTED_ENTITY))return"Persisted entity";if(n.includes(Re.CRON_JOB))return"Scheduled execution";if(n.includes(Re.RELATIONAL_DATABASE))return"Relational database"}if(p){let n="Extension of "+le(p,p.project)+" entity",l=fc(n);const c=Ry(d);return c.includes(Re.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):c.includes(Re.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):c.includes(Re.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):c.includes(Re.RELATIONAL_DATABASE)?"Relational database"+(l?", "+l:""):n}let i="";return d.abstract&&(i="Template "),d.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function dBe(d){return d.parent.type===o.DefinitionEntity||d.parent.type===o.InstalledProject?"Internal action of "+le(d.parent,d.project):d.parent.type===o.Loop?"Action repeated on every iteration":"Internal action of entity"}function vN(d){return Kx(d)?dBe(d):"Custom trigger"}function P2i(d){var p;switch(d.type){case o.DefinitionEntity:return TN(d);case o.FunctionDeclaration:return vN(d)}return(p=is[d.type])==null?void 0:p.singular}function V2i(d){var p;switch(d.type){case o.DefinitionEntity:return TN(d);case o.FunctionDeclaration:return vN(d)}return(p=is[d.type])==null?void 0:p.singular}const EN=4e4,uBe=280,N2i=300,bN=65,ay=32,Nb=39,pBe=26,cBe=49,iA=44,x2i=35,xb=52,AN=10,id=AN*2,rA=38,$b=90,kw=270,fBe=EN/2+120,yBe=EN/2+180;function hBe(d){let i=ay+iA+rA+AN;const n=[...d.inputs];return n.length&&(i+=id,n.forEach(()=>{i+=pBe})),{height:i,width:280}}function mBe(d){let i=bN;const n=[];if([o.DefinitionEntity].includes(d.type)){const T=[...d.suggestedProperties||[],...d.properties||[]];T.length&&(i+=id,T.forEach(v=>{i+=v.static?cBe:Nb}))}if([o.DefinitionEntity,o.InstalledProject,o.Loop].includes(d.type)){const T=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];T.length&&(i+=id,T.forEach(v=>{const E=hBe(v);i+=E.height}))}Vi.includes(d.type)?(St.includes(d.type)?n.push(...(d.usedInputs||[]).flatMap(T=>[T])||[]):n.push(...(d.inputs||[]).flatMap(T=>[T])||[]),d.error&&(i+=xb)):[o.ReturnStatement,o.BreakStatement,o.ContinueStatement].includes(d.type)?(n.push(...d.outputs||[]),d.throws&&(i+=xb)):d.type===o.Condition&&(n.push(d.inputs[0]),d.inputs[1]&&n.push(d.inputs[1]));const l=n.length;l&&(i+=l*Nb,i+=id);const c=[];if(d.type===o.FunctionDeclaration||d.type===o.GlobalEvent?c.push(...d.inputs||[]):Vi.includes(d.type)&&(St.includes(d.type)?c.push(...d.usedOutputs||[]):c.push(...d.outputs||[])),St.includes(d.type)){d.readsValue&&(i+=id,i+=iA),d.writesValues.length&&(i+=id,i+=iA),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=xb+id);const T=d.getDataType(null);(!T||T.inferred)&&(i+=rA)}const e=c.length;return e&&(i+=e*Nb,i+=id),[o.DefinitionEntity,o.FunctionDeclaration,o.ReturnStatement,o.BreakStatement,o.ContinueStatement].includes(d.type)&&(i+=rA),{height:i,width:280}}function cv(d){return`${d.split("-").map((n,l)=>l===0?n.charAt(0).toUpperCase()+n.slice(1):n.toLowerCase()).join(" ")}.`}function $2i(d){switch(d.code){case ve.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case ve.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case ve.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case ve.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case ve.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case ve.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case ve.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case ve.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case ve.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ie.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case ve.NoProperties:return"This entity has no properties, so it doesn't do anything";case ve.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case ve.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case ve.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case ve.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case ve.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case ve.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case ve.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case ve.PropertyImplementsNonAbstact:return"This property implements a non-template property";case ve.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case ve.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case ve.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case ve.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case ve.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ie.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ie.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ie.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ie.UnreachableEntity:return"This entity is unreachable";case ve.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case ve.AbstractEntityImplements:return"This template entity implements a non-template entity";case ve.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case ve.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case ve.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case ve.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case ve.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case ve.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case ve.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case ve.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case ve.MissingRequiredValue:return"This action is missing a required value";case ve.NoPrimaryKeyProperty:return"This entity has no primary key property";case ve.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case ve.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case ve.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case ve.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case ve.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case ve.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case ve.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ie.EmptyName:return"This entity has no name";case Ie.InvalidObjectStructure:return"This entity has an invalid structure";case Ie.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ie.MissingCaller:return"This action is missing a caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ie.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ie.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Oo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Oo.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case La.UUIDMustBeString:return`UUID must be a string, eg: "${hu()}"`;case La.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${hu()}"`;case La.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${hu()}"`;case ia.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ia.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ia.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cv(d.code)}}function L2i(d){switch(d.code){case ve.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case ve.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case ve.IncorrectEntityImplementation:return"Incorrect implementation";case ve.IncorrectMethodImplementation:return"Incorrect action implementation";case ve.IncorrectPropertyImplementation:return"Incorrect property implementation";case ve.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case ve.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case ve.MissingMethodImplementation:return"Missing action";case ve.MissingPropertyImplementation:return"Missing property";case Ie.NameNotUniqueInScope:return"Duplicate name";case ve.NoProperties:return"No properties";case ve.NonStaticPropertyInStaticEntity:return"Non-static property";case ve.StaticEntityWithNonStaticProperties:return"Non-static properties";case ve.ReadingFromIncompatibleType:return"Read from different type";case ve.WritingToIncompatibleType:return"Write to different type";case ve.ScopeWithoutLogic:return"No logic";case ve.NonStaticPropertyImplementsStatic:return"Invalid static property";case ve.PropertyImplementsIncompatibleType:return"Incompatible data type";case ve.PropertyImplementsNonAbstact:return"Non-template property";case ve.StaticPropertyImplementsNonStatic:return"Non-static property";case ve.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case ve.VariableHasInputsAndInternalCall:return"Bad internal call";case ve.VariableHasOutputsAndInternalCall:return"Bad internal call";case ve.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ie.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ie.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ie.InternalCallParentMissingDataType:return"Parent has no data type";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ie.UnreachableEntity:return"Unreachable entity";case ve.DisconnectedCallableEntity:return"Disconnected entity";case ve.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case ve.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case ve.InvalidPropertiesCombination:return"Invalid properties combination";case ve.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case ve.ExtendsIncompatibleEntities:return"Extends incompatible entities";case ve.ImplementingNonAbstractEntity:return"Implementing non-template entity";case ve.ImplementsIncompatibleEntities:return"Implements incompatible entities";case ve.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case ve.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case ve.MissingRequiredValue:return"Missing required value";case ve.NoPrimaryKeyProperty:return"No primary key property";case ve.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case ve.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case ve.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case ve.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case ve.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case ve.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case ve.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ie.EmptyName:return"Empty name";case Ie.InvalidObjectStructure:return"Invalid object structure";case Ie.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MissingCaller:return"Missing caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ie.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Oo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Oo.StatusCodeMustBeNumber:return"HTTP status code must be a number";case La.UUIDMustBeString:return"UUID must be a string";case La.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case La.UUIDMustBeValidFormat:return"UUID must be in a valid format";case ia.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ia.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ia.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cv(d.code)}}function M2i(d){switch(d.code){case ve.AbstractEntityWithNonAbstractMethods:return`${le(d.entity,d.entity.project)} has non-template actions`;case ve.AbstractEntityWithNonAbstractProperties:return`${le(d.entity,d.entity.project)} has non-template properties`;case ve.IncorrectEntityImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements template`;case ve.IncorrectMethodImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template`;case ve.IncorrectPropertyImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template`;case ve.AbstractMethodInNonAbstractEntity:return`${le(d.entity,d.entity.project)} can't be a template`;case ve.AbstractPropertyInNonAbstractEntity:return`${le(d.entity,d.entity.project)} can't be a template`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${le(d.entity,d.entity.project)} overwrites action`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${le(d.entity,d.entity.project)} overwrites property`;case ve.MissingMethodImplementation:return`${le(d.entity,d.entity.project)} is missing action`;case ve.MissingPropertyImplementation:return`${le(d.entity,d.entity.project)} is missing property`;case Ie.NameNotUniqueInScope:return`${le(d.entity,d.entity.project)} name is not unique`;case ve.NoProperties:return`${le(d.entity,d.entity.project)} has no properties`;case ve.NonStaticPropertyInStaticEntity:return`${le(d.entity,d.entity.project)} has non-static property`;case ve.StaticEntityWithNonStaticProperties:return`${le(d.entity,d.entity.project)} has non-static properties`;case ve.ReadingFromIncompatibleType:return`${le(d.entity,d.entity.project)} reads from different type`;case ve.WritingToIncompatibleType:return`${le(d.entity,d.entity.project)} writes to different type`;case ve.ScopeWithoutLogic:return`${le(d.entity,d.entity.project)} has no logic`;case ve.NonStaticPropertyImplementsStatic:return`${le(d.entity,d.entity.project)} has invalid static property`;case ve.PropertyImplementsIncompatibleType:return`${le(d.entity,d.entity.project)} has incompatible data type`;case ve.PropertyImplementsNonAbstact:return`${le(d.entity,d.entity.project)} has non-template property`;case ve.StaticPropertyImplementsNonStatic:return`${le(d.entity,d.entity.project)} has non-static property`;case ve.VariableCallsOthersAndHasInternalCall:return`${le(d.entity,d.entity.project)} has bad internal call`;case ve.VariableHasInputsAndInternalCall:return`${le(d.entity,d.entity.project)} has bad internal call`;case ve.VariableHasOutputsAndInternalCall:return`${le(d.entity,d.entity.project)} has bad internal call`;case ve.VariableIsCalledAndHasInternalCall:return`${le(d.entity,d.entity.project)} has bad internal call`;case Ie.InternalCallDeclarationIsInvalidType:return`${le(d.entity,d.entity.project)} has declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(d.entity,d.entity.project)} has declaration that is not found in parent`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${le(d.entity,d.entity.project)} has invalid parent declaration type`;case Ie.InternalCallParentMissingDataType:return`${le(d.entity,d.entity.project)}'s parent has no data type`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(d.entity,d.entity.project)} has declaration that is not in parent`;case Ie.UnreachableEntity:return`${le(d.entity,d.entity.project)} is unreachable`;case ve.DisconnectedCallableEntity:return`${le(d.entity,d.entity.project)} is not executed by any entity`;case ve.AbstractEntityImplements:return`${le(d.entity,d.entity.project)} implements a non-template entity`;case ve.AbstractExtendingNonAbstractEntity:return`${le(d.entity,d.entity.project)} extends a non-template entity`;case ve.InvalidPropertiesCombination:return`${le(d.entity,d.entity.project)} has invalid properties combination`;case ve.ExtendingNonInteractiveEntity:return`${le(d.entity,d.entity.project)} extends a non-interactive entity`;case ve.ExtendsIncompatibleEntities:return`${le(d.entity,d.entity.project)} extends incompatible entities`;case ve.ImplementingNonAbstractEntity:return`${le(d.entity,d.entity.project)} implements a non-template entity`;case ve.ImplementsIncompatibleEntities:return`${le(d.entity,d.entity.project)} implements incompatible entities`;case ve.LackingReturnStatementOnSomeBranches:return`${le(d.entity,d.entity.project)} is missing termination on some branches`;case ve.LastCalledEntityMustBeReturnEntity:return`${le(d.entity,d.entity.project)}'s last called entity must be a termination node`;case ve.MissingRequiredValue:return`${le(d.entity,d.entity.project)} is missing a required value`;case ve.NoPrimaryKeyProperty:return`${le(d.entity,d.entity.project)} has no primary key property`;case ve.NonAbstractExtendingAbstractEntity:return`${le(d.entity,d.entity.project)} extends a template entity`;case ve.NonStaticExtendingStaticEntity:return`${le(d.entity,d.entity.project)} extends a static entity`;case ve.NonStaticImplementingStaticEntity:return`${le(d.entity,d.entity.project)} implements a static entity`;case ve.StaticExtendingNonStaticEntity:return`${le(d.entity,d.entity.project)} extends a non-static entity`;case ve.StaticImplementingNonStaticEntity:return`${le(d.entity,d.entity.project)} implements a non-static entity`;case ve.VariableReadsValueAndInternalCall:return`${le(d.entity,d.entity.project)} reads a value and has internal call`;case ve.VariableWritesValuesAndInternalCall:return`${le(d.entity,d.entity.project)} writes values and has internal call`;case Ie.EmptyName:return`${is[d.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${le(d.entity,d.entity.project)} has invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${le(d.entity,d.entity.project)}'s loop body action overwrites an action`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites base action`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${le(d.entity,d.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${le(d.entity,d.entity.project)} has a name not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${le(d.entity,d.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${le(d.entity,d.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites base property`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${le(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case Oo.StatusCodeMustBeBetween100And599:return`${le(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Oo.StatusCodeMustBeNumber:return`${le(d.entity,d.entity.project)} HTTP status code must be a number`;case La.UUIDMustBeString:return`${le(d.entity,d.entity.project)} UUID must be a string`;case La.UUIDMustNotContainSpaces:return`${le(d.entity,d.entity.project)} UUID must not contain spaces`;case La.UUIDMustBeValidFormat:return`${le(d.entity,d.entity.project)} UUID must be in a valid format`;case ia.MustBeUniqueAmongSameEntities:return`${le(d.entity,d.entity.project)} value must be unique among the same kind`;case ia.StringValueMustNotHaveDashes:return`${le(d.entity,d.entity.project)} value must not contain dashes`;case ia.StringValueMustNotHaveSpaces:return`${le(d.entity,d.entity.project)} value must not contain spaces`;default:return`${le(d.entity,d.entity.project)} Error: ${cv(d.code)}`}}function B2i(d){var p,i,n,l;switch(d.code){case ve.AbstractEntityWithNonAbstractMethods:return`${le(d.entity,d.entity.project)} has non-template actions`;case ve.AbstractEntityWithNonAbstractProperties:return`${le(d.entity,d.entity.project)} has non-template properties`;case ve.IncorrectEntityImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template entity`;case ve.IncorrectMethodImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case ve.IncorrectPropertyImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case ve.AbstractMethodInNonAbstractEntity:return`${le(d.entity,d.entity.project)} is a template action in a non-template entity`;case ve.AbstractPropertyInNonAbstractEntity:return`${le(d.entity,d.entity.project)} is a template property in a non-template entity`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${le(d.entity,d.entity.project)} overwrites an action in the template entity`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${le(d.entity,d.entity.project)} overwrites a property in the template entity`;case ve.MissingMethodImplementation:return`${le(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case ve.MissingPropertyImplementation:return`${le(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case Ie.NameNotUniqueInScope:return`${le(d.entity,d.entity.project)} has a duplicate name in the same scope`;case ve.NoProperties:return`${le(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case ve.NonStaticPropertyInStaticEntity:return`${le(d.entity,d.entity.project)} has a non-static property in a static entity`;case ve.StaticEntityWithNonStaticProperties:return`${le(d.entity,d.entity.project)} has non-static properties in a static entity`;case ve.ReadingFromIncompatibleType:return`${le(d.entity,d.entity.project)} reads data from a value of a different data type`;case ve.WritingToIncompatibleType:return`${le(d.entity,d.entity.project)} writes data to a value of a different data type`;case ve.ScopeWithoutLogic:return`${le(d.entity,d.entity.project)} has no logic`;case ve.NonStaticPropertyImplementsStatic:return`${le(d.entity,d.entity.project)} has a static property in a non-static entity`;case ve.PropertyImplementsIncompatibleType:return`${le(d.entity,d.entity.project)} implements a property of a different data type`;case ve.PropertyImplementsNonAbstact:return`${le(d.entity,d.entity.project)} implements a non-template property`;case ve.StaticPropertyImplementsNonStatic:return`${le(d.entity,d.entity.project)} has a static property in a non-static entity`;case ve.VariableCallsOthersAndHasInternalCall:return`${le(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case ve.VariableHasInputsAndInternalCall:return`${le(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case ve.VariableHasOutputsAndInternalCall:return`${le(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case ve.VariableIsCalledAndHasInternalCall:return`${le(d.entity,d.entity.project)} is called while being used to execute internal logic`;case Ie.InternalCallDeclarationIsInvalidType:return`${le(d.entity,d.entity.project)} has a declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(d.entity,d.entity.project)} has a declaration that is not found in ${(p=d.entity.parent.getDataType(null))!=null&&p.entity?le((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${le(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ie.InternalCallParentMissingDataType:return`${le(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(d.entity,d.entity.project)} has a declaration doesn't belong to ${(n=d.entity.parent.getDataType(null))!=null&&n.entity?le((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case Ie.UnreachableEntity:return`${le(d.entity,d.entity.project)} is unreachable`;case ve.DisconnectedCallableEntity:return`${le(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case ve.AbstractEntityImplements:return`${le(d.entity,d.entity.project)} implements a non-template entity`;case ve.AbstractExtendingNonAbstractEntity:return`${le(d.entity,d.entity.project)} extends a non-template entity`;case ve.InvalidPropertiesCombination:return`${le(d.entity,d.entity.project)} has an invalid combination of properties`;case ve.ExtendingNonInteractiveEntity:return`${le(d.entity,d.entity.project)} extends a non-interactive entity`;case ve.ExtendsIncompatibleEntities:return`${le(d.entity,d.entity.project)} extends incompatible entities`;case ve.ImplementingNonAbstractEntity:return`${le(d.entity,d.entity.project)} implements a non-template entity`;case ve.ImplementsIncompatibleEntities:return`${le(d.entity,d.entity.project)} implements incompatible entities`;case ve.LackingReturnStatementOnSomeBranches:return`${le(d.entity,d.entity.project)} has branches that don't terminate`;case ve.LastCalledEntityMustBeReturnEntity:return`${le(d.entity,d.entity.project)} must end with a termination node`;case ve.MissingRequiredValue:return`${le(d.entity,d.entity.project)} is missing a required value`;case ve.NoPrimaryKeyProperty:return`${le(d.entity,d.entity.project)} has no primary key property`;case ve.NonAbstractExtendingAbstractEntity:return`${le(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case ve.NonStaticExtendingStaticEntity:return`${le(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case ve.NonStaticImplementingStaticEntity:return`${le(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case ve.StaticExtendingNonStaticEntity:return`${le(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case ve.StaticImplementingNonStaticEntity:return`${le(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case ve.VariableReadsValueAndInternalCall:return`${le(d.entity,d.entity.project)} reads a value and has an internal call`;case ve.VariableWritesValuesAndInternalCall:return`${le(d.entity,d.entity.project)} writes values and has an internal call`;case Ie.EmptyName:return`${is[d.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${le(d.entity,d.entity.project)} has an invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${le(d.entity,d.entity.project)}'s loop body action overwrites`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites a base action with same implementation`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${le(d.entity,d.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${le(d.entity,d.entity.project)} has a name that is not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${le(d.entity,d.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${le(d.entity,d.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites a base property with same implementation`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${le(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case Oo.StatusCodeMustBeBetween100And599:return`${le(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Oo.StatusCodeMustBeNumber:return`${le(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case La.UUIDMustBeString:return`${le(d.entity,d.entity.project)} UUID must be a string, eg: "${hu()}"`;case La.UUIDMustNotContainSpaces:return`${le(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${hu()}"`;case La.UUIDMustBeValidFormat:return`${le(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${hu()}"`;case ia.MustBeUniqueAmongSameEntities:return`${le(d.entity,d.entity.project)} value must be unique among the same kind`;case ia.StringValueMustNotHaveDashes:return`${le(d.entity,d.entity.project)} value must not contain dashes`;case ia.StringValueMustNotHaveSpaces:return`${le(d.entity,d.entity.project)} value must not contain spaces`;default:return`${le(d.entity,d.entity.project)} Error: ${cv(d.code)}`}}var gN=(d=>(d.ValuesAlreadyConnected="values-already-connected",d.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",d.CannotReadValueFromChildren="cannot-read-value-from-children",d.CannotWriteValueToChildren="cannot-write-value-to-children",d.CannotBeCalledByChildren="cannot-be-called-by-children",d.ExecutionsAlreadyConnected="executions-already-connected",d.DataTypesNotCompatible="data-types-not-compatible",d.CannotCallAncestor="cannot-call-ancestor",d.CannotConnectToItself="cannot-connect-to-itself",d.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",d.NotInScope="not-in-scope",d.IsNotValueWrittingEntity="is-not-value-writting-entity",d.IsNotValueReadingEntity="is-not-value-reading-entity",d.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",d.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",d.CallerIsInHigherScope="caller-is-in-higher-scope",d.CallerIsInLowerScope="caller-is-in-lower-scope",d.CallIsInHigherScope="call-is-in-higher-scope",d.CallIsInLowerScope="call-is-in-lower-scope",d.OtherIncompatibleScopeReason="other-incompatible-scope-reason",d.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",d.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",d.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",d))(gN||{});const G2i=Object.values(gN);var IN=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(IN||{});const U2i=Object.values(IN);var RN=(d=>(d.Suggestion="suggestion",d.CanvasGloballyDisabled="canvas-globally-disabled",d.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",d.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",d))(RN||{});const j2i=Object.values(RN);function k2i(d,p){const i=[...d,...p];return Array.from(new Set(i))}function K2i(d,p){const i=[...d,...p],n=Array.from(new Set(i));return{hasChanged:n.length!==d.length,reasons:n}}function F2i(d,p){const i=d.filter(l=>!p.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function S2i(d,p){return d.find(i=>i.entity.id===p)||null}function J4(d){return d.filter((p,i)=>d.indexOf(p)===i)}class bn{constructor(p,i,n=null,l){I(this,"ids",[]);I(this,"entity");I(this,"entityCardHeight");I(this,"entityCardWidth");I(this,"index");I(this,"childEntities",[]);I(this,"children",[]);I(this,"parents",[]);I(this,"calculationEntryPoint");I(this,"_onlyEntities",null);I(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=n||this,this===this.calculationEntryPoint&&!l)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,n){const l=fBe-kw-uBe,c=yBe-$b-bN;p.metaSync({x:p.x||l,y:p.y||c},i);const e=new bn(p,0,null,i);e._onlyEntities=n||[],e.ids=["0"];const y=[];e.next(v=>{y.push(...v)}),bn.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const T=e.flattenChildEntities();return e._onlyEntities?T.filter(v=>(e._onlyEntities||[]).includes(v)):T}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(n=>{n.next(l=>{i.push(...l)})}),i.length>0&&bn.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(p){this.calculationEntryPoint._changeSet=p}findAreaInChildrenFromEntity(p){if(this.entity===p)return this;const i=this.children.find(l=>l.entity===p);return i||this.children.reduce((l,c)=>l||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,n=i.find(c=>c.entity===p);return n||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=bn.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(n=>`${n}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=Tl(this.entity,!0);if(this.entity.type===o.Project){const i=[],n=[],l=[];p.forEach(e=>{if(o.DefinitionEntity===e.type){n.push(e);return}else if(zt.includes(e.type)){l.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const T=!!uA(e,y).length,v=Tl(e),E=Tl(y);return T?0:v.length&&!E.length?-1:!v.length&&E.length?1:0}).filter(e=>!Lp(e).length);this.childEntities=[...n,...l,...c]}else{const i=[],n=[],l=[],c=[],e=[];Sr.includes(this.entity.type)&&w1(this.entity).forEach(v=>{if(St.includes(v.type)){l.push(v);return}const E=ki(v);i.push(E)}),yr.includes(this.entity.type)&&n.push(...this.entity.detachedChildren);const y=p.filter(T=>{const v=i.includes(T);return v||l.includes(T)||n.includes(T)?!1:St.includes(T.type)?(l.push(T),!1):zr.includes(T.type)&&!v?(c.push(T),!1):T.type===o.DefinitionEntity?(e.push(T),!1):!0});i.sort((T,v)=>bc(T,v)?-1:0),c.sort((T,v)=>bc(T,v)?-1:0),l.sort((T,v)=>iC(T,v)?1:iC(v,T)?-1:0),this.childEntities=[...e,...i,...c,...y,...l,...n]}}calculateCardSize(){const p=mBe(this.entity);this.entityCardWidth=p.width,this.entityCardHeight=p.height}static getBoundriesOfTwoAreas(p,i){return{top:Math.min(p.top,i.top),left:Math.min(p.left,i.left),bottom:Math.max(p.bottom,i.bottom),right:Math.max(p.right,i.right)}}static getBoundriedOfCombinedAreas(p,i){const n=p.filter(c=>!i.includes(c));return n.reduce((c,e)=>i.includes(e)?c:bn.getBoundriesOfTwoAreas(c,e.fullBranchArea),n[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,y)=>bn.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],n=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,y)=>bn.getBoundriesOfTwoAreas(e,y),n)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>bn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,c)=>bn.getBoundriesOfTwoAreas(l,c),p)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const p=this.ownEntityArea;return{top:p.top,left:p.left,bottom:p.bottom+$b,right:p.right+kw}}static filterOutRepeatedAreas(p){return p.filter((i,n)=>p.indexOf(i)===n)}getEarliestId(p,i){const n=p.split("-"),l=i.split("-");return n.length<l.length?p:n.length>l.length?i:n.reduce((e,y,T)=>y<l[T]?p:i,p)}getEarliestLevel(){return this.ids.reduce((n,l)=>this.getEarliestId(n,l),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const n=this.parents.reduce((l,c)=>c.getEarliestLevel()>l.getEarliestLevel()?c:l,this.parents[0]).countColumns();return p+=n,p}getLatestId(p,i){if(p===i)return p;const n=p.split("-"),l=i.split("-");return n.length<l.length?i:n.length>l.length?p:n.reduce((e,y,T)=>y>l[T]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((n,l)=>this.getLatestId(n,l),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(n=>{n!==this.calculationEntryPoint&&n.shiftDownAlone(i)})}else if([...zt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(n=>!this.parents.includes(n));i.length?i.every(l=>{const c=this.countColumns(),e=l.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let n=[...p,this];return this.children.forEach(l=>{if(bn.getEarliestParentInChain(l)!==this)return;const e=S2i(n,l.entity.id);n=bn.filterOutRepeatedAreas([...n]),e||(n=n.filter(T=>T!==l));const y=l.shiftDownUntilAny(n,i);n.push(...y)}),n}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(n=>{const l=bn.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);bn.getEarliestParentInChain(n)===this&&n.shiftRightUntilAny(l,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const l=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(l,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+ay,T={top:y,left:e.left,bottom:y,right:e.right};return bn.getBoundriesOfTwoAreas(l,T)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-ay;this.shiftDownAlone(n)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+ay,T={top:y,left:e.left,bottom:y,right:e.right};return bn.getBoundriesOfTwoAreas(l,T)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-ay;return this.shiftDownAlone(n),n}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(n=>{const l=n.adjustVerticallyToAvoidOverlaps();i.push(...l)}),p.forEach(n=>{n.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((n,l)=>{if(!n.ids.length)return-1;if(!l.ids.length)return 1;const c=n.ids.sort((y,T)=>y.length<T.length?-1:0),e=l.ids.sort((y,T)=>y.length<T.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,l)=>{if(p.has(l.entity.id))return n;p.add(l.entity.id);const e=l.children.slice(0,l.children.indexOf(this)).reduce((y,T)=>[...y,T,...T.flattenChildren(p)],[]);return[...n,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,l)=>{if(p.has(l.entity.id))return n;p.add(l.entity.id);const e=l.children.filter(y=>y!==this).reduce((y,T)=>[...y,T,...T.flattenChildren(p)],[]);return[...n,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n,...n.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((n,l)=>p.has(l.entity.id)?n:(p.add(l.entity.id),[...n,l,...l.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(l=>l.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,n)=>{const l=n.children.indexOf(this),c=n.children.slice(l+1);return[...i,...c]},[]);return J4(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((n,l)=>[...n,...l.getLowerAreas()],[]);return J4([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const n=bn.getEarliestParentInChain(this).children[this.index-1];if(!n)return p;const l=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...l,...c,n],v=D(e.flatMap(P=>uA(this.entity,P.entity))).filter(P=>P.id!==this.entity.id).map(P=>this.findAreaFromEntity(P)).filter(P=>!!P),E=this.getFullAreaUntilAny(v),b=n.getFullAreaUntilAny(v),O=e.reduce((P,$)=>$===this||$.fullBranchArea.left!==E.left?P:Math.max(P,$.fullBranchArea.bottom),b.bottom);if(E.top<O){const P=O-E.top+$b;return this.shiftDownUntilAny(p,P)}return p}move(p,i){(this.onlyEntities||[]).includes(p)&&p.metaSync(i,this.changeSet)}addChild(p){const i=this.childEntities[p];let n=null;i.x&&i.y?n=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),n||(n=new bn(i,p,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(n)||(this.children.push(n),n.addParent(this));const c=n.fullBranchArea;if(c.left<l.right){const e=l.right-c.left;n.shiftRight(e)}return n}flattenChildEntities(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n.entity,...n.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((n,l)=>{const c=this.addChild(l);c&&i.push(c)}),p(i)}}var Im=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(Im||{}),fr=(d=>(d.RelationalDatabase="relational-database",d.CompiledLocalCodebase="compiled-local-codebase",d.CloudHostedCodebase="cloud-hosted-codebase",d.HttpApi="http-api",d.HttpEndpoint="http-endpoint",d.ServerlessFunction="serverless-function",d))(fr||{}),Kw=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(Kw||{}),sc=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.Skipped="skipped",d.AbortedByUser="aborted-by-user",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(sc||{}),Fw=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Fw||{}),Nt=(d=>(d.ProjectNotFound="project-not-found",d.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",d.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",d.DeploymentCompleted="deployment-completed",d.DeploymentStarted="deployment-started",d.DeploymentFailed="deployment-failed",d.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",d.RequestPayloadValidationFailed="request-payload-validation-failed",d.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",d.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",d.ProjectAlreadyBeingPublished="project-already-being-published",d.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",d.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",d.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",d.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",d.CreatingNewRelationalDatabase="creating-new-relational-database",d.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",d.RelationalDatabaseAlreadyExists="relational-database-already-exists",d.RelationalDatabaseDeletionStarted="relational-database-deletion-started",d.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",d.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",d.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",d.HttpApiDeploymentStarted="http-api-deployment-started",d.HttpApiDeploymentCompleted="http-api-deployment-completed",d.HttpApiDeploymentFailed="http-api-deployment-failed",d.CreatingNewHttpApi="creating-new-http-api",d.HttpApiAlreadyExists="http-api-already-exists",d.HttpApiDeletionStarted="http-api-deletion-started",d.HttpApiDeletionCompleted="http-api-deletion-completed",d.HttpApiDeletionFailed="http-api-deletion-failed",d.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",d.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",d.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",d.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",d.BundlingCodebaseForDownload="bundling-codebase-for-download",d.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",d.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",d.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",d.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",d.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",d.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",d.CodeCompilationStarted="code-compilation-started",d.CodeCompilationCompleted="code-compilation-completed",d.CodeCompilationFailed="code-compilation-failed",d.BundleCodebaseStarted="bundle-codebase-started",d.BundleCodebaseCompleted="bundle-codebase-completed",d.BundleCodebaseFailed="bundle-codebase-failed",d.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",d.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",d.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",d.MigrateRelationalDatabaseStarted="migrate-relational-database-started",d.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",d.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",d.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",d.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",d.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",d.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",d))(Nt||{}),fl=(d=>(d.CodeCompilation="code-compilation",d.RelationalDatabaseDeployment="relational-database-deployment",d.RelationalDatabaseDeletion="relational-database-deletion",d.HttpApiDeployment="http-api-deployment",d.HttpApiDeletion="http-api-deletion",d.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",d.BundleCodebase="bundle-codebase",d.MigrateRelationalDatabase="migrate-relational-database",d.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",d.ExecutePublicationCompletedEvent="execute-publication-completed-event",d.CodebaseCleanup="codebase-cleanup",d))(fl||{});fr.CloudHostedCodebase,fr.HttpApi,fr.RelationalDatabase,fr.CloudHostedCodebase,fr.CloudHostedCodebase,fr.RelationalDatabase,fr.CloudHostedCodebase,fr.CloudHostedCodebase;function TBe(d){return`project-${d}-http-api`}function e1(d){return`entity-${d}-database`}class vBe{constructor(p,i,n,l,c,e,y,T,v){I(this,"stepType");I(this,"id");I(this,"resourceType");I(this,"index");I(this,"dependency",[]);I(this,"lastEvent",null);I(this,"lastEventTimestamp",null);I(this,"status",sc.Queued);I(this,"publicationRun");I(this,"resource");this.stepType=p,this.id=i,this.resourceType=n,this.status=l,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=T,this.resource=v}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(p){var i,n;this.status=p.status,this.dependency=p.dependency,this.index=p.index,this.stepType=p.stepType,this.resourceType=p.resourceType,this.lastEvent=p.lastEvent,this.id=p.id,(n=this.resource)==null||n.setDetails((i=p.resource)==null?void 0:i.details)}}var EBe=(d=>(d.Ready="ready",d.Provisioning="provisioning",d.Queued="queued",d.ProvisioningFailed="provisioning-failed",d.Deleting="deleting",d.DeletingFailed="deleting-failed",d.Deleted="deleted",d))(EBe||{});class Qc{constructor(p,i,n){I(this,"provisionedBy");I(this,"publicationRun");I(this,"resourceType");I(this,"provider");I(this,"resourceId");I(this,"details",null);I(this,"name",null);I(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=n}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class q2i extends Qc{constructor(i,n,l){super(i,fr.HttpEndpoint,l);I(this,"resourceType",fr.HttpEndpoint);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=e1((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class Z2i extends Qc{constructor(i,n,l){super(i,fr.ServerlessFunction,l);I(this,"resourceType",fr.ServerlessFunction);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=e1((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class bBe extends Qc{constructor(i,n,l){super(i,fr.HttpApi,l);I(this,"resourceType",fr.HttpApi);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=TBe(this.publicationRun.project.id),this.resourceId}}class ABe extends Qc{constructor(i,n,l){super(i,fr.RelationalDatabase,l);I(this,"resourceType",fr.RelationalDatabase);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=e1((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class gBe extends Qc{constructor(i,n){super(i,fr.CloudHostedCodebase,n);I(this,"resourceType",fr.CloudHostedCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class IBe extends Qc{constructor(i,n){super(i,fr.CompiledLocalCodebase,n);I(this,"resourceType",fr.CompiledLocalCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class H2i{constructor(p,i){I(this,"id");I(this,"projectAutoIncrementPublicationCount");I(this,"projectPublishedSemanticVersion");I(this,"projectVersion");I(this,"projectId");I(this,"triggeredBy");I(this,"createdAt");I(this,"updatedAt");I(this,"status");I(this,"steps",[]);I(this,"editor");I(this,"explicitResources",new Map);I(this,"implicitGlobalResources",new Map);I(this,"finalGlobalEvent",null);I(this,"finalStatus",null);I(this,"contextType",J.PublicationRun);I(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.projectVersion=p.projectVersion,this.projectId=p.projectId,this.triggeredBy=p.triggeredBy,this.createdAt=p.createdAt,this.updatedAt=p.updatedAt,this.status=p.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(p){return this.steps.filter(i=>p.includes(i.resourceType))}getStepsTypes(p){return this.steps.filter(i=>p.includes(i.stepType))}toIds(p){return p.map(i=>i.id)}getResourceForEntity(p){const i=Array.from(this.explicitResources.values()).find(n=>n.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(fr.CompiledLocalCodebase,new IBe(this,Im.Amazon)),this.implicitGlobalResources.set(fr.CloudHostedCodebase,new gBe(this,Im.Amazon));const p=this.project.entities.filter(n=>Ki(n,Re.HTTP_ENDPOINT)),i=this.project.entities.filter(n=>Ki(n,Re.RELATIONAL_DATABASE));if(i.length&&i.forEach(n=>{const l=new ABe(this,[n],Im.Amazon);this.explicitResources.set(l.resourceId,l)}),p.length){const n=new bBe(this,p,Im.Amazon);this.explicitResources.set(n.resourceId,n)}}setSteps(p,i){p.forEach(n=>{this.addStep(n,i)}),this.editor.events.emit(Nt.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const n=p.dependency||[];if(n.length){const c=n.filter(e=>!this.steps.find(y=>y.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===p.id)){const c=new vBe(p.stepType,p.id,p.resourceType,p.status,n,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(te.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const n=this.steps.find(l=>{var c;return l.id===((c=p.payload)==null?void 0:c.id)});n&&M(p.emittedAt).isAfter(M(n.lastEventTimestamp))&&n.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===Kw.Error?(this.finalStatus=Fw.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===Kw.Complete&&(this.finalStatus=Fw.Success,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-completed",p))}requestExtension(p){return this.extensionsRegistry.requestExtension(p)}async initRegistry(){return this.extensionsRegistry=new yN(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(J.PublicationRun),this.extensionsRegistry}}function W2i(d){switch(d){case fl.CodeCompilation:return"Code generation";case fl.RelationalDatabaseDeployment:return"Database creation";case fl.HttpApiDeployment:return"HTTP gateway creation";case fl.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case fl.BundleCodebase:return"Bundle code";case fl.MigrateRelationalDatabase:return"Database structure migration";case fl.BusinessLogicCodebaseDeployment:return"Update servers with new code";case fl.CodebaseCleanup:return"Code cleanup";case fl.HttpApiDeletion:return"HTTP gateway deletion";case fl.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function z2i(d){switch(d){case Nt.DeploymentCompleted:return"Successfully published";case Nt.DeploymentStarted:return"Publication started";case Nt.DeploymentFailed:return"Publication failed";case Nt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Nt.RequestPayloadValidationFailed:return"Request payload validation failed";case Nt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Nt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Nt.RelationalDatabaseDeploymentStarted:return"Database creation started";case Nt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Nt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Nt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Nt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Nt.RelationalDatabaseAlreadyExists:return"Database already exists";case Nt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Nt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Nt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Nt.CreatingNewHttpApi:return"Creating new HTTP gateway";case Nt.HttpApiAlreadyExists:return"HTTP gateway already exists";case Nt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Nt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Nt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Nt.BundlingCodebaseForDownload:return"Bundling code for download";case Nt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Nt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Nt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Nt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Nt.CodeCompilationStarted:return"Code generation started";case Nt.CodeCompilationCompleted:return"Code generation completed";case Nt.CodeCompilationFailed:return"Code generation failed";case Nt.BundleCodebaseStarted:return"Code bundling started";case Nt.BundleCodebaseCompleted:return"Code bundling completed";case Nt.BundleCodebaseFailed:return"Code bundling failed";case Nt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Nt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Nt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Nt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Nt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Nt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Nt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Nt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Nt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Nt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Nt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Nt.ProjectNotFound:return"Project not found";case Nt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Nt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Nt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Nt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Nt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Nt.RelationalDatabaseDeletionStarted:return"Database deletion started";case Nt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Nt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Nt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var RBe=(d=>(d.NO_LOGIC="NO_LOGIC",d.NO_NAME="NO_NAME",d.NO_CHANGES="NO_CHANGES",d.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",d))(RBe||{});function J2i(d){switch(d){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function Y2i(d){switch(d){case fr.RelationalDatabase:return"Relational database";case fr.HttpEndpoint:case fr.HttpApi:return"HTTP endpoints";case fr.ServerlessFunction:case fr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function X2i(d){switch(d){case sc.Running:return"In progress";case sc.Failed:return"Failed";case sc.Success:return"Succeeded";case sc.Skipped:return"Skipped";case sc.Queued:default:return"Queued"}}function DBe(d){var n;if(!Ki(d,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=Y["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(d.type===o.BuiltInBaseEntity?Ki(d,Re.EXTERNAL_INTEGRATION_CONNECTION)&&(p=Sw(d.name)):d.type===o.DefinitionEntity&&d.implements.forEach(l=>{if(Ki(l,Re.EXTERNAL_INTEGRATION_CONNECTION)){const c=Sw(l==null?void 0:l.name);if(c)return p=c,!0}}),!p){const l=d.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var y;return((y=e.extends)==null?void 0:y.id)===i}));p=(n=l==null?void 0:l.getDefaultValue())==null?void 0:n.value}return p}function Q2i(d){return bhe[d]}function Sw(d){return d.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?d.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function OBe(d){if(d.type!==o.ActionDescriptor&&d.type!==o.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(d.type===o.ActionDescriptor){const p=d;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(d.type===o.Operation){const p=d.declaration;if(Object.values(Jt).includes(p.id))return p.id.split("--")[1]||null}return null}function eMi(d){if(!d)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Re).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===d.toLowerCase()))||null}function tMi(d){return d.type===o.BuiltInBaseEntity||d.type===o.DefinitionEntity?DBe(d):d.type===o.ActionDescriptor||d.type===o.Operation?OBe(d):null}function wBe(d){var l,c,e;if(!Ki(d,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=bje(d,Re.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const n=Y["built-in-base-entity"][i.id].properties.connectionId.id;if(d.type===o.BuiltInBaseEntity){if(Ki(d,Re.EXTERNAL_INTEGRATION_CONNECTION)){const y=d.properties.find(T=>{var v;return((v=T.extends)==null?void 0:v.id)===n});y&&(p=(l=y.getDefaultValue())==null?void 0:l.value)}}else if(d.type===o.DefinitionEntity){const y=d.properties.find(T=>!!T.implements.find(v=>v.id===n)||!!T.implements.find(v=>{var E;return((E=v.extends)==null?void 0:E.id)===n}));if(!y&&((c=d.extends)==null?void 0:c.type)===o.DefinitionEntity)return wBe(d.extends);p=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return p}function CBe(d){var l;(l=d.dataType)==null||l.validate(),d.inputs.forEach(c=>c.validate()),d.outputs.forEach(c=>c.validate()),d.internalCalls.forEach(c=>c.validate());const i=[...qd(d),...nf(d),..._Be(d),...Zd(d),...PBe(d)],n=QN(d);return i.push(...n),rr(d.errors,i)}function _Be(d,p){const n=[...d.project.getVariableDeclarations()].filter(l=>l.id!==d.id);return _v(d,[Wi],n,p)}function PBe(d){const p=[];if(d.parent!==d.project)return p;if(d.catchesError){const i=Mt({id:`${d.id}--${Ie.GlobalVariableDeclarationCannotCatchError}`,message:`${is[d.type].singular} "${le(d,d.project)}" with id "${d.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:pe.Error,code:Ie.GlobalVariableDeclarationCannotCatchError,entity:d});p.push(i.error)}if(d.errorCalls.length){const i=Mt({id:`${d.id}--${Ie.GlobalVariableDeclarationCannotCallOnError}`,message:`${is[d.type].singular} "${le(d,d.project)}" with id "${d.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:pe.Error,code:Ie.GlobalVariableDeclarationCannotCallOnError,entity:d});p.push(i.error)}if(d.calledBy.length){const i=Mt({id:`${d.id}--${Ie.GlobalVariableDeclarationCannotBeCalled}`,message:`${is[d.type].singular} "${le(d,d.project)}" with id "${d.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:pe.Error,code:Ie.GlobalVariableDeclarationCannotBeCalled,entity:d});p.push(i.error)}return[]}const iMi=Object.freeze(Object.defineProperty({__proto__:null,validate:CBe,validateGlobalVariableDeclaration:PBe,validateVariableDeclarationName:_Be},Symbol.toStringTag,{value:"Module"}));function VBe(d){d.inputs.forEach(l=>l.validate()),d.outputs.forEach(l=>l.validate()),d.internalCalls.forEach(l=>l.validate());const i=[...qd(d),...nf(d),...Zd(d)],n=QN(d);return i.push(...n),rr(d.errors,i)}const rMi=Object.freeze(Object.defineProperty({__proto__:null,validate:VBe},Symbol.toStringTag,{value:"Module"}));var DN=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(DN||{});const di=class di extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"x");I(this,"y");I(this,"type",o.VariableInstance);I(this,"catchesError",!1);I(this,"defaultValue",null);I(this,"writesValues",[]);I(this,"readsValue",null);I(this,"declaration");I(this,"inputs",[]);I(this,"outputs",[]);I(this,"error",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"successCalls",[]);I(this,"errorCalls",[]);I(this,"internalCalls",[]);I(this,"project");I(this,"errors",[]);I(this,"parent");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.VariableInstance,catchesError:!0,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,n){let l=n;if(i.parent){const P=re(i.parent);l=n.get(P)}const c=re(i.declaration),e=n.get(c),y=i.calledByEntry.map(P=>{const $=re(P);return n.get($)}),T=i.calledBySuccess.map(P=>{const $=re(P);return n.get($)}),v=i.calledByError.map(P=>{const $=re(P);return n.get($)});let E=null;if(i.readsValue){const P=re(i.readsValue);E=n.get(P)}const b={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:T,calledByError:v,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:E,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},O=he(b,n);return O.setParent(l,null),O}static validateGenerationTarget(i,n){let l=JSON.parse(JSON.stringify(i));const c=[],e=Tn(l,{parent:{list:!1,types:[...yr,o.Project],optional:!0},declaration:{list:!1,types:[o.VariableDeclaration]}},n);return l=e.modifiedData,c.push(...e.errors,...Nr(l)),{errors:c,modifiedData:l}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const n=[];let l=JSON.parse(JSON.stringify(i));const c=rf(l,this);return l=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${ne.InvalidParentUpdate}`,code:ne.InvalidParentUpdate,severity:pe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
55
+ `+c):n.stack=c}catch{}}throw n}}_request(p,i){typeof p=="string"?(i=i||{},i.url=p):i=p||{},i=Tc(this.defaults,i);const{transitional:n,paramsSerializer:l,headers:c}=i;n!==void 0&&Pb.assertOptions(n,{silentJSONParsing:fo.transitional(fo.boolean),forcedJSONParsing:fo.transitional(fo.boolean),clarifyTimeoutError:fo.transitional(fo.boolean)},!1),l!=null&&(Ue.isFunction(l)?i.paramsSerializer={serialize:l}:Pb.assertOptions(l,{encode:fo.function,serialize:fo.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Pb.assertOptions(i,{baseUrl:fo.spelling("baseURL"),withXsrfToken:fo.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let e=c&&Ue.merge(c.common,c[i.method]);c&&Ue.forEach(["delete","get","head","post","put","patch","common"],$=>{delete c[$]}),i.headers=hl.concat(e,c);const y=[];let T=!0;this.interceptors.request.forEach(function(L){typeof L.runWhen=="function"&&L.runWhen(i)===!1||(T=T&&L.synchronous,y.unshift(L.fulfilled,L.rejected))});const v=[];this.interceptors.response.forEach(function(L){v.push(L.fulfilled,L.rejected)});let E,b=0,O;if(!T){const $=[Z4.bind(this),void 0];for($.unshift(...y),$.push(...v),O=$.length,E=Promise.resolve(i);b<O;)E=E.then($[b++],$[b++]);return E}O=y.length;let P=i;for(;b<O;){const $=y[b++],L=y[b++];try{P=$(P)}catch(U){L.call(this,U);break}}try{E=Z4.call(this,P)}catch($){return Promise.reject($)}for(b=0,O=v.length;b<O;)E=E.then(v[b++],v[b++]);return E}getUri(p){p=Tc(this.defaults,p);const i=O2e(p.baseURL,p.url,p.allowAbsoluteUrls);return A2e(i,p.params,p.paramsSerializer)}}Ue.forEach(["delete","get","head","options"],function(p){eA.prototype[p]=function(i,n){return this.request(Tc(n||{},{method:p,url:i,data:(n||{}).data}))}});Ue.forEach(["post","put","patch"],function(p){function i(n){return function(c,e,y){return this.request(Tc(y||{},{method:p,headers:n?{"Content-Type":"multipart/form-data"}:{},url:c,data:e}))}}eA.prototype[p]=i(),eA.prototype[p+"Form"]=i(!0)});const Vb=eA;class cN{constructor(p){if(typeof p!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(c){i=c});const n=this;this.promise.then(l=>{if(!n._listeners)return;let c=n._listeners.length;for(;c-- >0;)n._listeners[c](l);n._listeners=null}),this.promise.then=l=>{let c;const e=new Promise(y=>{n.subscribe(y),c=y}).then(l);return e.cancel=function(){n.unsubscribe(c)},e},p(function(c,e,y){n.reason||(n.reason=new $h(c,e,y),i(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(p){if(this.reason){p(this.reason);return}this._listeners?this._listeners.push(p):this._listeners=[p]}unsubscribe(p){if(!this._listeners)return;const i=this._listeners.indexOf(p);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const p=new AbortController,i=n=>{p.abort(n)};return this.subscribe(i),p.signal.unsubscribe=()=>this.unsubscribe(i),p.signal}static source(){let p;return{token:new cN(function(l){p=l}),cancel:p}}}const E2i=cN;function b2i(d){return function(i){return d.apply(null,i)}}function A2i(d){return Ue.isObject(d)&&d.isAxiosError===!0}const Gw={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Gw).forEach(([d,p])=>{Gw[p]=d});const g2i=Gw;function V2e(d){const p=new Vb(d),i=d2e(Vb.prototype.request,p);return Ue.extend(i,Vb.prototype,p,{allOwnKeys:!0}),Ue.extend(i,p,null,{allOwnKeys:!0}),i.create=function(l){return V2e(Tc(d,l))},i}const mn=V2e(uN);mn.Axios=Vb;mn.CanceledError=$h;mn.CancelToken=E2i;mn.isCancel=R2e;mn.VERSION=P2e;mn.toFormData=WI;mn.AxiosError=ti;mn.Cancel=mn.CanceledError;mn.all=function(p){return Promise.all(p)};mn.spread=b2i;mn.isAxiosError=A2i;mn.mergeConfig=Tc;mn.AxiosHeaders=hl;mn.formToJSON=d=>I2e(Ue.isHTMLForm(d)?new FormData(d):d);mn.getAdapter=_2e.getAdapter;mn.HttpStatusCode=g2i;mn.default=mn;const I2i=mn;class N2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__HTTP_REQUEST,version:"1.0.0",description:"HTTP request operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Hn.HttpRequest);l&&(l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[3]||{},e={method:l[0],url:l[1],params:l[2],headers:c,data:l[4]};te.Logger.log("Axios request config: ",e);const y=await I2i(e);return{value:G.Success,error:null,result:{status:y.status,headers:y.headers,data:y.data}}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}const W4=Symbol("missing"),R2i=d=>d!=null&&typeof d=="object";function pv(d,p){if(typeof d!="string")throw new TypeError(`${p} expects the key to be a string.`);return d}function Lh(d,p){if(typeof d!="string"&&!Array.isArray(d))throw new TypeError(`${p} expects the path to be string or array.`);return d}function Xc(d,p){if(!mr(d))throw new TypeError(`${p} expects the first argument to be an object.`);return d??{}}function x2e(d,p){const i=pv(p,"ReadKey");return(d??{})[i]}function $2e(d,p,i){const n=pv(p,"WriteKey"),l=av(d??{});return l[n]=i,l}function L2e(d,p){const i=pv(p,"DeleteKey"),n=av(d??{});return delete n[i],n}function M2e(d,p,i){const n=Xc(d,"ReadNestedKey"),l=Lh(p,"ReadNestedKey");return HV(n,l,i)}function B2e(d,p,i){const n=Xc(d,"WriteNestedKey"),l=Lh(p,"WriteNestedKey"),c=av(n);return WV(c,l,!1),cPe(c,l,i,{createMissing:!1})}function G2e(d,p,i){const n=Xc(d,"WriteSafeNestedKeyRecursively"),l=Lh(p,"WriteSafeNestedKeyRecursively"),c=av(n);return WV(c,l,!0),cPe(c,l,i,{createMissing:!0})}function U2e(d,p){const i=Xc(d,"DeleteNestedKey"),n=Lh(p,"DeleteNestedKey"),l=av(i),{target:c,lastKey:e}=WV(l,n,!1);return delete c[e],l}function j2e(d,p){const i=pv(p,"HasKey"),n=d;return n!=null&&R2i(n)&&Object.prototype.hasOwnProperty.call(n,i)}function k2e(d,p,i){const n=pv(p,"KeyValueEquals");return d==null||typeof d!="object"?!1:d[n]===i}function K2e(d,p){const i=d,n=Lh(p,"HasNestedKey");return HV(i,n,W4)!==W4}function F2e(d,p,i){const n=Lh(p,"NestedKeyValueEquals");return HV(d,n)===i}function S2e(...d){const p={};for(let i=0;i<d.length;i++){const n=d[i];if(n!=null){if(!mr(n))throw new TypeError("MergeObjects expects every argument to be an object (or null/undefined).");Object.assign(p,n)}}return p}function q2e(d){const p=Xc(d,"ObjectKeys");return Object.keys(p)}function Z2e(d){const p=Xc(d,"ObjectValues");return Object.values(p)}function H2e(d){const p=Xc(d,"ObjectEntries");return Object.entries(p)}class W2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__VALIDATE_ENTITY,version:"1.0.0",description:"Entity validate operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.Validate);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)});te.Logger.log("Inputs for entity validation: ",l);const e=DI(l[1]).safeParse(l[0]);return e.success?{value:G.Success,error:null,result:{data:l[0]}}:{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e.error.errors,result:null}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}const ga=d=>d.map(p=>{var i,n;return((i=p.value)==null?void 0:i.valueAsType)??((n=p.value)==null?void 0:n.value)});class z2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_KEY,version:"1.0.0",description:"Entity read-key operation implementation module (top-level)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.ReadKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ga(n),e=x2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class J2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_KEY,version:"1.0.0",description:"Entity write-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.WriteKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=$2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class Y2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_KEY,version:"1.0.0",description:"Entity delete-key operation implementation module (top-level, immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.DeleteKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ga(n),e=L2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class X2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_READ_NESTED_KEY,version:"1.0.0",description:"Entity read-nested-key operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.ReadNestedKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=M2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class Q2e extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_NESTED_KEY,version:"1.0.0",description:"Entity write-nested-key operation implementation module (immutable, no auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.WriteNestedKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=B2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class eMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_WRITE_SAFE_NESTED_KEY_RECURSIVELY,version:"1.0.0",description:"Entity write-safe-nested-key-recursively operation implementation module (immutable, auto-create)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.WriteSafeNestedKeyRecursively);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=G2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class tMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__ENTITY_DELETE_NESTED_KEY,version:"1.0.0",description:"Entity delete-nested-key operation implementation module (immutable)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Ce.DeleteNestedKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const[l,c]=ga(n),e=U2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class iMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_KEY,version:"1.0.0",description:"Object has-key (top-level property present?)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.HasKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ga(n),e=j2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class rMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object key-value-equals (top-level property strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.KeyValueEquals);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=k2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class nMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_HAS_NESTED_KEY,version:"1.0.0",description:"Object has-nested-key (path present?)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.HasNestedKey);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=ga(n),e=K2e(l,c);return{value:G.Success,error:null,result:e}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class aMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_NESTED_KEY_VALUE_EQUALS,version:"1.0.0",description:"Object nested-key-value-equals (path strict equality)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.NestedKeyValueEquals);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e]=ga(n),y=F2e(l,c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class sMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_IS_INSTANCE_OF_TYPE,version:"1.0.0",description:"Object is-instance-of-type (DefinitionEntity-based runtime check)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Ce.IsInstanceOfType);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{var l,c,e,y,T,v,E,b,O,P;try{const $=((c=(l=n[0])==null?void 0:l.value)==null?void 0:c.parent)||((y=(e=n[0])==null?void 0:e.value)==null?void 0:y.standaloneParent),L=(v=(T=n[0])==null?void 0:T.value)==null?void 0:v.value,U=(b=(E=n[1])==null?void 0:E.value)==null?void 0:b.valueAsTypeSingle;if(!L)throw new TypeError("IsInstanceOfType expects a non-null input value.");if(!U)throw new TypeError("IsInstanceOfType expects a valid expectedType input.");if(!$)throw new TypeError("IsInstanceOfType cannot determine the value owner.");if(U.type!==o.DefinitionEntity)throw new TypeError("IsInstanceOfType expects expectedType to be a DefinitionEntity.");const F=$.getDataType(null);if(((O=F==null?void 0:F.entity)==null?void 0:O.type)!==o.DefinitionEntity)throw new TypeError("IsInstanceOfType cannot determine the data type of the input value.");let Z=!1;return((P=F==null?void 0:F.entity)==null?void 0:P.id)!==(U==null?void 0:U.id)?Z=!1:DI(F==null?void 0:F.entity).safeParse(L).success?Z=!0:Z=!1,{value:G.Success,error:null,result:Z}}catch($){return{value:G.UnhandledError,error:$,result:null}}}})}}class lMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_MERGE,version:"1.0.0",description:"Object merge operation implementation module (immutable, shallow merge with right-precedence)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Ce.Merge);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const l=ga(n),c=S2e(...l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class oMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_KEYS,version:"1.0.0",description:"Object keys operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Ce.Keys);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ga(n),c=q2e(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class dMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_VALUES,version:"1.0.0",description:"Object values operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Ce.Values);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ga(n),c=Z2e(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}class uMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__OBJECT_ENTRIES,version:"1.0.0",description:"Object entries operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic);if(!n)return;const l=n.get(Ce.Entries);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=ga(n),c=H2e(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:G.UnhandledError,error:l,result:null}}}})}}let ns=null;try{ns=require("crypto")}catch{}const Om=typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto:ns&&ns.webcrypto?ns.webcrypto:null,mu=Om?Om.subtle:null;function Mm(d){const p=new ArrayBuffer(d.byteLength);return new Uint8Array(p).set(d),p}function qr(d,p="utf8"){if(d instanceof Uint8Array)return d;const i=String(d);if(p==="utf8"){if(typeof TextEncoder<"u")return new TextEncoder().encode(i);if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"utf8"))}else if(p==="hex"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"hex"))}else if(p==="base64"){if(typeof Buffer<"u")return new Uint8Array(Buffer.from(i,"base64"))}else if(p==="base64url"){const n=i.replace(/-/g,"+").replace(/_/g,"/").replace(/=+$/,"");if(typeof Buffer<"u")return new Uint8Array(Buffer.from(n,"base64"));const l=typeof atob=="function"?atob(n):"",c=new Uint8Array(l.length);for(let e=0;e<l.length;e++)c[e]=l.charCodeAt(e);return c}throw new Error(`Unsupported environment/encoding combo for toBytes(${p})`)}function zl(d,p="utf8"){if(p==="utf8"){if(typeof TextDecoder<"u")return new TextDecoder().decode(d);if(typeof Buffer<"u")return Buffer.from(d).toString("utf8")}else if(p==="hex"){if(typeof Buffer<"u")return Buffer.from(d).toString("hex")}else if(p==="base64"){if(typeof Buffer<"u")return Buffer.from(d).toString("base64")}else if(p==="base64url"&&typeof Buffer<"u")return Buffer.from(d).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");throw new Error(`Unsupported environment/encoding combo for fromBytes(${p})`)}const pMe=d=>qr(d,"base64"),cMe=(d,p)=>{const i=d instanceof Uint8Array?d:qr(String(d),p||"utf8");return zl(i,"base64")},Ey=(d,p)=>{const i=d instanceof Uint8Array?d:qr(String(d),p||"utf8");return zl(i,"base64url")},vc=d=>qr(d,"base64url"),fMe=(d,p)=>{const i=d instanceof Uint8Array?d:qr(String(d),p||"utf8");return zl(i,"hex")},yMe=d=>qr(d,"hex");function fN(d){if(Om&&Om.getRandomValues){const p=new Uint8Array(d);return Om.getRandomValues(p),p}if(ns&&ns.randomBytes)return new Uint8Array(ns.randomBytes(d));throw new Error("Secure random not available")}function YI(d,p){if(!(d instanceof Uint8Array)||!(p instanceof Uint8Array)||d.length!==p.length)return!1;let i=0;for(let n=0;n<d.length;n++)i|=d[n]^p[n];return i===0}function hMe(d,p,i,n){if((typeof d!="string"||typeof p!="string")&&typeof d!="string"&&typeof p!="string")throw new Error("Invalid input types");const l=i??"utf8",c=n??"utf8",e=qr(d??"",l),y=qr(p??"",c);return YI(e,y)}async function mMe(d,p){if(mu){const i=await mu.digest({name:d},Mm(p));return new Uint8Array(i)}if(ns){const i=d.replace("SHA-","sha"),n=ns.createHash(i);return n.update(Buffer.from(p)),new Uint8Array(n.digest())}throw new Error("Hash not available")}async function TMe(d,p,i,n){if(typeof p!="string")throw new Error("Invalid input type for data; expected string");const l=String(d??"SHA-256"),c=i??"utf8",e=n??"base64url",y=qr(p??"",c),T=await mMe(l,y);return zl(T,e)}async function XI(d,p,i){if(mu){const n=await mu.importKey("raw",Mm(p),{name:"HMAC",hash:{name:d}},!1,["sign"]),l=await mu.sign("HMAC",n,Mm(i));return new Uint8Array(l)}if(ns){const n=`sha${d.split("-")[1]}`,l=ns.createHmac(n,Buffer.from(p));return l.update(Buffer.from(i)),new Uint8Array(l.digest())}throw new Error("HMAC not available")}async function vMe(d,p,i,n,l,c){if(typeof d!="string"||typeof p!="string")throw new Error("Invalid input types for key or data; expected strings");const e=String(i??"SHA-256"),y=n??"utf8",T=l??"utf8",v=c??"base64url",E=qr(d??"",y),b=qr(p??"",T),O=await XI(e,E,b);return zl(O,v)}async function QI(d,p,{iterations:i,length:n,hashAlg:l="SHA-256"}){if(mu){const c=await mu.importKey("raw",Mm(d),"PBKDF2",!1,["deriveBits"]),e=await mu.deriveBits({name:"PBKDF2",salt:Mm(p),iterations:i,hash:l},c,n*8);return new Uint8Array(e)}if(ns){const c=l==="SHA-512"?"sha512":"sha256";return await new Promise((e,y)=>{ns.pbkdf2(Buffer.from(d),Buffer.from(p),i,n,c,(T,v)=>{T?y(T):e(new Uint8Array(v))})})}throw new Error("PBKDF2 not available")}async function EMe(d,p,i,n,l,c,e,y){if(typeof d!="string"||typeof p!="string")throw new Error("Invalid input types for password or salt; expected strings");const T=c??"utf8",v=e??"utf8",E=y??"base64url",b=Math.max(1,Number(i)||21e4),O=Math.max(1,Number(n)||32),P=l??"SHA-256",$=qr(d??"",T),L=qr(p??"",v),U=await QI($,L,{iterations:b,length:O,hashAlg:P});return zl(U,E)}async function bMe(d,p=fN(16),i=21e4,n=32,l="SHA-256"){const c=qr(d,"utf8"),e=await QI(c,p,{iterations:i,length:n,hashAlg:l}),y=Ey(p),T=Ey(e);return`pbkdf2$${l.toLowerCase()}$${i}$${y}$${T}`}async function AMe(d,p){const i=String(p).split("$");if(i.length!==5||i[0]!=="pbkdf2")return!1;const n=i[1].toLowerCase(),l=parseInt(i[2],10),c=vc(i[3]),e=vc(i[4]),y=n.includes("512")?"SHA-512":"SHA-256",T=await QI(qr(d,"utf8"),c,{iterations:l,length:e.length,hashAlg:y});return YI(T,e)}async function gMe(d,p,i,n,l,c){const e=p!=null?Math.max(1,Number(p)||0):void 0,y=i!=null?Math.max(1,Number(i)||0):void 0,T=n??void 0,v=c??"base64url",E=l!=null?qr(l,v):void 0;return await bMe(String(d??""),E,e,y,T)}function z4(d){return Ey(qr(JSON.stringify(d),"utf8"))}function tA(d){try{return JSON.parse(zl(vc(d),"utf8"))}catch{return null}}async function IMe(d,p,{alg:i="HS256",includeIat:n=!0,expiresInSeconds:l,notBeforeSeconds:c,issuer:e,subject:y,audience:T,jwtid:v,header:E={}}={}){const b={alg:i,typ:"JWT",...E},O=Math.floor(Date.now()/1e3),P={...d||{}};n&&(P.iat=O),typeof l=="number"&&(P.exp=O+l),typeof c=="number"&&(P.nbf=O+c),e&&(P.iss=e),y&&(P.sub=y),T&&(P.aud=T),v&&(P.jti=v);const $=z4(b),L=z4(P),U=qr(`${$}.${L}`,"utf8"),Z=await XI(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,U),X=Ey(Z);return`${$}.${L}.${X}`}async function RMe(d,p,i,n,l,c,e,y,T,v,E,b){if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(d!=null&&typeof d!="object")throw new Error("Invalid input type for payload; expected object");if(E!=null&&typeof E!="object")throw new Error("Invalid input type for header; expected object");if(v!=null&&typeof v!="string")throw new Error("Invalid input type for jwtid; expected string");if(e!=null&&typeof e!="string")throw new Error("Invalid input type for issuer; expected string");if(y!=null&&typeof y!="string")throw new Error("Invalid input type for subject; expected string");if(T!=null&&typeof T!="string"&&!Array.isArray(T))throw new Error("Invalid input type for audience; expected string or string[]");const P=qr(p??"",b??"utf8");return await IMe(d??{},P,{alg:i??"HS256",includeIat:n==null?!0:!!n,expiresInSeconds:l!=null?Number(l):void 0,notBeforeSeconds:c!=null?Number(c):void 0,issuer:e??void 0,subject:y??void 0,audience:T??void 0,jwtid:v??void 0,header:E??void 0})}async function DMe(d,p,{alg:i="HS256",issuer:n,audience:l,maxAgeSeconds:c,clockSkewSeconds:e=60}={}){try{const[y,T,v]=String(d).split(".");if(!y||!T||!v)return{valid:!1,header:null,payload:null,reason:"Malformed"};const E=tA(y),b=tA(T);if(!E||!b)return{valid:!1,header:E,payload:b,reason:"Bad base64/json"};if(E.alg!==i)return{valid:!1,header:E,payload:b,reason:"Alg mismatch"};const O=qr(`${y}.${T}`,"utf8"),$=await XI(i==="HS512"?"SHA-512":i==="HS384"?"SHA-384":"SHA-256",p,O),L=vc(v);if(!YI($,L))return{valid:!1,header:E,payload:b,reason:"Bad signature"};const U=Math.floor(Date.now()/1e3),F=Math.max(0,Number(e)||0);if(b.nbf!=null&&U+F<Number(b.nbf))return{valid:!1,header:E,payload:b,reason:"Not before"};if(b.exp!=null&&U-F>=Number(b.exp))return{valid:!1,header:E,payload:b,reason:"Expired"};if(n&&b.iss!==n)return{valid:!1,header:E,payload:b,reason:"Issuer mismatch"};if(l){const Z=b.aud;if(!(Array.isArray(Z)?Z.includes(l):Z===l))return{valid:!1,header:E,payload:b,reason:"Audience mismatch"}}return c!=null&&b.iat!=null&&U-Number(b.iat)>Number(c)+F?{valid:!1,header:E,payload:b,reason:"MaxAge exceeded"}:{valid:!0,header:E,payload:b}}catch(y){return{valid:!1,header:null,payload:null,reason:String((y==null?void 0:y.message)??y)}}}async function OMe(d,p,i,n,l,c,e,y){if(typeof d!="string")throw new Error("Invalid input type for token; expected string");if(typeof p!="string")throw new Error("Invalid input type for secret; expected string");if(typeof n!="string")throw new Error("Invalid input type for issuer; expected string");if(l!=null&&typeof l!="string")throw new Error("Invalid input type for audience; expected string");const v=qr(p??"",y??"utf8");return await DMe(String(d??""),v,{alg:i??"HS256",issuer:n??void 0,audience:l??void 0,maxAgeSeconds:c!=null?Number(c):void 0,clockSkewSeconds:e!=null?Number(e):void 0})}function wMe(d){const[p,i,n]=String(d).split(".");return{header:p?tA(p):null,payload:i?tA(i):null,signature:n?vc(n):new Uint8Array}}function CMe(d,p){if(!d)throw new Error("Token is required for decoding");if(typeof d!="string")throw new Error("Invalid input type for token; expected string");const i=p??"base64url",{header:n,payload:l,signature:c}=wMe(String(d??"")),e=zl(c,i);return{header:n,payload:l,signature:e}}class _Me extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_GENERATE_RANDOM_BYTES,version:"1.0.0",description:"Randomness generate random bytes operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Xe.GenerateRandomBytes);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)}),e=Math.max(0,Number(l)||0),y=c??"base64url",T=fN(e),v=zl(T,y);return{value:G.Success,error:null,result:v}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class PMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_INTEGER,version:"1.0.0",description:"Randomness generate random integer operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomInteger);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=ixe(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class VMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_FLOAT,version:"1.0.0",description:"Randomness generate random float operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomFloat);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=SI();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class NMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_HEXADECIMAL,version:"1.0.0",description:"Randomness generate random hexadecimal operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomHexadecimal);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=eN(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class xMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE62,version:"1.0.0",description:"Randomness generate random base62 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomBase62);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=tN(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class $Me extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_BASE64,version:"1.0.0",description:"Randomness generate random base64 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=nxe(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class LMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_ALPHANUMERIC,version:"1.0.0",description:"Randomness generate random alphanumeric operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomAlphanumeric);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)||((v=y.value)==null?void 0:v.value)})[0],e=iN(c);return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class MMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_IDENTIFIER,version:"1.0.0",description:"Generate identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateIdentifier);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)||((E=T.value)==null?void 0:E.value)}),c=l[0],e=l[1],y=rN(c,e);return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class BMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_RANDOM_UUIDV4,version:"1.0.0",description:"Generate UUID v4 operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateRandomUUIDv4);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=hu();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class GMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_SHORT_IDENTIFIER,version:"1.0.0",description:"Generate short identifier operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{te.Logger.log("Initializing Random Generate Short Identifier Module");const n=i.find(l=>l.contextType===J.Logic);if(n){te.Logger.log("Project state found, setting up operation");const l=n.get(Xe.GenerateShortIdentifier);l?(te.Logger.log("Operation found, setting autoexecutable and implementation"),l.autoexecutable=!0,l.implementation=this.module.main):te.Logger.warn("Operation generate-short-identifier not found in project state")}else te.Logger.warn("Project state not found in contexts for Random Generate Short Identifier Module")},main:async(i,n)=>{try{const l=axe();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class UMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__RANDOMNESS_GENERATE_HEXADECIMAL_TOKEN,version:"1.0.0",description:"Generate hexadecimal token operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Xe.GenerateHexadecimalToken);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const l=sxe();return{value:G.Success,error:null,result:l}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}function D2i(d){let p;if(d===null?p="null":Array.isArray(d)?p="array":p=typeof d,!["string","number","boolean","null","object","array"].includes(p))throw new TypeError("GetTypeOf cannot determine type of the given value.");return p}class jMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_GET_TYPE_OF,version:"1.0.0",description:"Data type get type of operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(He.GetTypeOf);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{try{const c=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)||((T=e.value)==null?void 0:T.value)})[0];return{value:G.Success,error:null,result:D2i(c)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class kMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_STRING,version:"1.0.0",description:"Coerce any value to string via JS String(value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.ToString);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=String(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class KMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_NUMBER,version:"1.0.0",description:"Coerce to number via JS Number(value)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.ToNumber);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=Number(l);return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class FMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_TO_BYTES,version:"1.0.0",description:"Convert string/bytes-like to Uint8Array (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.ToBytes);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=qr(l,c||"utf8");return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class SMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_FROM_BYTES_TO_STRING,version:"1.0.0",description:"Convert Uint8Array to string (utf8|hex|base64|base64url)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.FromBytesToString);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)}),y=zl(l,c||"utf8");return{value:G.Success,error:null,result:y}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class qMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64,version:"1.0.0",description:"Bytes -> base64 string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.EncodeBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)});return{value:G.Success,error:null,result:cMe(l,c)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class ZMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64,version:"1.0.0",description:"base64 string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.DecodeBase64);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=pMe(String(l));return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class HMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_BASE64URL,version:"1.0.0",description:"Bytes -> base64url string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.EncodeBase64Url);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=Ey(l,c||"utf8");return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class WMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_BASE64URL,version:"1.0.0",description:"base64url string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.DecodeBase64Url);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=vc(String(l));return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class zMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_ENCODE_HEX,version:"1.0.0",description:"Bytes -> hex string (accepts string input by converting from utf8)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.EncodeHex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=fMe(l,c||"utf8");return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class JMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__DATA_TYPE_DECODE_HEX,version:"1.0.0",description:"hex string -> bytes (Uint8Array)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(He.DecodeHex);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)}),c=yMe(String(l));return{value:G.Success,error:null,result:c}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class YMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HASH,version:"1.0.0",description:"Crypto: Hash (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ii.Hash);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:TMe(l,c,e,y)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class XMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_HMAC,version:"1.0.0",description:"Crypto: HMAC (SHA-256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ii.Hmac);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v]=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)});return{value:G.Success,error:null,result:vMe(c,e,l,y,T,v)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class QMe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_CONSTANT_TIME_EQUAL,version:"1.0.0",description:"Crypto: constant-time equality for byte sequences",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ii.ConstantTimeEqual);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y]=n.map(T=>{var v,E;return((v=T.value)==null?void 0:v.valueAsType)??((E=T.value)==null?void 0:E.value)});return{value:G.Success,error:null,result:hMe(l,c,e,y)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class eBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__CRYPTO_DERIVE_KEY_PBKDF2,version:"1.0.0",description:"Crypto: derive key with PBKDF2 (SHA-256/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(ii.DeriveKeyPBKDF2);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v,E,b]=n.map(O=>{var P,$;return((P=O.value)==null?void 0:P.valueAsType)??(($=O.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:EMe(l,c,e,y,T,v,E,b)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class tBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_PARSE,version:"1.0.0",description:"Json parse string into object operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Yr.Parse);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{var l;try{const c=(l=n[0].value)==null?void 0:l.value;if(typeof c!="string")throw new Error(`Invalid input type for JSON.parse operation: expected string, got ${typeof c}`);const e=JSON.parse(c);return{value:G.Success,error:null,result:e}}catch(c){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:c,result:null}}}})}}class iBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_IN_OPERATIONS_IMPLEMENTATIONS__JSON_STRINGIFY,version:"1.0.0",description:"Json stringify object into string operation implementation module",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(l=>l.contextType===J.Logic);if(n){const l=n.get(Yr.Stringify);l&&(l.autoexecutable=!0,l.implementation=this.module.main)}},main:async(i,n)=>{var l,c;try{const e=(l=n[0].value)==null?void 0:l.value,y=(c=n[1].value)==null?void 0:c.value;if(!e||typeof e!="object"&&!Array.isArray(e))throw new Error(`Invalid input type for JSON.stringify operation: expected object or array, got ${typeof e}`);if(!y&&y!==0){const v=JSON.stringify(e);return{value:G.Success,error:null,result:v}}const T=JSON.stringify(e,null,y);return{value:G.Success,error:null,result:T}}catch(e){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:e,result:null}}}})}}class rBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_BUILD_HMAC,version:"1.0.0",description:"JWT: build (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(zi.BuildJwtHmac);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v,E,b,O,P,$,L]=n.map(U=>{var F,Z;return((F=U.value)==null?void 0:F.valueAsType)??((Z=U.value)==null?void 0:Z.value)});return{value:G.Success,error:null,result:await RMe(l,c,e,y,T,v,E,b,O,P,$,L)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class nBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_VERIFY_HMAC,version:"1.0.0",description:"JWT: verify (HS256/384/512)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(zi.VerifyJwtHmac);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v,E,b]=n.map(O=>{var P,$;return((P=O.value)==null?void 0:P.valueAsType)??(($=O.value)==null?void 0:$.value)});return{value:G.Success,error:null,result:await OMe(l,c,e,y,T,v,E,b)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class aBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__JWT_DECODE,version:"1.0.0",description:"JWT: decode (no verification)",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(zi.DecodeJwt);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(e=>{var y,T;return((y=e.value)==null?void 0:y.valueAsType)??((T=e.value)==null?void 0:T.value)});return{value:G.Success,error:null,result:CMe(l,c)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class sBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_HASH_PBKDF2,version:"1.0.0",description:"Password: hash (PBKDF2) -> envelope string",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Xr.HashPasswordPBKDF2);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c,e,y,T,v]=n.map(E=>{var b,O;return((b=E.value)==null?void 0:b.valueAsType)??((O=E.value)==null?void 0:O.value)});return{value:G.Success,error:null,result:await gMe(l,c,e,y,T,v)}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class lBe extends ge{constructor(){super(...arguments);I(this,"manifest",{id:Ae.BUILT_INT_OPERATIONS_IMPLEMENTATIONS__PASSWORD_VERIFY_PBKDF2,version:"1.0.0",description:"Password: verify (PBKDF2) -> boolean",initPriority:Ee.High,permissions:[be.All],contexts:[J.Logic]});I(this,"module",{init:i=>{const n=i.find(c=>c.contextType===J.Logic),l=n==null?void 0:n.get(Xr.VerifyPasswordPBKDF2);l&&(l.autoexecutable=!0,l.implementation=this.module.main)},main:async(i,n)=>{try{const[l,c]=n.map(y=>{var T,v;return((T=y.value)==null?void 0:T.valueAsType)??((v=y.value)==null?void 0:v.value)}),e=await AMe(String(l??""),String(c??""));return{value:G.Success,error:null,result:e}}catch(l){return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,error:l,result:null}}}})}}class Uw extends FI{constructor(p,i,n=i.projectId){super(p,J.Editor),this._editor=i,this.id=n}get ready(){return this._editor.ready}get hasLoadedLogic(){return this._editor.hasLoadedLogic}get destroyed(){return this._editor.destroyed}get logicLoadingPromise(){return this._editor.logicLoadingPromise}get logic(){return this._editor.logic}get lastPublishedProjectState(){return this._editor.lastPublishedProjectState}get branch(){return this._editor.branch}get projectId(){return this._editor.projectId}get sessionId(){return this._editor.sessionId}get userAuthorId(){return this._editor.userAuthorId}get peerConnections(){return this._editor.peerConnections}get test(){return this._editor.test}get localTestValues(){return this._editor.localTestValues}get resolvedValues(){return this._editor.resolvedValues}get persistedExecutionResults(){return this._editor.persistedExecutionResults}get publication(){return this._editor.publication}get livePublishedVersions(){return this._editor.livePublishedVersions}get publications(){return this._editor.publications}get liveResources(){return this._editor.liveResources}get execution(){return this._editor.execution}get project(){return this._editor.logic}get lastExecutionResults(){return this._editor.lastExecutionResults}get undoableStackValueIndex(){return this._editor.undoableStackValueIndex}set undoableStackValueIndex(p){this._editor.undoableStackValueIndex=p}get PROJECT_NOTIFICATIONS_CHANNEL(){return this._editor.PROJECT_NOTIFICATIONS_CHANNEL}getAccessToken(){return this._editor.getAccessToken()}removeValueByOwnerId(p){return this._editor.removeValueByOwnerId(p)}removeValue(p){return this._editor.removeValue(p)}undo(){return this._editor.undo()}redo(){return this._editor.redo()}initTest(p,i){return this._editor.initTest(p,i)}removeTest(){return this._editor.removeTest()}async copyEntities(p){return this._editor.copyEntities(p)}resolveInitialChildrenPositions(p,i,n){return this._editor.resolveInitialChildrenPositions(p,i,n)}publish(){return this._editor.publish()}loadGivenPublication(p){return this._editor.loadGivenPublication(p)}requestActiveDynamicValue(p,i=!1){return this._editor.requestActiveDynamicValue(p,i)}getValueTypePreference(p){return this._editor.getValueTypePreference(p)}setValueTypePreference(p,i){return this._editor.setValueTypePreference(p,i)}}function O2i(d,p){return p instanceof Uw?p:new Uw(d,p)}class jw extends FI{constructor(p,i){super(p,J.PublicationRun),this._publicationRun=i}get id(){return this._publicationRun.id}get projectAutoIncrementPublicationCount(){return this._publicationRun.projectAutoIncrementPublicationCount}get projectPublishedSemanticVersion(){return this._publicationRun.projectPublishedSemanticVersion}get projectVersion(){return this._publicationRun.projectVersion}get projectId(){return this._publicationRun.projectId}get triggeredBy(){return this._publicationRun.triggeredBy}get createdAt(){return this._publicationRun.createdAt}get updatedAt(){return this._publicationRun.updatedAt}get status(){return this._publicationRun.status}get steps(){return this._publicationRun.steps}get editor(){return this._publicationRun.editor}get explicitResources(){return this._publicationRun.explicitResources}get implicitGlobalResources(){return this._publicationRun.implicitGlobalResources}get finalGlobalEvent(){return this._publicationRun.finalGlobalEvent}get finalStatus(){return this._publicationRun.finalStatus}}function w2i(d,p){return p instanceof jw?p:new jw(d,p)}function C2i(d){d.register(new MPe(d)),d.register(new LPe(d)),d.register(new VPe(d)),d.register(new xPe(d)),d.register(new $Pe(d)),d.register(new NPe(d)),d.register(new gLe(d)),d.register(new ILe(d)),d.register(new RLe(d)),d.register(new OLe(d)),d.register(new DLe(d)),d.register(new wLe(d)),d.register(new PMe(d)),d.register(new VMe(d)),d.register(new NMe(d)),d.register(new xMe(d)),d.register(new $Me(d)),d.register(new LMe(d)),d.register(new MMe(d)),d.register(new BMe(d)),d.register(new GMe(d)),d.register(new UMe(d)),d.register(new A$e(d)),d.register(new g$e(d)),d.register(new I$e(d)),d.register(new R$e(d)),d.register(new D$e(d)),d.register(new O$e(d)),d.register(new w$e(d)),d.register(new C$e(d)),d.register(new _$e(d)),d.register(new P$e(d)),d.register(new V$e(d)),d.register(new N$e(d)),d.register(new x$e(d)),d.register(new $$e(d)),d.register(new L$e(d)),d.register(new M$e(d)),d.register(new B$e(d)),d.register(new G$e(d)),d.register(new U$e(d)),d.register(new K$e(d)),d.register(new F$e(d)),d.register(new S$e(d)),d.register(new kxe(d)),d.register(new Kxe(d)),d.register(new Fxe(d)),d.register(new Sxe(d)),d.register(new qxe(d)),d.register(new Zxe(d)),d.register(new Hxe(d)),d.register(new Wxe(d)),d.register(new zxe(d)),d.register(new Yxe(d)),d.register(new Xxe(d)),d.register(new Qxe(d)),d.register(new e$e(d)),d.register(new t$e(d)),d.register(new QNe(d)),d.register(new exe(d)),d.register(new txe(d)),d.register(new W2e(d)),d.register(new N2e(d)),d.register(new XVe(d)),d.register(new QVe(d)),d.register(new eNe(d)),d.register(new tNe(d)),d.register(new iNe(d)),d.register(new rNe(d)),d.register(new nNe(d)),d.register(new aNe(d)),d.register(new sNe(d)),d.register(new ENe(d)),d.register(new JNe(d)),d.register(new YNe(d)),d.register(new XNe(d)),d.register(new lNe(d)),d.register(new oNe(d)),d.register(new dNe(d)),d.register(new uNe(d)),d.register(new pNe(d)),d.register(new cNe(d)),d.register(new fNe(d)),d.register(new yNe(d)),d.register(new hNe(d)),d.register(new mNe(d)),d.register(new TNe(d)),d.register(new vNe(d)),d.register(new bNe(d)),d.register(new ANe(d)),d.register(new gNe(d)),d.register(new INe(d)),d.register(new RNe(d)),d.register(new DNe(d)),d.register(new ONe(d)),d.register(new wNe(d)),d.register(new CNe(d)),d.register(new _Ne(d)),d.register(new PNe(d)),d.register(new VNe(d)),d.register(new jNe(d)),d.register(new kNe(d)),d.register(new KNe(d)),d.register(new NNe(d)),d.register(new xNe(d)),d.register(new $Ne(d)),d.register(new LNe(d)),d.register(new MNe(d)),d.register(new BNe(d)),d.register(new GNe(d)),d.register(new UNe(d)),d.register(new X2e(d)),d.register(new Q2e(d)),d.register(new eMe(d)),d.register(new tMe(d)),d.register(new z2e(d)),d.register(new J2e(d)),d.register(new Y2e(d)),d.register(new iMe(d)),d.register(new nMe(d)),d.register(new sMe(d)),d.register(new rMe(d)),d.register(new aMe(d)),d.register(new lMe(d)),d.register(new uMe(d)),d.register(new oMe(d)),d.register(new dMe(d)),d.register(new i$e(d)),d.register(new s$e(d)),d.register(new l$e(d)),d.register(new u$e(d)),d.register(new p$e(d)),d.register(new c$e(d)),d.register(new f$e(d)),d.register(new y$e(d)),d.register(new h$e(d)),d.register(new m$e(d)),d.register(new T$e(d)),d.register(new o$e(d)),d.register(new d$e(d)),d.register(new n$e(d)),d.register(new a$e(d)),d.register(new r$e(d)),d.register(new Jxe(d)),d.register(new E$e(d)),d.register(new b$e(d)),d.register(new v$e(d)),d.register(new _Le(d)),d.register(new QLe(d)),d.register(new XLe(d)),d.register(new e2e(d)),d.register(new t2e(d)),d.register(new NLe(d)),d.register(new xLe(d)),d.register(new ULe(d)),d.register(new BLe(d)),d.register(new JLe(d)),d.register(new SLe(d)),d.register(new ZLe(d)),d.register(new WLe(d)),d.register(new HLe(d)),d.register(new GLe(d)),d.register(new kLe(d)),d.register(new KLe(d)),d.register(new jLe(d)),d.register(new CLe(d)),d.register(new $Le(d)),d.register(new qLe(d)),d.register(new n2e(d)),d.register(new $w(d)),d.register(new VLe(d)),d.register(new LLe(d)),d.register(new PLe(d)),d.register(new zLe(d)),d.register(new MLe(d)),d.register(new FLe(d)),d.register(new YLe(d)),d.register(new r2e(d)),d.register(new i2e(d)),d.register(new a2e(d)),d.register(new $w(d)),d.register(new l2e(d)),d.register(new s2e(d)),d.register(new o2e(d)),d.register(new aLe(d)),d.register(new sLe(d)),d.register(new lLe(d)),d.register(new Z$e(d)),d.register(new k$e(d)),d.register(new J$e(d)),d.register(new eLe(d)),d.register(new j$e(d)),d.register(new tLe(d)),d.register(new nLe(d)),d.register(new X$e(d)),d.register(new Y$e(d)),d.register(new Xb(d)),d.register(new oLe(d)),d.register(new dLe(d)),d.register(new Q$e(d)),d.register(new rLe(d)),d.register(new iLe(d)),d.register(new z$e(d)),d.register(new W$e(d)),d.register(new H$e(d)),d.register(new q$e(d)),d.register(new cLe(d)),d.register(new pLe(d)),d.register(new fLe(d)),d.register(new uLe(d)),d.register(new ZNe(d)),d.register(new FNe(d)),d.register(new qNe(d)),d.register(new HNe(d)),d.register(new WNe(d)),d.register(new SNe(d)),d.register(new zNe(d)),d.register(new jMe(d)),d.register(new ZMe(d)),d.register(new WMe(d)),d.register(new JMe(d)),d.register(new qMe(d)),d.register(new HMe(d)),d.register(new zMe(d)),d.register(new SMe(d)),d.register(new FMe(d)),d.register(new KMe(d)),d.register(new kMe(d)),d.register(new tBe(d)),d.register(new iBe(d)),d.register(new QMe(d)),d.register(new eBe(d)),d.register(new _Me(d)),d.register(new YMe(d)),d.register(new XMe(d)),d.register(new nBe(d)),d.register(new rBe(d)),d.register(new aBe(d)),d.register(new sBe(d)),d.register(new lBe(d))}class yN{constructor(p=new te.Events("extensions-registry-fallback-events")){I(this,"extensionsRegistry",new Map);I(this,"initialized",new Set);I(this,"initializedContexts",new Set);I(this,"onResolveEditorContextCallback",()=>null);I(this,"onResolveProjectLogicContextCallback",()=>null);I(this,"onResolveEditorGUIContextCallback",()=>null);I(this,"onResolveGUIContextCallback",()=>null);I(this,"onResolveCompileContextCallback",()=>null);I(this,"onResolvePublicationRunContextCallback",()=>null);this.events=p,this.off=this.events.off.bind(this.events),this.on=this.events.on.bind(this.events),this.emit=this.events.emit.bind(this.events),this.emitAsync=this.events.emitAsync.bind(this.events),this.emitAsyncAll=this.events.emitAsyncAll.bind(this.events),this.emitAsyncAllSettled=this.events.emitAsyncAllSettled.bind(this.events),this.emitAsyncSequentially=this.events.emitAsyncSequentially.bind(this.events),this.emitAsyncSequentiallyAll=this.events.emitAsyncSequentiallyAll.bind(this.events),this.emitAsyncSequentiallyAllSettled=this.events.emitAsyncSequentiallyAllSettled.bind(this.events)}onResolveEditorContext(p){this.onResolveEditorContextCallback=p}onResolveProjectLogicContext(p){this.onResolveProjectLogicContextCallback=p}onResolveGUIContext(p){this.onResolveGUIContextCallback=p}onResolveEditorGUIContext(p){this.onResolveEditorGUIContextCallback=p}onResolveCompileContext(p){this.onResolveCompileContextCallback=p}onResolvePublicationRunContext(p){this.onResolvePublicationRunContextCallback=p}get extensionInOrder(){return Array.from(this.extensionsRegistry.values()).sort((p,i)=>(p.manifest.initPriority||Ee.Normal)-(i.manifest.initPriority||Ee.Normal))}async setup(){C2i(this),te.Logger.log("Initializing extensions without context..."),this.initForReady()}requestContext(p){switch(p){case J.Editor:return this.onResolveEditorContextCallback();case J.Logic:return this.onResolveProjectLogicContextCallback();case J.EditorGUI:return this.onResolveEditorGUIContextCallback();case J.Compile:return this.onResolveCompileContextCallback();case J.PublicationRun:return this.onResolvePublicationRunContextCallback();case J.GUI:return this.onResolveGUIContextCallback();case J.EditorGUI:return this.onResolveEditorGUIContextCallback();default:throw new Error(`Unknown context type: ${p}`)}}requestContexts(p,i=[]){const n=[];i.length===0&&(i=p.manifest.contexts);for(const l of i){const c=this.requestContext(l);c&&n.push(c)}return n}requestExtension(p){const i=this.extensionsRegistry.get(p);if(i)return i;throw new Error(`Unknown extension: ${p}`)}register(p){this.extensionsRegistry.set(p.manifest.id,p)}async initAll(){var p,i;for(const n of this.extensionInOrder)if(n.module.init&&!this.initialized.has(n.manifest.id)){const l=n.manifest.contexts.map(c=>this.requestContext(c)).filter(c=>c!==null);l.length&&(await((i=(p=n.module).init)==null?void 0:i.call(p,l)),this.initialized.add(n.manifest.id))}else!n.module.init&&!this.initialized.has(n.manifest.id)&&this.initialized.add(n.manifest.id)}async initForReady(){te.Logger.log("Initializing extensions for ready contexts...");for(const p of this.extensionInOrder)if(p.module.init&&!this.initialized.has(p.manifest.id)){te.Logger.log("Initializing "+p.manifest.id+" extension...");const i=this.requestContexts(p);p.manifest.contexts.every(l=>!!i.find(c=>c.contextType===l))?(await p.module.init(i),this.initialized.add(p.manifest.id)):te.Logger.warn(`Skipping initialization of ${p.manifest.id} extension, not all contexts are ready.`,`Required contexts: ${p.manifest.contexts.join(", ")}`,`Available contexts: ${i.map(l=>l.contextType).join(", ")}`)}else!p.module.init&&!this.initialized.has(p.manifest.id)?(te.Logger.log("Set "+p.manifest.id+" extension as initialized by default..."),this.initialized.add(p.manifest.id)):te.Logger.log(`Skipping initialization of ${p.manifest.id} extension, already initialized or no init method defined.`)}async destroyAll(){for(const p of[...this.extensionInOrder].reverse())p.module.destroy&&await p.module.destroy();this.events.destroy()}on(p,i){this.events.on(p,i)}emit(p,...i){this.events.emit(p,...i)}off(p,i){this.events.off(p,i)}emitAsync(p,...i){return this.events.emitAsync(p,...i)}emitAsyncAll(p,...i){return this.events.emitAsyncAll(p,...i)}emitAsyncAllSettled(p,...i){return this.events.emitAsyncAllSettled(p,...i)}emitAsyncSequentially(p,...i){return this.events.emitAsyncSequentially(p,...i)}emitAsyncSequentiallyAll(p,...i){return this.events.emitAsyncSequentiallyAll(p,...i)}emitAsyncSequentiallyAllSettled(p,...i){return this.events.emitAsyncSequentiallyAllSettled(p,...i)}async contextAvailable(p){if(this.initializedContexts.has(p)){te.Logger.warn(`Context ${p} is already initialized. Skipping re-initialization.`);return}switch(this.initializedContexts.add(p),p){case J.Editor:{if(!this.onResolveEditorContextCallback)throw new Error("No editor context resolver callback set. Call onResolveEditorContext first.");break}case J.Logic:{if(!this.onResolveProjectLogicContextCallback)throw new Error("No project logic context resolver callback set. Call onResolveProjectLogicContext first.");break}}te.Logger.log(`Context ${p} is now available. Initializing extensions for this context...`),await this.initForReady()}getValueTypePreference(p){return window.localStorage.getItem("dynamic-value-type-preference--"+p)||null}setValueTypePreference(p,i){window.localStorage.setItem("dynamic-value-type-preference--"+p,(i==null?void 0:i.toString())||""),this.emit(p,{})}}let Rb=null;const hN={requestExtension:d=>(Rb||(Rb=new yN,Rb.setup()),Rb.requestExtension(d))},du={onBeforeEntityExecution:async()=>{},onEntityExecuted:async()=>{}};var mN=(d=>(d.FinishedSuccess="finished-success",d.FinishedError="finished-error",d.Running="running",d.Paused="paused",d.Stopped="stopped",d.NotStarted="not-started",d))(mN||{});const oBe={...hN,getValueTypePreference:()=>null,setValueTypePreference:()=>{}};class fu extends te.Events{constructor(i,n,l,c=null,e=oBe){super("exec-inst-super-events");I(this,"project");I(this,"entryPoint");I(this,"state","not-started");I(this,"events",new te.Events("execution-instance-events"));I(this,"entities",[]);I(this,"parentExecution",null);I(this,"executing",[]);I(this,"executed",[]);I(this,"skipped",[]);I(this,"scheduled",[]);I(this,"localTestValues");I(this,"resolvedValues");I(this,"persistedExecutionResults");I(this,"lastExecutionResults");I(this,"onAddToSkippedListCallback",null);I(this,"onRemoveFromSkippedListCallback",null);I(this,"onAddEntityCallback",null);I(this,"onRemoveEntityCallback",null);I(this,"onAbortExecutionCallback",null);this.parentContext=e,this.entities=n,this.entryPoint=l,this.project=i,this.parentExecution=c,this.localTestValues=new Am(x.UUID.uuid(),this.project),this.resolvedValues=new Am(x.UUID.uuid(),this.project),this.persistedExecutionResults=new Am(x.UUID.uuid(),this.project),this.lastExecutionResults=new Am(x.UUID.uuid(),this.project)}get valueResolutionContext(){return{execution:this,project:this.project,localTestValues:this.localTestValues,resolvedValues:this.resolvedValues,persistedExecutionResults:this.persistedExecutionResults,lastExecutionResults:this.lastExecutionResults,getValueTypePreference:this.parentContext.getValueTypePreference,setValueTypePreference:this.parentContext.setValueTypePreference}}skip(i){this.hasEntity(i)&&(this.removeFromScheduledList(i),!this.skipped.includes(i)&&(this.skipped.push(i),this.onAddToSkippedListCallback&&this.onAddToSkippedListCallback(i),Sr.includes(i.type)&&Rt(i).forEach(n=>this.skip(n))))}async schedule(i,n,l){if(this.hasExecuted(i))return null;if(zt.includes(i.type))return this.executeBranch(i,l,n);if(zr.includes(i.type)){if(i.calledBy.every(e=>this.hasExecuted(e)||!this.hasEntity(e)))return this.executeBranch(i,l,n);this.scheduled.includes(i)||this.scheduled.push(i)}return null}mergeExernalValuesWithInternalInputs(i,n){const l=[];return[...Vi,...zt].includes(n.type)?l.push(...n.inputs):kt.includes(n.type)&&l.push(...n.outputs),l.map(e=>{var T;let y=i.find(v=>v.valueOwner.id===e.id);if(y)return y;if(!y&&zt.includes(n.type)&&(y=i.find(v=>{var E;return((E=v.valueOwner.declaration)==null?void 0:E.id)===e.id})),y){const v=(T=y.value)==null?void 0:T.clone(null);return v==null||v.setStandaloneParent(e,null),{...y,valueOwner:e,value:v||null,inheritanceLink:{sources:[y],target:e}}}return rs.includes(e.type)?ho(e,this.valueResolutionContext):Ru(e,this.valueResolutionContext)}).reduce((e,y)=>{const T=yl(y==null?void 0:y.valueOwner,this.project),v=y?[y]:[];return T.forEach(E=>{var P,$,L;if(E.id===(y==null?void 0:y.valueOwner.id))return;const b=Et(E.getDataType(null),E,this.project);b==null||b.metaSync({value:(P=y==null?void 0:y.value)==null?void 0:P.value},null),b==null||b.setValueAsTypeList((($=y==null?void 0:y.value)==null?void 0:$.valueAsTypeList)||null),b==null||b.setValueAsTypeSingle(((L=y==null?void 0:y.value)==null?void 0:L.valueAsTypeSingle)||null);const O={...y,valueOwner:E,value:b};v.push(O)}),[...e,...v]},[]).sort((e,y)=>e.valueOwner.index-y.valueOwner.index)}inheritValuesFromContext(i){this.localTestValues=i.localTestValues,this.resolvedValues=i.resolvedValues,this.persistedExecutionResults=i.persistedExecutionResults}async executeInternalCall(i,n,l,c={}){var y,T;const e={...du,...c};try{let v={value:G.Success,error:null,result:null};if(n.sort((E,b)=>E.valueOwner.index-b.valueOwner.index),Object.values(Mr).includes(i.declaration.id)){const E=this.parentContext.requestExtension(ny+i.declaration.id).module.main;E?v=await E(i,n):te.Logger.warn(`No implementation found for built-in function: ${i.declaration.id}`)}else{v=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,l,e);let E=null;if(v.error){te.Logger.warn("Raw error executing entity: ",v.error);const b=(y=i.error)==null?void 0:y.getDataType(null),O=Et(b||null,i.error,l);b!=null&&b.asType?O==null||O.setValueAsTypeSingle(v.error):O==null||O.metaSync({value:v.error},null),E={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:O}}return{value:v.value,entity:i,error:E,result:{value:v.result||null,valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null}}}return{...v,entity:i}}catch(v){te.Logger.warn("Internal call execution error: ",v);let E=null;if(i.error){const b=(T=i.error)==null?void 0:T.getDataType(null),O=Et(b,i.error,l);b!=null&&b.asType?O==null||O.setValueAsTypeSingle(v):O==null||O.metaSync({value:v},null),E={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:O}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:E,result:null}}}static async executeOperation(i,n,l){var c,e;try{let y={value:G.Success,error:null,result:null};n.sort((b,O)=>b.valueOwner.index-O.valueOwner.index),i.declaration.implementation&&(y=await i.declaration.implementation(i,n));let T=null;if(y.error&&i.error){te.Logger.warn("Raw error executing entity: ",y.error);const b=((c=i.error)==null?void 0:c.getDataType(null))||null,O=Et(b,i.error,l);b!=null&&b.asType?O==null||O.setValueAsTypeSingle(y.error):O==null||O.metaSync({value:y.error},null),T={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:O}}const v=i==null?void 0:i.getDataType(null),E=Et(v,i,l);return v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y.result):E==null||E.metaSync({value:y.result},null),{value:y.value,entity:i,error:T,result:{value:E||null,valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null}}}catch(y){te.Logger.warn("Operation execution error: ",y);let T=null;if(i.error){const v=(e=i.error)==null?void 0:e.getDataType(null),E=Et(v,i.error,l);v!=null&&v.asType?E==null||E.setValueAsTypeSingle(y):E==null||E.metaSync({value:y},null),T={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:E}}return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:T,result:null}}}async executeSearch(i,n,l){var c;try{let e={value:G.Success,error:null,result:null};const y=await(await this.parentContext.requestExtension(Ae.SEARCH_NODE_IMPLEMENTATION)).module.main(i,n),T=i==null?void 0:i.getDataType(null),v=Et(T,i,l);return v==null||v.metaSync({value:{data:y.data}},null),y.error?{value:G.UnhandledError,entity:i,error:{valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null,value:v},result:null}:{value:e.value,entity:i,error:null,result:{value:v,valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null}}}catch(e){if(te.Logger.warn(`Search node execution error: ${e}`),!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const y=(c=i.error)==null?void 0:c.getDataType(null),T=Et(y,i.error,l);return T==null||T.metaSync({value:e},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:T},result:null}}}async executeLoop(i,n,l,c={}){var y,T,v,E,b,O;const e={...du,...c};try{let P={value:G.Success,error:null,result:null};const $=n.map(se=>{var Q,fe;return((Q=se==null?void 0:se.value)==null?void 0:Q.valueAsType)||((fe=se==null?void 0:se.value)==null?void 0:fe.value)});let L={};i.getUniqueInputMaps().forEach(se=>{const Q=i.body.inputs.find(me=>le(me,l)===le(se,l)),fe=se==null?void 0:se.getDataType(null),de=Et(fe,Q,l);fe!=null&&fe.asType?de==null||de.setValueAsTypeList([]):de==null||de.metaSync({value:[]},null),this.lastExecutionResults.writeValue(Q,de);const ce={value:de,valueOwner:Q,type:$e.ExecutionResult,inheritanceLink:null};L[Q.id]=ce});let F={value:G.Success,entity:i.body,error:null,result:null};switch(i.declaration.id){case Y.loop["counted-loop"].id:{const se=$[0];let Q=1;for(;Q<=se&&Q<=50;){const fe=i.body.inputs.map(de=>{if(de===i.currentIterationNumberArgumentDeclaration){const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=oc(ce),ae=this.lastExecutionResults.readValue(de.id);if(ae){ae.metaSync({value:Q},null),this.lastExecutionResults.writeValue(de,ae);const Be={value:ae,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null};return L[de.id]=Be,Be}const ye={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:Q,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:me,standaloneParent:de.toReference()},_e=Gi(ye,l);this.lastExecutionResults.writeValue(de,_e);const Ve={value:_e,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null};return L[de.id]=Ve,Ve}else return L[de.id]}).filter(de=>!!de);if(F=await this.executeFullFunctionDeclarationLogic(i.body,fe,e),(F.results||[]).forEach(de=>{var ye,_e,Ve,Be;if(de.valueOwner.type!==o.InputMap||kt.includes(de.valueOwner.parent.type))return;const ce=i.body.inputs.find(xe=>le(xe,l)===le(de.valueOwner,l)),ae=[...((_e=(ye=L==null?void 0:L[ce.id])==null?void 0:ye.value)==null?void 0:_e.value)||[],((Ve=de==null?void 0:de.value)==null?void 0:Ve.value)||null];(Be=L[ce.id].value)==null||Be.metaSync({value:ae},null),this.lastExecutionResults.writeValue(ce,L[ce.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}case Y.loop["manual-flow-loop"].id:{let se=1;for(;se<=50;){const Q=i.body.inputs.map(fe=>{if(fe===i.currentIterationNumberArgumentDeclaration){const de=this.lastExecutionResults.readValue(fe.id);if(de){de.metaSync({value:se},null),this.lastExecutionResults.writeValue(fe,de);const ye={value:de,valueOwner:fe,type:$e.ExecutionResult,inheritanceLink:null};return L[fe.id]=ye,ye}const ce=i.currentIterationNumberArgumentDeclaration.getDataType(null),me=Et(ce,fe,l);return me==null||me.metaSync({value:se},null),this.lastExecutionResults.writeValue(fe,me),{value:me,valueOwner:fe,type:$e.ExecutionResult,inheritanceLink:null}}else return L[fe.id]}).filter(fe=>!!fe);if(F=await this.executeFullFunctionDeclarationLogic(i.body,Q,e),(F.results||[]).forEach(fe=>{var ae,ye,_e;if(fe.valueOwner.type!==o.InputMap||kt.includes(fe.valueOwner.parent.type))return;const de=i.body.inputs.find(Ve=>le(Ve,l)===le(fe.valueOwner,l)),me=[...(ae=L[de.id].value)==null?void 0:ae.value,((ye=fe.value)==null?void 0:ye.value)||null];(_e=L[de.id].value)==null||_e.metaSync({value:me},null),this.lastExecutionResults.writeValue(de,L[de.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;se++}break}case Y.loop["list-loop"].id:{const se=$[0];let Q=1;const fe=se;for(let de=0;de<fe.length;de++){const ce=fe[de],me=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ae.id);if(ye)return ye.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,ye),{value:ye,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=Et(_e,ae,l);return Ve==null||Ve.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else if(ae===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=oc(ye),Ve=this.lastExecutionResults.readValue(ae.id);if(Ve)return Ve.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const Be={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:ae.toReference()},xe=Gi(Be,l);return this.lastExecutionResults.writeValue(ae,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else return L[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(F.results||[]).forEach(ae=>{var Be,xe,Me;if(ae.valueOwner.type!==o.InputMap||kt.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(We=>le(We,l)===le(ae.valueOwner,l)),Ve=[...(Be=L[ye.id].value)==null?void 0:Be.value,((xe=ae.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Ve},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}case Y.loop["object-keys-loop"].id:{const se=$[0];let Q=1;const fe=se?Object.keys(se):[];for(let de=0;de<fe.length;de++){const ce=fe[de],me=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ae.id);if(ye)return ye.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,ye),{value:ye,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=Et(_e,ae,l);return Ve==null||Ve.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else if(ae===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=oc(ye),Ve=this.lastExecutionResults.readValue(ae.id);if(Ve)return Ve.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const Be={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:ae.toReference()},xe=Gi(Be,l);return this.lastExecutionResults.writeValue(ae,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else return L[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(F.results||[]).forEach(ae=>{var Be,xe,Me;if(ae.valueOwner.type!==o.InputMap||kt.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(We=>le(We,l)===le(ae.valueOwner,l)),Ve=[...(Be=L[ye.id].value)==null?void 0:Be.value,((xe=ae.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Ve},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}case Y.loop["object-values-loop"].id:{const se=$[0];let Q=1;const fe=se?Object.values(se):[];for(let de=0;de<fe.length;de++){const ce=fe[de],me=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ae.id);if(ye)return ye.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,ye),{value:ye,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=Et(_e,ae,l);return Ve==null||Ve.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else if(ae===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=oc(ye),Ve=this.lastExecutionResults.readValue(ae.id);if(Ve)return Ve.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const Be={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:ae.toReference()},xe=Gi(Be,l);return this.lastExecutionResults.writeValue(ae,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else return L[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(F.results||[]).forEach(ae=>{var Be,xe,Me;if(ae.valueOwner.type!==o.InputMap||kt.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(We=>le(We,l)===le(ae.valueOwner,l)),Ve=[...(Be=L[ye.id].value)==null?void 0:Be.value,((xe=ae.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Ve},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}case Y.loop["string-loop"].id:{const se=$[0];let Q=1;const fe=se.split("");for(let de=0;de<fe.length;de++){const ce=fe[de],me=i.body.inputs.map(ae=>{if(ae===i.currentIterationNumberArgumentDeclaration){const ye=this.lastExecutionResults.readValue(ae.id);if(ye)return ye.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,ye),{value:ye,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const _e=i.currentIterationNumberArgumentDeclaration.getDataType(null),Ve=Et(_e,ae,l);return Ve==null||Ve.metaSync({value:Q},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:i.currentIterationNumberArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else if(ae===i.currentValueArgumentDeclaration){const ye=i.currentValueArgumentDeclaration.getDataType(null),_e=oc(ye),Ve=this.lastExecutionResults.readValue(ae.id);if(Ve)return Ve.metaSync({value:ce},null),this.lastExecutionResults.writeValue(ae,Ve),{value:Ve,valueOwner:ae,type:$e.ExecutionResult,inheritanceLink:null};const Be={id:x.UUID.uuid(),deletable:!0,editable:!0,type:o.LiteralValue,autogeneration:null,version:x.UUID.uuid(),createdAt:new Date().toISOString(),author:x.sessionAuthor,deleted:!1,previousVersion:null,value:ce,valueAsTypeSingle:null,valueAsTypeList:null,parent:null,name:_e,standaloneParent:ae.toReference()},xe=Gi(Be,l);return this.lastExecutionResults.writeValue(ae,xe),{value:xe,valueOwner:i.currentValueArgumentDeclaration,type:$e.ExecutionResult,inheritanceLink:null}}else return L[ae.id]}).filter(ae=>!!ae);if(F=await this.executeFullFunctionDeclarationLogic(i.body,me,e),(F.results||[]).forEach(ae=>{var Be,xe,Me;if(ae.valueOwner.type!==o.InputMap||kt.includes(ae.valueOwner.parent.type))return;const ye=i.body.inputs.find(We=>le(We,l)===le(ae.valueOwner,l)),Ve=[...(Be=L[ye.id].value)==null?void 0:Be.value,((xe=ae.value)==null?void 0:xe.value)||null];(Me=L[ye.id].value)==null||Me.metaSync({value:Ve},null),this.lastExecutionResults.writeValue(ye,L[ye.id].value)}),[G.CaughtError,G.Break,G.Return].includes(F.value))break;Q++}break}}if(P={value:[G.CaughtError,G.Return].includes(F.value)?F.value:G.Success,error:((T=(y=F.error)==null?void 0:y.value)==null?void 0:T.value)||null,result:((E=(v=F==null?void 0:F.result)==null?void 0:v.value)==null?void 0:E.value)||null},P.error&&i.error){const se=(b=i.error)==null?void 0:b.getDataType(null),Q=Et(se||null,i.error,l);se!=null&&se.asType?Q==null||Q.setValueAsTypeSingle(P.error):Q==null||Q.metaSync({value:P.error},null);const fe={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:Q};return{value:P.value,entity:i,error:fe,result:null}}const Z=i==null?void 0:i.getDataType(null),X=Et(Z,i,l);return Z!=null&&Z.asType?X==null||X.setValueAsTypeSingle(P.result):X==null||X.metaSync({value:P.result},null),{value:P.value,entity:i,error:null,result:{value:X||null,valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null}}}catch(P){if(te.Logger.warn("Error executing loop: ",P),i.error){const $=(O=i.error)==null?void 0:O.getDataType(null),L=Et($,i.error,l);return $!=null&&$.asType?L==null||L.setValueAsTypeSingle(P):L==null||L.metaSync({value:P},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:L},result:null}}else return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null}}}async executeFunctionCall(i,n,l,c={}){var y,T;const e={...du,...c};try{let v={value:G.Success,error:null,result:null};v=await this.executeDetachedFullFunctionDeclarationLogic(i.declaration,n,l,e);let E=null;if(v.error&&i.error){te.Logger.warn("Raw error executing entity: ",v.error);const b=(y=i.error)==null?void 0:y.getDataType(null),O=Et(b||null,i.error,l);b!=null&&b.asType?O==null||O.setValueAsTypeSingle(v.error):O==null||O.metaSync({value:v.error},null),E={valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:O}}return{value:v.value,entity:i,error:E,result:v.result}}catch(v){if(!i.error)return{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:null,result:null};const E=(T=i.error)==null?void 0:T.getDataType(null),b=Et(E,i.error,l);return E!=null&&E.asType?b==null||b.setValueAsTypeSingle(v):b==null||b.metaSync({value:v},null),{value:i.catchesError||i.errorCalls.length?G.CaughtError:G.UnhandledError,entity:i,error:{valueOwner:i.error,type:$e.ExecutionResult,inheritanceLink:null,value:b},result:null}}}async executeCondition(i,n){var c,e,y,T;let l=!1;switch(i.declaration.id){case Qr.BooleanIsTrue:{const v=(e=(c=n[0])==null?void 0:c.value)==null?void 0:e.value;if(typeof v!="boolean")throw new TypeError("BooleanIsTrue expects a boolean input.");l=v===!0;break}case Qr.BooleanIsFalse:{const v=(T=(y=n[0])==null?void 0:y.value)==null?void 0:T.value;if(typeof v!="boolean")throw new TypeError("BooleanIsFalse expects a boolean input.");l=v===!1;break}case sr.And:{l=(await Promise.all(i.andChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).every(E=>E);break}case sr.Or:{l=(await Promise.all(i.orChildrenGroup.map(async E=>{const b=this.mergeExernalValuesWithInternalInputs(n,E);return(await this.executeCondition(E,b)).value===G.Success}))).some(E=>E);break}default:throw new Error(`Condition declaration ${i.declaration.name} does not have an implementation.`)}return{value:l?G.Success:G.ConditionNotMet,entity:i,error:null,result:null}}async executeDetachedFullFunctionDeclarationLogic(i,n,l,c={}){const e={...du,...c,onBeforeEntityExecution:(v,E,b)=>{var O;return((O=c==null?void 0:c.onBeforeEntityExecution)==null?void 0:O.call(c,v,E,{...b,detached:!0}))||Promise.resolve()},onEntityExecuted:(v,E,b)=>{var O;return((O=c==null?void 0:c.onEntityExecuted)==null?void 0:O.call(c,v,E,{...b,detached:!0}))||Promise.resolve()}},y=new fu(l,[i,...hA(i)],i,this,this.parentContext);return y.inheritValuesFromContext(this),await y.execute(e,n)}async executeFullFunctionDeclarationLogic(i,n,l={}){const c={...du,...l},e=hA(i);e.forEach(v=>{this.addEntity(v)}),e.reduce((v,E)=>kt.includes(E.type)?[...v,...E.outputs]:Vi.includes(E.type)&&E.type!==o.Condition?[...v,...E.outputs,...E.inputs]:E.type===o.Condition?[...v,...E.inputs]:v,[]).forEach(v=>{this.lastExecutionResults.removeValue(v.id)});const T=await this.executeBranch(i,c,n);return{...T||{},value:(T==null?void 0:T.value)||G.Success,entity:i,error:(T==null?void 0:T.error)||null,result:(T==null?void 0:T.result)||null}}static async executeEntryPointEntity(i,n){return{value:G.Success,entity:i,error:null,result:null}}async executeReturnStatement(i,n){var y,T,v,E,b,O,P;if((y=i.throws)!=null&&y.readsValue){const $=ho(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:$e.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let l=ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((T=c==null?void 0:c.entity)==null?void 0:T.type)===o.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)mr((v=l==null?void 0:l.value)==null?void 0:v.value)&&($={...$,...(E=l==null?void 0:l.value)==null?void 0:E.value}),l==null||l.value.metaSync({value:$},null);else{const L=Et(c,i,this.project);L==null||L.metaSync({value:$},null),l={valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(L=>{var U,F;if(((U=L.declaration)==null?void 0:U.type)===o.Property&&L.declaration.static){const Z=this.lastExecutionResults.readValue(L.declaration.id),X=le(L,this.project),se=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||Wi(X);if(Z)Z.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Z);else{const Q=Et(L.getDataType(null),L,this.project);Q==null||Q.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Q)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&mr((O=l.value)==null?void 0:O.value)?((P=l.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var Z;const L=$.codeName||((Z=$.declaration)==null?void 0:Z.codeName)||Wi(le($,this.project)),U=e[L],F=Et($.getDataType(null),$,this.project);F==null||F.metaSync({value:U},null),$e.ExecutionResult}),l.type=$e.ExecutionResult,{value:G.Return,entity:i,error:null,result:l}}async executeContinueStatement(i,n){var y,T,v,E,b,O,P;if((y=i.throws)!=null&&y.readsValue){const $=ho(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:$e.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let l=ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((T=c==null?void 0:c.entity)==null?void 0:T.type)===o.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)mr((v=l==null?void 0:l.value)==null?void 0:v.value)&&($={...$,...(E=l==null?void 0:l.value)==null?void 0:E.value}),l==null||l.value.metaSync({value:$},null);else{const L=Et(c,i,this.project);L==null||L.metaSync({value:$},null),l={valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(L=>{var U,F;if(((U=L.declaration)==null?void 0:U.type)===o.Property&&L.declaration.static){const Z=this.lastExecutionResults.readValue(L.declaration.id),X=le(L,this.project),se=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||Wi(X);if(Z)Z.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Z);else{const Q=Et(L.getDataType(null),L,this.project);Q==null||Q.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Q)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&mr((O=l.value)==null?void 0:O.value)?((P=l.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var Z;const L=$.codeName||((Z=$.declaration)==null?void 0:Z.codeName)||Wi(le($,this.project)),U=e[L],F=Et($.getDataType(null),$,this.project);F==null||F.metaSync({value:U},null),$e.ExecutionResult}),l.type=$e.ExecutionResult,{value:G.Continue,entity:i,error:null,result:l}}async executeBreakStatement(i,n){var y,T,v,E,b,O,P;if((y=i.throws)!=null&&y.readsValue){const $=ho(i.throws,this.valueResolutionContext);return{value:G.UnhandledError,entity:i,error:{valueOwner:i.throws,type:$e.ExecutionResult,inheritanceLink:null,value:($==null?void 0:$.value)||null},result:null}}let l=ho(i,this.valueResolutionContext);const c=i.getDataType(null);if(c!=null&&c.isObject()){let $={};if(((T=c==null?void 0:c.entity)==null?void 0:T.type)===o.DefinitionEntity&&($={...$,...c.entity.getActiveRawDefaultValue()}),l!=null&&l.value)mr((v=l==null?void 0:l.value)==null?void 0:v.value)&&($={...$,...(E=l==null?void 0:l.value)==null?void 0:E.value}),l==null||l.value.metaSync({value:$},null);else{const L=Et(c,i,this.project);L==null||L.metaSync({value:$},null),l={valueOwner:i,type:$e.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(i,l.value),i.outputs.forEach(L=>{var U,F;if(((U=L.declaration)==null?void 0:U.type)===o.Property&&L.declaration.static){const Z=this.lastExecutionResults.readValue(L.declaration.id),X=le(L,this.project),se=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||Wi(X);if(Z)Z.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Z);else{const Q=Et(L.getDataType(null),L,this.project);Q==null||Q.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Q)}}})}else this.lastExecutionResults.writeValue(i,l==null?void 0:l.value);const e=(b=l==null?void 0:l.value)!=null&&b.value&&mr((O=l.value)==null?void 0:O.value)?((P=l.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var Z;const L=$.codeName||((Z=$.declaration)==null?void 0:Z.codeName)||Wi(le($,this.project)),U=e[L],F=Et($.getDataType(null),$,this.project);F==null||F.metaSync({value:U},null),$e.ExecutionResult}),l.type=$e.ExecutionResult,{value:G.Break,entity:i,error:null,result:l}}async executeVariable(i,n){var T,v,E,b,O,P;let l=ho(i,this.valueResolutionContext);const c=Zn(i),e=c.getDataType(null);if(e!=null&&e.isObject()){let $={};if(((T=e==null?void 0:e.entity)==null?void 0:T.type)===o.DefinitionEntity&&($={...$,...e.entity.getActiveRawDefaultValue()}),l!=null&&l.value)mr((v=l==null?void 0:l.value)==null?void 0:v.value)&&($={...$,...(E=l==null?void 0:l.value)==null?void 0:E.value}),l==null||l.value.metaSync({value:$},null);else{const L=Et(e,i,this.project);L==null||L.metaSync({value:$},null),l={valueOwner:c,type:$e.ExecutionResult,inheritanceLink:null,value:L}}this.lastExecutionResults.writeValue(c,l.value),c.inputs.forEach(L=>{var U,F;if(((U=L.declaration)==null?void 0:U.type)===o.Property&&L.declaration.static){const Z=this.lastExecutionResults.readValue(L.declaration.id),X=le(L,this.project),se=L.codeName||((F=L.declaration)==null?void 0:F.codeName)||Wi(X);if(Z)Z.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Z);else{const Q=Et(L.getDataType(null),L,this.project);Q==null||Q.metaSync({value:$[se]},null),this.lastExecutionResults.writeValue(L.declaration,Q)}}})}else this.lastExecutionResults.writeValue(c,l==null?void 0:l.value);const y=(b=l==null?void 0:l.value)!=null&&b.value&&mr((O=l.value)==null?void 0:O.value)?((P=l.value)==null?void 0:P.value)||{}:{};return i.outputs.map($=>{var Z;const L=$.codeName||((Z=$.declaration)==null?void 0:Z.codeName)||Wi(le($,this.project)),U=y[L],F=Et($.getDataType(null),$,this.project);F==null||F.metaSync({value:U},null),$e.ExecutionResult}),l.type=$e.ExecutionResult,{value:G.Success,entity:i,error:null,result:l}}mergeValues(i,n){const l=[];for(let c=0;c<n.length;c++)i!=null&&i[c]?l.push(i[c]):l.push(n[c]);return l}async executeEntity(i,n=[],l={}){var y,T,v,E,b,O,P,$,L,U,F;const c={...du,...l},e={detached:!1};switch(i.type){case o.Condition:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((y=c.onBeforeEntityExecution)==null?void 0:y.call(c,i,Z,e)),this.executeCondition(i,Z)}case o.InternalCall:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((T=c.onBeforeEntityExecution)==null?void 0:T.call(c,i,Z,e)),this.executeInternalCall(i,Z,this.project)}case o.Operation:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((v=c.onBeforeEntityExecution)==null?void 0:v.call(c,i,Z,e)),fu.executeOperation(i,Z,this.project)}case o.VariableInstance:case o.VariableDeclaration:return this.executeVariable(i,n);case o.FunctionCall:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((E=c.onBeforeEntityExecution)==null?void 0:E.call(c,i,Z,e)),this.executeFunctionCall(i,Z,this.project)}case o.FunctionDeclaration:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((b=c.onBeforeEntityExecution)==null?void 0:b.call(c,i,Z,e)),fu.executeEntryPointEntity(i,Z)}case o.Search:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((O=c.onBeforeEntityExecution)==null?void 0:O.call(c,i,Z,e)),this.executeSearch(i,Z,this.project)}case o.Loop:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((P=c.onBeforeEntityExecution)==null?void 0:P.call(c,i,Z,e)),this.executeLoop(i,Z,this.project,c)}case o.ReturnStatement:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await(($=c.onBeforeEntityExecution)==null?void 0:$.call(c,i,Z,e)),this.executeReturnStatement(i,Z)}case o.ContinueStatement:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((L=c.onBeforeEntityExecution)==null?void 0:L.call(c,i,Z,e)),this.executeContinueStatement(i,Z)}case o.BreakStatement:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((U=c.onBeforeEntityExecution)==null?void 0:U.call(c,i,Z,e)),this.executeBreakStatement(i,Z)}case o.GlobalEvent:{const Z=this.mergeExernalValuesWithInternalInputs(n,i);return await((F=c.onBeforeEntityExecution)==null?void 0:F.call(c,i,Z,e)),fu.executeEntryPointEntity(i,Z)}default:throw new Error(`Entity type ${i==null?void 0:i.type} is not recognized for execution.`)}}storeLastExecutionValues(i){var l,c,e;if(i.error&&i.error.valueOwner&&this.lastExecutionResults.writeValue(i.error.valueOwner,i.error.value),!i.result||!((l=i.result)!=null&&l.valueOwner))return;const n=yl((c=i.result)==null?void 0:c.valueOwner,this.project);(e=i.result)!=null&&e.value?n.forEach(y=>{var T;this.lastExecutionResults.writeValue(y,(T=i.result)==null?void 0:T.value)}):n.forEach(y=>{this.lastExecutionResults.removeValue(y.id)})}async executeBranch(i,n={},l=[]){var v;const c={...du,...n},e={detached:!1};if(!this.hasEntity(i)||this.hasSkipped(i))return null;this.addToExecutingList(i),this.hasScheduled(i)&&this.removeScheduled(i);const T=await this.executeEntity(i,l,c);if(this.removeFromExecutingList(i),this.addToAlreadyExecutedList(i),this.storeLastExecutionValues(T),await((v=c.onEntityExecuted)==null?void 0:v.call(c,i,T,e)),T.value===G.Success){const E=(i.successCalls||i.calls||[]).filter(L=>this.hasEntity(L));(i.errorCalls||[]).forEach(L=>{this.skip(L)});let O=[];const P=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=P.filter(L=>!!L).find(L=>L.value===G.CaughtError||L.value===G.Return||L.value===G.Break||L.value===G.Continue);return $||(O=[...O,...P],T)}else if(T.value===G.CaughtError||T.value===G.ConditionNotMet){const E=(i.errorCalls||[]).filter(L=>this.hasEntity(L));(i.successCalls||i.calls||[]).forEach(L=>{this.skip(L)});let O=[];const P=(await Promise.all(E.map(L=>this.schedule(L,[],c)))).filter(L=>!!L),$=P.filter(L=>!!L).find(L=>L.value===G.CaughtError||L.value===G.UnhandledError||L.value===G.Return||L.value===G.Break||L.value===G.Continue);return $||(O=[...O,...P],T)}else{if(T.value===G.UnhandledError)return this.executing.forEach(E=>{this.skip(E)}),this.scheduled.forEach(E=>{this.skip(E)}),Sr.includes(T.entity.type)&&Rt(T.entity).forEach(E=>{this.skip(E)}),T;if(T.value===G.Return)return T;if(T.value===G.Break)return T;if(T.value===G.Continue)return T}return T}async execute(i={},n=[]){const l={...du,...i};this.state="running";const c=await this.executeBranch(this.entryPoint,l,n);return this.state="finished-success",c}addEntity(i){var n;this.entities.includes(i)||(this.entities.push(i),(n=this.onAddEntityCallback)==null||n.call(this,i))}addEntities(i){i.forEach(n=>this.addEntity(n))}removeEntity(i){var n;if(i!==this.entryPoint){const l=this.entities.indexOf(i);l>-1&&(this.entities.splice(l,1),(n=this.onRemoveEntityCallback)==null||n.call(this,i))}}hasEntity(i){var c,e,y;if(this.entities.includes(i))return!0;if(((c=i.parent)==null?void 0:c.type)===o.FunctionDeclaration&&((y=(e=i.parent)==null?void 0:e.parent)==null?void 0:y.type)===o.DefinitionEntity)return this.entities.includes(i.parent);const n=ki(i);if(!n)return!1;const l=n.type===o.Loop&&i.parent===n.body?n.body:null;return l?this.entities.includes(l)||this.entities.includes(n):this.entities.includes(n)}removeScheduled(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}hasScheduled(i){return!!this.scheduled.includes(i)}hasSkipped(i){return!!this.skipped.includes(i)}hasExecuted(i){return!!this.executed.includes(i)}hasEntityWithId(i){const n=this.project.get(i);return n?this.hasEntity(n):!1}onAddToSkippedList(i){this.onAddToSkippedListCallback=i}onAbortExecution(i){this.onAbortExecutionCallback=i}onAddEntity(i){this.onAddEntityCallback=i}onRemoveFromSkippedList(i){this.onRemoveFromSkippedListCallback=i}onRemoveEntity(i){this.onRemoveEntityCallback=i}addToExecutingList(i){this.executing.includes(i)||this.executing.push(i)}addToScheduledList(i){this.scheduled.includes(i)||this.scheduled.push(i)}removeFromScheduledList(i){const n=this.scheduled.indexOf(i);n>-1&&this.scheduled.splice(n,1)}removeFromExecutingList(i){var l;const n=this.executing.indexOf(i);n>-1&&(this.executing.splice(n,1),(l=this.onAbortExecutionCallback)==null||l.call(this,i))}removeFromAlreadyExecutedList(i){const n=this.executed.indexOf(i);n>-1&&this.executed.splice(n,1)}removeFromSkippedList(i){var l;const n=this.skipped.indexOf(i);n>-1&&(this.skipped.splice(n,1),(l=this.onRemoveFromSkippedListCallback)==null||l.call(this,i))}addToAlreadyExecutedList(i){this.executed.includes(i)||this.executed.push(i)}addToSkippedList(i){var n;this.skipped.includes(i)||(this.skipped.push(i),(n=this.onAddToSkippedListCallback)==null||n.call(this,i))}getValueTypePreference(i){return this.parentContext.getValueTypePreference(i)||null}setValueTypePreference(i,n){this.parentContext.setValueTypePreference(i,n),this.emit(i,{})}}function _2i(d){var p,i;if(d.isList)return"list";if(((p=d.entity)==null?void 0:p.type)===o.DefinitionEntity)return"definition-entity";switch((i=d.entity)==null?void 0:i.name){case oe.Number:return"number";case oe.String:return"text";case oe.Boolean:return"boolean";case oe.UUID:return"uuid";case oe.Date:return"date-time";default:return"definition-entity"}}const is={[o.PrimitiveEntity]:{singular:"Primitive",plural:"Primitives",shortSingular:"Primitive",shortPlural:"Primitives"},[o.DefinitionEntity]:{singular:"Definition",plural:"Definitions",shortSingular:"Definition",shortPlural:"Definitions"},[o.BuiltInBaseEntity]:{singular:"Base",plural:"Bases",shortSingular:"Base definition",shortPlural:"Base definitions"},[o.Property]:{singular:"Property",plural:"Properties",shortSingular:"Property",shortPlural:"Properties"},[o.FunctionDeclaration]:{singular:"Custom trigger",plural:"Custom triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[o.FunctionCall]:{singular:"Execute trigger",plural:"Execute trigger",shortSingular:"Execute",shortPlural:"Execute"},[o.GlobalEvent]:{singular:"System trigger",plural:"System triggers",shortSingular:"Trigger",shortPlural:"Triggers"},[o.Project]:{singular:"Project",plural:"Projects",shortSingular:"Project",shortPlural:"Projects"},[o.VariableDeclaration]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[o.VariableInstance]:{singular:"Variable",plural:"Variables",shortSingular:"Variable",shortPlural:"Variables"},[o.Condition]:{singular:"Condition",plural:"Conditions",shortSingular:"Condition",shortPlural:"Conditions"},[o.Operation]:{singular:"Operation",plural:"Operations",shortSingular:"Operation",shortPlural:"Operations"},[o.ReturnStatement]:{singular:"Termination",plural:"Terminations",shortSingular:"Termination",shortPlural:"Terminations"},[o.InstalledProject]:{singular:"Installed project",plural:"Installed projects",shortSingular:"Project",shortPlural:"Projects"},[o.Search]:{singular:"Search",plural:"Searches",shortSingular:"Search",shortPlural:"Searches"},[o.Loop]:{singular:"Loop",plural:"Loops",shortSingular:"Loop",shortPlural:"Loops"},[o.ActionDescriptor]:{singular:"Action descriptor",plural:"Action descriptors",shortSingular:"Action descriptor",shortPlural:"Action descriptors"},[o.InternalCall]:{singular:"Internal call",plural:"Internal calls",shortSingular:"Internal call",shortPlural:"Internal calls"},[o.BreakStatement]:{singular:"Loop exit",plural:"Loop exists",shortSingular:"Exit",shortPlural:"Exits"},[o.ContinueStatement]:{singular:"Next iteration",plural:"Next iterations",shortSingular:"Next",shortPlural:"Nexts"},[o.ArgumentDeclaration]:{singular:"Input definition",plural:"Input definitions",shortSingular:"Input",shortPlural:"Inputs"},[o.InputMap]:{singular:"Input",plural:"Inputs",shortSingular:"Input",shortPlural:"Inputs"},[o.OutputMap]:{singular:"Output",plural:"Outputs",shortSingular:"Output",shortPlural:"Outputs"},[o.ValueDescriptor]:{singular:"Value descriptor",plural:"Value descriptors",shortSingular:"Value descriptor",shortPlural:"Value descriptors"},[o.DataType]:{singular:"Data type",plural:"Data types",shortSingular:"Data type",shortPlural:"Data types"},[o.LiteralValue]:{singular:"Literal value",plural:"Literal values",shortSingular:"Value",shortPlural:"Values"}};function TN(d){const p=_1(d);if(!p){const n=Ry(d);if(n.includes(Re.HTTP_ENDPOINT))return"HTTP endpoint";if(n.includes(Re.PERSISTED_ENTITY))return"Persisted entity";if(n.includes(Re.CRON_JOB))return"Scheduled execution";if(n.includes(Re.RELATIONAL_DATABASE))return"Relational database"}if(p){let n="Extension of "+le(p,p.project)+" entity",l=fc(n);const c=Ry(d);return c.includes(Re.HTTP_ENDPOINT)?"HTTP endpoint"+(l?", "+l:""):c.includes(Re.PERSISTED_ENTITY)?"Persisted entity"+(l?", "+l:""):c.includes(Re.CRON_JOB)?"Scheduled execution"+(l?", "+l:""):c.includes(Re.RELATIONAL_DATABASE)?"Relational database"+(l?", "+l:""):n}let i="";return d.abstract&&(i="Template "),d.static&&(i+=i?" single copy ":"Single copy "),i?i+"definition":"Definition"}function dBe(d){return d.parent.type===o.DefinitionEntity||d.parent.type===o.InstalledProject?"Internal action of "+le(d.parent,d.project):d.parent.type===o.Loop?"Action repeated on every iteration":"Internal action of entity"}function vN(d){return Kx(d)?dBe(d):"Custom trigger"}function P2i(d){var p;switch(d.type){case o.DefinitionEntity:return TN(d);case o.FunctionDeclaration:return vN(d)}return(p=is[d.type])==null?void 0:p.singular}function V2i(d){var p;switch(d.type){case o.DefinitionEntity:return TN(d);case o.FunctionDeclaration:return vN(d)}return(p=is[d.type])==null?void 0:p.singular}const EN=4e4,uBe=280,N2i=300,bN=65,ay=32,Nb=39,pBe=26,cBe=49,iA=44,x2i=35,xb=52,AN=10,id=AN*2,rA=38,$b=90,kw=270,fBe=EN/2+120,yBe=EN/2+180;function hBe(d){let i=ay+iA+rA+AN;const n=[...d.inputs];return n.length&&(i+=id,n.forEach(()=>{i+=pBe})),{height:i,width:280}}function mBe(d){let i=bN;const n=[];if([o.DefinitionEntity].includes(d.type)){const T=[...d.suggestedProperties||[],...d.properties||[]];T.length&&(i+=id,T.forEach(v=>{i+=v.static?cBe:Nb}))}if([o.DefinitionEntity,o.InstalledProject,o.Loop].includes(d.type)){const T=[...(d==null?void 0:d.suggestedMethods)||[],...d.methods||[],...d.functions||[],...d.body?[d.body]:[]];T.length&&(i+=id,T.forEach(v=>{const E=hBe(v);i+=E.height}))}Vi.includes(d.type)?(St.includes(d.type)?n.push(...(d.usedInputs||[]).flatMap(T=>[T])||[]):n.push(...(d.inputs||[]).flatMap(T=>[T])||[]),d.error&&(i+=xb)):[o.ReturnStatement,o.BreakStatement,o.ContinueStatement].includes(d.type)?(n.push(...d.outputs||[]),d.throws&&(i+=xb)):d.type===o.Condition&&(n.push(d.inputs[0]),d.inputs[1]&&n.push(d.inputs[1]));const l=n.length;l&&(i+=l*Nb,i+=id);const c=[];if(d.type===o.FunctionDeclaration||d.type===o.GlobalEvent?c.push(...d.inputs||[]):Vi.includes(d.type)&&(St.includes(d.type)?c.push(...d.usedOutputs||[]):c.push(...d.outputs||[])),St.includes(d.type)){d.readsValue&&(i+=id,i+=iA),d.writesValues.length&&(i+=id,i+=iA),d.internalCalls.length&&d.usedInternalCalls.forEach(()=>i+=xb+id);const T=d.getDataType(null);(!T||T.inferred)&&(i+=rA)}const e=c.length;return e&&(i+=e*Nb,i+=id),[o.DefinitionEntity,o.FunctionDeclaration,o.ReturnStatement,o.BreakStatement,o.ContinueStatement].includes(d.type)&&(i+=rA),{height:i,width:280}}function cv(d){return`${d.split("-").map((n,l)=>l===0?n.charAt(0).toUpperCase()+n.slice(1):n.toLowerCase()).join(" ")}.`}function $2i(d){switch(d.code){case ve.AbstractEntityWithNonAbstractMethods:return"This template entity has non-template actions";case ve.AbstractEntityWithNonAbstractProperties:return"This template entity has non-template properties";case ve.IncorrectEntityImplementation:return"This entity incorrectly implements a template entity";case ve.IncorrectMethodImplementation:return"This action incorrectly implements the template action it's based on";case ve.IncorrectPropertyImplementation:return"This property incorrectly implements the template property it's based on";case ve.AbstractMethodInNonAbstractEntity:return"This action is a template action in a non-template entity";case ve.AbstractPropertyInNonAbstractEntity:return"This property is a template property in a non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"An action in this entity overwrites an action in the template entity with the same name";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"A property in this entity overwrites a property in the template entity with the same name";case ve.MissingMethodImplementation:return"This entity is missing an action implementation from the template entity";case ve.MissingPropertyImplementation:return"This entity is missing a property implementation from the template entity";case Ie.NameNotUniqueInScope:return"Invalid name. There is another entity with the same name in the same scope";case ve.NoProperties:return"This entity has no properties, so it doesn't do anything";case ve.NonStaticPropertyInStaticEntity:return"This property is not static in a static entity";case ve.StaticEntityWithNonStaticProperties:return"This static entity has non-static properties";case ve.ReadingFromIncompatibleType:return"This entity reads data from a value of a different data type";case ve.WritingToIncompatibleType:return"This entity writes data to a value of a different data type";case ve.ScopeWithoutLogic:return"This action has no logic, so it doesn't do anything";case ve.NonStaticPropertyImplementsStatic:return"This property is static in a non-static entity";case ve.PropertyImplementsIncompatibleType:return"This property implements a property of a different data type";case ve.PropertyImplementsNonAbstact:return"This property implements a non-template property";case ve.StaticPropertyImplementsNonStatic:return"This static property implements a non-static property";case ve.VariableCallsOthersAndHasInternalCall:return"This variable calls other entities while being used to execute internal logic";case ve.VariableHasInputsAndInternalCall:return"This variable has inputs while being used to execute internal logic";case ve.VariableHasOutputsAndInternalCall:return"This variable has outputs while being used to execute internal logic";case ve.VariableIsCalledAndHasInternalCall:return"This variable is called while being used to execute internal logic";case Ie.InternalCallDeclarationIsInvalidType:return"This internal call is not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"This internal call is not found in the parent entity";case Ie.InternalCallParentDeclarationEntityInvalidType:return"This internal call parent entity is not a data type";case Ie.InternalCallParentMissingDataType:return"This internal call parent entity has no data type";case Ie.UnreachableEntity:return"This entity is unreachable";case ve.DisconnectedCallableEntity:return"This entity is disconnected and won't be executed by anything after publishing";case ve.AbstractEntityImplements:return"This template entity implements a non-template entity";case ve.AbstractExtendingNonAbstractEntity:return"This template entity extends a non-template entity";case ve.InvalidPropertiesCombination:return"This entity has an invalid combination of properties";case ve.ExtendingNonInteractiveEntity:return"This entity extends a non-interactive entity";case ve.ExtendsIncompatibleEntities:return"This entity extends incompatible entities";case ve.ImplementingNonAbstractEntity:return"This entity implements a non-template entity";case ve.ImplementsIncompatibleEntities:return"This entity implements incompatible entities";case ve.LackingReturnStatementOnSomeBranches:return"This action is missing a termination on some branches";case ve.LastCalledEntityMustBeReturnEntity:return"The last called entity in this action must be a termination node";case ve.MissingRequiredValue:return"This action is missing a required value";case ve.NoPrimaryKeyProperty:return"This entity has no primary key property";case ve.NonAbstractExtendingAbstractEntity:return"This non-template entity extends a template entity";case ve.NonStaticExtendingStaticEntity:return"This non-static entity extends a static entity";case ve.NonStaticImplementingStaticEntity:return"This non-static entity implements a static entity";case ve.StaticExtendingNonStaticEntity:return"This static entity extends a non-static entity";case ve.StaticImplementingNonStaticEntity:return"This static entity implements a non-static entity";case ve.VariableReadsValueAndInternalCall:return"This variable reads a value while being used to execute internal logic";case ve.VariableWritesValuesAndInternalCall:return"This variable writes values while being used to execute internal logic";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"This internal call declaration is not in the parent entity";case Ie.EmptyName:return"This entity has no name";case Ie.InvalidObjectStructure:return"This entity has an invalid structure";case Ie.LoopBodyFunctionOverwrite:return"This loop body action overwrites an action in the template entity with the same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"This action overwrites a base action with the same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"This action overwrites an action in an extended entity with the same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"This action overwrites an action in an implemented entity with the same implementation";case Ie.MissingCaller:return"This action is missing a caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"This entity has a name that is not unique in the scope of the code it is used in";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"This entity name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"This entity name must start with a letter or an underscore";case Ie.NoOverlapWithImplementedSignature:return"This action does not overlap with the implemented action signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"This property overwrites a base property with the same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an extended entity with the same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"This property overwrites a property in an implemented entity with the same implementation";case Ie.ReaderWriterIncompatibleDataType:return"This reader/writer has an incompatible data type with the value it is reading/writing";case Oo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Oo.StatusCodeMustBeNumber:return"HTTP status code must be a number, between 100 and 599";case La.UUIDMustBeString:return`UUID must be a string, eg: "${hu()}"`;case La.UUIDMustNotContainSpaces:return`UUID must not contain spaces, eg: "${hu()}"`;case La.UUIDMustBeValidFormat:return`UUID must be in a valid format. Eg: "${hu()}"`;case ia.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ia.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ia.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cv(d.code)}}function L2i(d){switch(d.code){case ve.AbstractEntityWithNonAbstractMethods:return"Non-template actions";case ve.AbstractEntityWithNonAbstractProperties:return"Non-template properties";case ve.IncorrectEntityImplementation:return"Incorrect implementation";case ve.IncorrectMethodImplementation:return"Incorrect action implementation";case ve.IncorrectPropertyImplementation:return"Incorrect property implementation";case ve.AbstractMethodInNonAbstractEntity:return"Template action in non-template entity";case ve.AbstractPropertyInNonAbstractEntity:return"Template property in non-template entity";case Ie.MethodOverwritesOtherSiblingWithSameName:return"Action overwrite";case Ie.PropertyOverwritesOtherSiblingWithSameName:return"Property overwrite";case ve.MissingMethodImplementation:return"Missing action";case ve.MissingPropertyImplementation:return"Missing property";case Ie.NameNotUniqueInScope:return"Duplicate name";case ve.NoProperties:return"No properties";case ve.NonStaticPropertyInStaticEntity:return"Non-static property";case ve.StaticEntityWithNonStaticProperties:return"Non-static properties";case ve.ReadingFromIncompatibleType:return"Read from different type";case ve.WritingToIncompatibleType:return"Write to different type";case ve.ScopeWithoutLogic:return"No logic";case ve.NonStaticPropertyImplementsStatic:return"Invalid static property";case ve.PropertyImplementsIncompatibleType:return"Incompatible data type";case ve.PropertyImplementsNonAbstact:return"Non-template property";case ve.StaticPropertyImplementsNonStatic:return"Non-static property";case ve.VariableCallsOthersAndHasInternalCall:return"Bad internal call";case ve.VariableHasInputsAndInternalCall:return"Bad internal call";case ve.VariableHasOutputsAndInternalCall:return"Bad internal call";case ve.VariableIsCalledAndHasInternalCall:return"Bad internal call";case Ie.InternalCallDeclarationIsInvalidType:return"Declaration not an action";case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return"Declaration not found in parent";case Ie.InternalCallParentDeclarationEntityInvalidType:return"Invalid parent declaration type";case Ie.InternalCallParentMissingDataType:return"Parent has no data type";case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return"Declaration not in parent";case Ie.UnreachableEntity:return"Unreachable entity";case ve.DisconnectedCallableEntity:return"Disconnected entity";case ve.AbstractEntityImplements:return"Abstract entity implements a non-template entity";case ve.AbstractExtendingNonAbstractEntity:return"Abstract entity extends a non-template entity";case ve.InvalidPropertiesCombination:return"Invalid properties combination";case ve.ExtendingNonInteractiveEntity:return"Extending non-interactive entity";case ve.ExtendsIncompatibleEntities:return"Extends incompatible entities";case ve.ImplementingNonAbstractEntity:return"Implementing non-template entity";case ve.ImplementsIncompatibleEntities:return"Implements incompatible entities";case ve.LackingReturnStatementOnSomeBranches:return"Missing termination on some branches";case ve.LastCalledEntityMustBeReturnEntity:return"Last called entity must be a termination node";case ve.MissingRequiredValue:return"Missing required value";case ve.NoPrimaryKeyProperty:return"No primary key property";case ve.NonAbstractExtendingAbstractEntity:return"Non-template entity extending a template entity";case ve.NonStaticExtendingStaticEntity:return"Non-static entity extending a static entity";case ve.NonStaticImplementingStaticEntity:return"Non-static entity implementing a static entity";case ve.StaticExtendingNonStaticEntity:return"Static entity extending a non-static entity";case ve.StaticImplementingNonStaticEntity:return"Static entity implementing a non-static entity";case ve.VariableReadsValueAndInternalCall:return"Variable reads value and has internal call";case ve.VariableWritesValuesAndInternalCall:return"Variable writes values and has internal call";case Ie.EmptyName:return"Empty name";case Ie.InvalidObjectStructure:return"Invalid object structure";case Ie.LoopBodyFunctionOverwrite:return"Loop body action overwrites action with same name";case Ie.MethodOverwritesBaseMethodWithSameImplementation:return"Action overwrites base action with same implementation";case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return"Action overwrites another with same implementation";case Ie.MissingCaller:return"Missing caller";case Ie.NameAsResolvedCodeNameNotUniqueInScope:return"Name not unique in scope";case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return"Name can only contain letters, numbers, underscores and spaces";case Ie.NameMustStartWithLetterOrUnderscore:return"Name must start with letter or underscore";case Ie.NoOverlapWithImplementedSignature:return"No overlap with implemented signature";case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return"Property overwrites base property with same implementation";case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return"Property overwrites another with same implementation";case Ie.ReaderWriterIncompatibleDataType:return"Reader/writer incompatible data type";case Oo.StatusCodeMustBeBetween100And599:return"HTTP status code must be between 100 and 599";case Oo.StatusCodeMustBeNumber:return"HTTP status code must be a number";case La.UUIDMustBeString:return"UUID must be a string";case La.UUIDMustNotContainSpaces:return"UUID must not contain spaces";case La.UUIDMustBeValidFormat:return"UUID must be in a valid format";case ia.MustBeUniqueAmongSameEntities:return"This value must be unique among the same kind";case ia.StringValueMustNotHaveDashes:return"This value must not contain dashes";case ia.StringValueMustNotHaveSpaces:return"This value must not contain spaces";default:return cv(d.code)}}function M2i(d){switch(d.code){case ve.AbstractEntityWithNonAbstractMethods:return`${le(d.entity,d.entity.project)} has non-template actions`;case ve.AbstractEntityWithNonAbstractProperties:return`${le(d.entity,d.entity.project)} has non-template properties`;case ve.IncorrectEntityImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements template`;case ve.IncorrectMethodImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template`;case ve.IncorrectPropertyImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template`;case ve.AbstractMethodInNonAbstractEntity:return`${le(d.entity,d.entity.project)} can't be a template`;case ve.AbstractPropertyInNonAbstractEntity:return`${le(d.entity,d.entity.project)} can't be a template`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${le(d.entity,d.entity.project)} overwrites action`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${le(d.entity,d.entity.project)} overwrites property`;case ve.MissingMethodImplementation:return`${le(d.entity,d.entity.project)} is missing action`;case ve.MissingPropertyImplementation:return`${le(d.entity,d.entity.project)} is missing property`;case Ie.NameNotUniqueInScope:return`${le(d.entity,d.entity.project)} name is not unique`;case ve.NoProperties:return`${le(d.entity,d.entity.project)} has no properties`;case ve.NonStaticPropertyInStaticEntity:return`${le(d.entity,d.entity.project)} has non-static property`;case ve.StaticEntityWithNonStaticProperties:return`${le(d.entity,d.entity.project)} has non-static properties`;case ve.ReadingFromIncompatibleType:return`${le(d.entity,d.entity.project)} reads from different type`;case ve.WritingToIncompatibleType:return`${le(d.entity,d.entity.project)} writes to different type`;case ve.ScopeWithoutLogic:return`${le(d.entity,d.entity.project)} has no logic`;case ve.NonStaticPropertyImplementsStatic:return`${le(d.entity,d.entity.project)} has invalid static property`;case ve.PropertyImplementsIncompatibleType:return`${le(d.entity,d.entity.project)} has incompatible data type`;case ve.PropertyImplementsNonAbstact:return`${le(d.entity,d.entity.project)} has non-template property`;case ve.StaticPropertyImplementsNonStatic:return`${le(d.entity,d.entity.project)} has non-static property`;case ve.VariableCallsOthersAndHasInternalCall:return`${le(d.entity,d.entity.project)} has bad internal call`;case ve.VariableHasInputsAndInternalCall:return`${le(d.entity,d.entity.project)} has bad internal call`;case ve.VariableHasOutputsAndInternalCall:return`${le(d.entity,d.entity.project)} has bad internal call`;case ve.VariableIsCalledAndHasInternalCall:return`${le(d.entity,d.entity.project)} has bad internal call`;case Ie.InternalCallDeclarationIsInvalidType:return`${le(d.entity,d.entity.project)} has declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(d.entity,d.entity.project)} has declaration that is not found in parent`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${le(d.entity,d.entity.project)} has invalid parent declaration type`;case Ie.InternalCallParentMissingDataType:return`${le(d.entity,d.entity.project)}'s parent has no data type`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(d.entity,d.entity.project)} has declaration that is not in parent`;case Ie.UnreachableEntity:return`${le(d.entity,d.entity.project)} is unreachable`;case ve.DisconnectedCallableEntity:return`${le(d.entity,d.entity.project)} is not executed by any entity`;case ve.AbstractEntityImplements:return`${le(d.entity,d.entity.project)} implements a non-template entity`;case ve.AbstractExtendingNonAbstractEntity:return`${le(d.entity,d.entity.project)} extends a non-template entity`;case ve.InvalidPropertiesCombination:return`${le(d.entity,d.entity.project)} has invalid properties combination`;case ve.ExtendingNonInteractiveEntity:return`${le(d.entity,d.entity.project)} extends a non-interactive entity`;case ve.ExtendsIncompatibleEntities:return`${le(d.entity,d.entity.project)} extends incompatible entities`;case ve.ImplementingNonAbstractEntity:return`${le(d.entity,d.entity.project)} implements a non-template entity`;case ve.ImplementsIncompatibleEntities:return`${le(d.entity,d.entity.project)} implements incompatible entities`;case ve.LackingReturnStatementOnSomeBranches:return`${le(d.entity,d.entity.project)} is missing termination on some branches`;case ve.LastCalledEntityMustBeReturnEntity:return`${le(d.entity,d.entity.project)}'s last called entity must be a termination node`;case ve.MissingRequiredValue:return`${le(d.entity,d.entity.project)} is missing a required value`;case ve.NoPrimaryKeyProperty:return`${le(d.entity,d.entity.project)} has no primary key property`;case ve.NonAbstractExtendingAbstractEntity:return`${le(d.entity,d.entity.project)} extends a template entity`;case ve.NonStaticExtendingStaticEntity:return`${le(d.entity,d.entity.project)} extends a static entity`;case ve.NonStaticImplementingStaticEntity:return`${le(d.entity,d.entity.project)} implements a static entity`;case ve.StaticExtendingNonStaticEntity:return`${le(d.entity,d.entity.project)} extends a non-static entity`;case ve.StaticImplementingNonStaticEntity:return`${le(d.entity,d.entity.project)} implements a non-static entity`;case ve.VariableReadsValueAndInternalCall:return`${le(d.entity,d.entity.project)} reads a value and has internal call`;case ve.VariableWritesValuesAndInternalCall:return`${le(d.entity,d.entity.project)} writes values and has internal call`;case Ie.EmptyName:return`${is[d.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${le(d.entity,d.entity.project)} has invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${le(d.entity,d.entity.project)}'s loop body action overwrites an action`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites base action`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${le(d.entity,d.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${le(d.entity,d.entity.project)} has a name not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${le(d.entity,d.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${le(d.entity,d.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites base property`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${le(d.entity,d.entity.project)} has reader/writer with incompatible data type`;case Oo.StatusCodeMustBeBetween100And599:return`${le(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Oo.StatusCodeMustBeNumber:return`${le(d.entity,d.entity.project)} HTTP status code must be a number`;case La.UUIDMustBeString:return`${le(d.entity,d.entity.project)} UUID must be a string`;case La.UUIDMustNotContainSpaces:return`${le(d.entity,d.entity.project)} UUID must not contain spaces`;case La.UUIDMustBeValidFormat:return`${le(d.entity,d.entity.project)} UUID must be in a valid format`;case ia.MustBeUniqueAmongSameEntities:return`${le(d.entity,d.entity.project)} value must be unique among the same kind`;case ia.StringValueMustNotHaveDashes:return`${le(d.entity,d.entity.project)} value must not contain dashes`;case ia.StringValueMustNotHaveSpaces:return`${le(d.entity,d.entity.project)} value must not contain spaces`;default:return`${le(d.entity,d.entity.project)} Error: ${cv(d.code)}`}}function B2i(d){var p,i,n,l;switch(d.code){case ve.AbstractEntityWithNonAbstractMethods:return`${le(d.entity,d.entity.project)} has non-template actions`;case ve.AbstractEntityWithNonAbstractProperties:return`${le(d.entity,d.entity.project)} has non-template properties`;case ve.IncorrectEntityImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template entity`;case ve.IncorrectMethodImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template action it's based on`;case ve.IncorrectPropertyImplementation:return`${le(d.entity,d.entity.project)} incorrectly implements the template property it's based on`;case ve.AbstractMethodInNonAbstractEntity:return`${le(d.entity,d.entity.project)} is a template action in a non-template entity`;case ve.AbstractPropertyInNonAbstractEntity:return`${le(d.entity,d.entity.project)} is a template property in a non-template entity`;case Ie.MethodOverwritesOtherSiblingWithSameName:return`${le(d.entity,d.entity.project)} overwrites an action in the template entity`;case Ie.PropertyOverwritesOtherSiblingWithSameName:return`${le(d.entity,d.entity.project)} overwrites a property in the template entity`;case ve.MissingMethodImplementation:return`${le(d.entity,d.entity.project)} is missing an action implementation from the template entity`;case ve.MissingPropertyImplementation:return`${le(d.entity,d.entity.project)} is missing a property implementation from the template entity`;case Ie.NameNotUniqueInScope:return`${le(d.entity,d.entity.project)} has a duplicate name in the same scope`;case ve.NoProperties:return`${le(d.entity,d.entity.project)} has no properties, so it doesn't do anything`;case ve.NonStaticPropertyInStaticEntity:return`${le(d.entity,d.entity.project)} has a non-static property in a static entity`;case ve.StaticEntityWithNonStaticProperties:return`${le(d.entity,d.entity.project)} has non-static properties in a static entity`;case ve.ReadingFromIncompatibleType:return`${le(d.entity,d.entity.project)} reads data from a value of a different data type`;case ve.WritingToIncompatibleType:return`${le(d.entity,d.entity.project)} writes data to a value of a different data type`;case ve.ScopeWithoutLogic:return`${le(d.entity,d.entity.project)} has no logic`;case ve.NonStaticPropertyImplementsStatic:return`${le(d.entity,d.entity.project)} has a static property in a non-static entity`;case ve.PropertyImplementsIncompatibleType:return`${le(d.entity,d.entity.project)} implements a property of a different data type`;case ve.PropertyImplementsNonAbstact:return`${le(d.entity,d.entity.project)} implements a non-template property`;case ve.StaticPropertyImplementsNonStatic:return`${le(d.entity,d.entity.project)} has a static property in a non-static entity`;case ve.VariableCallsOthersAndHasInternalCall:return`${le(d.entity,d.entity.project)} calls other entities while being used to execute internal logic`;case ve.VariableHasInputsAndInternalCall:return`${le(d.entity,d.entity.project)} has inputs while being used to execute internal logic`;case ve.VariableHasOutputsAndInternalCall:return`${le(d.entity,d.entity.project)} has outputs while being used to execute internal logic`;case ve.VariableIsCalledAndHasInternalCall:return`${le(d.entity,d.entity.project)} is called while being used to execute internal logic`;case Ie.InternalCallDeclarationIsInvalidType:return`${le(d.entity,d.entity.project)} has a declaration that is not an action`;case Ie.InternalCallDeclarationNotFoundInParentDatatypeEntity:return`${le(d.entity,d.entity.project)} has a declaration that is not found in ${(p=d.entity.parent.getDataType(null))!=null&&p.entity?le((i=d.entity.parent.getDataType(null))==null?void 0:i.entity,d.entity.project):"the variable's data-type entity"}`;case Ie.InternalCallParentDeclarationEntityInvalidType:return`${le(d.entity,d.entity.project)} is part of a variable whos data-type entity can't have actions`;case Ie.InternalCallParentMissingDataType:return`${le(d.entity,d.entity.project)} is part of a variable with no data-type entity`;case Ie.InternalCallDeclarationNotInParentDatatypeEntity:return`${le(d.entity,d.entity.project)} has a declaration doesn't belong to ${(n=d.entity.parent.getDataType(null))!=null&&n.entity?le((l=d.entity.parent.getDataType(null))==null?void 0:l.entity,d.entity.project):"the variable's data-type entity"}`;case Ie.UnreachableEntity:return`${le(d.entity,d.entity.project)} is unreachable`;case ve.DisconnectedCallableEntity:return`${le(d.entity,d.entity.project)} is disconnected and won't be executed by anything after publishing`;case ve.AbstractEntityImplements:return`${le(d.entity,d.entity.project)} implements a non-template entity`;case ve.AbstractExtendingNonAbstractEntity:return`${le(d.entity,d.entity.project)} extends a non-template entity`;case ve.InvalidPropertiesCombination:return`${le(d.entity,d.entity.project)} has an invalid combination of properties`;case ve.ExtendingNonInteractiveEntity:return`${le(d.entity,d.entity.project)} extends a non-interactive entity`;case ve.ExtendsIncompatibleEntities:return`${le(d.entity,d.entity.project)} extends incompatible entities`;case ve.ImplementingNonAbstractEntity:return`${le(d.entity,d.entity.project)} implements a non-template entity`;case ve.ImplementsIncompatibleEntities:return`${le(d.entity,d.entity.project)} implements incompatible entities`;case ve.LackingReturnStatementOnSomeBranches:return`${le(d.entity,d.entity.project)} has branches that don't terminate`;case ve.LastCalledEntityMustBeReturnEntity:return`${le(d.entity,d.entity.project)} must end with a termination node`;case ve.MissingRequiredValue:return`${le(d.entity,d.entity.project)} is missing a required value`;case ve.NoPrimaryKeyProperty:return`${le(d.entity,d.entity.project)} has no primary key property`;case ve.NonAbstractExtendingAbstractEntity:return`${le(d.entity,d.entity.project)} is a non-template entity extending a template entity`;case ve.NonStaticExtendingStaticEntity:return`${le(d.entity,d.entity.project)} is a non-static entity extending a static entity`;case ve.NonStaticImplementingStaticEntity:return`${le(d.entity,d.entity.project)} is a non-static entity implementing a static entity`;case ve.StaticExtendingNonStaticEntity:return`${le(d.entity,d.entity.project)} is a static entity extending a non-static entity`;case ve.StaticImplementingNonStaticEntity:return`${le(d.entity,d.entity.project)} is a static entity implementing a non-static entity`;case ve.VariableReadsValueAndInternalCall:return`${le(d.entity,d.entity.project)} reads a value and has an internal call`;case ve.VariableWritesValuesAndInternalCall:return`${le(d.entity,d.entity.project)} writes values and has an internal call`;case Ie.EmptyName:return`${is[d.entity.type]} has no name`;case Ie.InvalidObjectStructure:return`${le(d.entity,d.entity.project)} has an invalid structure`;case Ie.LoopBodyFunctionOverwrite:return`${le(d.entity,d.entity.project)}'s loop body action overwrites`;case Ie.MethodOverwritesBaseMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites a base action with same implementation`;case Ie.MethodOverwritesOtherExtendedEntitysMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another action with same implementation`;case Ie.MethodOverwritesOtherImplementedEntitysMethodWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another action with same implementation`;case Ie.MissingCaller:return`${le(d.entity,d.entity.project)} is missing a caller`;case Ie.NameAsResolvedCodeNameNotUniqueInScope:return`${le(d.entity,d.entity.project)} has a name that is not unique in the scope`;case Ie.NameCanOnlyContainLettersNumbersUnderscoreAndSpaces:return`${le(d.entity,d.entity.project)} name can only contain letters, numbers, underscores and spaces`;case Ie.NameMustStartWithLetterOrUnderscore:return`${le(d.entity,d.entity.project)} name must start with letter or underscore`;case Ie.NoOverlapWithImplementedSignature:return`${le(d.entity,d.entity.project)} has no overlap with implemented signature`;case Ie.PropertyOverwritesBasePropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites a base property with same implementation`;case Ie.PropertyOverwritesOtherExtendedEntitysPropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another property with same implementation`;case Ie.PropertyOverwritesOtherImplementedEntitysPropertyWithSameImplementation:return`${le(d.entity,d.entity.project)} overwrites another property with same implementation`;case Ie.ReaderWriterIncompatibleDataType:return`${le(d.entity,d.entity.project)} has a reader/writer with incompatible data type`;case Oo.StatusCodeMustBeBetween100And599:return`${le(d.entity,d.entity.project)} HTTP status code must be between 100 and 599`;case Oo.StatusCodeMustBeNumber:return`${le(d.entity,d.entity.project)} HTTP status code must be a number, between 100 and 599`;case La.UUIDMustBeString:return`${le(d.entity,d.entity.project)} UUID must be a string, eg: "${hu()}"`;case La.UUIDMustNotContainSpaces:return`${le(d.entity,d.entity.project)} UUID must not contain spaces, eg: "${hu()}"`;case La.UUIDMustBeValidFormat:return`${le(d.entity,d.entity.project)} UUID must be in a valid format. Eg: "${hu()}"`;case ia.MustBeUniqueAmongSameEntities:return`${le(d.entity,d.entity.project)} value must be unique among the same kind`;case ia.StringValueMustNotHaveDashes:return`${le(d.entity,d.entity.project)} value must not contain dashes`;case ia.StringValueMustNotHaveSpaces:return`${le(d.entity,d.entity.project)} value must not contain spaces`;default:return`${le(d.entity,d.entity.project)} Error: ${cv(d.code)}`}}var gN=(d=>(d.ValuesAlreadyConnected="values-already-connected",d.CannotReadMoreThanOneValue="cannot-read-more-than-one-value",d.CannotReadValueFromChildren="cannot-read-value-from-children",d.CannotWriteValueToChildren="cannot-write-value-to-children",d.CannotBeCalledByChildren="cannot-be-called-by-children",d.ExecutionsAlreadyConnected="executions-already-connected",d.DataTypesNotCompatible="data-types-not-compatible",d.CannotCallAncestor="cannot-call-ancestor",d.CannotConnectToItself="cannot-connect-to-itself",d.CannotWriteValueToAncestor="cannot-write-value-to-ancestor",d.NotInScope="not-in-scope",d.IsNotValueWrittingEntity="is-not-value-writting-entity",d.IsNotValueReadingEntity="is-not-value-reading-entity",d.ContinueOrBreakStatementCalledFromOutsideLoop="continue-or-break-statement-called-from-outside-loop",d.ElementInLoopBodyCallingOutsideLoop="element-in-loop-body-calling-outside-loop",d.CallerIsInHigherScope="caller-is-in-higher-scope",d.CallerIsInLowerScope="caller-is-in-lower-scope",d.CallIsInHigherScope="call-is-in-higher-scope",d.CallIsInLowerScope="call-is-in-lower-scope",d.OtherIncompatibleScopeReason="other-incompatible-scope-reason",d.SiblingInternalCallAlreadyUsedInParentVariable="sibling-internal-call-already-used-in-parent-variable",d.ErrorOututMapCannotBeConnectedToParentSuccessBranchCallees="error-output-map-cannot-be-connected-to-parent-success-branch-callees",d.SuccessOutputMapCannotBeConnectedToParentErrorBranchCallees="success-output-map-cannot-be-connected-to-parent-error-branch-callees",d))(gN||{});const G2i=Object.values(gN);var IN=(d=>(d.NotPartOfOngoingTest="not-part-of-ongoing-test",d.CannotBeAddedToTest="cannot-be-added-to-test",d))(IN||{});const U2i=Object.values(IN);var RN=(d=>(d.Suggestion="suggestion",d.CanvasGloballyDisabled="canvas-globally-disabled",d.CannotInteractWithInputInVariableWithInternalCalls="cannot-interact-with-input-in-variable-with-internal-calls",d.CannotInteractWithOutputInVariableWithInternalCalls="cannot-interact-with-output-in-variable-with-internal-calls",d))(RN||{});const j2i=Object.values(RN);function k2i(d,p){const i=[...d,...p];return Array.from(new Set(i))}function K2i(d,p){const i=[...d,...p],n=Array.from(new Set(i));return{hasChanged:n.length!==d.length,reasons:n}}function F2i(d,p){const i=d.filter(l=>!p.includes(l));return{hasChanged:i.length!==d.length,reasons:i}}function S2i(d,p){return d.find(i=>i.entity.id===p)||null}function J4(d){return d.filter((p,i)=>d.indexOf(p)===i)}class bn{constructor(p,i,n=null,l){I(this,"ids",[]);I(this,"entity");I(this,"entityCardHeight");I(this,"entityCardWidth");I(this,"index");I(this,"childEntities",[]);I(this,"children",[]);I(this,"parents",[]);I(this,"calculationEntryPoint");I(this,"_onlyEntities",null);I(this,"_changeSet",null);if(this.index=i,this.entity=p,this.calculationEntryPoint=n||this,this===this.calculationEntryPoint&&!l)throw new Error("Change set must be provided for the calculation entry point");this.calculateCardSize(),this.getSortedChildren()}static autoGenerateLayout(p,i,n){const l=fBe-kw-uBe,c=yBe-$b-bN;p.metaSync({x:p.x||l,y:p.y||c},i);const e=new bn(p,0,null,i);e._onlyEntities=n||[],e.ids=["0"];const y=[];e.next(v=>{y.push(...v)}),bn.recursivelyAssembleChildrenAreas(y),e.resolveChildrenOverlaps();const T=e.flattenChildEntities();return e._onlyEntities?T.filter(v=>(e._onlyEntities||[]).includes(v)):T}static recursivelyAssembleChildrenAreas(p){const i=[];p.forEach(n=>{n.next(l=>{i.push(...l)})}),i.length>0&&bn.recursivelyAssembleChildrenAreas(i)}get onlyEntities(){return this.calculationEntryPoint._onlyEntities}get changeSet(){return this.calculationEntryPoint._changeSet}set changeSet(p){this.calculationEntryPoint._changeSet=p}findAreaInChildrenFromEntity(p){if(this.entity===p)return this;const i=this.children.find(l=>l.entity===p);return i||this.children.reduce((l,c)=>l||c.findAreaInChildrenFromEntity(p),null)}findAreaFromEntity(p){if(this.entity===p)return this;const i=this.calculationEntryPoint.children,n=i.find(c=>c.entity===p);return n||i.reduce((c,e)=>c||e.findAreaInChildrenFromEntity(p),null)}addParent(p){if(!this.parents.includes(p)){const i=bn.resolveIds(p,this.index);this.ids.push(...i),this.parents.push(p)}}static resolveIds(p,i){return p?p.ids.map(n=>`${n}-${i}`):[`${i}`]}getSortedChildren(){if(this.entity.collapsed){this.childEntities=[];return}const p=Tl(this.entity,!0);if(this.entity.type===o.Project){const i=[],n=[],l=[];p.forEach(e=>{if(o.DefinitionEntity===e.type){n.push(e);return}else if(zt.includes(e.type)){l.push(e);return}i.push(e)});const c=i.sort((e,y)=>{const T=!!uA(e,y).length,v=Tl(e),E=Tl(y);return T?0:v.length&&!E.length?-1:!v.length&&E.length?1:0}).filter(e=>!Lp(e).length);this.childEntities=[...n,...l,...c]}else{const i=[],n=[],l=[],c=[],e=[];Sr.includes(this.entity.type)&&w1(this.entity).forEach(v=>{if(St.includes(v.type)){l.push(v);return}const E=ki(v);i.push(E)}),yr.includes(this.entity.type)&&n.push(...this.entity.detachedChildren);const y=p.filter(T=>{const v=i.includes(T);return v||l.includes(T)||n.includes(T)?!1:St.includes(T.type)?(l.push(T),!1):zr.includes(T.type)&&!v?(c.push(T),!1):T.type===o.DefinitionEntity?(e.push(T),!1):!0});i.sort((T,v)=>bc(T,v)?-1:0),c.sort((T,v)=>bc(T,v)?-1:0),l.sort((T,v)=>iC(T,v)?1:iC(v,T)?-1:0),this.childEntities=[...e,...i,...c,...y,...l,...n]}}calculateCardSize(){const p=mBe(this.entity);this.entityCardWidth=p.width,this.entityCardHeight=p.height}static getBoundriesOfTwoAreas(p,i){return{top:Math.min(p.top,i.top),left:Math.min(p.left,i.left),bottom:Math.max(p.bottom,i.bottom),right:Math.max(p.right,i.right)}}static getBoundriedOfCombinedAreas(p,i){const n=p.filter(c=>!i.includes(c));return n.reduce((c,e)=>i.includes(e)?c:bn.getBoundriesOfTwoAreas(c,e.fullBranchArea),n[0].fullBranchArea)}getFullAreaUntilAny(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(e=>!p.includes(e)).map(e=>e.getFullAreaUntilAny(p)).reduce((e,y)=>bn.getBoundriesOfTwoAreas(e,y),i)}getFullAreaUntilAreaOrAnyChildren(p){const i=[p,...p.flattenChildren()],n=this.ownEntityPlusBufferArea;return this.children.filter(e=>i.includes(e)).map(e=>e.getFullAreaUntil(p)).reduce((e,y)=>bn.getBoundriesOfTwoAreas(e,y),n)}getFullAreaUntil(p){const i=this.ownEntityPlusBufferArea;return this.children.filter(c=>c!==p).map(c=>c.getFullAreaUntil(p)).reduce((c,e)=>bn.getBoundriesOfTwoAreas(c,e),i)}get fullBranchArea(){const p=this.ownEntityPlusBufferArea;return this.children.map(l=>l.fullBranchArea).reduce((l,c)=>bn.getBoundriesOfTwoAreas(l,c),p)}get ownEntityArea(){return{top:this.entity.y,left:this.entity.x,bottom:this.entity.y+this.entityCardHeight,right:this.entity.x+this.entityCardWidth}}get ownEntityPlusBufferArea(){const p=this.ownEntityArea;return{top:p.top,left:p.left,bottom:p.bottom+$b,right:p.right+kw}}static filterOutRepeatedAreas(p){return p.filter((i,n)=>p.indexOf(i)===n)}getEarliestId(p,i){const n=p.split("-"),l=i.split("-");return n.length<l.length?p:n.length>l.length?i:n.reduce((e,y,T)=>y<l[T]?p:i,p)}getEarliestLevel(){return this.ids.reduce((n,l)=>this.getEarliestId(n,l),this.ids[0]).split("-").length}countColumns(){let p=0;if(this!==this.calculationEntryPoint)p++;else return p;if(!this.parents.length)return p;const n=this.parents.reduce((l,c)=>c.getEarliestLevel()>l.getEarliestLevel()?c:l,this.parents[0]).countColumns();return p+=n,p}getLatestId(p,i){if(p===i)return p;const n=p.split("-"),l=i.split("-");return n.length<l.length?i:n.length>l.length?p:n.reduce((e,y,T)=>y>l[T]?p:i,p)}getLatestLevel(){return this.ids.length===1?this.ids[0].split("-").length:this.ids.reduce((n,l)=>this.getLatestId(n,l),this.ids[0]).split("-").length}smoothPosition(){const p=this.flattenSiblings();if(!p.length&&this.parents.length<=1&&this.children.length){const i=this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();this.parents.forEach(n=>{n!==this.calculationEntryPoint&&n.shiftDownAlone(i)})}else if([...zt].includes(this.entity.type)&&this.children.length)this.centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight();else if(!this.children.length&&this.parents.length>1){const i=p.filter(n=>!this.parents.includes(n));i.length?i.every(l=>{const c=this.countColumns(),e=l.countColumns();return c>e})&&this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight():i.length||this.centerHeaderVerticallyOverCombinedAllParentsHeaderHeight()}}shiftDownUntilAny(p,i){if(p.includes(this))return p;this.move(this.entity,{y:this.entity.y+i});let n=[...p,this];return this.children.forEach(l=>{if(bn.getEarliestParentInChain(l)!==this)return;const e=S2i(n,l.entity.id);n=bn.filterOutRepeatedAreas([...n]),e||(n=n.filter(T=>T!==l));const y=l.shiftDownUntilAny(n,i);n.push(...y)}),n}shiftRightUntilAny(p,i){p.includes(this)||(this.move(this.entity,{x:this.entity.x+i}),this.children.forEach(n=>{const l=bn.filterOutRepeatedAreas([...this.flattenSiblings(),...p]);bn.getEarliestParentInChain(n)===this&&n.shiftRightUntilAny(l,i)}))}shiftRight(p){this.move(this.entity,{x:this.entity.x+p}),this.children.forEach(i=>{const l=i.flattenSiblings().filter(c=>c!==i);i.shiftRightUntilAny(l,p)})}shiftDownAlone(p){this.move(this.entity,{y:this.entity.y+p})}centerHeaderVerticallyOverCombinedAllParentsHeaderHeight(){const p=this.parents.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+ay,T={top:y,left:e.left,bottom:y,right:e.right};return bn.getBoundriesOfTwoAreas(l,T)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-ay;this.shiftDownAlone(n)}centerHeaderVerticallyOverCombinedAllChildrenHeaderHeight(){const p=this.children.reduce((l,c)=>{const e=c.ownEntityArea,y=e.top+ay,T={top:y,left:e.left,bottom:y,right:e.right};return bn.getBoundriesOfTwoAreas(l,T)},{top:1/0,left:1/0,bottom:-1/0,right:-1/0}),n=(p.bottom-p.top)/2-ay;return this.shiftDownAlone(n),n}resolveChildrenOverlaps(){const p=this.flattenChildren();let i=[];p.forEach(n=>{const l=n.adjustVerticallyToAvoidOverlaps();i.push(...l)}),p.forEach(n=>{n.smoothPosition()})}static getEarliestParentInChain(p){let i=p.parents[0];return p.parents.length&&(i=p.parents.sort((n,l)=>{if(!n.ids.length)return-1;if(!l.ids.length)return 1;const c=n.ids.sort((y,T)=>y.length<T.length?-1:0),e=l.ids.sort((y,T)=>y.length<T.length?-1:0);return c[0].length-e[0].length})[0]),i}flattenEarlierSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,l)=>{if(p.has(l.entity.id))return n;p.add(l.entity.id);const e=l.children.slice(0,l.children.indexOf(this)).reduce((y,T)=>[...y,T,...T.flattenChildren(p)],[]);return[...n,...e]},[])}flattenSiblings(p=new Set){return p.add(this.entity.id),this.parents.reduce((n,l)=>{if(p.has(l.entity.id))return n;p.add(l.entity.id);const e=l.children.filter(y=>y!==this).reduce((y,T)=>[...y,T,...T.flattenChildren(p)],[]);return[...n,...e]},[])}flattenChildren(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n,...n.flattenChildren(p)]),[])}flattenParents(p=new Set){return this.parents.reduce((n,l)=>p.has(l.entity.id)?n:(p.add(l.entity.id),[...n,l,...l.flattenParents(p)]),[])}getAreaIfRendered(p){return this.calculationEntryPoint.flattenChildren().find(l=>l.entity.id===p.id)||null}getLowerSiblings(){const p=this.parents.reduce((i,n)=>{const l=n.children.indexOf(this),c=n.children.slice(l+1);return[...i,...c]},[]);return J4(p)}getLowerAreas(){const p=this.getLowerSiblings(),i=this.parents.reduce((n,l)=>[...n,...l.getLowerAreas()],[]);return J4([...p,...i])}adjustVerticallyToAvoidOverlaps(p=[]){const n=bn.getEarliestParentInChain(this).children[this.index-1];if(!n)return p;const l=this.flattenEarlierSiblings(),c=this.flattenParents(),e=[...l,...c,n],v=D(e.flatMap(P=>uA(this.entity,P.entity))).filter(P=>P.id!==this.entity.id).map(P=>this.findAreaFromEntity(P)).filter(P=>!!P),E=this.getFullAreaUntilAny(v),b=n.getFullAreaUntilAny(v),O=e.reduce((P,$)=>$===this||$.fullBranchArea.left!==E.left?P:Math.max(P,$.fullBranchArea.bottom),b.bottom);if(E.top<O){const P=O-E.top+$b;return this.shiftDownUntilAny(p,P)}return p}move(p,i){(this.onlyEntities||[]).includes(p)&&p.metaSync(i,this.changeSet)}addChild(p){const i=this.childEntities[p];let n=null;i.x&&i.y?n=this.getAreaIfRendered(i):!i.x&&!i.y&&this.move(i,{x:this.entity.x,y:this.entity.y}),n||(n=new bn(i,p,this.calculationEntryPoint));const l=this.ownEntityPlusBufferArea;this.children.includes(n)||(this.children.push(n),n.addParent(this));const c=n.fullBranchArea;if(c.left<l.right){const e=l.right-c.left;n.shiftRight(e)}return n}flattenChildEntities(p=new Set){return this.children.reduce((i,n)=>p.has(n.entity.id)?i:(p.add(n.entity.id),[...i,n.entity,...n.flattenChildEntities(p)]),[])}next(p){const i=[];this.childEntities.forEach((n,l)=>{const c=this.addChild(l);c&&i.push(c)}),p(i)}}var Im=(d=>(d.Amazon="amazon",d.Google="google",d.Microsoft="microsoft",d))(Im||{}),fr=(d=>(d.RelationalDatabase="relational-database",d.CompiledLocalCodebase="compiled-local-codebase",d.CloudHostedCodebase="cloud-hosted-codebase",d.HttpApi="http-api",d.HttpEndpoint="http-endpoint",d.ServerlessFunction="serverless-function",d))(fr||{}),Kw=(d=>(d.Post="post",d.Get="get",d.Acknowledgement="acknowledgment",d.Progress="progress",d.Error="error",d.Complete="complete",d))(Kw||{}),sc=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.Skipped="skipped",d.AbortedByUser="aborted-by-user",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(sc||{}),Fw=(d=>(d.Queued="queued",d.Running="running",d.Success="success",d.Failed="failed",d.CleanedUp="cleaned-up",d.UnrecoverableFailure="unrecoverable-failure",d.Reverted="reverted",d.UnpublishingStarted="unpublishing-started",d.Unpublished="unpublished",d))(Fw||{}),Nt=(d=>(d.ProjectNotFound="project-not-found",d.ProjectPublishRequestAcknowledged="project-publish-request-acknowledged",d.PublicationStepFailedReasonUnknown="publication-step-failed-reason-unknown",d.DeploymentCompleted="deployment-completed",d.DeploymentStarted="deployment-started",d.DeploymentFailed="deployment-failed",d.AllInfrastructureSuccessfullyProvisioned="all-infrastucture-successfully-provisioned",d.RequestPayloadValidationFailed="request-payload-validation-failed",d.ProjectStateValidationFailedMissingName="project-state-validation-failed-missing-name",d.ProjectStateValidationFailedMissingAnyFunctionality="project-state-validation-failed-missing-any-functionality",d.ProjectAlreadyBeingPublished="project-already-being-published",d.BillingSubscriptionUpdateFailed="billing-subscription-update-failed",d.RelationalDatabaseDeploymentStarted="relational-database-deployment-started",d.RelationalDatabaseDeploymentCompleted="relational-database-deployment-completed",d.RelationalDatabaseDeploymentFailed="relational-database-deployment-failed",d.CreatingNewRelationalDatabase="creating-new-relational-database",d.WaitingForPreviousRelationalDatabaseDeployment="waiting-for-previous-relationa-database-deployment",d.RelationalDatabaseAlreadyExists="relational-database-already-exists",d.RelationalDatabaseDeletionStarted="relational-database-deletion-started",d.RelationalDatabaseDeletionCompleted="relational-database-deletion-completed",d.RelationalDatabaseDeletionFailed="relational-database-deletion-failed",d.WaitingForPreviousRelationalDatabaseDeletion="waiting-for-previous-relationa-database-deletion",d.HttpApiDeploymentStarted="http-api-deployment-started",d.HttpApiDeploymentCompleted="http-api-deployment-completed",d.HttpApiDeploymentFailed="http-api-deployment-failed",d.CreatingNewHttpApi="creating-new-http-api",d.HttpApiAlreadyExists="http-api-already-exists",d.HttpApiDeletionStarted="http-api-deletion-started",d.HttpApiDeletionCompleted="http-api-deletion-completed",d.HttpApiDeletionFailed="http-api-deletion-failed",d.WaitingForPreviousHttpApiDeletion="waiting-for-previous-http-api-deletion",d.BusinessLogicCodebaseDeploymentStarted="business-logic-codebase-deployment-started",d.BusinessLogicCodebaseDeploymentCompleted="business-logic-codebase-deployment-completed",d.BusinessLogicCodebaseDeploymentFailed="business-logic-codebase-deployment-failed",d.BundlingCodebaseForDownload="bundling-codebase-for-download",d.UploadingCodebaseToCloudStorage="uploading-codebase-to-cloud-storage",d.UploadingCodebaseToCloudStorageCompleted="uploading-codebase-to-cloud-storage-completed",d.UploadingCodebaseToCloudStorageFailed="uploading-codebase-to-cloud-storage-failed",d.InfrastructureValuesCodebaseInterpolationStarted="infrastructure-values-codebase-interpolation-started",d.InfrastructureValuesCodebaseInterpolationCompleted="infrastructure-values-codebase-interpolation-completed",d.InfrastructureValuesCodebaseInterpolationFailed="infrastructure-values-codebase-interpolation-failed",d.CodeCompilationStarted="code-compilation-started",d.CodeCompilationCompleted="code-compilation-completed",d.CodeCompilationFailed="code-compilation-failed",d.BundleCodebaseStarted="bundle-codebase-started",d.BundleCodebaseCompleted="bundle-codebase-completed",d.BundleCodebaseFailed="bundle-codebase-failed",d.InstallingCodebaseDependenciesStarted="installing-codebase-dependencies-started",d.InstallingCodebaseDependenciesCompleted="installing-codebase-dependencies-completed",d.InstallingCodebaseDependenciesFailed="installing-codebase-dependencies-failed",d.MigrateRelationalDatabaseStarted="migrate-relational-database-started",d.MigrateRelationalDatabaseCompleted="migrate-relational-database-completed",d.MigrateRelationalDatabaseFailed="migrate-relational-database-failed",d.ExecutePublicationCompletedEventStarted="execute-publication-completed-event-started",d.ExecutePublicationCompletedEventCompleted="execute-publication-completed-event-completed",d.ExecutePublicationCompletedEventFailed="execute-publication-completed-event-failed",d.ExecutePublicationCompletedEventTimedOut="execute-publication-completed-event-timed-out",d))(Nt||{}),fl=(d=>(d.CodeCompilation="code-compilation",d.RelationalDatabaseDeployment="relational-database-deployment",d.RelationalDatabaseDeletion="relational-database-deletion",d.HttpApiDeployment="http-api-deployment",d.HttpApiDeletion="http-api-deletion",d.InfrastructureValuesCodebaseInterpolation="infrastructure-values-codebase-interpolation",d.BundleCodebase="bundle-codebase",d.MigrateRelationalDatabase="migrate-relational-database",d.BusinessLogicCodebaseDeployment="business-logic-codebase-deployment",d.ExecutePublicationCompletedEvent="execute-publication-completed-event",d.CodebaseCleanup="codebase-cleanup",d))(fl||{});fr.CloudHostedCodebase,fr.HttpApi,fr.RelationalDatabase,fr.CloudHostedCodebase,fr.CloudHostedCodebase,fr.RelationalDatabase,fr.CloudHostedCodebase,fr.CloudHostedCodebase;function TBe(d){return`project-${d}-http-api`}function e1(d){return`entity-${d}-database`}class vBe{constructor(p,i,n,l,c,e,y,T,v){I(this,"stepType");I(this,"id");I(this,"resourceType");I(this,"index");I(this,"dependency",[]);I(this,"lastEvent",null);I(this,"lastEventTimestamp",null);I(this,"status",sc.Queued);I(this,"publicationRun");I(this,"resource");this.stepType=p,this.id=i,this.resourceType=n,this.status=l,this.dependency=c,this.index=e,this.lastEventTimestamp=y,this.publicationRun=T,this.resource=v}toJSON(){return{stepType:this.stepType,id:this.id,resourceType:this.resourceType,index:this.index,status:this.status,dependency:this.dependency,lastEvent:this.lastEvent,resource:{resourceId:this.resource.resourceId,resourceType:this.resource.resourceType,provider:this.resource.provider,details:this.resource.details,status:this.resource.status,name:this.resource.name}}}async update(p){var i,n;this.status=p.status,this.dependency=p.dependency,this.index=p.index,this.stepType=p.stepType,this.resourceType=p.resourceType,this.lastEvent=p.lastEvent,this.id=p.id,(n=this.resource)==null||n.setDetails((i=p.resource)==null?void 0:i.details)}}var EBe=(d=>(d.Ready="ready",d.Provisioning="provisioning",d.Queued="queued",d.ProvisioningFailed="provisioning-failed",d.Deleting="deleting",d.DeletingFailed="deleting-failed",d.Deleted="deleted",d))(EBe||{});class Qc{constructor(p,i,n){I(this,"provisionedBy");I(this,"publicationRun");I(this,"resourceType");I(this,"provider");I(this,"resourceId");I(this,"details",null);I(this,"name",null);I(this,"status","queued");this.publicationRun=p,this.resourceType=i,this.provider=n}setDetails(p){this.details=p}setStatus(p){this.status=p}setProvisionedBy(p){this.provisionedBy=p}}class q2i extends Qc{constructor(i,n,l){super(i,fr.HttpEndpoint,l);I(this,"resourceType",fr.HttpEndpoint);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=e1((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class Z2i extends Qc{constructor(i,n,l){super(i,fr.ServerlessFunction,l);I(this,"resourceType",fr.ServerlessFunction);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=e1((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class bBe extends Qc{constructor(i,n,l){super(i,fr.HttpApi,l);I(this,"resourceType",fr.HttpApi);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=TBe(this.publicationRun.project.id),this.resourceId}}class ABe extends Qc{constructor(i,n,l){super(i,fr.RelationalDatabase,l);I(this,"resourceType",fr.RelationalDatabase);I(this,"owners",new Map);I(this,"details",null);I(this,"status","queued");n.forEach(c=>{this.owners.set(c.id,c)}),this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){var i,n;return this.resourceId=e1((n=(i=Array.from(this.owners.values()))==null?void 0:i[0])==null?void 0:n.id),this.resourceId}}class gBe extends Qc{constructor(i,n){super(i,fr.CloudHostedCodebase,n);I(this,"resourceType",fr.CloudHostedCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`cloud-hosted-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}`,this.resourceId}}class IBe extends Qc{constructor(i,n){super(i,fr.CompiledLocalCodebase,n);I(this,"resourceType",fr.CompiledLocalCodebase);I(this,"details",null);I(this,"status","queued");this.resolveDeterministicResourceId()}resolveDeterministicResourceId(){return this.resourceId=`compiled-codebase--${this.publicationRun.project.id}--${this.publicationRun.project.version}--${this.publicationRun.id}`,this.resourceId}}class H2i{constructor(p,i){I(this,"id");I(this,"projectAutoIncrementPublicationCount");I(this,"projectPublishedSemanticVersion");I(this,"projectVersion");I(this,"projectId");I(this,"triggeredBy");I(this,"createdAt");I(this,"updatedAt");I(this,"status");I(this,"steps",[]);I(this,"editor");I(this,"explicitResources",new Map);I(this,"implicitGlobalResources",new Map);I(this,"finalGlobalEvent",null);I(this,"finalStatus",null);I(this,"contextType",J.PublicationRun);I(this,"extensionsRegistry");this.id=p.id,this.projectAutoIncrementPublicationCount=p.projectAutoIncrementPublicationCount,this.projectPublishedSemanticVersion=p.projectPublishedSemanticVersion,this.projectVersion=p.projectVersion,this.projectId=p.projectId,this.triggeredBy=p.triggeredBy,this.createdAt=p.createdAt,this.updatedAt=p.updatedAt,this.status=p.status,this.editor=i,this.initRegistry()}get off(){return this.extensionsRegistry.off}get on(){return this.extensionsRegistry.on}get emit(){return this.extensionsRegistry.emit}get emitAsync(){return this.extensionsRegistry.emitAsync}get emitAsyncAll(){return this.extensionsRegistry.emitAsyncAll}get emitAsyncAllSettled(){return this.extensionsRegistry.emitAsyncAllSettled}get emitAsyncSequentially(){return this.extensionsRegistry.emitAsyncSequentially}get emitAsyncSequentiallyAll(){return this.extensionsRegistry.emitAsyncSequentiallyAll}get emitAsyncSequentiallyAllSettled(){return this.extensionsRegistry.emitAsyncSequentiallyAllSettled}get project(){return this.editor.project}getInfraTypes(p){return this.steps.filter(i=>p.includes(i.resourceType))}getStepsTypes(p){return this.steps.filter(i=>p.includes(i.stepType))}toIds(p){return p.map(i=>i.id)}getResourceForEntity(p){const i=Array.from(this.explicitResources.values()).find(n=>n.owners.has(p.id));return i||null}async init(){await this.initResources()}async initResources(){this.implicitGlobalResources.set(fr.CompiledLocalCodebase,new IBe(this,Im.Amazon)),this.implicitGlobalResources.set(fr.CloudHostedCodebase,new gBe(this,Im.Amazon));const p=this.project.entities.filter(n=>Ki(n,Re.HTTP_ENDPOINT)),i=this.project.entities.filter(n=>Ki(n,Re.RELATIONAL_DATABASE));if(i.length&&i.forEach(n=>{const l=new ABe(this,[n],Im.Amazon);this.explicitResources.set(l.resourceId,l)}),p.length){const n=new bBe(this,p,Im.Amazon);this.explicitResources.set(n.resourceId,n)}}setSteps(p,i){p.forEach(n=>{this.addStep(n,i)}),this.editor.events.emit(Nt.ProjectPublishRequestAcknowledged,{})}addStep(p,i){const n=p.dependency||[];if(n.length){const c=n.filter(e=>!this.steps.find(y=>y.id===e));if(c.length)throw new Error(`Missing dependencies: ${c.join(", ")}`)}if(!this.steps.find(c=>c.id===p.id)){const c=new vBe(p.stepType,p.id,p.resourceType,p.status,n,p.index,i,this,null);this.steps.push(c)}}onUpdate(p){var i;if(te.Logger.log("onUpdate",p),(i=p.payload)!=null&&i.stepType){const n=this.steps.find(l=>{var c;return l.id===((c=p.payload)==null?void 0:c.id)});n&&M(p.emittedAt).isAfter(M(n.lastEventTimestamp))&&n.update(p.payload)}this.editor.events.emit("publication-updated",{}),p.type===Kw.Error?(this.finalStatus=Fw.Failed,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-error",p)):p.type===Kw.Complete&&(this.finalStatus=Fw.Success,this.finalGlobalEvent=p.event,this.editor.events.emit("project-publication-completed",p))}requestExtension(p){return this.extensionsRegistry.requestExtension(p)}async initRegistry(){return this.extensionsRegistry=new yN(this.editor.events),await this.extensionsRegistry.setup(),this.extensionsRegistry.onResolvePublicationRunContext(()=>this),await this.extensionsRegistry.contextAvailable(J.PublicationRun),this.extensionsRegistry}}function W2i(d){switch(d){case fl.CodeCompilation:return"Code generation";case fl.RelationalDatabaseDeployment:return"Database creation";case fl.HttpApiDeployment:return"HTTP gateway creation";case fl.InfrastructureValuesCodebaseInterpolation:return"Link code with resources";case fl.BundleCodebase:return"Bundle code";case fl.MigrateRelationalDatabase:return"Database structure migration";case fl.BusinessLogicCodebaseDeployment:return"Update servers with new code";case fl.CodebaseCleanup:return"Code cleanup";case fl.HttpApiDeletion:return"HTTP gateway deletion";case fl.RelationalDatabaseDeletion:return"Database deletion";default:return"Publication finished"}}function z2i(d){switch(d){case Nt.DeploymentCompleted:return"Successfully published";case Nt.DeploymentStarted:return"Publication started";case Nt.DeploymentFailed:return"Publication failed";case Nt.AllInfrastructureSuccessfullyProvisioned:return"All infrastructure successfully provisioned";case Nt.RequestPayloadValidationFailed:return"Request payload validation failed";case Nt.ProjectStateValidationFailedMissingName:return"Project state validation failed: missing name";case Nt.ProjectStateValidationFailedMissingAnyFunctionality:return"Project state validation failed: missing any functionality";case Nt.RelationalDatabaseDeploymentStarted:return"Database creation started";case Nt.RelationalDatabaseDeploymentCompleted:return"Database creation completed";case Nt.RelationalDatabaseDeploymentFailed:return"Database creation failed";case Nt.CreatingNewRelationalDatabase:return"Creating new database (up to 5 mins)";case Nt.WaitingForPreviousRelationalDatabaseDeployment:return"Waiting for previous database creation";case Nt.RelationalDatabaseAlreadyExists:return"Database already exists";case Nt.HttpApiDeploymentStarted:return"HTTP gateway creation started";case Nt.HttpApiDeploymentCompleted:return"HTTP gateway creation completed";case Nt.HttpApiDeploymentFailed:return"HTTP gateway creation failed";case Nt.CreatingNewHttpApi:return"Creating new HTTP gateway";case Nt.HttpApiAlreadyExists:return"HTTP gateway already exists";case Nt.BusinessLogicCodebaseDeploymentStarted:return"Update servers with new code started";case Nt.BusinessLogicCodebaseDeploymentCompleted:return"Update servers with new code completed";case Nt.BusinessLogicCodebaseDeploymentFailed:return"Update servers with new code failed";case Nt.BundlingCodebaseForDownload:return"Bundling code for download";case Nt.UploadingCodebaseToCloudStorage:return"Uploading code to cloud storage";case Nt.InfrastructureValuesCodebaseInterpolationStarted:return"Linking code with resources started";case Nt.InfrastructureValuesCodebaseInterpolationCompleted:return"Linking code with resources completed";case Nt.InfrastructureValuesCodebaseInterpolationFailed:return"Linking code with resources failed";case Nt.CodeCompilationStarted:return"Code generation started";case Nt.CodeCompilationCompleted:return"Code generation completed";case Nt.CodeCompilationFailed:return"Code generation failed";case Nt.BundleCodebaseStarted:return"Code bundling started";case Nt.BundleCodebaseCompleted:return"Code bundling completed";case Nt.BundleCodebaseFailed:return"Code bundling failed";case Nt.InstallingCodebaseDependenciesStarted:return"Installing code dependencies";case Nt.InstallingCodebaseDependenciesCompleted:return"Installing code dependencies completed";case Nt.InstallingCodebaseDependenciesFailed:return"Installing code dependencies failed";case Nt.MigrateRelationalDatabaseStarted:return"Database structure migration started";case Nt.MigrateRelationalDatabaseCompleted:return"Database structure migration completed";case Nt.MigrateRelationalDatabaseFailed:return"Database structure migration failed";case Nt.ProjectAlreadyBeingPublished:return"Project already being published. You need to wait for the previous publication to complete";case Nt.ProjectPublishRequestAcknowledged:return"Project publish request acknowledged";case Nt.UploadingCodebaseToCloudStorageCompleted:return"Uploading code to cloud storage completed";case Nt.UploadingCodebaseToCloudStorageFailed:return"Uploading code to cloud storage failed";case Nt.BillingSubscriptionUpdateFailed:return"Billing subscription update failed";case Nt.ProjectNotFound:return"Project not found";case Nt.HttpApiDeletionCompleted:return"HTTP gateway deletion completed";case Nt.HttpApiDeletionFailed:return"HTTP gateway deletion failed";case Nt.HttpApiDeletionStarted:return"HTTP gateway deletion started";case Nt.PublicationStepFailedReasonUnknown:return"Publication step failed: reason unknown";case Nt.WaitingForPreviousHttpApiDeletion:return"Waiting for previous HTTP gateway deletion";case Nt.RelationalDatabaseDeletionStarted:return"Database deletion started";case Nt.RelationalDatabaseDeletionCompleted:return"Database deletion completed";case Nt.RelationalDatabaseDeletionFailed:return"Database deletion failed";case Nt.WaitingForPreviousRelationalDatabaseDeletion:return"Waiting for previous database deletion"}return"Unknown event"}var RBe=(d=>(d.NO_LOGIC="NO_LOGIC",d.NO_NAME="NO_NAME",d.NO_CHANGES="NO_CHANGES",d.PROJECT_PUBLICATION_ALREADY_ONGOING="PROJECT_PUBLICATION_ALREADY_ONGOING",d))(RBe||{});function J2i(d){switch(d){case"NO_LOGIC":return"This project has no logic";case"NO_NAME":return"This project has no name";case"NO_CHANGES":return"This version has already been published";case"PROJECT_PUBLICATION_ALREADY_ONGOING":return"This project is already being published";default:return"Publishing is currently not available. Try again later"}}function Y2i(d){switch(d){case fr.RelationalDatabase:return"Relational database";case fr.HttpEndpoint:case fr.HttpApi:return"HTTP endpoints";case fr.ServerlessFunction:case fr.CloudHostedCodebase:return"Server code functions";default:return"Resources"}}function X2i(d){switch(d){case sc.Running:return"In progress";case sc.Failed:return"Failed";case sc.Success:return"Succeeded";case sc.Skipped:return"Skipped";case sc.Queued:default:return"Queued"}}function DBe(d){var n;if(!Ki(d,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=Y["built-in-base-entity"].BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_ENTITY.properties.integration.id;if(d.type===o.BuiltInBaseEntity?Ki(d,Re.EXTERNAL_INTEGRATION_CONNECTION)&&(p=Sw(d.name)):d.type===o.DefinitionEntity&&d.implements.forEach(l=>{if(Ki(l,Re.EXTERNAL_INTEGRATION_CONNECTION)){const c=Sw(l==null?void 0:l.name);if(c)return p=c,!0}}),!p){const l=d.properties.find(c=>!!c.implements.find(e=>e.id===i)||!!c.implements.find(e=>{var y;return((y=e.extends)==null?void 0:y.id)===i}));p=(n=l==null?void 0:l.getDefaultValue())==null?void 0:n.value}return p}function Q2i(d){return bhe[d]}function Sw(d){return d.includes("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")?d.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").toLocaleLowerCase().replace("_auth",""):null}function OBe(d){if(d.type!==o.ActionDescriptor&&d.type!==o.Operation)throw new Error("Only ActionDescriptorState or OperationState can be used to resolve an external integration ID");if(d.type===o.ActionDescriptor){const p=d;if(p.id.startsWith("external-integration--"))return p.id.split("--")[1]}if(d.type===o.Operation){const p=d.declaration;if(Object.values(Jt).includes(p.id))return p.id.split("--")[1]||null}return null}function eMi(d){if(!d)throw new Error("The integrationName parameter is required to resolve the base built-in name.");return Object.values(Re).find(i=>!!(i.startsWith("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_")&&i.endsWith("_AUTH")&&i.replace("BUILT_IN_EXTERNAL_INTEGRATION_CONNECTION_","").replace("_AUTH","").toLowerCase()===d.toLowerCase()))||null}function tMi(d){return d.type===o.BuiltInBaseEntity||d.type===o.DefinitionEntity?DBe(d):d.type===o.ActionDescriptor||d.type===o.Operation?OBe(d):null}function wBe(d){var l,c,e;if(!Ki(d,Re.EXTERNAL_INTEGRATION_CONNECTION))return null;let p=null;const i=bje(d,Re.EXTERNAL_INTEGRATION_CONNECTION);if(!i)return null;const n=Y["built-in-base-entity"][i.id].properties.connectionId.id;if(d.type===o.BuiltInBaseEntity){if(Ki(d,Re.EXTERNAL_INTEGRATION_CONNECTION)){const y=d.properties.find(T=>{var v;return((v=T.extends)==null?void 0:v.id)===n});y&&(p=(l=y.getDefaultValue())==null?void 0:l.value)}}else if(d.type===o.DefinitionEntity){const y=d.properties.find(T=>!!T.implements.find(v=>v.id===n)||!!T.implements.find(v=>{var E;return((E=v.extends)==null?void 0:E.id)===n}));if(!y&&((c=d.extends)==null?void 0:c.type)===o.DefinitionEntity)return wBe(d.extends);p=(e=y==null?void 0:y.getDefaultValue())==null?void 0:e.value}return p}function CBe(d){var l;(l=d.dataType)==null||l.validate(),d.inputs.forEach(c=>c.validate()),d.outputs.forEach(c=>c.validate()),d.internalCalls.forEach(c=>c.validate());const i=[...qd(d),...nf(d),..._Be(d),...Zd(d),...PBe(d)],n=QN(d);return i.push(...n),rr(d.errors,i)}function _Be(d,p){const n=[...d.project.getVariableDeclarations()].filter(l=>l.id!==d.id);return _v(d,[Wi],n,p)}function PBe(d){const p=[];if(d.parent!==d.project)return p;if(d.catchesError){const i=Mt({id:`${d.id}--${Ie.GlobalVariableDeclarationCannotCatchError}`,message:`${is[d.type].singular} "${le(d,d.project)}" with id "${d.id}" cannot catch an error because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:pe.Error,code:Ie.GlobalVariableDeclarationCannotCatchError,entity:d});p.push(i.error)}if(d.errorCalls.length){const i=Mt({id:`${d.id}--${Ie.GlobalVariableDeclarationCannotCallOnError}`,message:`${is[d.type].singular} "${le(d,d.project)}" with id "${d.id}" cannot call other entities from its error branch because it is globally declared. Global variable declarations must crash the project if an error occurs.`,severity:pe.Error,code:Ie.GlobalVariableDeclarationCannotCallOnError,entity:d});p.push(i.error)}if(d.calledBy.length){const i=Mt({id:`${d.id}--${Ie.GlobalVariableDeclarationCannotBeCalled}`,message:`${is[d.type].singular} "${le(d,d.project)}" with id "${d.id}" cannot be called because it is globally declared. Global variable declarations must be self initialized when the project is loaded, and not be called for initialization.`,severity:pe.Error,code:Ie.GlobalVariableDeclarationCannotBeCalled,entity:d});p.push(i.error)}return[]}const iMi=Object.freeze(Object.defineProperty({__proto__:null,validate:CBe,validateGlobalVariableDeclaration:PBe,validateVariableDeclarationName:_Be},Symbol.toStringTag,{value:"Module"}));function VBe(d){d.inputs.forEach(l=>l.validate()),d.outputs.forEach(l=>l.validate()),d.internalCalls.forEach(l=>l.validate());const i=[...qd(d),...nf(d),...Zd(d)],n=QN(d);return i.push(...n),rr(d.errors,i)}const rMi=Object.freeze(Object.defineProperty({__proto__:null,validate:VBe},Symbol.toStringTag,{value:"Module"}));var DN=(d=>(d.Parent="parent",d.DataTypeEntity="data-type-entity",d.VarDeclaration="var-declaration",d))(DN||{});const di=class di extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"x");I(this,"y");I(this,"type",o.VariableInstance);I(this,"catchesError",!1);I(this,"defaultValue",null);I(this,"writesValues",[]);I(this,"readsValue",null);I(this,"declaration");I(this,"inputs",[]);I(this,"outputs",[]);I(this,"error",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"successCalls",[]);I(this,"errorCalls",[]);I(this,"internalCalls",[]);I(this,"project");I(this,"errors",[]);I(this,"parent");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.VariableInstance,catchesError:!0,declaration:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,n){let l=n;if(i.parent){const P=re(i.parent);l=n.get(P)}const c=re(i.declaration),e=n.get(c),y=i.calledByEntry.map(P=>{const $=re(P);return n.get($)}),T=i.calledBySuccess.map(P=>{const $=re(P);return n.get($)}),v=i.calledByError.map(P=>{const $=re(P);return n.get($)});let E=null;if(i.readsValue){const P=re(i.readsValue);E=n.get(P)}const b={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.VariableInstance,catchesError:i.catchesError||!1,declaration:e.toReference(),calledByEntry:y,calledBySuccess:T,calledByError:v,defaultValue:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:E,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},O=he(b,n);return O.setParent(l,null),O}static validateGenerationTarget(i,n){let l=JSON.parse(JSON.stringify(i));const c=[],e=Tn(l,{parent:{list:!1,types:[...yr,o.Project],optional:!0},declaration:{list:!1,types:[o.VariableDeclaration]}},n);return l=e.modifiedData,c.push(...e.errors,...Nr(l)),{errors:c,modifiedData:l}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const n=[];let l=JSON.parse(JSON.stringify(i));const c=rf(l,this);return l=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${ne.InvalidParentUpdate}`,code:ne.InvalidParentUpdate,severity:pe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
56
56
  If an entity is called by another, they must be in the same scope, which means they have the same parent.
57
57
  Specifically for variables, their scope is also calculated from their value readers and value writters.
58
58
  You shouldn't have to manually update a 'parent' property. The equivalent result is to change its value readers, value writters, or callers.`})),{errors:n,modifiedData:l}}subscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-dependents"))){const n=[],l=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const T=y.entity.afterAllChildrenInitialized(i);n.push(...T.updated),l.push(...T.added),c.push(...T.removed),e.push(...T.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}onDetachedDependencyRemoved(i,n,l){const c=[],e=[],y=[],T=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.remove({ignoreUpstream:!1},l);c.push(...v),e.push(...E),y.push(...b)}if(n==="var-declaration"){const{updated:v,added:E,removed:b}=this.remove({ignoreUpstream:!1},l);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}onDetachedDependencyRestored(i,n,l){const c=[],e=[],y=[],T=[];if(n==="parent"){const{updated:v,added:E,removed:b}=this.restore({},l);c.push(...v),e.push(...E),y.push(...b)}if(n==="var-declaration"){const{updated:v,added:E,removed:b}=this.restore({},l);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}unsubscribeFromDependencies(){var i,n,l,c,e,y,T;return(n=(i=this.parent)==null?void 0:i.unsubscribeDependents)==null||n.call(i,[{entity:this,field:"parent"}]),(e=(c=(l=this.declaration.dataType)==null?void 0:l.entity)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"data-type-entity"}]),(T=(y=this.declaration)==null?void 0:y.unsubscribeDependents)==null||T.call(y,[{entity:this,field:"var-declaration"}]),this}subscribeToDependencies(){var i,n,l,c;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"parent"}]),(c=(l=(n=this.declaration.dataType)==null?void 0:n.entity)==null?void 0:l.subscribeDependents)==null||c.call(l,[{entity:this,field:"data-type-entity"}]),this.declaration.subscribeDependents([{entity:this,field:"var-declaration"}]),this}increaseVersion(i){if(i&&!M(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&M(i).isSame(M(this.createdAt))?this:(this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=M(i).toISOString()||M().toISOString(),this)}captureVersion(){var n;const i=((n=this.knownVersions)==null?void 0:n.get(this.version))||new di(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.inputs=[...this.inputs],i.outputs=[...this.outputs],i.internalCalls=[...this.internalCalls],i.successCalls=[...this.successCalls],i.errorCalls=[...this.errorCalls],i.writesValues=[...this.writesValues],i.readsValue=this.readsValue,i.defaultValue=this.defaultValue,i.declaration=this.declaration,i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.error=this.error,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const n=[],l=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);n.push(this.parent,...y.updated),l.push(...y.added),c.push(...y.removed)}return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}async restoreVersion(i){var T;const n=[],l=[],c=[],e=[];if(this.version===i)return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this};if(!this.knownVersions){const v=new Map;for(const[E,b]of this.knownVersions||new Map){if(v.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[O,P]of b.knownVersions)v.set(O,P);b.knownVersions=null}}let y=(T=this.knownVersions)==null?void 0:T.get(i);if(!y){const v=await this.APILoadVersion({},i);if(!v)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new di(v,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.inputs=y.inputs,this.outputs=y.outputs,this.internalCalls=y.internalCalls,this.successCalls=y.successCalls,this.errorCalls=y.errorCalls,this.writesValues=y.writesValues,this.readsValue=y.readsValue,this.defaultValue=y.defaultValue,this.declaration=y.declaration,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.error=y.error,this.parent=y.parent,{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}updateWithShallowTransfer(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,n),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const l=re(i.parent),c=this.project.get(l),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(n),c)this.setParent(c,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.readsValue){const l=re(i.readsValue),c=this.project.get(l),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(n),c&&this.setValueWriter(c,n)}else this.removeValueWriter(n);if(i.declaration){const l=re(i.declaration),c=this.project.get(l);c&&this.setDeclaration(c)}if(i.calledByEntry.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addEntryCaller(e,n),e.addCall(this,n))}),[...this.calledByEntry].forEach(l=>{i.calledByEntry.find(e=>re(e)===l.id)||(this.removeCaller(l,n),l.removeCall(this,n))}),i.calledBySuccess.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addSuccessCaller(e,n),e.addSuccessCall(this,n))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>re(e)===l.id)||(this.removeCaller(l,n),l.removeCall(this,n))}),i.calledByError.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addErrorCaller(e,n),e.addErrorCall(this,n))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>re(e)===l.id)||(this.removeCaller(l,n),l.removeCall(this,n))}),i.outputs.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addOutput(e,n),e.setParent(this,n))}),[...this.outputs].forEach(l=>{i.outputs.find(e=>re(e)===l.id)||(this.removeOutput(l,n),l.removeFromParent(n))}),i.inputs.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addInput(e,n),e.setParent(this,n))}),[...this.inputs].forEach(l=>{i.inputs.find(e=>re(e)===l.id)||(this.removeInput(l,n),l.removeFromParent(n))}),i.defaultValue){const l=re(i.defaultValue),c=this.project.get(l);c&&this.setDefaultValue(c,n)}else this.setDefaultValue(null,n);return i.writesValues.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addValueReader(e,n),e.setValueWriter(this,n))}),[...this.writesValues].forEach(l=>{i.writesValues.find(e=>re(e)===l.id)||(this.removeValueReader(l,n),l.setValueWriter(null,n))}),this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],n=[],l=[],c=[];if(this.initialData.parent){const e=re(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const e=re(this.initialData.readsValue),y=this.project.get(e);y&&(this.setValueWriter(y,null),i.push(y))}if(this.initialData.declaration){const e=re(this.initialData.declaration),y=this.project.get(e);y&&(this.setDeclaration(y),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.addEntryCaller(T,null)}),this.initialData.calledBySuccess.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.addSuccessCaller(T,null)}),this.initialData.calledByError.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.addErrorCaller(T,null)}),{updated:D(i),added:D(n),removed:D(l),affected:D(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AfterAllChildrenInitialized))){var xe;if(!this.checkCanEdit(this,i))return te.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];if(this.initialized=!0,!this.declaration.dataType||(xe=this.declaration.dataType)!=null&&xe.inferred){const{added:Me,updated:We,removed:Fe,affected:qe}=this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(i);l.push(...Me),n.push(...We),c.push(...Fe),e.push(...qe)}const{added:y,updated:T,removed:v,affected:E}=this.syncInputs(i);l.push(...y),n.push(...T),c.push(...v),e.push(...E);const{added:b,updated:O,removed:P,affected:$}=this.syncOutputs(i);l.push(...b),n.push(...O),c.push(...P),e.push(...$);const{added:L,updated:U,removed:F,affected:Z}=this.generateUnusedInternalCalls(i);l.push(...L),n.push(...U),c.push(...F),e.push(...Z);const{added:X,updated:se,removed:Q,affected:fe}=this.removeUnrecognizedInputs(i);l.push(...X),n.push(...se),c.push(...Q),e.push(...fe);const{added:de,updated:ce,removed:me,affected:ae}=this.removeUnrecognizedOutputs(i);l.push(...de),n.push(...ce),c.push(...me),e.push(...ae);const{added:ye,updated:_e,removed:Ve,affected:Be}=this.removeUnrecognizedInternalCalls(i);return l.push(...ye),n.push(..._e),c.push(...Ve),e.push(...Be),this.inputs.sort((Me,We)=>{var Fe,qe;return(Me.index??((Fe=Me.declaration)==null?void 0:Fe.index))-(We.index??((qe=We.declaration)==null?void 0:qe.index))}),this.outputs.sort((Me,We)=>{var Fe,qe;return(Me.index??((Fe=Me.declaration)==null?void 0:Fe.index))-(We.index??((qe=We.declaration)==null?void 0:qe.index))}),this.captureVersion(),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-self-to-project"))){const n=[this],l=[],c=[],e=[];return this.parent===this.project&&this.project.addVariableInstance(this),this.readsValue&&(this.readsValue.addValueReader(this,i),n.push(this.readsValue)),this.writesValues.forEach(y=>{y.setValueWriter(this,i),n.push(y)}),this.successCalls.forEach(y=>{y.addSuccessCaller(this,i),n.push(y)}),this.errorCalls.forEach(y=>{y.addErrorCaller(this,i),n.push(y)}),this.calledBySuccess.forEach(y=>{y.addSuccessCall(this,i),n.push(y)}),this.calledByError.forEach(y=>{y.addErrorCall(this,i),n.push(y)}),this.calledByEntry.forEach(y=>{y.addCall(this,i),n.push(y)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}get usedInputs(){return this.inputs.filter(i=>i.readsValue||i.defaultValue)}get unusedInputs(){return this.inputs.filter(i=>!i.readsValue&&!i.defaultValue)}get usedOutputs(){return this.outputs.filter(i=>i.writesValues.length)}get unusedOutputs(){return this.outputs.filter(i=>!i.writesValues.length)}get usedInternalCalls(){return this.internalCalls.filter(i=>!!i.calledBy.length||!!i.writesValues.length||!!i.successCalls.length||!!i.errorCalls.length)}get unusedInternalCalls(){const i=this.usedInternalCalls;return this.internalCalls.filter(l=>!(i.find(y=>y.id===l.id)||i.find(y=>y.declaration===l.declaration)))}removeInternalCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-variable-instance-internal-call"))){const l=this.internalCalls.findIndex(c=>c.id===i.id);return l>-1&&(this.internalCalls.splice(l,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose("remove-variable-instance-internal-call",this.id),this}removeInput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveInput))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[removeInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this;const l=this.inputs.findIndex(c=>c.id===i.id);return l>-1&&(this.inputs.splice(l,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose(_.RemoveInput,this.id),this}addInput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddInput))){return this.checkCanEdit(this,n)?this.inputs.includes(i)?(n==null||n.attemptAutoclose(_.AddInput,this.id),this):(this.inputs.push(i),n==null||n.add(this,H.Affected),n==null||n.attemptAutoclose(_.AddInput,this.id),this):(te.Logger.warn(`[addInput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.AddInput,this.id),this)}addOutput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this,n)?this.outputs.includes(i)?(n==null||n.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),n==null||n.add(this,H.Affected),n==null||n.attemptAutoclose("add-output",this.id),this):(te.Logger.warn(`[addOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("add-output",this.id),this)}removeOutput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[removeOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("remove-output",this.id),this;const l=this.outputs.findIndex(c=>c.id===i.id);return l>-1&&(this.outputs.splice(l,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose("remove-output",this.id),this}addSuccessCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddSuccessCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCaller,n)?(this.calledBySuccess.find(c=>c.id===i.id)||(this.calledBySuccess.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddSuccessCaller,this.id),this):this}addErrorCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddErrorCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCaller,n)?(this.calledByError.find(c=>c.id===i.id)||(this.calledByError.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddErrorCaller,this.id),this):this}addEntryCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddEntryCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddEntryCaller,n)?(this.calledByEntry.find(c=>c.id===i.id)||(this.calledByEntry.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddEntryCaller,this.id),this):this}addErrorCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddErrorCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCall,n)?(this.errorCalls.find(c=>c.id===i.id)||(this.errorCalls.push(i),l&&ht(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddErrorCall,this.id),this):this}addSuccessCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddSuccessCall)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCall,n)?(this.successCalls.find(c=>c.id===i.id)||(this.successCalls.push(i),l&&ht(this,n),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.AddSuccessCall,this.id),this):this}removeCall(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveCall)),l=!1){if(!this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCall,n))return this;const c=this.successCalls.findIndex(y=>y.id===i.id);c>-1&&(this.successCalls.splice(c,1),n==null||n.add(this,H.Affected));const e=this.errorCalls.findIndex(y=>y.id===i.id);return e>-1&&(this.errorCalls.splice(e,1),n==null||n.add(this,H.Affected)),l&&ht(this,n),n==null||n.attemptAutoclose(_.RemoveCall,this.id),this}removeCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-caller")),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCaller,n)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),l&&ht(this,n),n==null||n.attemptAutoclose(_.RemoveCaller,this.id),this):this}addValueReader(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,_.AddValueReader,n)?this.writesValues.includes(i)?(n==null||n.attemptAutoclose(_.AddValueReader,this.id),this):(this.writesValues.push(i),n==null||n.add(this,H.Affected),this):this}setError(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetErrorEntity))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[setError] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetErrorEntity,this.id),this;const l=this.error;return(l==null?void 0:l.id)!==(i==null?void 0:i.id)&&(l==null||l.remove({ignoreUpstream:!0},n),this.error=i,this.subscribeToDependencies(),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.SetErrorEntity,this.id),this}setParent(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetParent,n)?(((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetParent,this.id),this):this}initChildren(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=he(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.declaration.type===o.GenericReference){const n=this.project.findSubscribedInstanceFromReference(this.initialData.declaration);if(!n)return this;this.declaration=n}else this.declaration=he(this.initialData.declaration,this.project),this.declaration.initChildren(i);return $v.initWritesValues(this,this.parent),sf.initReadsValue(this),this.initialData.inputs.forEach(n=>{const l=he(n,this.project);return l.setParent(this,null),l.initChildren(i),this.addInput(l,null),l}),this.initialData.outputs.forEach(n=>{const l=he(n,this.project);return l.setParent(this,null),l.initChildren(i),this.addOutput(l,i),l}),this.successCalls=this.initialData.successCalls.map(n=>{const l=he(n,this.project);if(l.addSuccessCaller(this,null),[o.BreakStatement,o.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===o.ReturnStatement){const c=en(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==o.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.errorCalls=this.initialData.errorCalls.map(n=>{const l=he(n,this.project);if(l.addErrorCaller(this,null),[o.BreakStatement,o.ContinueStatement].includes(l.type))l.setParent(this.parent.parent,null),l.initChildren(i);else if(l.type===o.ReturnStatement){const c=en(this,this.project);l.setParent(c,null),l.initChildren(i)}else l.type!==o.InternalCall&&(l.setParent(this.parent,null),l.initChildren(i));return l}),this.internalCalls=this.initialData.internalCalls.reduce((n,l)=>{if(l.type===o.GenericReference){const c=this.project.findSubscribedInstanceFromReference(l);if(!c)return n;const e=c;return e.setParent(this,null),[...n,e]}else{const c=he(l,this.project);return c.setParent(this,null),c.initChildren(i),[...n,c]}},[]),this.initialData.error&&(this.error=he(this.initialData.error,this.project),this.error.setParent(this,null),this.error.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}setValueWriter(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetValueWriter))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,_.SetValueWriter,n)?(this.readsValue!==i&&(this.readsValue=i,n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose(_.SetValueWriter,this.id),this):this}removeValueWriter(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditWithCounterpartAndSideEffects(this,this.readsValue,_.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,H.Updated)),i==null||i.attemptAutoclose(_.RemoveValueWriter,this.id),this)}removeValueReader(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveValueReader))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,_.RemoveValueReader,n)?this.writesValues.includes(i)?(this.writesValues=this.writesValues.filter(l=>l.id!==i.id),n==null||n.add(this,H.Affected),this):(n==null||n.attemptAutoclose(_.RemoveValueReader,this.id),this):this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"meta-sync"))){const l=$r(this,i,n),c=xr(this,l),e=this.toMeta();return this.x=l.x||e.x,this.y=l.y||e.y,this.catchesError=l.catchesError!==void 0?l.catchesError:this.catchesError,super.baseMetaSync(l,this,n),l.deleted===!0&&!e.deleted?n==null||n.add(this,H.Removed):l.deleted===!1&&e.deleted?n==null||n.add(this,H.Added):c&&(n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ge,...n){return await di.repository.APILoad(this.id,...n),this}async APICreate(i=Ge,...n){return await di.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(i=Ge,...n){return await di.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(i=Ge,...n){return await di.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(i=Ge,...n){return await di.repository.APIClone(this.id,...n),this}async APILoadVersion(i=Ge,n,...l){return await di.repository.APILoadVersion(this.id,n,...l)}removeFromParent(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveFromParent))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.parent.type===o.Project?(this.parent.removeVariableInstance(this),e.push(this.parent)):this.parent.detachedChildren.includes(this)&&this.parent.unsubscribeDetachedChild(this),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:D(c),updated:D(n),removed:D(l),affected:D(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveEntity))){var T;if(!this.checkCanDelete(this,n))return te.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${_.RemoveEntity}-${this.id}`,action:_.RemoveEntity,owner:this,errorReason:tr.ActionOwnerEntityNonDeletable,rootAction:((T=n==null?void 0:n.self)==null?void 0:T.id)===this.id&&(n==null?void 0:n.autoCloseActionName)===_.RemoveEntity}),n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[],c=[],e=[],y=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:O}=v.entity.onDetachedDependencyRemoved(this,v.field,n);l.push(...E),c.push(...b),e.push(...O)}),this.defaultValue){const{updated:v,removed:E}=this.defaultValue.remove({ignoreUpstream:!0},n);l.push(...v),c.push(...E)}if(this.readsValue&&(l.push(this.readsValue),this.readsValue.removeValueReader(this,n)),this.writesValues.forEach(v=>{l.push(v),v.setValueWriter(null,n)}),this.inputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);l.push(...E),c.push(...b)}),this.outputs.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);l.push(...E),c.push(...b)}),this.successCalls.forEach(v=>{l.push(v),v.removeCaller(this,n)}),this.errorCalls.forEach(v=>{l.push(v),v.removeCaller(this,n)}),this.internalCalls.forEach(v=>{const{updated:E,removed:b}=v.remove({ignoreUpstream:!0},n);l.push(...E),c.push(...b)}),!i){const v=this.removeFromParent(n);e.push(...v.added),l.push(...v.updated),c.push(...v.removed),y.push(...v.affected),this.calledBy.forEach(E=>{l.push(E),E.removeCall(this,n)})}return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:D(e),updated:D(l),removed:D(c),affected:D(y),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RestoreEntity))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:T,removed:v,added:E}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...T),c.push(...v),n.push(...E)}),this.defaultValue){const{updated:y}=this.defaultValue.restore({},i);l.push(...y)}return this.readsValue&&(l.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.writesValues.forEach(y=>{l.push(y),y.setValueWriter(this,i)}),this.inputs.forEach(y=>{const{updated:T}=y.restore({},i);l.push(...T)}),this.outputs.forEach(y=>{const{updated:T}=y.restore({},i);l.push(...T)}),this.successCalls.forEach(y=>{l.push(y),y.addSuccessCaller(this,i)}),this.errorCalls.forEach(y=>{l.push(y),y.addErrorCaller(this,i)}),this.internalCalls.forEach(y=>{const{updated:T}=y.restore({},i);l.push(...T)}),this.calledBySuccess.forEach(y=>{l.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{l.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{l.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this}}toFlat(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this,...((l=this.defaultValue)==null?void 0:l.toFlat(i))||[],...this.writesValues.flatMap(e=>e.toFlat(i)),...((c=this.readsValue)==null?void 0:c.toFlat(i))||[],...this.successCalls.flatMap(e=>e.toFlat(i)),...this.errorCalls.flatMap(e=>e.toFlat(i)),...this.inputs.flatMap(e=>e.toFlat(i)),...this.outputs.flatMap(e=>e.toFlat(i)),...this.internalCalls.flatMap(e=>e.toFlat(i))])}toFlatIds(i=new Set){var l;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((l=this.defaultValue)==null?void 0:l.toFlatIds(i))||[],...this.writesValues.flatMap(c=>c.toFlatIds(i)),...this.successCalls.flatMap(c=>c.toFlatIds(i)),...this.errorCalls.flatMap(c=>c.toFlatIds(i)),...this.inputs.flatMap(c=>c.toFlatIds(i)),...this.outputs.flatMap(c=>c.toFlatIds(i)),...this.internalCalls.flatMap(c=>c.toFlatIds(i))])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,catchesError:this.catchesError,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,x:this.x,y:this.y,type:this.type,editable:this.editable,deletable:this.deletable}}toJSON(i=new Set){var n,l,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,declaration:this.declaration.toJSON(i),defaultValue:((n=this.defaultValue)==null?void 0:n.toJSON(i))||null,readsValue:((l=this.readsValue)==null?void 0:l.toReference())||null,writesValues:this.writesValues.map(e=>e.toJSON(i)),inputs:this.inputs.map(e=>e.toJSON(i)),outputs:this.outputs.map(e=>e.toJSON(i)),successCalls:this.successCalls.map(e=>e.toJSON(i)),errorCalls:this.errorCalls.map(e=>e.toJSON(i)),internalCalls:this.internalCalls.map(e=>e.toJSON(i)),calledBySuccess:this.calledBySuccess.map(e=>e.toReference()),calledByError:this.calledByError.map(e=>e.toReference()),calledByEntry:this.calledByEntry.map(e=>e.toReference()),parent:this.parent.toReference(),error:((c=this.error)==null?void 0:c.toJSON(i))||null,x:this.x,y:this.y})}toJSONClone(i=pt){var l,c,e,y,T,v,E,b;let n;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?n=i.seenEntityMaps.get(this.id):(n=i.newId||jr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,n)),(c=i.seenEntities)!=null&&c.has(n)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(n),(T=i.seenEntities)==null||T.add(this.id),{id:n,version:x.UUID.uuid(),createdAt:i.timestamp||M().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,defaultValue:((v=this.defaultValue)==null?void 0:v.toJSONClone({...i,newId:null}))||null,declaration:this.declaration.toReference({seenEntityMaps:i.seenEntityMaps}),readsValue:((E=this.readsValue)==null?void 0:E.toReference({seenEntityMaps:i.seenEntityMaps}))||null,writesValues:this.writesValues.map(O=>O.toJSONClone({...i,newId:null})),inputs:this.inputs.map(O=>O.toJSONClone({...i,newId:null})),outputs:this.outputs.map(O=>O.toJSONClone({...i,newId:null})),successCalls:this.successCalls.map(O=>O.toJSONClone({...i,newId:null})),errorCalls:this.errorCalls.map(O=>O.toJSONClone({...i,newId:null})),internalCalls:this.internalCalls.map(O=>this.calledBy.length||this.readsValue?O.toJSONClone({...i,newId:null}):O.toReference({seenEntityMaps:i.seenEntityMaps})),calledBySuccess:this.calledBySuccess.map(O=>O.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map(O=>O.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map(O=>O.toReference({seenEntityMaps:i.seenEntityMaps})),error:((b=this.error)==null?void 0:b.toJSONClone({...i,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps}),x:this.x,y:this.y})}toReference(i=pt){var l;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n+"--"+x.UUID.uuid()+"--ref",type:o.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(i=pt){var l,c,e,y,T;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,catchesError:this.catchesError,type:this.type,editable:this.editable,deletable:this.deletable,x:this.x,y:this.y,defaultValue:((c=this.defaultValue)==null?void 0:c.toReference(i))||null,declaration:((e=this.declaration)==null?void 0:e.toReference(i))||null,readsValue:((y=this.readsValue)==null?void 0:y.toReference(i))||null,writesValues:this.writesValues.map(v=>v.toReference(i)),inputs:this.inputs.map(v=>v.toReference(i)),outputs:this.outputs.map(v=>v.toReference(i)),successCalls:this.successCalls.map(v=>v.toReference(i)),errorCalls:this.errorCalls.map(v=>v.toReference(i)),calledBySuccess:this.calledBySuccess.map(v=>v.toReference(i)),calledByError:this.calledByError.map(v=>v.toReference(i)),calledByEntry:this.calledByEntry.map(v=>v.toReference(i)),internalCalls:this.internalCalls.map(v=>v.toReference(i)),error:((T=this.error)==null?void 0:T.toReference(i))||null,parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((l=this.defaultValue)==null?void 0:l.toFlatJSON(i))||[],...((c=this.declaration)==null?void 0:c.toFlatJSON(i))||[],...this.writesValues.flatMap(e=>e.toFlatJSON(i)),...this.successCalls.flatMap(e=>e.toFlatJSON(i)),...this.errorCalls.flatMap(e=>e.toFlatJSON(i)),...this.inputs.flatMap(e=>e.toFlatJSON(i)),...this.outputs.flatMap(e=>e.toFlatJSON(i)),...this.internalCalls.flatMap(e=>e.toFlatJSON(i)),...this.calledBy.flatMap(e=>e.toFlatJSON(i))])}toGenerationTarget(){const i=this.parent.type===o.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(n=>n.id),calledBySuccess:this.calledBySuccess.map(n=>n.id),calledByError:this.calledByError.map(n=>n.id),parent:i}}toFlatGenerationTarget(i=new Set){var l,c,e;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((l=this.defaultValue)==null?void 0:l.toFlatGenerationTarget(i))||[],...((c=this.declaration)==null?void 0:c.toFlatGenerationTarget(i))||[],...((e=this.readsValue)==null?void 0:e.toFlatGenerationTarget(i))||[],...this.writesValues.flatMap(y=>y.toFlatGenerationTarget(i)),...this.successCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.errorCalls.flatMap(y=>y.toFlatGenerationTarget(i)),...this.inputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.outputs.flatMap(y=>y.toFlatGenerationTarget(i)),...this.internalCalls.flatMap(y=>y.toFlatGenerationTarget(i))])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this.inputs.forEach(n=>n.clearErrors()),this.outputs.forEach(n=>n.clearErrors()),this.successCalls.forEach(n=>n.clearErrors()),this.errorCalls.forEach(n=>n.clearErrors()),this.internalCalls.forEach(n=>n.clearErrors()),this}validate(){const i=VBe(this);return this.errors=i,{success:!0}}getErrors(){var n,l;return[...this.errors,...((n=this.defaultValue)==null?void 0:n.getErrors())||[],...this.inputs.flatMap(c=>c.getErrors()),...this.internalCalls.flatMap(c=>c.getErrors()),...this.outputs.flatMap(c=>c.getErrors()),...((l=this.readsValue)==null?void 0:l.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.defaultValue)||null}setDefaultValue(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("set-default-value",this.id),this;const l=this.defaultValue;return(l==null?void 0:l.id)!==(i==null?void 0:i.id)&&(l==null||l.remove({ignoreUpstream:!0},n),this.defaultValue=i,n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.CloneEntity)),n=null,l=null,c=!0){var $,L,U,F;const e=Pr(n,this),y=this.toJSON(),T=l||x.UUID.uuid();y.inputs=[],y.id=T,y.version=x.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||M().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.deletable=!0,y.editable=!0;const v=Gi(y,e);n?v.setParent(n,i):v.setParent(this.parent,null),c&&v.subscribe(),v.initChildren(i),i==null||i.add(v,H.Added);const E=($=this.defaultValue)==null?void 0:$.clone(i,v,x.UUID.uuid(),c);v.defaultValue=E||null;const b=(L=this.inputs)==null?void 0:L.map(Z=>Z.clone(i,v,x.UUID.uuid(),c));v.inputs=b;const O=(U=this.outputs)==null?void 0:U.map(Z=>Z.clone(i,v,x.UUID.uuid(),c));v.outputs=O;const P=(F=this.internalCalls)==null?void 0:F.map(Z=>Z.clone(i,v,x.UUID.uuid(),c));return v.internalCalls=P,i==null||i.attemptAutoclose(_.CloneEntity,this.id),v}addInternalCall(i){return this.internalCalls.find(n=>n===i)||this.internalCalls.push(i),this}setDeclaration(i){return this.declaration!==i&&(this.declaration=i),this}removeUnrecognizedInputs(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveUnrecognizedInputs))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeUnrecognizedInputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.inputs].forEach(y=>{const T=y.remove({ignoreUpstream:!1},i);c.push(...T.removed),n.push(...T.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.inputs].forEach(y=>{var v;if(!y.declaration){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated);return}if(![...((v=this.declaration.dataType)==null?void 0:v.entity).allProperties].find(E=>y.declaration===E)){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated)}}),i==null||i.attemptAutoclose(_.RemoveUnrecognizedInputs,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}removeUnrecognizedOutputs(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-unrecognized-variable-instance-outputs"))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeUnrecognizedOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveUnrecognizedOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.declaration.dataType&&!this.declaration.dataType.isObject()?[...this.outputs].forEach(y=>{const T=y.remove({ignoreUpstream:!1},i);c.push(...T.removed),n.push(...T.updated)}):this.declaration.dataType&&this.declaration.dataType.hasStrictObjectStructure()&&[...this.outputs].forEach(y=>{var v;if(!y.declaration){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated);return}if(![...((v=this.declaration.dataType)==null?void 0:v.entity).allProperties].find(E=>y.declaration===E)){const E=y.remove({ignoreUpstream:!1},i);c.push(...E.removed),n.push(...E.updated)}}),i==null||i.attemptAutoclose("remove-unrecognized-variable-instance-outputs",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}removeUnrecognizedInternalCalls(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-unrecognized-variable-declaration-internal-calls"))){const n=[],l=[],c=[],e=[];if(!this.declaration.dataType||!this.declaration.dataType.entity||![o.DefinitionEntity,o.PrimitiveEntity,o.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))[...this.internalCalls].forEach(T=>{const v=T.remove({ignoreUpstream:!1},i);c.push(...v.removed),n.push(...v.updated)});else if(this.declaration.dataType&&this.declaration.dataType.entity&&[o.DefinitionEntity,o.PrimitiveEntity,o.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)){const T=[...this.declaration.dataType.entity.getAllInteractiveMethods()],v=[...T].filter(E=>!T.some(b=>{var O,P;return b.id!==E.id&&(((O=b.implements)==null?void 0:O.id)===E.id||((P=b.extends)==null?void 0:P.id)===E.id)})&&!E.deleted);[...this.internalCalls].forEach(E=>{if(!E.declaration){const O=E.remove({ignoreUpstream:!1},i);c.push(...O.removed),n.push(...O.updated);return}if(!v.find(O=>E.declaration===O)){const O=E.remove({ignoreUpstream:!1},i);c.push(...O.removed),n.push(...O.updated);return}})}return this.internalCalls.filter((T,v)=>{const E=this.internalCalls.findIndex(O=>O.declaration===T.declaration&&O!==T);if(E===-1)return!1;const b=this.internalCalls[E];return M(b==null?void 0:b.createdAt).isSame(M(T.createdAt))?v>E:!!M(b==null?void 0:b.createdAt).isAfter(T.createdAt)}).forEach(T=>{const v=T.remove({ignoreUpstream:!1},i);c.push(...v.removed),n.push(...v.updated)}),i==null||i.attemptAutoclose("remove-unrecognized-variable-declaration-internal-calls",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}syncInputs(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-variable-instance-inputs"))){const n=[],l=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([o.DefinitionEntity,o.PrimitiveEntity,o.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.properties];y.filter(b=>!b.getDataType(i)).forEach(b=>{const O=this.inputs.find(L=>le(L,this.project)===le(b,this.project));if(!O)return;const P=this.declaration.getMasterInputWithValueWritterFromAllInstances(O);if(!P)return;const $=bo(P);b.setDataType($,i),O.setDeclaration(b,i)}),y.filter(b=>!this.inputs.find(O=>{var P;return((P=O.declaration)==null?void 0:P.id)===b.id})).forEach(b=>{const O={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.InputMap,parentRelationType:null,parent:this.toReference(),name:null,description:null,codeName:null,declaration:b,defaultValue:null,index:b.index,readsValue:null},P=he(O,this.project);return P.setParent(this,i),P.initChildren(i),i==null||i.add(P,H.Added),this.addInput(P,i),P}),this.inputs.filter(b=>!b.declaration).forEach(b=>{const O=y.find(P=>le(P,this.project)===le(b,this.project));O&&b.setDeclaration(O,i)})}}else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("sync-variable-instance-inputs",this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this}}syncOutputs(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SyncOutputs))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[syncOutputs] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity)[o.DefinitionEntity,o.PrimitiveEntity,o.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList&&[...this.declaration.dataType.entity.properties].filter(v=>!this.outputs.find(E=>E.declaration===v)).map(v=>{const E={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.OutputMap,parent:this.toReference(),declaration:v,index:v.index,writesValues:[]},b=he(E,this.project);return b.setParent(this,i),b.initChildren(i),i==null||i.add(b,H.Added),this.addOutput(b,i),b});else return i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose(_.SyncOutputs,this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this}}generateUnusedInternalCalls(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"generate-unused-internal-calls"))){const n=[],l=[],c=[],e=[];if(this.declaration.dataType)if(this.declaration.dataType.entity){if([o.DefinitionEntity,o.PrimitiveEntity,o.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)&&!this.declaration.dataType.isList){const y=[...this.declaration.dataType.entity.getAllInteractiveMethods()];[...y].filter(E=>!y.some(b=>{var O,P;return b.id!==E.id&&(((O=b.implements)==null?void 0:O.id)===E.id||((P=b.extends)==null?void 0:P.id)===E.id)})&&!E.deleted).filter(E=>!this.internalCalls.find(O=>{var $,L,U,F,Z;return((($=O.declaration)==null?void 0:$.id)||((U=(L=O.initialData)==null?void 0:L.declaration)==null?void 0:U.entityId)||((Z=(F=O.initialData)==null?void 0:F.declaration)==null?void 0:Z.id))===E.id})).forEach(E=>{const b=this.internalCalls.find(O=>{const P=Ac(O.declaration),$=Ac(E);return P.id===$.id});if(b)b.setDeclaration(E),b.subscribeToDependencies();else{const O=E.createInternalCall(i,this);i==null||i.add(O,H.Added),this.addInternalCall(O)}})}}else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("generate-unused-internal-calls",this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this}}getDataType(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"get-data-type"))){var l;const n=((l=this.declaration)==null?void 0:l.getDataType(i))||null;return i==null||i.attemptAutoclose("get-data-type",this.id),n}getUnusedInputs(){return this.inputs.filter(i=>i.suggestion||!i.readsValue&&!i.defaultValue)}getUnusedOutputs(){return this.outputs.filter(i=>i.suggestion||!i.writesValues.length)}getUsedInputs(){return this.inputs.filter(i=>!i.suggestion&&(i.readsValue||i.defaultValue))}getUsedOutputs(){return this.outputs.filter(i=>!i.suggestion&&i.writesValues.length)}};I(di,"repository",{APICreate:async(i,...n)=>i,APIUpdate:async(i,...n)=>i,APIDelete:async(i,...n)=>i,APIClone:async(i,...n)=>{},APILoad:async(i,...n)=>null,APILoadVersion:async(i,n,...l)=>null}),I(di,"type",o.VariableInstance),I(di,"USER_MANAGED_PARENT_TYPES",[...yr,o.Project]),I(di,"PARENT_TYPES",[...di.USER_MANAGED_PARENT_TYPES]),I(di,"MUTABLE_BASE_PROPERTIES",["catchesError"]),I(di,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),I(di,"BASE_PROPERTIES",[...di.MUTABLE_BASE_PROPERTIES,...di.INMUTABLE_BASE_PROPERTIES]),I(di,"MUTABLE_META_PROPERTIES",[...di.MUTABLE_BASE_PROPERTIES,"x","y"]),I(di,"INMUTABLE_META_PROPERTIES",[...di.INMUTABLE_BASE_PROPERTIES]),I(di,"META_PROPERTIES",[...di.MUTABLE_META_PROPERTIES,...di.INMUTABLE_META_PROPERTIES]),I(di,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),I(di,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),I(di,"UPSTREAM_PROPERTIES",[...di.MUTABLE_UPSTREAM_PROPERTIES,...di.INMUTABLE_UPSTREAM_PROPERTIES]),I(di,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),I(di,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),I(di,"DOWNSTREAM_PROPERTIES",[...di.MUTABLE_DOWNSTREAM_PROPERTIES,...di.INMUTABLE_DOWNSTREAM_PROPERTIES]),I(di,"PROPERTIES",[...di.META_PROPERTIES,...di.UPSTREAM_PROPERTIES,...di.DOWNSTREAM_PROPERTIES]);let Du=di;var NBe=(d=>(d.Parent="variable-declaration-parent",d.DataTypeEntity="variable-declaration-data-type-entity",d.DataType="variable-declaration-data-type",d))(NBe||{});const ui=class ui extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"name");I(this,"codeName",null);I(this,"description",null);I(this,"required",!1);I(this,"constant",!1);I(this,"x");I(this,"y");I(this,"type",o.VariableDeclaration);I(this,"catchesError",!1);I(this,"defaultValue",null);I(this,"dataType",null);I(this,"writesValues",[]);I(this,"readsValue",null);I(this,"inputs",[]);I(this,"outputs",[]);I(this,"error",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"successCalls",[]);I(this,"errorCalls",[]);I(this,"internalCalls",[]);I(this,"parent");I(this,"errors",[]);I(this,"project");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.name=i.name,this.description=i.description,this.constant=i.constant,this.codeName=i.codeName,this.required=i.required,this.x=i.x,this.y=i.y,this.catchesError=i.catchesError||!1}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.VariableDeclaration,catchesError:!0,name:"",codeName:null,description:"",dataType:null,internalCalls:[],successCalls:[],errorCalls:[],readsValue:null,writesValues:[],defaultValue:null,constant:!1,required:!1,inputs:[],outputs:[],parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],error:null,x:0,y:0}}static fromGenerationTarget(i,n){let l=n;if(i.parent){const b=re(i.parent);l=n.get(b)}const c=i.calledByEntry.map(b=>{const O=re(b);return n.get(O)}),e=i.calledBySuccess.map(b=>{const O=re(b);return n.get(O)}),y=i.calledByError.map(b=>{const O=re(b);return n.get(O)});let T=null;if(i.readsValue){const b=re(i.readsValue);T=n.get(b)}const v={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.VariableDeclaration,catchesError:i.catchesError||!1,name:i.name,defaultValue:null,codeName:i.codeName||null,description:i.description||null,constant:i.constant||!1,required:i.required||!1,calledByEntry:c,calledBySuccess:e,calledByError:y,dataType:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:T,inputs:[],outputs:[],writesValues:[],error:null,x:0,y:0,parent:l},E=he(v,n);return E.setParent(l,null),E}static validateGenerationTarget(i,n){let l=JSON.parse(JSON.stringify(i));const c=[],e=Tn(l,{parent:{list:!1,types:[...yr,o.Project],optional:!0}},n);l=e.modifiedData;const y=Hx(l,n);return c.push(...e.errors,...y,...Nr(l)),{errors:c,modifiedData:l}}get variableInstances(){const i=[];return Object.values(this.detachedDependents).forEach(n=>{n.field===DN.VarDeclaration&&!i.includes(n.entity)&&i.push(n.entity)}),i}validateGeneratedUpdate(i){const n=[];let l=JSON.parse(JSON.stringify(i));const c=rf(l,this);return l=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${ne.InvalidParentUpdate}`,code:ne.InvalidParentUpdate,severity:pe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
@@ -159,7 +159,7 @@ You can update the existing 'literal-value' with the 'update' action, for exampl
159
159
  }
160
160
  }\`\`\`
161
161
  Or 'delete' and then 'post' actions to replace it.`})):i.push(new De({id:`${d.id}--${d.parent}--${ne.InvalidParentReference}`,code:ne.InvalidParentReference,severity:pe.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a parent reference that isn't pointing to an entity of type 'input-map' or 'data-type'.`})):i.push(new De({id:`${d.id}--${d.parent}--${ne.ReferencedEntityNotFound}`,code:ne.ReferencedEntityNotFound,severity:pe.Error,message:`Entity of type "${d.type}" with id "${d.id}", is referencing an entity with id "${d.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`}))}else i.push(new De({id:`${d.id}--${Ie.InvalidObjectStructure}`,code:Ie.InvalidObjectStructure,severity:pe.Error,message:`Entity of type "${d.type}" with id "${d.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type 'input-map' or 'data-type'.`}));else return i.push(new De({id:`${d.id}--${Ie.InvalidObjectStructure}`,code:Ie.InvalidObjectStructure,severity:pe.Error,message:`Entity of type "${d.type}" with id "${d.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type 'input-map' or 'data-type'.`})),i;if(d.valueAsTypeSingle){const c=[],e=[],y=d.valueAsTypeSingle;Array.isArray(y)?y.forEach(T=>{typeof T=="string"?e.push(T):c.push(T)}):typeof y=="string"?e.push(y):c.push(y),c.forEach(T=>{const v=D1(T);i.push(...v),v.length===0&&e.push(T.entityId)}),e.forEach(T=>{const v=p.get(T);v?[o.DefinitionEntity,o.BuiltInBaseEntity].includes(v.type)||i.push(new De({id:`${d.id}--${T}--${ne.InvalidImplementsReference}`,code:ne.InvalidImplementsReference,severity:pe.Error,message:`Entity of type "${d.type}" with id "${d.id}", has an 'valueAsTypeSingle' reference that isn't pointing to an entity of type 'definition-entity', 'function-declaration' or 'operation'.`})):i.push(new De({id:`${d.id}--${T}--${ne.ReferencedEntityNotFound}`,code:ne.ReferencedEntityNotFound,severity:pe.Error,message:`Entity of type "${d.type}" with id "${d.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.`}))})}return i}var I4e=(d=>(d.ValueAsTypeSingle="value-as-type-single",d.ValueAsTypeList="value-as-type-list",d))(I4e||{});const hi=class hi extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"type",o.LiteralValue);I(this,"id");I(this,"name");I(this,"autogeneration",null);I(this,"value",null);I(this,"valueAsTypeSingle",null);I(this,"valueAsTypeList",null);I(this,"errors",[]);I(this,"parent");I(this,"standaloneParent");I(this,"project");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"standalone",!1);if(this.initialData=i,this.project=n,this.id=i.id,this.name=i.name,this.autogeneration=i.autogeneration,this.value=i.value,!this.name)throw new Error("[LiteralValueState.constructor] Must have a name in the initial data passed to the constructor")}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.LiteralValue,standaloneParent:null,name:"",autogeneration:null,value:null,valueAsTypeSingle:null,valueAsTypeList:null,parent:null}}static fromGenerationTarget(i,n){const l=re(i.parent),c=n.get(l);let e=null,y=null;i.valueAsTypeList?Array.isArray(i.valueAsTypeList)&&(y=i.valueAsTypeList.map(E=>n.get(E)||n.getBuiltIn(E))):i.valueAsTypeSingle&&(e=n.get(i.valueAsTypeSingle)||n.getBuiltIn(i.valueAsTypeSingle));const T={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.LiteralValue,standaloneParent:null,name:i.name,autogeneration:i.autogeneration,valueAsTypeSingle:e,valueAsTypeList:y,value:i.value||null,parent:c},v=he(T,n);return v.setParent(c,null),v}static validateGenerationTarget(i,n){let l=JSON.parse(JSON.stringify(i));const c=[],e=lGi(l,n);return c.push(...e,...Nr(l)),{errors:c,modifiedData:l}}get valueAsType(){return this.valueAsTypeSingle?this.valueAsTypeSingle:this.valueAsTypeList?this.valueAsTypeList:null}get isFinal(){return!!(this.parent.type===o.Property&&(this.parent.constant||this.parent.implements.some(i=>i.constant))||this.parent.type===o.Property&&this.parent.parent.type===o.DefinitionEntity&&!af(this.parent.parent))}validateGeneratedUpdate(i){const n=[];return i.parent&&n.push(new De({id:`${this.id}--${ne.InvalidParentUpdate}`,code:ne.InvalidParentUpdate,severity:pe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
162
- This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`})),{errors:n,modifiedData:i}}subscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-dependents"))){const n=[],l=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const T=y.entity.afterAllChildrenInitialized(i);n.push(...T.updated),l.push(...T.added),c.push(...T.removed),e.push(...T.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}onDetachedDependencyRemoved(i,n,l){const c=[],e=[],y=[],T=[];return n==="value-as-type-single"&&(this.valueAsTypeSingle=null,l==null||l.add(this,H.Updated)),n==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(v=>v.id!==i.id),l==null||l.add(this,H.Updated)),{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}onDetachedDependencyRestored(i,n,l){const c=[],e=[],y=[],T=[];return n==="value-as-type-single"&&(this.valueAsTypeSingle=i,l==null||l.add(this,H.Updated)),n==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],i],l==null||l.add(this,H.Updated)),{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}unsubscribeFromDependencies(){return this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==o.BuiltInBaseEntity&&this.valueAsTypeSingle.unsubscribeDependents([{entity:this,field:"value-as-type-single"}]),this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&this.valueAsTypeList.forEach(i=>{i.type!==o.BuiltInBaseEntity&&i.unsubscribeDependents([{entity:this,field:"value-as-type-list"}])}),this}subscribeToDependencies(){return!this.valueAsTypeSingle&&!this.valueAsTypeList?this:(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.forEach(i=>{i.type!==o.BuiltInBaseEntity&&i.subscribeDependents([{entity:this,field:"value-as-type-list"}])}):this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==o.BuiltInBaseEntity&&this.valueAsTypeSingle.subscribeDependents([{entity:this,field:"value-as-type-single"}]),this)}increaseVersion(i){if(i&&!M(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&M(i).isSame(M(this.createdAt))?this:(this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=M(i).toISOString()||M().toISOString(),this)}captureVersion(){var n;const i=((n=this.knownVersions)==null?void 0:n.get(this.version))||new hi(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.valueAsTypeSingle=this.valueAsTypeSingle,i.valueAsTypeList=this.valueAsTypeList?[...this.valueAsTypeList]:this.valueAsTypeList,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const n=[],l=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);n.push(this.parent,...y.updated),l.push(...y.added),c.push(...y.removed)}return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}async restoreVersion(i){var T;const n=[],l=[],c=[],e=[];if(this.version===i)return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this};if(!this.knownVersions){const v=new Map;for(const[E,b]of this.knownVersions||new Map){if(v.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[O,P]of b.knownVersions)v.set(O,P);b.knownVersions=null}}let y=(T=this.knownVersions)==null?void 0:T.get(i);if(!y){const v=await this.APILoadVersion({},i);if(!v)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new hi(v,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.valueAsTypeSingle=y.valueAsTypeSingle,this.parent=y.parent,{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}updateWithShallowTransfer(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,n),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,i.parent&&i.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(i.parent){const l=re(i.parent),c=this.project.get(l),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(n),c)this.setParent(c,n),this.addSelfToProject(n);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else if(i.standaloneParent){const l=re(i.standaloneParent),c=this.project.get(l);if(c)this.setStandaloneParent(c,n);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${l}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.valueAsTypeList&&Array.isArray(i.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],i.valueAsTypeList.forEach(l=>{const c=re(l),e=this.project.get(c);e&&this.valueAsTypeList.push(e)});else if(i.valueAsTypeSingle){const l=re(i.valueAsTypeSingle),c=this.project.get(l);c&&(this.valueAsTypeSingle=c)}else this.valueAsTypeSingle=null,this.valueAsTypeList=null;return this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],n=[],l=[],c=[];if(this.initialData.parent&&this.initialData.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(this.initialData.parent){const e=re(this.initialData.parent),y=this.project.get(e);if(te.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating parent reference '${e}' for entity with id '${this.id}'`),y)te.Logger.log(`[LiteralValueState.hydrateAncestors] Setting parent reference '${y.id}' for entity with id '${this.id}'`),this.setParent(y,null),i.push(y);else throw te.Logger.error(`[LiteralValueState.hydrateAncestors] Parent reference '${e}' for entity with id '${this.id}' not found in the project`),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else if(this.initialData.standaloneParent){const e=re(this.initialData.standaloneParent),y=this.project.get(e);if(te.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating standalone parent reference '${e}' for entity with id '${this.id}'`),y)te.Logger.log(`[LiteralValueState.hydrateAncestors] Setting standalone parent reference '${y.id}' for entity with id '${this.id}'`),this.setStandaloneParent(y);else throw te.Logger.error(`[LiteralValueState.hydrateAncestors] Standalone parent reference '${e}' for entity with id '${this.id}' not found in the project`),new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${e}' that isn't found in the project`)}else throw te.Logger.error(`[LiteralValueState.hydrateAncestors] Entity with id '${this.id}' must have a 'parent'`),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],this.initialData.valueAsTypeList.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.valueAsTypeList.push(T)});else if(this.initialData.valueAsTypeSingle){const e=re(this.initialData.valueAsTypeSingle),y=this.project.get(e);y&&(this.valueAsTypeSingle=y)}return{updated:D(i),added:D(n),removed:D(l),affected:D(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.initialized=!0,this.captureVersion(),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-self-to-project"))){var y,T;const n=[this],l=[],c=[],e=[];return((y=this.parent)==null?void 0:y.type)===o.DataType?this.parent.setEntity(this,i):(T=this.parent)==null||T.setDefaultValue(this,i),e.push(this.parent),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}setParent(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetParent,n)?(((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetParent,this.id),this):this}setStandaloneParent(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetStandaloneParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetStandaloneParent,n)?(((l=this.standaloneParent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.standaloneParent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetStandaloneParent,this.id),this):this}setValueAsTypeSingle(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetValueAsTypeSingle))){return this.checkCanEdit(this,n)?(this.valueAsTypeSingle!==i&&(this.valueAsTypeSingle=i,n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose(_.SetValueAsTypeSingle,this.id),this):(te.Logger.warn(`[setValueAsTypeSingle] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetValueAsTypeSingle,this.id),this)}setValueAsTypeList(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetValueAsTypeList))){var l,c;return this.checkCanEdit(this,n)?(!i&&this.valueAsTypeList?(this.valueAsTypeList=null,n==null||n.add(this,H.Updated)):i&&!this.valueAsTypeList?(this.valueAsTypeList=i,n==null||n.add(this,H.Updated)):i&&this.valueAsTypeList&&((l=this.valueAsTypeList)==null?void 0:l.length)!==i.length?(this.valueAsTypeList=i,n==null||n.add(this,H.Updated)):i&&this.valueAsTypeList&&((c=this.valueAsTypeList)!=null&&c.every((e,y)=>e!==i[y]))&&(this.valueAsTypeList=i,n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose(_.SetValueAsTypeList,this.id),this):(te.Logger.warn(`[setValueAsTypeList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetValueAsTypeList,this.id),this)}setValueAsType(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetValueAsType))){return this.checkCanEdit(this,n)?i?(Array.isArray(i)?this.setValueAsTypeList(i,n):this.setValueAsTypeSingle(i,n),n==null||n.attemptAutoclose(_.SetValueAsType,this.id),this):(this.setValueAsTypeSingle(null,n),this.setValueAsTypeList(null,n),this):(te.Logger.warn(`[setValueAsType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetValueAsType,this.id),this)}initChildren(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.standalone){if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(n=>{if(n.type===o.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(n);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.entityType}' with id '${n.entityId}' that is not part of the project state.`);return c}const l=this.project.get(n.id);if(!l)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.type}' with id '${n.id}' that is not part of the project state.`);return l});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===o.GenericReference){const l=this.project.findSubscribedBuiltInInstanceFromReference(this.initialData.valueAsTypeSingle);if(!l)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=l,this}const n=this.project.get(this.initialData.valueAsTypeSingle.id);if(!n)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=n}return this}if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(n=>{if(n.type===o.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(n);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.entityType}' with id '${n.entityId}' that is not part of the project state.`);return c}const l=this.project.get(n.id);if(!l)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.type}' with id '${n.id}' that is not part of the project state.`);return l});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===o.GenericReference){const l=re(this.initialData.valueAsTypeSingle),c=l?this.project.get(l):null;if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=c,this}const n=this.project.get(this.initialData.valueAsTypeSingle.id);if(!n)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=n}return this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"meta-sync"))){const l=$r(this,i,n),c=xr(this,l),e=this.toMeta();return this.name=l.name!==void 0?l.name:e.name,this.autogeneration=l.autogeneration!==void 0?l.autogeneration:e.autogeneration,this.value=l.value!==void 0?l.value:e.value,super.baseMetaSync(l,this,n),l.deleted===!0&&!e.deleted?n==null||n.add(this,H.Removed):l.deleted===!1&&e.deleted?n==null||n.add(this,H.Added):c&&(n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ge,...n){return await hi.repository.APILoad(this.id,...n),this}async APICreate(i=Ge,...n){return await hi.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(i=Ge,...n){return await hi.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(i=Ge,...n){return await hi.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(i=Ge,...n){return await hi.repository.APIClone(this.id,...n),this}async APILoadVersion(i=Ge,n,...l){return await hi.repository.APILoadVersion(this.id,n,...l)}removeFromParent(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveFromParent))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.parent&&(this.parent.type===o.DataType?this.parent.setEntity(null,i):RA.includes(this.parent.type)&&this.parent.setDefaultValue(null,i),e.push(this.parent)),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:D(c),updated:D(n),removed:D(l),affected:D(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveEntity))){var T;if(!this.checkCanDelete(this,n))return te.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${_.RemoveEntity}-${this.id}`,action:_.RemoveEntity,owner:this,errorReason:tr.ActionOwnerEntityNonDeletable,rootAction:((T=n==null?void 0:n.self)==null?void 0:T.id)===this.id&&(n==null?void 0:n.autoCloseActionName)===_.RemoveEntity}),n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[],c=[],e=[],y=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:O}=v.entity.onDetachedDependencyRemoved(this,v.field,n);l.push(...E),c.push(...b),e.push(...O)}),!i){const v=this.removeFromParent(n);e.push(...v.added),l.push(...v.updated),c.push(...v.removed),y.push(...v.affected)}return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:D(e),updated:D(l),removed:D(c),affected:D(y),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RestoreEntity))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:T,removed:v,added:E}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...T),c.push(...v),n.push(...E)}),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlat(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(l=>l.toFlat(i)):[]])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatIds(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(l=>l.toFlatIds(i)):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,value:this.value,autogeneration:this.autogeneration,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var n,l,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:((n=this.valueAsTypeSingle)==null?void 0:n.toJSON(i))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(e=>e.toJSON(i)):null,parent:(l=this.parent)==null?void 0:l.toReference(),standaloneParent:(c=this.standaloneParent)==null?void 0:c.toReference()})}toJSONClone(i=pt){var l,c,e,y,T,v,E;let n;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?n=i.seenEntityMaps.get(this.id):(n=i.newId||jr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,n)),(c=i.seenEntities)!=null&&c.has(n)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(n),(T=i.seenEntities)==null||T.add(this.id),{id:n,version:x.UUID.uuid(),createdAt:i.timestamp||M().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:this.valueAsTypeSingle?this.project.getBuiltIn(this.valueAsTypeSingle.id)?this.valueAsTypeSingle.toJSON():this.valueAsTypeSingle.toJSONClone({...i,newId:null}):null,valueAsTypeList:this.valueAsTypeSingle&&Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(b=>this.project.getBuiltIn(b.id)?b.toJSON(i.seenEntities):b.toJSONClone({...i,newId:null})):null,parent:(v=this.parent)==null?void 0:v.toReference({seenEntityMaps:i.seenEntityMaps}),standaloneParent:(E=this.standaloneParent)==null?void 0:E.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=pt){var l;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n+"--"+x.UUID.uuid()+"--ref",type:o.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(i=pt){var l,c,e,y;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,valueAsTypeSingle:((c=this.valueAsTypeSingle)==null?void 0:c.toReference(i))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(T=>T.toReference(i)):null,value:this.value,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.toReference(i),standaloneParent:(y=this.standaloneParent)==null?void 0:y.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatJSON(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(l=>l.toFlatJSON(i)):[]])}toGenerationTarget(){var i,n,l;return{id:this.id,type:this.type,name:this.name,valueAsTypeSingle:((i=this.valueAsTypeSingle)==null?void 0:i.id)||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(c=>c.id):null,value:this.value,autogeneration:this.autogeneration,parent:(n=this.parent)==null?void 0:n.id,standaloneParent:(l=this.standaloneParent)==null?void 0:l.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatGenerationTarget(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(l=>l.toFlatGenerationTarget(i)):[]])}clearErrors(){return this.errors=[],this}validate(){const i=g4e(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.CloneEntity)),n=null,l=null,c=!0){const e=Pr(n,this),y=this.toJSON(),T=l||x.UUID.uuid();y.id=T,y.version=x.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||M().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.editable=!0,y.deletable=!0;const v=Gi(y,e);return v.hydrateAncestors(),n&&v.setParent(n,i),c&&(v.subscribe(),v.addSelfToProject(i)),i==null||i.add(v,H.Added),v.initChildren(i),i==null||i.attemptAutoclose(_.CloneEntity,this.id),v}merge(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"merge-literal-value"))){const l=[],c=[],e=[],y=[];return this.valueAsTypeSingle!==(i==null?void 0:i.valueAsTypeSingle)&&(this.setValueAsType(i.valueAsTypeSingle,n),l.push(this)),this.value!==i.value&&(this.metaSync({value:i.value},n),l.push(this)),this.autogeneration!==i.autogeneration&&(this.metaSync({autogeneration:i.autogeneration},n),l.push(this)),this.name!==i.name&&(this.metaSync({name:i.name},n),l.push(this)),n==null||n.attemptAutoclose("merge-literal-value",this.id),{updated:D(l),added:D(c),removed:D(e),affected:D(y),self:this}}};I(hi,"repository",{APICreate:async(i,...n)=>i,APIUpdate:async(i,...n)=>i,APIDelete:async(i,...n)=>i,APIClone:async(i,...n)=>{},APILoad:async(i,...n)=>null,APILoadVersion:async(i,n,...l)=>null}),I(hi,"type",o.LiteralValue),I(hi,"USER_MANAGED_PARENT_TYPES",[o.DataType,o.InputMap,o.Property,o.ArgumentDeclaration,o.ReturnStatement,o.BreakStatement,o.ContinueStatement,o.VariableDeclaration,o.VariableInstance,o.ValueDescriptor,o.OutputMap]),I(hi,"PARENT_TYPES",[...hi.USER_MANAGED_PARENT_TYPES]),I(hi,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value"]),I(hi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),I(hi,"BASE_PROPERTIES",[...hi.MUTABLE_BASE_PROPERTIES,...hi.INMUTABLE_BASE_PROPERTIES]),I(hi,"MUTABLE_META_PROPERTIES",[...hi.MUTABLE_BASE_PROPERTIES]),I(hi,"INMUTABLE_META_PROPERTIES",[...hi.INMUTABLE_BASE_PROPERTIES]),I(hi,"META_PROPERTIES",[...hi.MUTABLE_META_PROPERTIES,...hi.INMUTABLE_META_PROPERTIES]),I(hi,"MUTABLE_UPSTREAM_PROPERTIES",[]),I(hi,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),I(hi,"UPSTREAM_PROPERTIES",[...hi.MUTABLE_UPSTREAM_PROPERTIES,...hi.INMUTABLE_UPSTREAM_PROPERTIES]),I(hi,"MUTABLE_DOWNSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),I(hi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),I(hi,"DOWNSTREAM_PROPERTIES",[...hi.MUTABLE_DOWNSTREAM_PROPERTIES,...hi.INMUTABLE_DOWNSTREAM_PROPERTIES]),I(hi,"PROPERTIES",[...hi.META_PROPERTIES,...hi.UPSTREAM_PROPERTIES,...hi.DOWNSTREAM_PROPERTIES]);let Jr=hi;function R4e(d){var i;d.outputs.forEach(n=>n.validate()),(i=d.throws)==null||i.validate();const p=[];return rr(d.errors,p)}const oGi=Object.freeze(Object.defineProperty({__proto__:null,validate:R4e},Symbol.toStringTag,{value:"Module"}));var D4e=(d=>(d.Parent="break-statement-parent-field",d.DataTypeEntity="break-statement-data-type-entity-field",d.DataType="break-statement-data-type-field",d.ParentDataType="break-statement-parent-data-type-field",d.ParentDataTypeEntity="break-statement-parent-data-type-entity-field",d))(D4e||{});const Ii=class Ii extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"x");I(this,"y");I(this,"type",o.BreakStatement);I(this,"outputs",[]);I(this,"readsValue",null);I(this,"dataType",null);I(this,"defaultValue",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"throws",null);I(this,"project");I(this,"errors",[]);I(this,"parent");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.x=i.x,this.y=i.y}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.BreakStatement,outputs:[],defaultValue:null,dataType:null,readsValue:null,calledBySuccess:[],calledByError:[],calledByEntry:[],throws:null,parent:null,x:0,y:0}}static fromGenerationTarget(i,n){const l=re(i.parent),c=n.get(l),e=i.calledByEntry.map(O=>{const P=re(O);return n.get(P)}),y=i.calledBySuccess.map(O=>{const P=re(O);return n.get(P)}),T=i.calledByError.map(O=>{const P=re(O);return n.get(P)});let v=null;if(i.readsValue){const O=re(i.readsValue);v=n.get(O)}const E={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.BreakStatement,x:0,y:0,outputs:[],defaultValue:null,dataType:null,readsValue:v,calledBySuccess:y,calledByError:T,calledByEntry:e,throws:null,parent:c},b=he(E,n);return b.setParent(c,null),b}static validateGenerationTarget(i,n){let l=JSON.parse(JSON.stringify(i));const c=[],e=Tn(l,{parent:{list:!1,types:[o.Loop]}},n);return l=e.modifiedData,c.push(...e.errors,...Nr(l)),{errors:c,modifiedData:l}}get codeNativeValueValidation(){return this._codeNativeValueValidation||null}validateGeneratedUpdate(i){const n=[];let l=JSON.parse(JSON.stringify(i));const c=rf(l,this);return l=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${ne.InvalidParentUpdate}`,code:ne.InvalidParentUpdate,severity:pe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
162
+ This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`})),{errors:n,modifiedData:i}}subscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-dependents"))){const n=[],l=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const T=y.entity.afterAllChildrenInitialized(i);n.push(...T.updated),l.push(...T.added),c.push(...T.removed),e.push(...T.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}onDetachedDependencyRemoved(i,n,l){const c=[],e=[],y=[],T=[];return n==="value-as-type-single"&&(this.valueAsTypeSingle=null,l==null||l.add(this,H.Updated)),n==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(v=>v.id!==i.id),l==null||l.add(this,H.Updated)),{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}onDetachedDependencyRestored(i,n,l){const c=[],e=[],y=[],T=[];return n==="value-as-type-single"&&(this.valueAsTypeSingle=i,l==null||l.add(this,H.Updated)),n==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],i],l==null||l.add(this,H.Updated)),{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}unsubscribeFromDependencies(){return this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==o.BuiltInBaseEntity&&this.valueAsTypeSingle.unsubscribeDependents([{entity:this,field:"value-as-type-single"}]),this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)&&this.valueAsTypeList.forEach(i=>{i.type!==o.BuiltInBaseEntity&&i.unsubscribeDependents([{entity:this,field:"value-as-type-list"}])}),this}subscribeToDependencies(){return!this.valueAsTypeSingle&&!this.valueAsTypeList?this:(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.forEach(i=>{i.type!==o.BuiltInBaseEntity&&i.subscribeDependents([{entity:this,field:"value-as-type-list"}])}):this.valueAsTypeSingle&&this.valueAsTypeSingle.type!==o.BuiltInBaseEntity&&this.valueAsTypeSingle.subscribeDependents([{entity:this,field:"value-as-type-single"}]),this)}increaseVersion(i){if(i&&!M(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&M(i).isSame(M(this.createdAt))?this:(this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=M(i).toISOString()||M().toISOString(),this)}captureVersion(){var n;const i=((n=this.knownVersions)==null?void 0:n.get(this.version))||new hi(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.valueAsTypeSingle=this.valueAsTypeSingle,i.valueAsTypeList=this.valueAsTypeList?[...this.valueAsTypeList]:this.valueAsTypeList,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const n=[],l=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);n.push(this.parent,...y.updated),l.push(...y.added),c.push(...y.removed)}return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}async restoreVersion(i){var T;const n=[],l=[],c=[],e=[];if(this.version===i)return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this};if(!this.knownVersions){const v=new Map;for(const[E,b]of this.knownVersions||new Map){if(v.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[O,P]of b.knownVersions)v.set(O,P);b.knownVersions=null}}let y=(T=this.knownVersions)==null?void 0:T.get(i);if(!y){const v=await this.APILoadVersion({},i);if(!v)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new hi(v,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.valueAsTypeSingle=y.valueAsTypeSingle,this.parent=y.parent,{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}updateWithShallowTransfer(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,n),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,i.parent&&i.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(i.parent){const l=re(i.parent),c=this.project.get(l),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(n),c)this.setParent(c,n),this.addSelfToProject(n);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else if(i.standaloneParent){const l=re(i.standaloneParent),c=this.project.get(l);if(c)this.setStandaloneParent(c,n);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${l}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.valueAsTypeList&&Array.isArray(i.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],i.valueAsTypeList.forEach(l=>{const c=re(l),e=this.project.get(c);e&&this.valueAsTypeList.push(e)});else if(i.valueAsTypeSingle){const l=re(i.valueAsTypeSingle),c=this.project.get(l);c&&(this.valueAsTypeSingle=c)}else this.valueAsTypeSingle=null,this.valueAsTypeList=null;return this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],n=[],l=[],c=[];if(this.initialData.parent&&this.initialData.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(this.initialData.parent){const e=re(this.initialData.parent),y=this.project.get(e);if(te.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating parent reference '${e}' for entity with id '${this.id}'`),y)te.Logger.log(`[LiteralValueState.hydrateAncestors] Setting parent reference '${y.id}' for entity with id '${this.id}'`),this.setParent(y,null),i.push(y);else throw te.Logger.error(`[LiteralValueState.hydrateAncestors] Parent reference '${e}' for entity with id '${this.id}' not found in the project`),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else if(this.initialData.standaloneParent){const e=re(this.initialData.standaloneParent),y=this.project.get(e);if(te.Logger.log(`[LiteralValueState.hydrateAncestors] Hydrating standalone parent reference '${e}' for entity with id '${this.id}'`),y)te.Logger.log(`[LiteralValueState.hydrateAncestors] Setting standalone parent reference '${y.id}' for entity with id '${this.id}'`),this.setStandaloneParent(y,null);else throw te.Logger.error(`[LiteralValueState.hydrateAncestors] Standalone parent reference '${e}' for entity with id '${this.id}' not found in the project`),new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${e}' that isn't found in the project`)}else throw te.Logger.error(`[LiteralValueState.hydrateAncestors] Entity with id '${this.id}' must have a 'parent'`),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],this.initialData.valueAsTypeList.forEach(e=>{const y=re(e),T=this.project.get(y);T&&this.valueAsTypeList.push(T)});else if(this.initialData.valueAsTypeSingle){const e=re(this.initialData.valueAsTypeSingle),y=this.project.get(e);y&&(this.valueAsTypeSingle=y)}return{updated:D(i),added:D(n),removed:D(l),affected:D(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.initialized=!0,this.captureVersion(),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-self-to-project"))){var y,T;const n=[this],l=[],c=[],e=[];return((y=this.parent)==null?void 0:y.type)===o.DataType?this.parent.setEntity(this,i):(T=this.parent)==null||T.setDefaultValue(this,i),e.push(this.parent),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}setParent(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetParent,n)?(((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetParent,this.id),this):this}setStandaloneParent(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetStandaloneParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetStandaloneParent,n)?(((l=this.standaloneParent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.standaloneParent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetStandaloneParent,this.id),this):this}setValueAsTypeSingle(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetValueAsTypeSingle))){return this.checkCanEdit(this,n)?(this.valueAsTypeSingle!==i&&(this.valueAsTypeSingle=i,n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose(_.SetValueAsTypeSingle,this.id),this):(te.Logger.warn(`[setValueAsTypeSingle] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetValueAsTypeSingle,this.id),this)}setValueAsTypeList(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetValueAsTypeList))){var l,c;return this.checkCanEdit(this,n)?(!i&&this.valueAsTypeList?(this.valueAsTypeList=null,n==null||n.add(this,H.Updated)):i&&!this.valueAsTypeList?(this.valueAsTypeList=i,n==null||n.add(this,H.Updated)):i&&this.valueAsTypeList&&((l=this.valueAsTypeList)==null?void 0:l.length)!==i.length?(this.valueAsTypeList=i,n==null||n.add(this,H.Updated)):i&&this.valueAsTypeList&&((c=this.valueAsTypeList)!=null&&c.every((e,y)=>e!==i[y]))&&(this.valueAsTypeList=i,n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose(_.SetValueAsTypeList,this.id),this):(te.Logger.warn(`[setValueAsTypeList] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetValueAsTypeList,this.id),this)}setValueAsType(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetValueAsType))){return this.checkCanEdit(this,n)?i?(Array.isArray(i)?this.setValueAsTypeList(i,n):this.setValueAsTypeSingle(i,n),n==null||n.attemptAutoclose(_.SetValueAsType,this.id),this):(this.setValueAsTypeSingle(null,n),this.setValueAsTypeList(null,n),this):(te.Logger.warn(`[setValueAsType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetValueAsType,this.id),this)}initChildren(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.standalone){if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(n=>{if(n.type===o.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(n);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.entityType}' with id '${n.entityId}' that is not part of the project state.`);return c}const l=this.project.get(n.id);if(!l)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.type}' with id '${n.id}' that is not part of the project state.`);return l});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===o.GenericReference){const l=this.project.findSubscribedBuiltInInstanceFromReference(this.initialData.valueAsTypeSingle);if(!l)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=l,this}const n=this.project.get(this.initialData.valueAsTypeSingle.id);if(!n)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=n}return this}if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(n=>{if(n.type===o.GenericReference){const c=this.project.findSubscribedBuiltInInstanceFromReference(n);if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.entityType}' with id '${n.entityId}' that is not part of the project state.`);return c}const l=this.project.get(n.id);if(!l)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${n.type}' with id '${n.id}' that is not part of the project state.`);return l});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===o.GenericReference){const l=re(this.initialData.valueAsTypeSingle),c=l?this.project.get(l):null;if(!c)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=c,this}const n=this.project.get(this.initialData.valueAsTypeSingle.id);if(!n)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=n}return this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"meta-sync"))){const l=$r(this,i,n),c=xr(this,l),e=this.toMeta();return this.name=l.name!==void 0?l.name:e.name,this.autogeneration=l.autogeneration!==void 0?l.autogeneration:e.autogeneration,this.value=l.value!==void 0?l.value:e.value,super.baseMetaSync(l,this,n),l.deleted===!0&&!e.deleted?n==null||n.add(this,H.Removed):l.deleted===!1&&e.deleted?n==null||n.add(this,H.Added):c&&(n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ge,...n){return await hi.repository.APILoad(this.id,...n),this}async APICreate(i=Ge,...n){return await hi.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(i=Ge,...n){return await hi.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(i=Ge,...n){return await hi.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(i=Ge,...n){return await hi.repository.APIClone(this.id,...n),this}async APILoadVersion(i=Ge,n,...l){return await hi.repository.APILoadVersion(this.id,n,...l)}removeFromParent(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveFromParent))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.parent&&(this.parent.type===o.DataType?this.parent.setEntity(null,i):RA.includes(this.parent.type)&&this.parent.setDefaultValue(null,i),e.push(this.parent)),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:D(c),updated:D(n),removed:D(l),affected:D(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveEntity))){var T;if(!this.checkCanDelete(this,n))return te.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${_.RemoveEntity}-${this.id}`,action:_.RemoveEntity,owner:this,errorReason:tr.ActionOwnerEntityNonDeletable,rootAction:((T=n==null?void 0:n.self)==null?void 0:T.id)===this.id&&(n==null?void 0:n.autoCloseActionName)===_.RemoveEntity}),n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[],c=[],e=[],y=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:b,added:O}=v.entity.onDetachedDependencyRemoved(this,v.field,n);l.push(...E),c.push(...b),e.push(...O)}),!i){const v=this.removeFromParent(n);e.push(...v.added),l.push(...v.updated),c.push(...v.removed),y.push(...v.affected)}return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:D(e),updated:D(l),removed:D(c),affected:D(y),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RestoreEntity))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return i!=null&&i.hasAdded(this.id)?(i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:T,removed:v,added:E}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...T),c.push(...v),n.push(...E)}),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this})}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlat(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(l=>l.toFlat(i)):[]])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatIds(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(l=>l.toFlatIds(i)):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,value:this.value,autogeneration:this.autogeneration,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name}}toJSON(i=new Set){var n,l,c;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:((n=this.valueAsTypeSingle)==null?void 0:n.toJSON(i))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(e=>e.toJSON(i)):null,parent:(l=this.parent)==null?void 0:l.toReference(),standaloneParent:(c=this.standaloneParent)==null?void 0:c.toReference()})}toJSONClone(i=pt){var l,c,e,y,T,v,E;let n;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?n=i.seenEntityMaps.get(this.id):(n=i.newId||jr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,n)),(c=i.seenEntities)!=null&&c.has(n)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(n),(T=i.seenEntities)==null||T.add(this.id),{id:n,version:x.UUID.uuid(),createdAt:i.timestamp||M().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:this.valueAsTypeSingle?this.project.getBuiltIn(this.valueAsTypeSingle.id)?this.valueAsTypeSingle.toJSON():this.valueAsTypeSingle.toJSONClone({...i,newId:null}):null,valueAsTypeList:this.valueAsTypeSingle&&Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(b=>this.project.getBuiltIn(b.id)?b.toJSON(i.seenEntities):b.toJSONClone({...i,newId:null})):null,parent:(v=this.parent)==null?void 0:v.toReference({seenEntityMaps:i.seenEntityMaps}),standaloneParent:(E=this.standaloneParent)==null?void 0:E.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=pt){var l;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n+"--"+x.UUID.uuid()+"--ref",type:o.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(i=pt){var l,c,e,y;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,name:this.name,valueAsTypeSingle:((c=this.valueAsTypeSingle)==null?void 0:c.toReference(i))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(T=>T.toReference(i)):null,value:this.value,autogeneration:this.autogeneration,parent:(e=this.parent)==null?void 0:e.toReference(i),standaloneParent:(y=this.standaloneParent)==null?void 0:y.toReference(i)}}toFlatJSON(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatJSON(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(l=>l.toFlatJSON(i)):[]])}toGenerationTarget(){var i,n,l;return{id:this.id,type:this.type,name:this.name,valueAsTypeSingle:((i=this.valueAsTypeSingle)==null?void 0:i.id)||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(c=>c.id):null,value:this.value,autogeneration:this.autogeneration,parent:(n=this.parent)==null?void 0:n.id,standaloneParent:(l=this.standaloneParent)==null?void 0:l.id}}toFlatGenerationTarget(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatGenerationTarget(i):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(l=>l.toFlatGenerationTarget(i)):[]])}clearErrors(){return this.errors=[],this}validate(){const i=g4e(this);return this.errors=i,{success:!0}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.CloneEntity)),n=null,l=null,c=!0){const e=Pr(n,this),y=this.toJSON(),T=l||x.UUID.uuid();y.id=T,y.version=x.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||M().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.editable=!0,y.deletable=!0;const v=Gi(y,e);return v.hydrateAncestors(),n&&v.setParent(n,i),c&&(v.subscribe(),v.addSelfToProject(i)),i==null||i.add(v,H.Added),v.initChildren(i),i==null||i.attemptAutoclose(_.CloneEntity,this.id),v}merge(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"merge-literal-value"))){const l=[],c=[],e=[],y=[];return this.valueAsTypeSingle!==(i==null?void 0:i.valueAsTypeSingle)&&(this.setValueAsType(i.valueAsTypeSingle,n),l.push(this)),this.value!==i.value&&(this.metaSync({value:i.value},n),l.push(this)),this.autogeneration!==i.autogeneration&&(this.metaSync({autogeneration:i.autogeneration},n),l.push(this)),this.name!==i.name&&(this.metaSync({name:i.name},n),l.push(this)),n==null||n.attemptAutoclose("merge-literal-value",this.id),{updated:D(l),added:D(c),removed:D(e),affected:D(y),self:this}}};I(hi,"repository",{APICreate:async(i,...n)=>i,APIUpdate:async(i,...n)=>i,APIDelete:async(i,...n)=>i,APIClone:async(i,...n)=>{},APILoad:async(i,...n)=>null,APILoadVersion:async(i,n,...l)=>null}),I(hi,"type",o.LiteralValue),I(hi,"USER_MANAGED_PARENT_TYPES",[o.DataType,o.InputMap,o.Property,o.ArgumentDeclaration,o.ReturnStatement,o.BreakStatement,o.ContinueStatement,o.VariableDeclaration,o.VariableInstance,o.ValueDescriptor,o.OutputMap]),I(hi,"PARENT_TYPES",[...hi.USER_MANAGED_PARENT_TYPES]),I(hi,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value"]),I(hi,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),I(hi,"BASE_PROPERTIES",[...hi.MUTABLE_BASE_PROPERTIES,...hi.INMUTABLE_BASE_PROPERTIES]),I(hi,"MUTABLE_META_PROPERTIES",[...hi.MUTABLE_BASE_PROPERTIES]),I(hi,"INMUTABLE_META_PROPERTIES",[...hi.INMUTABLE_BASE_PROPERTIES]),I(hi,"META_PROPERTIES",[...hi.MUTABLE_META_PROPERTIES,...hi.INMUTABLE_META_PROPERTIES]),I(hi,"MUTABLE_UPSTREAM_PROPERTIES",[]),I(hi,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),I(hi,"UPSTREAM_PROPERTIES",[...hi.MUTABLE_UPSTREAM_PROPERTIES,...hi.INMUTABLE_UPSTREAM_PROPERTIES]),I(hi,"MUTABLE_DOWNSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),I(hi,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),I(hi,"DOWNSTREAM_PROPERTIES",[...hi.MUTABLE_DOWNSTREAM_PROPERTIES,...hi.INMUTABLE_DOWNSTREAM_PROPERTIES]),I(hi,"PROPERTIES",[...hi.META_PROPERTIES,...hi.UPSTREAM_PROPERTIES,...hi.DOWNSTREAM_PROPERTIES]);let Jr=hi;function R4e(d){var i;d.outputs.forEach(n=>n.validate()),(i=d.throws)==null||i.validate();const p=[];return rr(d.errors,p)}const oGi=Object.freeze(Object.defineProperty({__proto__:null,validate:R4e},Symbol.toStringTag,{value:"Module"}));var D4e=(d=>(d.Parent="break-statement-parent-field",d.DataTypeEntity="break-statement-data-type-entity-field",d.DataType="break-statement-data-type-field",d.ParentDataType="break-statement-parent-data-type-field",d.ParentDataTypeEntity="break-statement-parent-data-type-entity-field",d))(D4e||{});const Ii=class Ii extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"x");I(this,"y");I(this,"type",o.BreakStatement);I(this,"outputs",[]);I(this,"readsValue",null);I(this,"dataType",null);I(this,"defaultValue",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"throws",null);I(this,"project");I(this,"errors",[]);I(this,"parent");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.x=i.x,this.y=i.y}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.BreakStatement,outputs:[],defaultValue:null,dataType:null,readsValue:null,calledBySuccess:[],calledByError:[],calledByEntry:[],throws:null,parent:null,x:0,y:0}}static fromGenerationTarget(i,n){const l=re(i.parent),c=n.get(l),e=i.calledByEntry.map(O=>{const P=re(O);return n.get(P)}),y=i.calledBySuccess.map(O=>{const P=re(O);return n.get(P)}),T=i.calledByError.map(O=>{const P=re(O);return n.get(P)});let v=null;if(i.readsValue){const O=re(i.readsValue);v=n.get(O)}const E={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.BreakStatement,x:0,y:0,outputs:[],defaultValue:null,dataType:null,readsValue:v,calledBySuccess:y,calledByError:T,calledByEntry:e,throws:null,parent:c},b=he(E,n);return b.setParent(c,null),b}static validateGenerationTarget(i,n){let l=JSON.parse(JSON.stringify(i));const c=[],e=Tn(l,{parent:{list:!1,types:[o.Loop]}},n);return l=e.modifiedData,c.push(...e.errors,...Nr(l)),{errors:c,modifiedData:l}}get codeNativeValueValidation(){return this._codeNativeValueValidation||null}validateGeneratedUpdate(i){const n=[];let l=JSON.parse(JSON.stringify(i));const c=rf(l,this);return l=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${ne.InvalidParentUpdate}`,code:ne.InvalidParentUpdate,severity:pe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
163
163
  If an entity is called by another, they must be in the same scope, which means they have the same parent.
164
164
  You shouldn't have to manually update a 'parent' property.
165
165
  Specifically for break statements the parent needs to always be the 'loop' entity that contains it.`})),{errors:n,modifiedData:i}}subscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]||(this.detachedDependents[n.entity.id]=n)}),this}unsubscribeDependents(i){return i.forEach(n=>{this.detachedDependents[n.entity.id]&&delete this.detachedDependents[n.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-dependents"))){const n=[],l=[],c=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const T=y.entity.afterAllChildrenInitialized(i);n.push(...T.updated),l.push(...T.added),c.push(...T.removed),e.push(...T.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}onDetachedDependencyRemoved(i,n,l){const c=[],e=[],y=[],T=[];if(n==="break-statement-parent-field"){const{updated:v,added:E,removed:b}=this.remove({ignoreUpstream:!1},l);c.push(...v),e.push(...E),y.push(...b)}if(n==="break-statement-parent-data-type-field"){const{updated:v,added:E,removed:b}=this.afterAllChildrenInitialized(l);c.push(...v),e.push(...E),y.push(...b)}if(n==="break-statement-parent-data-type-entity-field"){const{updated:v,added:E,removed:b}=this.afterAllChildrenInitialized(l);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}onDetachedDependencyRestored(i,n,l){const c=[],e=[],y=[],T=[];if(n==="break-statement-parent-field"){const{updated:v,added:E,removed:b}=this.restore({},l);c.push(...v),e.push(...E),y.push(...b)}if(n==="break-statement-parent-data-type-field"){const{updated:v,added:E,removed:b}=this.afterAllChildrenInitialized(l);c.push(...v),e.push(...E),y.push(...b)}if(n==="break-statement-parent-data-type-entity-field"){const{updated:v,added:E,removed:b}=this.afterAllChildrenInitialized(l);c.push(...v),e.push(...E),y.push(...b)}return{updated:D(c),added:D(e),removed:D(y),affected:D(T),self:this}}unsubscribeFromDependencies(){var i,n,l,c,e,y,T,v,E,b,O,P;return this.parent.unsubscribeDependents([{entity:this,field:"break-statement-parent-field"}]),(l=(n=(i=this.dataType)==null?void 0:i.entity)==null?void 0:n.unsubscribeDependents)==null||l.call(n,[{entity:this,field:"break-statement-data-type-entity-field"}]),(e=(c=this.dataType)==null?void 0:c.unsubscribeDependents)==null||e.call(c,[{entity:this,field:"break-statement-data-type-field"}]),(E=(v=(T=(y=this.parent)==null?void 0:y.dataType)==null?void 0:T.entity)==null?void 0:v.unsubscribeDependents)==null||E.call(v,[{entity:this,field:"break-statement-parent-data-type-entity-field"}]),(P=(O=(b=this.parent)==null?void 0:b.dataType)==null?void 0:O.unsubscribeDependents)==null||P.call(O,[{entity:this,field:"break-statement-parent-data-type-field"}]),this}subscribeToDependencies(){var i,n,l,c,e,y,T,v,E,b,O,P,$;return(i=this.parent)==null||i.subscribeDependents([{entity:this,field:"break-statement-parent-field"}]),(c=(l=(n=this.dataType)==null?void 0:n.entity)==null?void 0:l.subscribeDependents)==null||c.call(l,[{entity:this,field:"break-statement-data-type-entity-field"}]),(y=(e=this.dataType)==null?void 0:e.subscribeDependents)==null||y.call(e,[{entity:this,field:"break-statement-data-type-field"}]),(b=(E=(v=(T=this.parent)==null?void 0:T.dataType)==null?void 0:v.entity)==null?void 0:E.subscribeDependents)==null||b.call(E,[{entity:this,field:"break-statement-parent-data-type-entity-field"}]),($=(P=(O=this.parent)==null?void 0:O.dataType)==null?void 0:P.subscribeDependents)==null||$.call(P,[{entity:this,field:"break-statement-parent-data-type-field"}]),this}increaseVersion(i){if(i&&!M(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&M(i).isSame(M(this.createdAt))?this:(this.previousVersion=this.version,this.version=x.UUID.uuid(),this.createdAt=M(i).toISOString()||M().toISOString(),this)}captureVersion(){var n;const i=((n=this.knownVersions)==null?void 0:n.get(this.version))||new Ii(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.outputs=[...this.outputs],i.readsValue=this.readsValue,i.defaultValue=this.defaultValue,i.dataType=this.dataType,i.throws=this.throws,i.calledBySuccess=[...this.calledBySuccess],i.calledByError=[...this.calledByError],i.calledByEntry=[...this.calledByEntry],i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const n=[],l=[],c=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);n.push(this.parent,...y.updated),l.push(...y.added),c.push(...y.removed)}return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}async restoreVersion(i){var T;const n=[],l=[],c=[],e=[];if(this.version===i)return{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this};if(!this.knownVersions){const v=new Map;for(const[E,b]of this.knownVersions||new Map){if(v.set(E,b),b.activeVersion=!1,b.knownVersions)for(const[O,P]of b.knownVersions)v.set(O,P);b.knownVersions=null}}let y=(T=this.knownVersions)==null?void 0:T.get(i);if(!y){const v=await this.APILoadVersion({},i);if(!v)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new Ii(v,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.outputs=y.outputs,this.readsValue=y.readsValue,this.defaultValue=y.defaultValue,this.dataType=y.dataType,this.throws=y.throws,this.calledBySuccess=y.calledBySuccess,this.calledByError=y.calledByError,this.calledByEntry=y.calledByEntry,this.parent=y.parent,{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}updateWithShallowTransfer(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.UpdateWithShallowTransfer))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[updateWithShallowTransfer] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this;if(this.metaSync(i,n),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const l=re(i.parent),c=this.project.get(l),e=this.parent;if(e&&e.id!==(c==null?void 0:c.id)&&this.removeFromParent(n),c)this.setParent(c,n),this.addSelfToProject(n);else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.readsValue){const l=re(i.readsValue),c=this.project.get(l),e=this.readsValue;e&&e.id!==(c==null?void 0:c.id)&&this.removeValueWriter(n),c&&this.setValueWriter(c,n)}else this.removeValueWriter(n);if(i.calledByEntry.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addEntryCaller(e,n),e.addCall(this,n))}),[...this.calledByEntry].forEach(l=>{i.calledByEntry.find(e=>re(e)===l.id)||(this.removeCaller(l,n),l.removeCall(this,n))}),i.calledBySuccess.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addSuccessCaller(e,n),e.addSuccessCall(this,n))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>re(e)===l.id)||(this.removeCaller(l,n),l.removeCall(this,n))}),i.calledByError.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addErrorCaller(e,n),e.addErrorCall(this,n))}),[...this.calledBySuccess].forEach(l=>{i.calledBySuccess.find(e=>re(e)===l.id)||(this.removeCaller(l,n),l.removeCall(this,n))}),i.outputs.forEach(l=>{const c=re(l),e=this.project.get(c);e&&(this.addOutput(e,n),e.setParent(this,n))}),[...this.outputs].forEach(l=>{i.outputs.find(e=>re(e)===l.id)||(this.removeOutput(l,n),l.removeFromParent(n))}),i.dataType){const l=re(i.dataType),c=this.project.get(l);c&&this.setDataType(c,n)}else this.setDataType(null,n);if(i.defaultValue){const l=re(i.defaultValue),c=this.project.get(l);c&&this.setDefaultValue(c,n)}else this.setDefaultValue(null,n);return this.captureVersion(),this.subscribeToDependencies(),n==null||n.attemptAutoclose(_.UpdateWithShallowTransfer,this.id),this}hydrateAncestors(){const i=[],n=[],l=[],c=[];if(this.initialData.parent){const e=re(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const e=re(this.initialData.readsValue),y=this.project.get(e);y&&(this.setValueWriter(y,null),i.push(y))}return this.initialData.calledByEntry.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addEntryCaller(T,null),i.push(T))}),this.initialData.calledBySuccess.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addSuccessCaller(T,null),i.push(T))}),this.initialData.calledByError.forEach(e=>{const y=re(e),T=this.project.get(y);T&&(this.addErrorCaller(T,null),i.push(T))}),{updated:D(i),added:D(n),removed:D(l),affected:D(c),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AfterAllChildrenInitialized))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[afterAllChildrenInitialized] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:[],added:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];this.initialized=!0,!this.dataType||this.dataType.inferred;const{added:y,updated:T,removed:v,affected:E}=this.syncInputs(i);return l.push(...y),n.push(...T),c.push(...v),e.push(...E),this.parent.syncTerminationStatements(i),this.outputs.sort((b,O)=>{var P,$;return(b.index??((P=b.declaration)==null?void 0:P.index))-(O.index??(($=O.declaration)==null?void 0:$.index))}),this.captureVersion(),i==null||i.attemptAutoclose(_.AfterAllChildrenInitialized,this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-self-to-project"))){var y,T;const n=[this],l=[],c=[],e=[];return this.readsValue&&(this.readsValue.addValueReader(this,i),n.push(this.readsValue)),this.calledByEntry.forEach(v=>{v.addCall(this,i),n.push(v)}),this.calledBySuccess.forEach(v=>{v.addSuccessCall(this,i),n.push(v)}),this.calledByError.forEach(v=>{v.addErrorCall(this,i),n.push(v)}),this.parent.addBreakStatement(this),e.push(this.parent),i==null||i.add(this.parent,H.Affected),(y=this.parent)==null||y.breakStatements.forEach(v=>{v.id!==this.id&&(e.push(v),i==null||i.add(v,H.Affected))}),(T=this.parent)==null||T.continueStatements.forEach(v=>{v.id!==this.id&&(e.push(v),i==null||i.add(v,H.Affected))}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:D(n),added:D(l),removed:D(c),affected:D(e),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}addSuccessCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddSuccessCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddSuccessCaller,n)?(this.calledBySuccess.find(c=>c.id===i.id)||(this.calledBySuccess.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddSuccessCaller,this.id),this):this}addErrorCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddErrorCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddErrorCaller,n)?(this.calledByError.find(c=>c.id===i.id)||(this.calledByError.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddErrorCaller,this.id),this):this}addEntryCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.AddEntryCaller)),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.AddEntryCaller,n)?(this.calledByEntry.find(c=>c.id===i.id)||(this.calledByEntry.push(i),n==null||n.add(this,H.Updated),l&&ht(this,n)),n==null||n.attemptAutoclose(_.AddEntryCaller,this.id),this):this}removeCaller(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-caller")),l=!1){return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.RemoveCaller,n)?(this.calledBySuccess=this.calledBySuccess.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByError=this.calledByError.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),this.calledByEntry=this.calledByEntry.filter(c=>c.id!==i.id?!0:(n==null||n.add(this,H.Updated),n==null||n.add(c,H.Affected),!1)),l&&ht(this,n),n==null||n.attemptAutoclose(_.RemoveCaller,this.id),this):this}setThrows(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"set-throws"))){var l;if(!this.checkCanEdit(this,n))return te.Logger.warn(`[setThrows] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("set-throws",this.id),this;if(i!==null&&i.parentRelationType!==dd.Error)throw new Error("The 'throws' InputMap must have a parentRelationType of 'Error'.");return((l=this.throws)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.throws=i,n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose("set-throws",this.id),this}addOutput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"add-output"))){return this.checkCanEdit(this,n)?this.outputs.includes(i)?(n==null||n.attemptAutoclose("add-output",this.id),this):(this.outputs.push(i),n==null||n.add(this,H.Affected),n==null||n.attemptAutoclose("add-output",this.id),this):(te.Logger.warn(`[addOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("add-output",this.id),this)}removeOutput(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"remove-output"))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[removeOutput] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("remove-output",this.id),this;const l=this.outputs.findIndex(c=>c.id===i.id);return l>-1&&(this.outputs.splice(l,1),n&&(n==null||n.add(this,H.Affected))),n==null||n.attemptAutoclose("remove-output",this.id),this}setParent(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetParent))){var l;return this.checkCanEditWithCounterpartAndSideEffects(this,i,_.SetParent,n)?(((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,n&&(n==null||n.add(this,H.Updated))),n==null||n.attemptAutoclose(_.SetParent,this.id),this):this}setValueWriter(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetValueWriter))){return this.checkCanEditFromScopeOwnerWithSideEffects(this,_.SetValueWriter,n)?(this.readsValue!==i&&(this.readsValue=i,n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose(_.SetValueWriter,this.id),this):this}removeValueWriter(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveValueWriter))){return this.readsValue&&!this.checkCanEditWithCounterpartAndSideEffects(this,this.readsValue,_.RemoveValueWriter,i)?this:(this.readsValue&&(this.readsValue=null,i==null||i.add(this,H.Updated)),i==null||i.attemptAutoclose(_.RemoveValueWriter,this.id),this)}initChildren(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=he(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),this.initialData.dataType&&(this.dataType=he(this.initialData.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(i)),sf.initReadsValue(this),this.outputs=this.initialData.outputs.map(n=>{const l=he(n,this.project);return l.setParent(this,null),l.initChildren(i),l}),this.initialData.throws&&(this.throws=he(this.initialData.throws,this.project),this.throws.setParent(this,null),this.throws.initChildren(i)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"meta-sync"))){const l=$r(this,i,n),c=xr(this,l),e=this.toMeta();return this.x=l.x||e.x,this.y=l.y||e.y,super.baseMetaSync(l,this,n),l.deleted===!0&&!e.deleted?n==null||n.add(this,H.Removed):l.deleted===!1&&e.deleted?n==null||n.add(this,H.Added):c&&(n==null||n.add(this,H.Updated)),n==null||n.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=Ge,...n){return await Ii.repository.APILoad(this.id,...n),this}async APICreate(i=Ge,...n){return await Ii.repository.APICreate(this.toShallowJSON(),...n),this}async APIUpdate(i=Ge,...n){return await Ii.repository.APIUpdate(this.toShallowJSON(),...n),this}async APIDelete(i=Ge,...n){return await Ii.repository.APIDelete(this.toShallowJSON(),...n),this}async APIClone(i=Ge,...n){return await Ii.repository.APIClone(this.id,...n),this}async APILoadVersion(i=Ge,n,...l){return await Ii.repository.APILoadVersion(this.id,n,...l)}removeFromParent(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveFromParent))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[removeFromParent] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];return this.parent.removeBreakStatement(this),e.push(this.parent),i==null||i.attemptAutoclose(_.RemoveFromParent,this.id),{added:D(c),updated:D(n),removed:D(l),affected:D(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveEntity))){var T,v,E;if(!this.checkCanDelete(this,n))return te.Logger.warn(`[remove] User is not allowed to delete or edit this ${this.type} entity with id: ${this.id}`),n==null||n.event({id:`${_.RemoveEntity}-${this.id}`,action:_.RemoveEntity,owner:this,errorReason:tr.ActionOwnerEntityNonDeletable,rootAction:((T=n==null?void 0:n.self)==null?void 0:T.id)===this.id&&(n==null?void 0:n.autoCloseActionName)===_.RemoveEntity}),n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const l=[],c=[],e=[],y=[];if(n!=null&&n.hasRemoved(this.id))return n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(c.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},n),Object.values(this.detachedDependents).forEach(b=>{const{updated:O,removed:P,added:$}=b.entity.onDetachedDependencyRemoved(this,b.field,n);l.push(...O),c.push(...P),e.push(...$)}),this.readsValue&&(l.push(this.readsValue),this.readsValue.removeValueReader(this,n)),this.outputs.forEach(b=>{const{updated:O,removed:P}=b.remove({ignoreUpstream:!0},n);l.push(...O),c.push(...P)}),this.throws){const{updated:b,removed:O}=this.throws.remove({ignoreUpstream:!0},n);l.push(...b),c.push(...O)}if(this.dataType){const{updated:b,removed:O}=this.dataType.remove({ignoreUpstream:!0},n);l.push(...b),c.push(...O)}if(!i){const b=this.removeFromParent(n);e.push(...b.added),l.push(...b.updated),c.push(...b.removed),y.push(...b.affected),this.calledBy.forEach(O=>{l.push(O),O.removeCall(this,n)})}return n==null||n.add(this.parent,H.Affected),(v=this.parent)==null||v.breakStatements.forEach(b=>{b.id!==this.id&&(y.push(b),n==null||n.add(b,H.Affected))}),(E=this.parent)==null||E.continueStatements.forEach(b=>{b.id!==this.id&&(y.push(b),n==null||n.add(b,H.Affected))}),n==null||n.attemptAutoclose(_.RemoveEntity,this.id),{added:D(e),updated:D(l),removed:D(c),affected:D(y),self:this}}restore({}={},i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RestoreEntity))){if(!this.checkCanEdit(this,i))return te.Logger.warn(`[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};const n=[],l=[],c=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:T,removed:v,added:E}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...T),c.push(...v),n.push(...E)}),this.readsValue&&(l.push(this.readsValue),this.readsValue.addValueReader(this,i)),this.outputs.forEach(y=>{const{updated:T}=y.restore({},i);l.push(...T)}),this.throws){const{updated:y}=this.throws.restore({},i);l.push(...y)}if(this.dataType){const{updated:y}=this.dataType.restore({},i);l.push(...y)}return this.parent.addBreakStatement(this),this.calledBySuccess.forEach(y=>{l.push(y),y.addSuccessCall(this,i)}),this.calledByError.forEach(y=>{l.push(y),y.addErrorCall(this,i)}),this.calledByEntry.forEach(y=>{l.push(y),y.addCall(this,i)}),i==null||i.attemptAutoclose(_.RestoreEntity,this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this}}toFlat(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this,...this.outputs.flatMap(l=>l.toFlat(i)),...this.throws?this.throws.toFlat(i):[],...this.dataType?this.dataType.toFlat(i):[]])}toFlatIds(i=new Set){return i.has(this.id)?[]:(i.add(this.id),[this.id,...this.outputs.flatMap(l=>l.toFlatIds(i)),...this.throws?this.throws.toFlatIds(i):[],...this.dataType?this.dataType.toFlatIds(i):[]])}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,editable:this.editable,deletable:this.deletable}}toJSON(i=new Set){var n,l,c,e,y;return i.has(this.id)?this.toReference():(i.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,x:this.x,y:this.y,defaultValue:((n=this.defaultValue)==null?void 0:n.toJSON(i))||null,dataType:((l=this.dataType)==null?void 0:l.toJSON(i))||null,readsValue:((c=this.readsValue)==null?void 0:c.toReference())||null,outputs:this.outputs.map(T=>T.toJSON(i)),calledBySuccess:this.calledBySuccess.map(T=>T.toReference()),calledByError:this.calledByError.map(T=>T.toReference()),calledByEntry:this.calledByEntry.map(T=>T.toReference()),parent:((e=this.parent)==null?void 0:e.toReference())||null,throws:((y=this.throws)==null?void 0:y.toJSON(i))||null})}toJSONClone(i=pt){var l,c,e,y,T,v,E,b,O,P;let n;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?n=i.seenEntityMaps.get(this.id):(n=i.newId||jr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,n)),(c=i.seenEntities)!=null&&c.has(n)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(n),(T=i.seenEntities)==null||T.add(this.id),{id:n,version:x.UUID.uuid(),createdAt:i.timestamp||M().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,x:this.x,y:this.y,defaultValue:((v=this.defaultValue)==null?void 0:v.toJSONClone({...i,newId:null}))||null,dataType:((E=this.dataType)==null?void 0:E.toJSONClone({...i,newId:null}))||null,readsValue:((b=this.readsValue)==null?void 0:b.toReference({seenEntityMaps:i.seenEntityMaps}))||null,outputs:this.outputs.map($=>$.toJSONClone({...i,newId:null})),calledBySuccess:this.calledBySuccess.map($=>$.toReference({seenEntityMaps:i.seenEntityMaps})),calledByError:this.calledByError.map($=>$.toReference({seenEntityMaps:i.seenEntityMaps})),calledByEntry:this.calledByEntry.map($=>$.toReference({seenEntityMaps:i.seenEntityMaps})),parent:((O=this.parent)==null?void 0:O.toReference({seenEntityMaps:i.seenEntityMaps}))||null,throws:((P=this.throws)==null?void 0:P.toJSONClone({...i,newId:null}))||null})}toReference(i=pt){var l;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n+"--"+x.UUID.uuid()+"--ref",type:o.GenericReference,entityId:n,version:this.version,entityType:this.type}}toShallowJSON(i=pt){var l,c,e,y,T,v;let n=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(n=i.seenEntityMaps.get(this.id)),{id:n,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,editable:this.editable,deletable:this.deletable,x:this.x,y:this.y,defaultValue:((c=this.defaultValue)==null?void 0:c.toReference(i))||null,dataType:((e=this.dataType)==null?void 0:e.toReference(i))||null,readsValue:((y=this.readsValue)==null?void 0:y.toReference(i))||null,outputs:this.outputs.map(E=>E.toReference(i)),calledBySuccess:this.calledBySuccess.map(E=>E.toReference(i)),calledByError:this.calledByError.map(E=>E.toReference(i)),calledByEntry:this.calledByEntry.map(E=>E.toReference(i)),throws:((T=this.throws)==null?void 0:T.toReference(i))||null,parent:((v=this.parent)==null?void 0:v.toReference(i))||null}}toFlatJSON(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((l=this.defaultValue)==null?void 0:l.toFlatJSON(i))||[],...((c=this.dataType)==null?void 0:c.toFlatJSON(i))||[],...this.outputs.flatMap(e=>e.toFlatJSON(i)),...this.throws?this.throws.toFlatJSON(i):[]])}toGenerationTarget(){return{id:this.id,type:this.type,calledByEntry:this.calledByEntry.map(i=>i.id),calledByError:this.calledByError.map(i=>i.id),calledBySuccess:this.calledBySuccess.map(i=>i.id),parent:this.parent.id}}toFlatGenerationTarget(i=new Set){var l,c;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((l=this.defaultValue)==null?void 0:l.toFlatGenerationTarget(i))||[],...((c=this.dataType)==null?void 0:c.toFlatGenerationTarget(i))||[],...this.outputs.flatMap(e=>e.toFlatGenerationTarget(i)),...this.throws?this.throws.toFlatGenerationTarget(i):[]])}clearErrors(){var i,n,l;return this.errors=[],(i=this.dataType)==null||i.clearErrors(),(n=this.defaultValue)==null||n.clearErrors(),this.outputs.forEach(c=>c.clearErrors()),(l=this.throws)==null||l.clearErrors(),this}validate(){const i=R4e(this);return this.errors=i,{success:!0}}getErrors(){var n,l;return[...this.errors,...((n=this.defaultValue)==null?void 0:n.getErrors())||[],...((l=this.dataType)==null?void 0:l.getErrors())||[],...this.outputs.flatMap(c=>c.getErrors()),...this.throws?this.throws.getErrors():[]]}getShallowErrors(){return this.errors}getDefaultValue(){return this.defaultValue||null}setDefaultValue(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"set-default-value"))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[setDefaultValue] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose("set-default-value",this.id),this;const l=this.defaultValue;return(l==null?void 0:l.id)!==(i==null?void 0:i.id)&&(l==null||l.remove({ignoreUpstream:!0},n),this.defaultValue=i,n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.CloneEntity)),n=null,l=null,c=!0){var L,U,F;const e=Pr(n,this),y=this.toJSON(),T=l||x.UUID.uuid();y.outputs=[];const v=T.split("-id"),E=v[v.length-1||0]||T;y.id=T,y.version=x.UUID.uuid(),y.createdAt=(i==null?void 0:i.timestamp)||M().toISOString(),y.author=(i==null?void 0:i.author)||"1",y.previousVersion=null,y.deleted=!1,y.deletable=!0,y.editable=!0;const b=Gi(y,e);n?b.setParent(n,i):b.setParent(this.parent,null),c&&b.subscribe(),b.initChildren(i),i==null||i.add(b,H.Added);const O=(L=this.dataType)==null?void 0:L.clone(i,b,x.UUID.uuid(),c);b.setDataType(O||null,i);const P=(U=this.defaultValue)==null?void 0:U.clone(i,b,x.UUID.uuid(),c);b.setDefaultValue(P||null,i);const $=(F=this.outputs)==null?void 0:F.map((Z,X)=>Z.clone(i,b,E+"-return-declaration-"+X+"-id",c));return b.outputs=$,this.throws&&(b.throws=this.throws.clone(i,b,E+"-throws-id",c)),i==null||i.attemptAutoclose(_.CloneEntity,this.id),b}getMasterInputWithValueWritterFromAllInstances(i){return D([...this.outputs,...this.parent.breakStatements.filter(c=>c.id!==this.id).flatMap(c=>c.outputs),...this.parent.continueStatements.flatMap(c=>c.outputs)]).find(c=>le(c,this.project)===le(i,this.project)&&!!c.readsValue)||i}syncInputs(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"sync-break-statement-inputs"))){const n=[],l=[],c=[],e=[],y=this.getDataType(i);if(y)if(y.entity){if(y.isObject()){const T=[...y.entity.properties];this.outputs.filter(b=>!b.declaration||!T.find(O=>{var P;return O.id===((P=b.declaration)==null?void 0:P.id)})).forEach(b=>{const O=T.find(P=>le(P,this.project)===le(b,this.project));O&&b.setDeclaration(O,i)}),T.filter(b=>!this.outputs.find(O=>{var P;return((P=O.declaration)==null?void 0:P.id)===b.id})).forEach(b=>{const O={id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.InputMap,parentRelationType:null,parent:this.toReference(),name:null,description:null,codeName:null,declaration:b,defaultValue:null,index:b.index,readsValue:null},P=he(O,this.project);return P.hydrateAncestors(),i==null||i.add(P,H.Added),P.setParent(this,i),P.initChildren(i),this.addOutput(P,i),P})}}else return i==null||i.attemptAutoclose("sync-break-statement-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};else return i==null||i.attemptAutoclose("sync-break-statement-inputs",this.id),{added:[],updated:[],removed:[],affected:[],self:this};return i==null||i.attemptAutoclose("sync-break-statement-inputs",this.id),{added:D(n),updated:D(l),removed:D(c),affected:D(e),self:this}}setDataType(i,n=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.SetDataType))){if(!this.checkCanEdit(this,n))return te.Logger.warn(`[setDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),n==null||n.attemptAutoclose(_.SetDataType,this.id),this;const l=this.dataType;return(l==null?void 0:l.id)!==(i==null?void 0:i.id)&&(l==null||l.remove({ignoreUpstream:!0},n),this.dataType=i,this.subscribeToDependencies(),n==null||n.add(this,H.Affected)),n==null||n.attemptAutoclose(_.SetDataType,this.id),this}removeDataType(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,_.RemoveDataType))){return this.checkCanEdit(this,i)?(this.dataType&&(this.dataType.remove({ignoreUpstream:!0},i),i==null||i.add(this,H.Affected),this.dataType=null),i==null||i.attemptAutoclose(_.RemoveDataType,this.id),this):(te.Logger.warn(`[removeDataType] User is not allowed to edit this ${this.type} entity with id: ${this.id}`),i==null||i.attemptAutoclose(_.RemoveDataType,this.id),this)}getDataType(i=this.project.addChangeSet(new q(this.project,x.sessionAuthor,M().toISOString(),this,!0,"get-data-type"))){if((!this.dataType||this.dataType.inferred)&&this.project.initialized,this.dataType)return i==null||i.attemptAutoclose("get-data-type",this.id),this.dataType;const n=this.parent.getDataType(i);return n?(i==null||i.attemptAutoclose("get-data-type",this.id),n):(i==null||i.attemptAutoclose("get-data-type",this.id),null)}};I(Ii,"repository",{APICreate:async(i,...n)=>i,APIUpdate:async(i,...n)=>i,APIDelete:async(i,...n)=>i,APIClone:async(i,...n)=>{},APILoad:async(i,...n)=>null,APILoadVersion:async(i,n,...l)=>null}),I(Ii,"type",o.BreakStatement),I(Ii,"USER_MANAGED_PARENT_TYPES",[o.Loop]),I(Ii,"PARENT_TYPES",[...Ii.USER_MANAGED_PARENT_TYPES]),I(Ii,"MUTABLE_BASE_PROPERTIES",[]),I(Ii,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),I(Ii,"BASE_PROPERTIES",[...Ii.MUTABLE_BASE_PROPERTIES,...Ii.INMUTABLE_BASE_PROPERTIES]),I(Ii,"MUTABLE_META_PROPERTIES",["x","y"]),I(Ii,"INMUTABLE_META_PROPERTIES",[...Ii.INMUTABLE_BASE_PROPERTIES]),I(Ii,"META_PROPERTIES",[...Ii.MUTABLE_META_PROPERTIES,...Ii.INMUTABLE_META_PROPERTIES]),I(Ii,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),I(Ii,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),I(Ii,"UPSTREAM_PROPERTIES",[...Ii.MUTABLE_UPSTREAM_PROPERTIES,...Ii.INMUTABLE_UPSTREAM_PROPERTIES]),I(Ii,"MUTABLE_DOWNSTREAM_PROPERTIES",["outputs","throws"]),I(Ii,"INMUTABLE_DOWNSTREAM_PROPERTIES",["dataType","defaultValue"]),I(Ii,"DOWNSTREAM_PROPERTIES",[...Ii.MUTABLE_DOWNSTREAM_PROPERTIES,...Ii.INMUTABLE_DOWNSTREAM_PROPERTIES]),I(Ii,"PROPERTIES",[...Ii.META_PROPERTIES,...Ii.UPSTREAM_PROPERTIES,...Ii.DOWNSTREAM_PROPERTIES]);let Pu=Ii;function O4e(d){var i;d.outputs.forEach(n=>n.validate()),(i=d.throws)==null||i.validate();const p=[];return rr(d.errors,p)}const dGi=Object.freeze(Object.defineProperty({__proto__:null,validate:O4e},Symbol.toStringTag,{value:"Module"}));var w4e=(d=>(d.Parent="continue-statement-parent-field",d.DataTypeEntity="continue-statement-data-type-entity-field",d.DataType="continue-statement-data-type-field",d.ParentDataType="continue-statement-parent-data-type-field",d.ParentDataTypeEntity="continue-statement-parent-data-type-entity-field",d))(w4e||{});const Ri=class Ri extends Ur{constructor(i,n){super(i);I(this,"initialData");I(this,"id");I(this,"x");I(this,"y");I(this,"type",o.ContinueStatement);I(this,"outputs",[]);I(this,"readsValue",null);I(this,"dataType",null);I(this,"defaultValue",null);I(this,"calledBySuccess",[]);I(this,"calledByError",[]);I(this,"calledByEntry",[]);I(this,"throws",null);I(this,"project");I(this,"errors",[]);I(this,"parent");I(this,"detachedDependents",{});I(this,"knownVersions",null);I(this,"activeVersion",!1);I(this,"initialized",!1);I(this,"startedInitialization",!1);I(this,"suggestion",!1);I(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=n,this.id=i.id,this.x=i.x,this.y=i.y}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||M().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.ContinueStatement,outputs:[],defaultValue:null,dataType:null,readsValue:null,throws:null,parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],x:0,y:0}}static fromGenerationTarget(i,n){const l=re(i.parent),c=n.get(l),e=i.calledByEntry.map(O=>{const P=re(O);return n.get(P)}),y=i.calledBySuccess.map(O=>{const P=re(O);return n.get(P)}),T=i.calledByError.map(O=>{const P=re(O);return n.get(P)});let v=null;if(i.readsValue){const O=re(i.readsValue);v=n.get(O)}const E={id:i.id,version:x.UUID.uuid(),createdAt:M().toISOString(),author:x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:o.ContinueStatement,x:0,y:0,outputs:[],defaultValue:null,dataType:null,readsValue:v,calledBySuccess:y,calledByError:T,calledByEntry:e,throws:null,parent:c},b=he(E,n);return b.setParent(c,null),b}static validateGenerationTarget(i,n){let l=JSON.parse(JSON.stringify(i));const c=[],e=Tn(l,{parent:{list:!1,types:[o.Loop]}},n);return l=e.modifiedData,c.push(...e.errors,...Nr(l)),{errors:c,modifiedData:l}}get codeNativeValueValidation(){return this._codeNativeValueValidation||null}validateGeneratedUpdate(i){const n=[];let l=JSON.parse(JSON.stringify(i));const c=rf(l,this);return l=c.modifiedData,n.push(...c.errors),i.parent&&n.push(new De({id:`${this.id}--${ne.InvalidParentUpdate}`,code:ne.InvalidParentUpdate,severity:pe.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.